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
Pipeline #155687 passed with stage
in 4 minutes and 30 seconds
......@@ -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();
......
......@@ -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();
}
}
File mode changed from 100644 to 100755
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment