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

Commit 62c6aa1c authored by Frank Preel's avatar Frank Preel Committed by Romain Hunault
Browse files

Launch Synchronizer service

parent 21675677
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -2,6 +2,7 @@
<!--
<!--
     Copyright (C) 2013-2015 The CyanogenMod Project
     Copyright (C) 2013-2015 The CyanogenMod Project
     Copyright (C) 2017 The LineageOS Project
     Copyright (C) 2017 The LineageOS Project
     Copyright (C) 2018 


     Licensed under the Apache License, Version 2.0 (the "License");
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     you may not use this file except in compliance with the License.
@@ -108,4 +109,7 @@
    <string name="lockscreen_setup_summary"><b>Protect this device</b> and require a PIN, pattern, or password to unlock the screen</string>
    <string name="lockscreen_setup_summary"><b>Protect this device</b> and require a PIN, pattern, or password to unlock the screen</string>
    <string name="lockscreen_setup_screen_lock_setup">Set up</string>
    <string name="lockscreen_setup_screen_lock_setup">Set up</string>
    
    
    <!-- eelo -->
    <string name="eelo_start_synchronizer_err">Cannot start eelo synchronizer</string>
    
</resources>
</resources>
+23 −0
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2017 The LineageOS Project
 * Copyright (C) 2017 The LineageOS Project
 * Copyright (C) 2018 eelo
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * you may not use this file except in compliance with the License.
@@ -23,8 +24,12 @@ import static com.cyanogenmod.setupwizard.SetupWizardApp.LOGV;


import android.annotation.Nullable;
import android.annotation.Nullable;
import android.content.Intent;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ComponentName;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Bundle;
import android.util.Log;
import android.util.Log;
import android.widget.Toast;


import com.android.setupwizardlib.util.SystemBarHelper;
import com.android.setupwizardlib.util.SystemBarHelper;


@@ -46,6 +51,7 @@ public class SetupWizardExitActivity extends BaseSetupWizardActivity {
        SetupWizardUtils.enableCaptivePortalDetection(this);
        SetupWizardUtils.enableCaptivePortalDetection(this);
        PhoneMonitor.onSetupFinished();
        PhoneMonitor.onSetupFinished();
        launchHome();
        launchHome();
        launchEeloSynchronizer();
        finish();
        finish();
        applyForwardTransition(TRANSITION_ID_FADE);
        applyForwardTransition(TRANSITION_ID_FADE);
        Intent i = new Intent();
        Intent i = new Intent();
@@ -59,4 +65,21 @@ public class SetupWizardExitActivity extends BaseSetupWizardActivity {
                .addFlags(FLAG_ACTIVITY_NEW_TASK|FLAG_ACTIVITY_CLEAR_TASK));
                .addFlags(FLAG_ACTIVITY_NEW_TASK|FLAG_ACTIVITY_CLEAR_TASK));
    }
    }


    /*
    *   Launch eelo synchronizer service
    */
    private final void launchEeloSynchronizer() {
        try {
            IntentFilter filter = new IntentFilter();
            filter.addAction(Intent.ACTION_BOOT_COMPLETED);
            ComponentName receiver = new ComponentName("io.eelo.synchronizer", 
                    "io.eelo.synchronizer.triggers.BootCompleteReceiver");
            PackageManager pm  = getPackageManager();
            pm.setComponentEnabledSetting(receiver, 
                      PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 
                      PackageManager.DONT_KILL_APP);
        } catch (java.lang.Throwable t) {
            //Toast.makeText(getApplicationContext(), getString(R.string.eelo_start_synchronizer_err), Toast.LENGTH_LONG).show();
        }
    }
}
}