restartService --> forceStopService
JobService shouldn't need to be restarted, but simply killed.
Restarting the service presents requires an app to call the service
start intent, which right now was interfacer itself, and it got
caught in our Signature check (as it isn't Substratum's check).
When a new job intent is broadcasted, JobService should be launched
(restarted) automatically anyway.
Change-Id: If0bb66fa7481b1865686e0b1393a270a8c3df0ba
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d8a1dd8..e2709b6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,8 +4,8 @@
coreApp="true"
package="projekt.interfacer"
android:sharedUserId="android.uid.system"
- android:versionCode="50"
- android:versionName="fifty"
+ android:versionCode="56"
+ android:versionName="fifty six"
tools:ignore="GradleOverrides">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
diff --git a/app/src/main/java/projekt/interfacer/services/JobService.java b/app/src/main/java/projekt/interfacer/services/JobService.java
index 755fa55..83f2dc0 100644
--- a/app/src/main/java/projekt/interfacer/services/JobService.java
+++ b/app/src/main/java/projekt/interfacer/services/JobService.java
@@ -95,7 +95,7 @@
public static final String COMMAND_VALUE_INSTALL = "install";
public static final String COMMAND_VALUE_UNINSTALL = "uninstall";
public static final String COMMAND_VALUE_RESTART_UI = "restart_ui";
- public static final String COMMAND_VALUE_RESTART_SERVICE = "restart_service";
+ public static final String COMMAND_VALUE_FORCE_STOP_SERVICE = "force_stop_service";
public static final String COMMAND_VALUE_CONFIGURATION_SHIM = "configuration_shim";
public static final String COMMAND_VALUE_BOOTANIMATION = "bootanimation";
public static final String COMMAND_VALUE_FONTS = "fonts";
@@ -134,7 +134,6 @@
private MainHandler mMainHandler;
private long mLastJobTime;
private boolean mIsRunning;
- private boolean mShouldRestartService;
private static IOverlayManager getOMS() {
if (mOMS == null) {
@@ -220,9 +219,9 @@
}
} else if (TextUtils.equals(command, COMMAND_VALUE_RESTART_UI)) {
jobs_to_add.add(new UiResetJob());
- } else if (TextUtils.equals(command, COMMAND_VALUE_RESTART_SERVICE)) {
- log("Restarting JobService...");
- restartService();
+ } else if (TextUtils.equals(command, COMMAND_VALUE_FORCE_STOP_SERVICE)) {
+ log("Force stopping JobService...");
+ forceStopService();
} else if (TextUtils.equals(command, COMMAND_VALUE_CONFIGURATION_SHIM)) {
jobs_to_add.add(new LocaleChanger(getApplicationContext(), mMainHandler));
} else if (TextUtils.equals(command, COMMAND_VALUE_BOOTANIMATION)) {
@@ -318,17 +317,6 @@
return null;
}
- @Override
- public void onDestroy() {
- if (mShouldRestartService) {
- Intent intent = new Intent(this, JobService.class);
- PendingIntent pending = PendingIntent.getActivity(this, 0, new Intent(), 0);
- intent.putExtra(INTERFACER_TOKEN, pending);
- intent.putExtra(JOB_TIME_KEY, System.currentTimeMillis());
- startService(intent);
- }
- }
-
private boolean isProcessing() {
return mJobQueue.size() > 0;
}
@@ -664,8 +652,7 @@
}
}
- private void restartService() {
- mShouldRestartService = true;
+ private void forceStopService() {
stopService(new Intent(this, JobService.class));
}