mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Account for reinstalls where service permissions are lost.
This commit is contained in:
parent
17749bb14a
commit
3b0cec9db6
@ -3,6 +3,7 @@ package com.topjohnwu.magisk.services;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Icon;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.service.quicksettings.Tile;
|
import android.service.quicksettings.Tile;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
@ -53,12 +54,16 @@ public class TileServiceNewApi extends android.service.quicksettings.TileService
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupState() {
|
private void setupState() {
|
||||||
|
if (!Utils.hasServicePermission(getApplicationContext())) {
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("autoRootEnable",false).apply();
|
||||||
|
}
|
||||||
mRootsState = Utils.CheckRootsState(getApplicationContext());
|
mRootsState = Utils.CheckRootsState(getApplicationContext());
|
||||||
Logger.dh("QST (New): SetupState");
|
Logger.dh("QST (New): SetupState");
|
||||||
Icon iconRoot = Icon.createWithResource(getApplicationContext(), R.drawable.root);
|
Icon iconRoot = Icon.createWithResource(getApplicationContext(), R.drawable.root);
|
||||||
Icon iconAuto = Icon.createWithResource(getApplicationContext(), R.drawable.ic_autoroot);
|
Icon iconAuto = Icon.createWithResource(getApplicationContext(), R.drawable.ic_autoroot);
|
||||||
Tile tile = getQsTile();
|
Tile tile = getQsTile();
|
||||||
Logger.dh("QST: State is " + mRootsState);
|
Logger.dh("QST: State is " + mRootsState);
|
||||||
|
|
||||||
switch (mRootsState) {
|
switch (mRootsState) {
|
||||||
case 2:
|
case 2:
|
||||||
tile.setLabel(getApplicationContext().getString(R.string.auto_toggle));
|
tile.setLabel(getApplicationContext().getString(R.string.auto_toggle));
|
||||||
|
Loading…
Reference in New Issue
Block a user