Improve UI/UX around device transfer.

fork-5.53.8
Cody Henthorne 2021-03-16 10:18:02 -04:00 zatwierdzone przez GitHub
rodzic ace85df9b7
commit 490944a02a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
24 zmienionych plików z 394 dodań i 168 usunięć

Wyświetl plik

@ -37,6 +37,7 @@ import org.thoughtcrime.securesms.database.StickerDatabase;
import org.thoughtcrime.securesms.profiles.AvatarHelper; import org.thoughtcrime.securesms.profiles.AvatarHelper;
import org.thoughtcrime.securesms.util.SetUtil; import org.thoughtcrime.securesms.util.SetUtil;
import org.thoughtcrime.securesms.util.Stopwatch; import org.thoughtcrime.securesms.util.Stopwatch;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.Util; import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.libsignal.kdf.HKDFv3; import org.whispersystems.libsignal.kdf.HKDFv3;
import org.whispersystems.libsignal.util.ByteUtil; import org.whispersystems.libsignal.util.ByteUtil;
@ -154,6 +155,12 @@ public class FullBackupExporter extends FullBackupBase {
EventBus.getDefault().post(new BackupEvent(BackupEvent.Type.PROGRESS, ++count)); EventBus.getDefault().post(new BackupEvent(BackupEvent.Type.PROGRESS, ++count));
outputStream.write(preference); outputStream.write(preference);
} }
for (BackupProtos.SharedPreference preference : TextSecurePreferences.getPreferencesToSaveToBackup(context)) {
throwIfCanceled(cancellationSignal);
EventBus.getDefault().post(new BackupEvent(BackupEvent.Type.PROGRESS, ++count));
outputStream.write(preference);
}
stopwatch.split("prefs"); stopwatch.split("prefs");

Wyświetl plik

