From 3b0cec9db6c7077278fa5688247d493306e03568 Mon Sep 17 00:00:00 2001 From: d8ahazard Date: Sun, 25 Sep 2016 01:25:58 -0500 Subject: [PATCH] Account for reinstalls where service permissions are lost. --- .../com/topjohnwu/magisk/services/TileServiceNewApi.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/com/topjohnwu/magisk/services/TileServiceNewApi.java b/app/src/main/java/com/topjohnwu/magisk/services/TileServiceNewApi.java index a970fe9f1..7102409a4 100644 --- a/app/src/main/java/com/topjohnwu/magisk/services/TileServiceNewApi.java +++ b/app/src/main/java/com/topjohnwu/magisk/services/TileServiceNewApi.java @@ -3,6 +3,7 @@ package com.topjohnwu.magisk.services; import android.annotation.SuppressLint; import android.content.Intent; import android.graphics.drawable.Icon; +import android.preference.PreferenceManager; import android.service.quicksettings.Tile; import com.topjohnwu.magisk.R; @@ -53,12 +54,16 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService } private void setupState() { + if (!Utils.hasServicePermission(getApplicationContext())) { + PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("autoRootEnable",false).apply(); + } mRootsState = Utils.CheckRootsState(getApplicationContext()); Logger.dh("QST (New): SetupState"); Icon iconRoot = Icon.createWithResource(getApplicationContext(), R.drawable.root); Icon iconAuto = Icon.createWithResource(getApplicationContext(), R.drawable.ic_autoroot); Tile tile = getQsTile(); Logger.dh("QST: State is " + mRootsState); + switch (mRootsState) { case 2: tile.setLabel(getApplicationContext().getString(R.string.auto_toggle));