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

Commit a16458b1 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

Merge branch 'reset-lock' into 'v1-nougat'

Reset OperationManagerService setting

See merge request e/apps/eDrive!64
parents 5dcb92b8 d307eb70
Loading
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -32,10 +32,10 @@ public class EdriveApplication extends Application {
        super.onCreate();

        Log.i(TAG, "Starting");
        resetOperationManagerSetting();

        SharedPreferences prefs = getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE);
        if (prefs.getString(AccountManager.KEY_ACCOUNT_NAME, null) != null) {
            prefs.edit().putBoolean(AppConstants.KEY_OMS_IS_WORKING, false).commit();
            scheduleScannerJob();
        } else {
            Account mAccount = CommonUtils.getAccount(getString(R.string.eelo_account_type), AccountManager.get(this));
@@ -44,7 +44,6 @@ public class EdriveApplication extends Application {
                String accountType = mAccount.type;

                prefs.edit().putString(AccountManager.KEY_ACCOUNT_NAME, accountName)
                        .putBoolean(AppConstants.KEY_OMS_IS_WORKING, false)
                        .putString(AccountManager.KEY_ACCOUNT_TYPE, accountType)
                        .apply();

@@ -59,6 +58,12 @@ public class EdriveApplication extends Application {
        }
    }

    private void resetOperationManagerSetting() {
        getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).edit()
                .putBoolean(AppConstants.KEY_OMS_IS_WORKING, false)
                .apply();
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
+8 −0
Original line number Diff line number Diff line
@@ -290,4 +290,12 @@ public class OperationManagerService extends Service implements OnRemoteOperatio
    public IBinder onBind(Intent intent) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void onLowMemory() {
         Log.w(TAG, "System is low on memory. Service might get killed. Setting KEY_OMS_IS_WORKING to false");
         getSharedPreferences(AppConstants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).edit()
                 .putBoolean(AppConstants.KEY_OMS_IS_WORKING, false)
                 .apply();
    }
}

gradlew

100644 → 100755
+0 −0

File mode changed from 100644 to 100755.