Guest User

restore_backup.patch

a guest
Aug 11th, 2020
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.55 KB | None | 0 0
  1. diff --git a/AndroidManifest.xml b/AndroidManifest.xml
  2. index a10f1a4..2ae3673 100644
  3. --- a/AndroidManifest.xml
  4. +++ b/AndroidManifest.xml
  5. @@ -257,6 +257,19 @@
  6. </intent-filter>
  7. </activity>
  8.  
  9. + <activity android:name=".backup.RestoreIntroActivity"
  10. + android:label="@string/activity_label_empty"
  11. + android:excludeFromRecents="true"
  12. + android:configChanges="mcc|mnc"
  13. + android:immersive="true"
  14. + android:exported="false"
  15. + android:windowSoftInputMode="stateAlwaysHidden">
  16. + <intent-filter>
  17. + <action android:name="org.lineageos.setupwizard.LINEAGE_RESTORE_BACKUP"/>
  18. + <category android:name="android.intent.category.DEFAULT"/>
  19. + </intent-filter>
  20. + </activity>
  21. +
  22. <activity android:name=".FinishActivity"
  23. android:label="@string/activity_label_empty"
  24. android:excludeFromRecents="true"
  25. diff --git a/res/raw/lineage_wizard_script.xml b/res/raw/lineage_wizard_script.xml
  26. index d997994..4185a2b 100644
  27. --- a/res/raw/lineage_wizard_script.xml
  28. +++ b/res/raw/lineage_wizard_script.xml
  29. @@ -66,6 +66,14 @@
  30. </WizardAction>
  31.  
  32. <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_LOCKSCREEN_SETTINGS;end" id="lockscreen_settings">
  33. + <result wizard:action="wait_install_apps" />
  34. + </WizardAction>
  35. +
  36. + <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_WAIT_INSTALL_APPS;end" id="wait_install_apps">
  37. + <result wizard:action="restore" />
  38. + </WizardAction>
  39. +
  40. + <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_RESTORE_BACKUP;end" id="restore">
  41. <result wizard:action="finish" />
  42. </WizardAction>
  43.  
  44. diff --git a/res/values/strings.xml b/res/values/strings.xml
  45. index 0bb3b88..bdd302e 100644
  46. --- a/res/values/strings.xml
  47. +++ b/res/values/strings.xml
  48. @@ -98,4 +98,16 @@
  49. <string name="lockscreen_setup_summary"><b>Protect this device</b> and require a PIN, pattern, or password to unlock the screen</string>
  50. <string name="lockscreen_setup_screen_lock_setup">Set up</string>
  51.  
  52. + <!-- App install -->
  53. + <string name="calyx_fdroid_repo_location" translatable="false">/product/fdroid/repo</string>
  54. + <string name="install_apps_title">Additional Apps</string>
  55. + <string name="install_apps_subtitle"><b>Review additional apps.</b> You can install them later as well.</string>
  56. + <string name="install_apps_select_all">All of the following apps</string>
  57. + <string name="waiting_for_apps">Please wait while we finish setting up your device.</string>
  58. +
  59. + <!-- Backup Restore -->
  60. + <string name="intro_restore_title">Restore apps and data</string>
  61. + <string name="intro_restore_subtitle">If you have a backup from your last phone, you can restore it here.</string>
  62. + <string name="intro_restore_button">Restore from backup</string>
  63. +
  64. </resources>
  65. diff --git a/src/org/lineageos/setupwizard/SetupWizardApp.java b/src/org/lineageos/setupwizard/SetupWizardApp.java
  66. index 538c298..45d3773 100644
  67. --- a/src/org/lineageos/setupwizard/SetupWizardApp.java
  68. +++ b/src/org/lineageos/setupwizard/SetupWizardApp.java
  69. @@ -42,6 +42,7 @@ public class SetupWizardApp extends Application {
  70. public static final String ACTION_EMERGENCY_DIAL = "com.android.phone.EmergencyDialer.DIAL";
  71. public static final String ACTION_NEXT = "com.android.wizard.NEXT";
  72. public static final String ACTION_LOAD = "com.android.wizard.LOAD";
  73. + public static final String ACTION_RESTORE_FROM_BACKUP = "com.stevesoltys.seedvault.RESTORE_BACKUP";
  74.  
  75.  
  76. public static final String EXTRA_FIRST_RUN = "firstRun";
  77. @@ -69,6 +70,7 @@ public class SetupWizardApp extends Application {
  78. public static final int REQUEST_CODE_SETUP_BLUETOOTH= 5;
  79. public static final int REQUEST_CODE_SETUP_FINGERPRINT = 7;
  80. public static final int REQUEST_CODE_SETUP_LOCKSCREEN = 9;
  81. + public static final int REQUEST_CODE_RESTORE = 10;
  82.  
  83. public static final int RADIO_READY_TIMEOUT = 10 * 1000;
  84.  
  85. diff --git a/src/org/lineageos/setupwizard/backup/RestoreIntroActivity.java b/src/org/lineageos/setupwizard/backup/RestoreIntroActivity.java
  86. index e69de29..e131b74 100644
  87. --- a/src/org/lineageos/setupwizard/backup/RestoreIntroActivity.java
  88. +++ b/src/org/lineageos/setupwizard/backup/RestoreIntroActivity.java
  89. @@ -0,0 +1,43 @@
  90. +package org.lineageos.setupwizard.backup;
  91. +
  92. +import android.content.Intent;
  93. +import org.lineageos.setupwizard.R;
  94. +import org.lineageos.setupwizard.SubBaseActivity;
  95. +
  96. +import static org.lineageos.setupwizard.SetupWizardApp.*;
  97. +
  98. +public class RestoreIntroActivity extends SubBaseActivity {
  99. +
  100. + @Override
  101. + protected void onStartSubactivity() {
  102. + setNextAllowed(true);
  103. +
  104. + findViewById(R.id.intro_restore_button).setOnClickListener(v -> launchRestore());
  105. + }
  106. +
  107. + @Override
  108. + protected int getLayoutResId() {
  109. + return R.layout.intro_restore_activity;
  110. + }
  111. +
  112. + @Override
  113. + protected int getTitleResId() {
  114. + return R.string.intro_restore_title;
  115. + }
  116. +
  117. + @Override
  118. + protected int getIconResId() {
  119. + return R.drawable.ic_restore;
  120. + }
  121. +
  122. + @Override
  123. + protected int getSubactivityNextTransition() {
  124. + return TRANSITION_ID_SLIDE;
  125. + }
  126. +
  127. + private void launchRestore() {
  128. + Intent intent = new Intent(ACTION_RESTORE_FROM_BACKUP);
  129. + startSubactivity(intent, REQUEST_CODE_RESTORE);
  130. + }
  131. +
  132. +}
  133.  
Advertisement
Add Comment
Please, Sign In to add comment