@ -45,6 +45,7 @@ import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -213,7 +214,14 @@ public class FullBackupImporter extends FullBackupBase {
@SuppressLint("ApplySharedPref") @SuppressLint("ApplySharedPref")
private static void processPreference(@NonNull Context context, SharedPreference preference) { private static void processPreference(@NonNull Context context, SharedPreference preference) {
SharedPreferences preferences = context.getSharedPreferences(preference.getFile(), 0); SharedPreferences preferences = context.getSharedPreferences(preference.getFile(), 0);
preferences.edit().putString(preference.getKey(), preference.getValue()).commit();
if (preference.hasValue()) {
preferences.edit().putString(preference.getKey(), preference.getValue()).commit();
} else if (preference.hasBooleanValue()) {
preferences.edit().putBoolean(preference.getKey(), preference.getBooleanValue()).commit();
} else if (preference.hasIsStringSetValue() && preference.getIsStringSetValue()) {
preferences.edit().putStringSet(preference.getKey(), new HashSet<>(preference.getStringSetValueList())).commit();
}
} }
private static void dropAllTables(@NonNull SQLiteDatabase db) { private static void dropAllTables(@NonNull SQLiteDatabase db) {

Wyświetl plik

@ -73,7 +73,8 @@ public abstract class DeviceTransferSetupFragment extends LoggingFragment {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
Group progressGroup = view.findViewById(R.id.device_transfer_setup_fragment_progress_group); Group progressGroup = view.findViewById(R.id.device_transfer_setup_fragment_progress_group);
Group errorGroup = view.findViewById(R.id.device_transfer_setup_fragment_error_group); Group errorGroup = view.findViewById(R.id.device_transfer_setup_fragment_error_group);
Group verifyGroup = view.findViewById(R.id.device_transfer_setup_fragment_verify_group); View verifyGroup = view.findViewById(R.id.device_transfer_setup_fragment_verify);
View waitingGroup = view.findViewById(R.id.device_transfer_setup_fragment_waiting);
View troubleshooting = view.findViewById(R.id.device_transfer_setup_fragment_troubleshooting); View troubleshooting = view.findViewById(R.id.device_transfer_setup_fragment_troubleshooting);
TextView status = view.findViewById(R.id.device_transfer_setup_fragment_status); TextView status = view.findViewById(R.id.device_transfer_setup_fragment_status);
TextView error = view.findViewById(R.id.device_transfer_setup_fragment_error); TextView error = view.findViewById(R.id.device_transfer_setup_fragment_error);
@ -90,6 +91,7 @@ public abstract class DeviceTransferSetupFragment extends LoggingFragment {
progressGroup.setVisibility(step.isProgress() ? View.VISIBLE : View.GONE); progressGroup.setVisibility(step.isProgress() ? View.VISIBLE : View.GONE);
errorGroup.setVisibility(step.isError() ? View.VISIBLE : View.GONE); errorGroup.setVisibility(step.isError() ? View.VISIBLE : View.GONE);
verifyGroup.setVisibility(step == SetupStep.VERIFY ? View.VISIBLE : View.GONE); verifyGroup.setVisibility(step == SetupStep.VERIFY ? View.VISIBLE : View.GONE);
waitingGroup.setVisibility(step == SetupStep.WAITING_FOR_OTHER_TO_VERIFY ? View.VISIBLE : View.GONE);
troubleshooting.setVisibility(step == SetupStep.TROUBLESHOOTING ? View.VISIBLE : View.GONE); troubleshooting.setVisibility(step == SetupStep.TROUBLESHOOTING ? View.VISIBLE : View.GONE);
Log.i(TAG, "Handling step: " + step.name()); Log.i(TAG, "Handling step: " + step.name());
@ -166,8 +168,7 @@ public abstract class DeviceTransferSetupFragment extends LoggingFragment {
viewModel.onVerified(); viewModel.onVerified();
}); });
break; break;
case CONNECTING: case WAITING_FOR_OTHER_TO_VERIFY:
status.setText(getStatusTextForStep(step, false));
break; break;
case CONNECTED: case CONNECTED:
Log.d(TAG, "Connected! isNotShutdown: " + viewModel.isNotShutdown()); Log.d(TAG, "Connected! isNotShutdown: " + viewModel.isNotShutdown());

Wyświetl plik

@ -59,6 +59,7 @@ public final class DeviceTransferSetupViewModel extends ViewModel {
case SERVICE_CONNECTED: case SERVICE_CONNECTED:
store.update(s -> s.updateStep(SetupStep.CONNECTED)); store.update(s -> s.updateStep(SetupStep.CONNECTED));
break; break;
case SHUTDOWN:
case FAILED: case FAILED:
store.update(s -> s.updateStep(SetupStep.ERROR)); store.update(s -> s.updateStep(SetupStep.ERROR));
break; break;
@ -116,7 +117,7 @@ public final class DeviceTransferSetupViewModel extends ViewModel {
} }
public void onVerified() { public void onVerified() {
store.update(s -> s.updateStep(SetupStep.CONNECTING)); store.update(s -> s.updateStep(SetupStep.WAITING_FOR_OTHER_TO_VERIFY));
} }
public void onResume() { public void onResume() {

Wyświetl plik

@ -18,7 +18,7 @@ public enum SetupStep {
SETTING_UP(true, false), SETTING_UP(true, false),
WAITING(true, false), WAITING(true, false),
VERIFY(false, false), VERIFY(false, false),
CONNECTING(true, false), WAITING_FOR_OTHER_TO_VERIFY(false, false),
CONNECTED(true, false), CONNECTED(true, false),
TROUBLESHOOTING(false, false), TROUBLESHOOTING(false, false),
ERROR(false, true); ERROR(false, true);

Wyświetl plik

@ -67,8 +67,6 @@ public final class NewDeviceTransferSetupFragment extends DeviceTransferSetupFra
: R.string.NewDeviceTransferSetup__preparing_to_connect_to_old_android_device; : R.string.NewDeviceTransferSetup__preparing_to_connect_to_old_android_device;
case WAITING: case WAITING:
return R.string.NewDeviceTransferSetup__waiting_for_old_device_to_connect; return R.string.NewDeviceTransferSetup__waiting_for_old_device_to_connect;
case CONNECTING:
return R.string.NewDeviceTransferSetup__connecting_to_old_android_device;
case ERROR: case ERROR:
return R.string.NewDeviceTransferSetup__an_unexpected_error_occurred_while_attempting_to_connect_to_your_old_device; return R.string.NewDeviceTransferSetup__an_unexpected_error_occurred_while_attempting_to_connect_to_your_old_device;
case TROUBLESHOOTING: case TROUBLESHOOTING:

Wyświetl plik

@ -29,8 +29,8 @@ public final class TransferOrRestoreFragment extends LoggingFragment {
view.findViewById(R.id.transfer_or_restore_fragment_restore) view.findViewById(R.id.transfer_or_restore_fragment_restore)
.setOnClickListener(v -> Navigation.findNavController(v).navigate(R.id.action_choose_backup)); .setOnClickListener(v -> Navigation.findNavController(v).navigate(R.id.action_choose_backup));
String description = getString(R.string.TransferOrRestoreFragment__transfer_your_account_and_message_history_from_your_old_android_device); String description = getString(R.string.TransferOrRestoreFragment__transfer_your_account_and_messages_from_your_old_android_device);
String toBold = getString(R.string.TransferOrRestoreFragment__you_must_have_access_to_your_old_device); String toBold = getString(R.string.TransferOrRestoreFragment__you_need_access_to_your_old_device);
TextView transferDescriptionView = view.findViewById(R.id.transfer_or_restore_fragment_transfer_description); TextView transferDescriptionView = view.findViewById(R.id.transfer_or_restore_fragment_transfer_description);
transferDescriptionView.setText(SpanUtil.boldSubstring(description, toBold)); transferDescriptionView.setText(SpanUtil.boldSubstring(description, toBold));

Wyświetl plik

@ -1,9 +1,12 @@
package org.thoughtcrime.securesms.devicetransfer.olddevice; package org.thoughtcrime.securesms.devicetransfer.olddevice;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
public class OldDeviceExitActivity extends AppCompatActivity { public class OldDeviceExitActivity extends AppCompatActivity {
@ -11,14 +14,23 @@ public class OldDeviceExitActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
finish(); finishAll(this);
} }
public static void exit(Context context) { public static void exit(@NonNull Activity activity) {
Intent intent = new Intent(context, OldDeviceExitActivity.class); Intent intent = new Intent(activity, OldDeviceExitActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(intent); activity.startActivity(intent);
finishAll(activity);
}
private static void finishAll(@NonNull Activity activity) {
if (Build.VERSION.SDK_INT < 21) {
activity.finishAffinity();
} else {
activity.finishAndRemoveTask();
}
} }
} }

Wyświetl plik

@ -36,6 +36,6 @@ public final class OldDeviceTransferCompleteFragment extends LoggingFragment {
} }
private void close() { private void close() {
OldDeviceExitActivity.exit(requireContext()); OldDeviceExitActivity.exit(requireActivity());
} }
} }

Wyświetl plik

@ -93,8 +93,6 @@ public final class OldDeviceTransferSetupFragment extends DeviceTransferSetupFra
case SETTING_UP: case SETTING_UP:
case WAITING: case WAITING:
return R.string.OldDeviceTransferSetup__searching_for_your_new_android_device; return R.string.OldDeviceTransferSetup__searching_for_your_new_android_device;
case CONNECTING:
return R.string.OldDeviceTransferSetup__connecting_to_new_android_device;
case ERROR: case ERROR:
return R.string.OldDeviceTransferSetup__an_unexpected_error_occurred_while_attempting_to_connect_to_your_old_device; return R.string.OldDeviceTransferSetup__an_unexpected_error_occurred_while_attempting_to_connect_to_your_old_device;
case TROUBLESHOOTING: case TROUBLESHOOTING:

Wyświetl plik

@ -16,6 +16,7 @@ import androidx.core.app.NotificationCompat;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.signal.core.util.logging.Log; import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.backup.BackupProtos;
import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraintObserver; import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraintObserver;
import org.thoughtcrime.securesms.keyvalue.SettingsValues; import org.thoughtcrime.securesms.keyvalue.SettingsValues;
import org.thoughtcrime.securesms.lock.RegistrationLockReminders; import org.thoughtcrime.securesms.lock.RegistrationLockReminders;
@ -25,9 +26,11 @@ import org.whispersystems.signalservice.api.util.UuidUtil;
import java.io.IOException; import java.io.IOException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -209,6 +212,74 @@ public class TextSecurePreferences {
private static final String ARGON2_TESTED = "argon2_tested"; private static final String ARGON2_TESTED = "argon2_tested";
private static final String[] booleanPreferencesToBackup = {SCREEN_SECURITY_PREF,
INCOGNITO_KEYBORAD_PREF,
ALWAYS_RELAY_CALLS_PREF,
READ_RECEIPTS_PREF,
TYPING_INDICATORS,
SHOW_UNIDENTIFIED_DELIVERY_INDICATORS,
UNIVERSAL_UNIDENTIFIED_ACCESS,
NOTIFICATION_PREF,
VIBRATE_PREF,
IN_THREAD_NOTIFICATION_PREF,
CALL_NOTIFICATIONS_PREF,
CALL_VIBRATE_PREF,
NEW_CONTACTS_NOTIFICATIONS,
SHOW_INVITE_REMINDER_PREF,
SYSTEM_EMOJI_PREF,
ENTER_SENDS_PREF};
private static final String[] stringPreferencesToBackup = {LED_COLOR_PREF,
LED_BLINK_PREF,
REPEAT_ALERTS_PREF,
NOTIFICATION_PRIVACY_PREF,
THEME_PREF,
LANGUAGE_PREF,
MESSAGE_BODY_TEXT_SIZE_PREF};
private static final String[] stringSetPreferencesToBackup = {MEDIA_DOWNLOAD_MOBILE_PREF,
MEDIA_DOWNLOAD_WIFI_PREF,
MEDIA_DOWNLOAD_ROAMING_PREF};
public static List<BackupProtos.SharedPreference> getPreferencesToSaveToBackup(@NonNull Context context) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
List<BackupProtos.SharedPreference> backupProtos = new ArrayList<>();
String defaultFile = context.getPackageName() + "_preferences";
for (String booleanPreference : booleanPreferencesToBackup) {
if (preferences.contains(booleanPreference)) {
backupProtos.add(BackupProtos.SharedPreference.newBuilder()
.setFile(defaultFile)
.setKey(booleanPreference)
.setBooleanValue(preferences.getBoolean(booleanPreference, false))
.build());
}
}
for (String stringPreference : stringPreferencesToBackup) {
if (preferences.contains(stringPreference)) {
backupProtos.add(BackupProtos.SharedPreference.newBuilder()
.setFile(defaultFile)
.setKey(stringPreference)
.setValue(preferences.getString(stringPreference, null))
.build());
}
}
for (String stringSetPreference : stringSetPreferencesToBackup) {
if (preferences.contains(stringSetPreference)) {
backupProtos.add(BackupProtos.SharedPreference.newBuilder()
.setFile(defaultFile)
.setKey(stringSetPreference)
.setIsStringSetValue(true)
.addAllStringSetValue(preferences.getStringSet(stringSetPreference, Collections.emptySet()))
.build());
}
}
return backupProtos;
}
public static boolean isScreenLockEnabled(@NonNull Context context) { public static boolean isScreenLockEnabled(@NonNull Context context) {
return getBooleanPreference(context, SCREEN_LOCK, false); return getBooleanPreference(context, SCREEN_LOCK, false);
} }

Wyświetl plik

@ -25,9 +25,12 @@ message SqlStatement {
} }
message SharedPreference { message SharedPreference {
optional string file = 1; optional string file = 1;
optional string key = 2; optional string key = 2;
optional string value = 3; optional string value = 3;
optional bool booleanValue = 4;
repeated string stringSetValue = 5;
optional bool isStringSetValue = 6;
} }
message Attachment { message Attachment {

Wyświetl plik

@ -65,67 +65,32 @@
<!-- endregion --> <!-- endregion -->
<!-- region Verify code --> <!-- region Verify code -->
<TextView <include
android:id="@+id/device_transfer_setup_fragment_verify_code_title" android:id="@+id/device_transfer_setup_fragment_verify"
layout="@layout/device_transfer_setup_verify_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:gravity="center" android:visibility="gone"
android:text="@string/DeviceTransferSetup__verify_code" app:layout_constraintBottom_toBottomOf="parent"
android:textAppearance="@style/Signal.Text.Headline.Registration"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<!-- endregion -->
<TextView <!-- region Waiting for other continue -->
android:id="@+id/device_transfer_setup_fragment_verify_description" <include
android:id="@+id/device_transfer_setup_fragment_waiting"
layout="@layout/device_transfer_setup_waiting_for_other_verify_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginTop="16dp" android:visibility="gone"
android:gravity="center"
android:text="@string/DeviceTransferSetup__verify_that_the_code_below_matches_on_both_of_your_devices"
android:textAppearance="@style/TextAppearance.Signal.Body1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/device_transfer_setup_fragment_verify_code_title" />
<TextView
android:id="@+id/device_transfer_setup_fragment_sas_verify_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:letterSpacing=".4"
android:textSize="40sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent" />
tools:ignore="UnusedAttribute"
tools:text="1234567" />
<com.google.android.material.button.MaterialButton
android:id="@+id/device_transfer_setup_fragment_sas_verify_yes"
style="@style/Signal.Widget.Button.Large.Primary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="@string/DeviceTransferSetup__continue"
app:layout_constraintBottom_toTopOf="@+id/device_transfer_setup_fragment_sas_verify_no"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<com.google.android.material.button.MaterialButton
android:id="@+id/device_transfer_setup_fragment_sas_verify_no"
style="@style/Signal.Widget.Button.Medium.Secondary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/DeviceTransferSetup__the_numbers_do_not_match"
android:textColor="@color/signal_alert_primary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!-- endregion --> <!-- endregion -->
<!-- region Troubleshooting --> <!-- region Troubleshooting -->
<include <include
android:id="@+id/device_transfer_setup_fragment_troubleshooting" android:id="@+id/device_transfer_setup_fragment_troubleshooting"
layout="@layout/device_transfer_setup_troubleshooting_layout" layout="@layout/device_transfer_setup_troubleshooting_layout"
@ -137,7 +102,6 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<!-- endregion --> <!-- endregion -->
<!-- region Groups --> <!-- region Groups -->
@ -145,6 +109,7 @@
android:id="@+id/device_transfer_setup_fragment_progress_group" android:id="@+id/device_transfer_setup_fragment_progress_group"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="device_transfer_setup_fragment_progress,device_transfer_setup_fragment_status" /> app:constraint_referenced_ids="device_transfer_setup_fragment_progress,device_transfer_setup_fragment_status" />
<androidx.constraintlayout.widget.Group <androidx.constraintlayout.widget.Group
@ -153,13 +118,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"
app:constraint_referenced_ids="device_transfer_setup_fragment_error,device_transfer_setup_fragment_error_resolve" /> app:constraint_referenced_ids="device_transfer_setup_fragment_error,device_transfer_setup_fragment_error_resolve" />
<androidx.constraintlayout.widget.Group
android:id="@+id/device_transfer_setup_fragment_verify_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="device_transfer_setup_fragment_verify_code_title,device_transfer_setup_fragment_verify_description,device_transfer_setup_fragment_sas_verify_code,device_transfer_setup_fragment_sas_verify_no,device_transfer_setup_fragment_sas_verify_yes" />
<!-- endregion --> <!-- endregion -->
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

Wyświetl plik

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/device_transfer_setup_fragment_verify_code_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/DeviceTransferSetup__verify_code"
android:textAppearance="@style/Signal.Text.Headline.Registration" />
<TextView
android:id="@+id/device_transfer_setup_fragment_verify_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/DeviceTransferSetup__verify_that_the_code_below_matches_on_both_of_your_devices"
android:textAppearance="@style/TextAppearance.Signal.Body1" />
<Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/device_transfer_setup_fragment_sas_verify_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="monospace"
android:gravity="center"
android:letterSpacing=".3"
android:lines="1"
android:minHeight="48dp"
app:autoSizeMaxTextSize="48sp"
app:autoSizeMinTextSize="12sp"
app:autoSizeTextType="uniform"
tools:ignore="UnusedAttribute"
tools:text="1234567" />
<Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<com.google.android.material.button.MaterialButton
android:id="@+id/device_transfer_setup_fragment_sas_verify_yes"
style="@style/Signal.Widget.Button.Large.Primary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="@string/DeviceTransferSetup__continue" />
<com.google.android.material.button.MaterialButton
android:id="@+id/device_transfer_setup_fragment_sas_verify_no"
style="@style/Signal.Widget.Button.Medium.Secondary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/DeviceTransferSetup__the_numbers_do_not_match"
android:textColor="@color/signal_alert_primary" />
</LinearLayout>

Wyświetl plik

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/DeviceTransferSetup__waiting_for_other_device"
android:textAppearance="@style/Signal.Text.Headline.Registration" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/DeviceTransferSetup__tap_continue_on_your_other_device_to_start_the_transfer"
android:textAppearance="@style/TextAppearance.Signal.Body1" />
<Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
<TextView
android:id="@+id/device_transfer_setup_fragment_sas_verify_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/DeviceTransferSetup__tap_continue_on_your_other_device"
android:textAppearance="@style/TextAppearance.Signal.Body1" />
<Space
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.2" />
</LinearLayout>

Wyświetl plik

@ -72,7 +72,7 @@
app:layout_constraintHorizontal_bias="0" app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="@+id/transfer_or_restore_fragment_transfer_header" app:layout_constraintStart_toStartOf="@+id/transfer_or_restore_fragment_transfer_header"
app:layout_constraintTop_toBottomOf="@+id/transfer_or_restore_fragment_transfer_header" app:layout_constraintTop_toBottomOf="@+id/transfer_or_restore_fragment_transfer_header"
tools:text="@string/TransferOrRestoreFragment__transfer_your_account_and_message_history_from_your_old_android_device" /> tools:text="@string/TransferOrRestoreFragment__transfer_your_account_and_messages_from_your_old_android_device" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
@ -112,7 +112,7 @@
android:id="@+id/transfer_or_restore_fragment_restore_description" android:id="@+id/transfer_or_restore_fragment_restore_description"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/TransferOrRestoreFragment__restore_your_messages_and_media_from_a_local_backup" android:text="@string/TransferOrRestoreFragment__restore_your_messages_from_a_local_backup"
android:textColor="@color/signal_text_secondary" android:textColor="@color/signal_text_secondary"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

Wyświetl plik

@ -21,14 +21,19 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/old_device_trasnfer_complete_fragment_subtitle" android:id="@+id/old_device_trasnfer_complete_fragment_subtitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_marginTop="@dimen/transfer_item_spacing" android:layout_marginTop="@dimen/transfer_item_spacing"
android:gravity="center" android:layout_marginBottom="8dp"
android:gravity="top|center"
android:text="@string/OldDeviceTransferComplete__your_signal_data_has_Been_transferred_to_your_new_device" android:text="@string/OldDeviceTransferComplete__your_signal_data_has_Been_transferred_to_your_new_device"
android:textAppearance="@style/TextAppearance.Signal.Body1" android:textAppearance="@style/TextAppearance.Signal.Body1"
app:autoSizeMaxTextSize="16sp"
app:autoSizeMinTextSize="12sp"
app:autoSizeTextType="uniform"
app:layout_constraintBottom_toTopOf="@+id/old_device_trasnfer_complete_fragment_success"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/old_device_transfer_complete_fragment_title" /> app:layout_constraintTop_toBottomOf="@+id/old_device_transfer_complete_fragment_title" />

Wyświetl plik

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical">
android:paddingBottom="16dp">
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/old_device_transfer_instructions_fragment_toolbar" android:id="@+id/old_device_transfer_instructions_fragment_toolbar"
@ -13,89 +13,111 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:navigationIcon="@drawable/ic_arrow_left_24" /> app:navigationIcon="@drawable/ic_arrow_left_24" />
<androidx.appcompat.widget.AppCompatImageView <ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:scaleX="@integer/image_scale_flip"
app:srcCompat="@drawable/ic_transfer_account" />
<TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginStart="32dp" android:clipToPadding="false"
android:layout_marginEnd="32dp" android:fillViewport="true"
android:gravity="center" android:scrollIndicators="bottom"
android:text="@string/OldDeviceTransferInstructions__transfer_account" tools:ignore="UnusedAttribute">
android:textAppearance="@style/Signal.Text.Headline" />
<androidx.gridlayout.widget.GridLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="32dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="16dp"
android:layout_weight="1"
app:alignmentMode="alignBounds"
app:columnCount="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="8dp" android:orientation="vertical"
android:text="@string/OldDeviceTransferInstructions__first_bullet" android:paddingBottom="16dp">
android:textAppearance="@style/TextAppearance.Signal.Body1" />
<TextView <androidx.appcompat.widget.AppCompatImageView
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="24dp" android:layout_gravity="center"
android:text="@string/OldDeviceTransferInstructions__download_signal_on_your_new_android_device" android:layout_marginTop="8dp"
android:textAlignment="viewStart" android:layout_marginBottom="16dp"
android:textAppearance="@style/TextAppearance.Signal.Body1" android:scaleX="@integer/image_scale_flip"
app:layout_columnWeight="1" /> app:srcCompat="@drawable/ic_transfer_account" />
<TextView <androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/OldDeviceTransferInstructions__second_bullet" android:layout_marginStart="32dp"
android:textAppearance="@style/TextAppearance.Signal.Body1" /> android:layout_marginEnd="32dp"
android:gravity="center"
android:lines="1"
android:text="@string/OldDeviceTransferInstructions__transfer_account"
android:textAppearance="@style/Signal.Text.Headline"
app:autoSizeMaxTextSize="28sp"
app:autoSizeMinTextSize="14sp"
app:autoSizeTextType="uniform" />
<TextView <androidx.gridlayout.widget.GridLayout
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_marginBottom="24dp" android:layout_marginStart="32dp"
android:text="@string/OldDeviceTransferInstructions__tap_on_transfer_or_restore_account" android:layout_marginTop="16dp"
android:textAlignment="viewStart" android:layout_marginEnd="32dp"
android:textAppearance="@style/TextAppearance.Signal.Body1" android:layout_marginBottom="16dp"
app:layout_columnWeight="1" /> android:layout_weight="1"
app:alignmentMode="alignBounds"
app:columnCount="2">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/OldDeviceTransferInstructions__third_bullet" android:layout_marginEnd="8dp"
android:textAppearance="@style/TextAppearance.Signal.Body1" /> android:text="@string/OldDeviceTransferInstructions__first_bullet"
android:textAppearance="@style/TextAppearance.Signal.Body1" />
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/OldDeviceTransferInstructions__select_transfer_from_android_device_when_prompted_and_then_continue" android:layout_marginBottom="24dp"
android:textAlignment="viewStart" android:text="@string/OldDeviceTransferInstructions__download_signal_on_your_new_android_device"
android:textAppearance="@style/TextAppearance.Signal.Body1" android:textAlignment="viewStart"
app:layout_columnWeight="1" /> android:textAppearance="@style/TextAppearance.Signal.Body1"
app:layout_columnWeight="1" />
</androidx.gridlayout.widget.GridLayout> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/OldDeviceTransferInstructions__second_bullet"
android:textAppearance="@style/TextAppearance.Signal.Body1" />
<com.google.android.material.button.MaterialButton <TextView
android:id="@+id/old_device_transfer_instructions_fragment_continue" android:layout_width="0dp"
style="@style/Signal.Widget.Button.Large.Primary" android:layout_height="wrap_content"
android:layout_width="match_parent" android:layout_marginBottom="24dp"
android:layout_height="wrap_content" android:text="@string/OldDeviceTransferInstructions__tap_on_transfer_or_restore_account"
android:layout_marginStart="32dp" android:textAlignment="viewStart"
android:layout_marginEnd="32dp" android:textAppearance="@style/TextAppearance.Signal.Body1"
android:text="@string/OldDeviceTransferInstructions__continue" /> app:layout_columnWeight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/OldDeviceTransferInstructions__third_bullet"
android:textAppearance="@style/TextAppearance.Signal.Body1" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/OldDeviceTransferInstructions__select_transfer_from_android_device_when_prompted_and_then_continue"
android:textAlignment="viewStart"
android:textAppearance="@style/TextAppearance.Signal.Body1"
app:layout_columnWeight="1" />
</androidx.gridlayout.widget.GridLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/old_device_transfer_instructions_fragment_continue"
style="@style/Signal.Widget.Button.Large.Primary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:text="@string/OldDeviceTransferInstructions__continue" />
</LinearLayout>
</ScrollView>
</LinearLayout> </LinearLayout>

Wyświetl plik

@ -2760,10 +2760,10 @@
<string name="TransferOrRestoreFragment__transfer_or_restore_account">Transfer or restore account</string> <string name="TransferOrRestoreFragment__transfer_or_restore_account">Transfer or restore account</string>
<string name="TransferOrRestoreFragment__if_you_have_previously_registered_a_signal_account">If you have previously registered a Signal account, you can transfer or restore your account and messages</string> <string name="TransferOrRestoreFragment__if_you_have_previously_registered_a_signal_account">If you have previously registered a Signal account, you can transfer or restore your account and messages</string>
<string name="TransferOrRestoreFragment__transfer_from_android_device">Transfer from Android device</string> <string name="TransferOrRestoreFragment__transfer_from_android_device">Transfer from Android device</string>
<string name="TransferOrRestoreFragment__transfer_your_account_and_message_history_from_your_old_android_device">Transfer your account and message history from your old Android device. You must have access to your old device.</string> <string name="TransferOrRestoreFragment__transfer_your_account_and_messages_from_your_old_android_device">Transfer your account and messages from your old Android device. You need access to your old device.</string>
<string name="TransferOrRestoreFragment__you_must_have_access_to_your_old_device">You must have access to your old device.</string> <string name="TransferOrRestoreFragment__you_need_access_to_your_old_device">You need access to your old device.</string>
<string name="TransferOrRestoreFragment__restore_from_backup">Restore from backup</string> <string name="TransferOrRestoreFragment__restore_from_backup">Restore from backup</string>
<string name="TransferOrRestoreFragment__restore_your_messages_and_media_from_a_local_backup">Restore your messages and media from a local backup. If you don\'t restore now, you wouldn\'t be able to restore later.</string> <string name="TransferOrRestoreFragment__restore_your_messages_from_a_local_backup">Restore your messages from a local backup. If you dont restore now, you won\'t be able to restore later.</string>
<!-- NewDeviceTransferInstructionsFragment --> <!-- NewDeviceTransferInstructionsFragment -->
<string name="NewDeviceTransferInstructions__open_signal_on_your_old_android_phone">Open Signal on your old Android phone</string> <string name="NewDeviceTransferInstructions__open_signal_on_your_old_android_phone">Open Signal on your old Android phone</string>
@ -2779,7 +2779,6 @@
<string name="NewDeviceTransferSetup__preparing_to_connect_to_old_android_device">Preparing to connect to old Android device…</string> <string name="NewDeviceTransferSetup__preparing_to_connect_to_old_android_device">Preparing to connect to old Android device…</string>
<string name="NewDeviceTransferSetup__take_a_moment_should_be_ready_soon">Taking a moment, should be ready soon</string> <string name="NewDeviceTransferSetup__take_a_moment_should_be_ready_soon">Taking a moment, should be ready soon</string>
<string name="NewDeviceTransferSetup__waiting_for_old_device_to_connect">Waiting for old Android device to connect…</string> <string name="NewDeviceTransferSetup__waiting_for_old_device_to_connect">Waiting for old Android device to connect…</string>
<string name="NewDeviceTransferSetup__connecting_to_old_android_device">Connecting to old Android device…</string>
<string name="NewDeviceTransferSetup__signal_needs_the_location_permission_to_discover_and_connect_with_your_old_device">Signal needs the location permission to discover and connect to your old Android device.</string> <string name="NewDeviceTransferSetup__signal_needs_the_location_permission_to_discover_and_connect_with_your_old_device">Signal needs the location permission to discover and connect to your old Android device.</string>
<string name="NewDeviceTransferSetup__signal_needs_location_services_enabled_to_discover_and_connect_with_your_old_device">Signal needs location services enabled to discover and connect with your old Android device.</string> <string name="NewDeviceTransferSetup__signal_needs_location_services_enabled_to_discover_and_connect_with_your_old_device">Signal needs location services enabled to discover and connect with your old Android device.</string>
<string name="NewDeviceTransferSetup__signal_needs_wifi_on_to_discover_and_connect_with_your_old_device">Signal needs Wi-Fi on to discover and connect with your old Android device. Wi-Fi needs to be on but it does not have to be connected to a Wi-Fi network.</string> <string name="NewDeviceTransferSetup__signal_needs_wifi_on_to_discover_and_connect_with_your_old_device">Signal needs Wi-Fi on to discover and connect with your old Android device. Wi-Fi needs to be on but it does not have to be connected to a Wi-Fi network.</string>
@ -2789,7 +2788,6 @@
<!-- OldDeviceTransferSetupFragment --> <!-- OldDeviceTransferSetupFragment -->
<string name="OldDeviceTransferSetup__searching_for_your_new_android_device">Searching for your new Android device…</string> <string name="OldDeviceTransferSetup__searching_for_your_new_android_device">Searching for your new Android device…</string>
<string name="OldDeviceTransferSetup__connecting_to_new_android_device">Connecting to new Android device…</string>
<string name="OldDeviceTransferSetup__signal_needs_the_location_permission_to_discover_and_connect_with_your_new_device">Signal needs the location permission to discover and connect to your new Android device.</string> <string name="OldDeviceTransferSetup__signal_needs_the_location_permission_to_discover_and_connect_with_your_new_device">Signal needs the location permission to discover and connect to your new Android device.</string>
<string name="OldDeviceTransferSetup__signal_needs_location_services_enabled_to_discover_and_connect_with_your_new_device">Signal needs location services enabled to discover and connect with your new Android device.</string> <string name="OldDeviceTransferSetup__signal_needs_location_services_enabled_to_discover_and_connect_with_your_new_device">Signal needs location services enabled to discover and connect with your new Android device.</string>
<string name="OldDeviceTransferSetup__signal_needs_wifi_on_to_discover_and_connect_with_your_new_device">Signal needs Wi-Fi on to discover and connect with your new Android device. Wi-Fi needs to be on but it does not have to be connected to a Wi-Fi network.</string> <string name="OldDeviceTransferSetup__signal_needs_wifi_on_to_discover_and_connect_with_your_new_device">Signal needs Wi-Fi on to discover and connect with your new Android device. Wi-Fi needs to be on but it does not have to be connected to a Wi-Fi network.</string>
@ -2825,6 +2823,9 @@
<string name="DeviceTransferSetup__make_sure_both_devices_are_in_transfer_mode">Make sure both devices are in transfer mode.</string> <string name="DeviceTransferSetup__make_sure_both_devices_are_in_transfer_mode">Make sure both devices are in transfer mode.</string>
<string name="DeviceTransferSetup__go_to_support_page">Go to support page</string> <string name="DeviceTransferSetup__go_to_support_page">Go to support page</string>
<string name="DeviceTransferSetup__try_again">Try again</string> <string name="DeviceTransferSetup__try_again">Try again</string>
<string name="DeviceTransferSetup__waiting_for_other_device">Waiting for other device</string>
<string name="DeviceTransferSetup__tap_continue_on_your_other_device_to_start_the_transfer">Tap Continue on your other device to start the transfer.</string>
<string name="DeviceTransferSetup__tap_continue_on_your_other_device">Tap Continue on your other device…</string>
<!-- NewDeviceTransferFragment --> <!-- NewDeviceTransferFragment -->
<string name="NewDeviceTransfer__cannot_transfer_from_a_newer_version_of_signal">Cannot transfer from a newer versions of Signal</string> <string name="NewDeviceTransfer__cannot_transfer_from_a_newer_version_of_signal">Cannot transfer from a newer versions of Signal</string>

Wyświetl plik

@ -181,6 +181,7 @@ final class DeviceTransferClient implements Handler.Callback {
update(TransferStatus.networkConnected()); update(TransferStatus.networkConnected());
break; break;
case NetworkClientThread.NETWORK_CLIENT_STOPPED: case NetworkClientThread.NETWORK_CLIENT_STOPPED:
update(TransferStatus.shutdown());
internalShutdown(); internalShutdown();
break; break;
default: default:

Wyświetl plik

@ -146,6 +146,7 @@ final class DeviceTransferServer implements Handler.Callback {
startWifiDirect(message.arg1); startWifiDirect(message.arg1);
break; break;
case NetworkServerThread.NETWORK_SERVER_STOPPED: case NetworkServerThread.NETWORK_SERVER_STOPPED:
update(TransferStatus.shutdown());
internalShutdown(); internalShutdown();
break; break;
case NetworkServerThread.NETWORK_CLIENT_CONNECTED: case NetworkServerThread.NETWORK_CLIENT_CONNECTED:

Wyświetl plik

@ -92,8 +92,18 @@ final class NetworkClientThread extends Thread {
Log.i(TAG, "Waiting for user to verify sas"); Log.i(TAG, "Waiting for user to verify sas");
awaitAuthenticationCodeVerification(); awaitAuthenticationCodeVerification();
Log.d(TAG, "Waiting for server to tell us they also verified"); Log.d(TAG, "Waiting for server to tell us they also verified");
//noinspection ResultOfMethodCallIgnored outputStream.write(0x43);
inputStream.read(); outputStream.flush();
try {
int result = inputStream.read();
if (result == -1) {
Log.w(TAG, "Something happened waiting for server to verify");
throw new DeviceTransferAuthentication.DeviceTransferAuthenticationException("server disconnected while we waited");
}
} catch (IOException e) {
Log.w(TAG, "Something happened waiting for server to verify", e);
throw new DeviceTransferAuthentication.DeviceTransferAuthenticationException(e);
}
handler.sendEmptyMessage(NETWORK_CLIENT_CONNECTED); handler.sendEmptyMessage(NETWORK_CLIENT_CONNECTED);
clientTask.run(context, outputStream); clientTask.run(context, outputStream);

Wyświetl plik

@ -73,10 +73,21 @@ final class NetworkServerThread extends Thread {
Log.i(TAG, "Waiting for user to verify sas"); Log.i(TAG, "Waiting for user to verify sas");
awaitAuthenticationCodeVerification(); awaitAuthenticationCodeVerification();
Log.d(TAG, "Waiting for client to tell us they also verified");
handler.sendEmptyMessage(NETWORK_CLIENT_CONNECTED);
outputStream.write(0x43); outputStream.write(0x43);
outputStream.flush(); outputStream.flush();
try {
int result = inputStream.read();
if (result == -1) {
Log.w(TAG, "Something happened waiting for client to verify");
throw new DeviceTransferAuthentication.DeviceTransferAuthenticationException("client disconnected while we waited");
}
} catch (IOException e) {
Log.w(TAG, "Something happened waiting for client to verify", e);
throw new DeviceTransferAuthentication.DeviceTransferAuthenticationException(e);
}
handler.sendEmptyMessage(NETWORK_CLIENT_CONNECTED);
serverTask.run(context, inputStream); serverTask.run(context, inputStream);
outputStream.write(0x53); outputStream.write(0x53);

Wyświetl plik

@ -59,6 +59,10 @@ public class TransferStatus {
return new TransferStatus(TransferMode.UNAVAILABLE); return new TransferStatus(TransferMode.UNAVAILABLE);
} }
public static @NonNull TransferStatus shutdown() {
return new TransferStatus(TransferMode.SHUTDOWN);
}
public static @NonNull TransferStatus failed() { public static @NonNull TransferStatus failed() {
return new TransferStatus(TransferMode.FAILED); return new TransferStatus(TransferMode.FAILED);
} }
@ -72,6 +76,7 @@ public class TransferStatus {
NETWORK_CONNECTED, NETWORK_CONNECTED,
VERIFICATION_REQUIRED, VERIFICATION_REQUIRED,
SERVICE_CONNECTED, SERVICE_CONNECTED,
SERVICE_DISCONNECTED SERVICE_DISCONNECTED,
SHUTDOWN
} }
} }