Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a1cad4c authored by Amit Kumar's avatar Amit Kumar
Browse files

Add backup in setupwizard if /e/ account is added

Change-Id: I7404e512c65e7b846f27bd2c329a59ea31c3ff59
parent b3074048
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ import android.accounts.AccountManagerCallback;
import android.accounts.AccountManagerFuture;
import android.os.Bundle;

import static org.lineageos.setupwizard.SetupWizardApp.*;

public class EAccountManagerActivity extends SubBaseActivity {

    public static final String TAG = EAccountManagerActivity.class.getSimpleName();
@@ -69,8 +71,14 @@ public class EAccountManagerActivity extends SubBaseActivity {
                @Override
                public void run(AccountManagerFuture<Bundle> future) {
                    // An eelo account has been added, continue to the next screen
                    Account[] accounts = accountManager.getAccountsByType("e.foundation.webdav.eelo");
                    if (accounts.length > 0) {
                        launchRestore();
                    } else {
                        onNavigateNext();
                    }

                }
            }, null);
        } 
        catch (Exception e) {} 
@@ -81,4 +89,9 @@ public class EAccountManagerActivity extends SubBaseActivity {
    protected int getSubactivityNextTransition() {
        return TRANSITION_ID_SLIDE;
    }

    private void launchRestore() {
        Intent intent = new Intent(ACTION_RESTORE_FROM_BACKUP);
        startSubactivity(intent, REQUEST_CODE_RESTORE);
    }
}
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public class SetupWizardApp extends Application {
    public static final String ACTION_EMERGENCY_DIAL = "com.android.phone.EmergencyDialer.DIAL";
    public static final String ACTION_NEXT = "com.android.wizard.NEXT";
    public static final String ACTION_LOAD = "com.android.wizard.LOAD";
    public static final String ACTION_RESTORE_FROM_BACKUP = "foundation.e.backup.RESTORE_BACKUP";


    public static final String EXTRA_FIRST_RUN = "firstRun";
@@ -70,6 +71,7 @@ public class SetupWizardApp extends Application {
    public static final int REQUEST_CODE_SETUP_BLUETOOTH= 5;
    public static final int REQUEST_CODE_SETUP_FINGERPRINT = 7;
    public static final int REQUEST_CODE_SETUP_LOCKSCREEN = 9;
    public static final int REQUEST_CODE_RESTORE = 10;

    public static final int RADIO_READY_TIMEOUT = 10 * 1000;