mirror of
https://github.com/topjohnwu/Magisk
synced 2024-11-14 22:28:37 +01:00
I think...that...might be it?
This commit is contained in:
parent
f9513ca802
commit
4b49331d97
@ -41,12 +41,15 @@ public class TileServiceCompat extends Service {
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
root = Utils.rootEnabled();
|
||||
autoRoot = Utils.autoToggleEnabled(getApplicationContext());
|
||||
updateRoots();
|
||||
updateTile();
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
private void updateRoots() {
|
||||
root = Utils.rootEnabled();
|
||||
autoRoot = Utils.autoToggleEnabled(getApplicationContext());
|
||||
}
|
||||
|
||||
|
||||
private void registerClickTileReceiver() {
|
||||
@ -70,26 +73,15 @@ public class TileServiceCompat extends Service {
|
||||
|
||||
|
||||
private void onSimpleClick() {
|
||||
updateRoots();
|
||||
updateTile();
|
||||
Utils.toggleRoot(!root);
|
||||
}
|
||||
|
||||
private void onLongClick() {
|
||||
Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||
sendBroadcast(it);
|
||||
Utils.toggleAutoRoot(!Utils.autoToggleEnabled(getApplicationContext()),getApplicationContext());
|
||||
}
|
||||
|
||||
public static boolean openApp(Context context, String packageName) {
|
||||
PackageManager manager = context.getPackageManager();
|
||||
Intent i = manager.getLaunchIntentForPackage(packageName);
|
||||
if (i == null) {
|
||||
return false;
|
||||
//throw new PackageManager.NameNotFoundException();
|
||||
}
|
||||
i.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
context.startActivity(i);
|
||||
return true;
|
||||
updateRoots();
|
||||
updateTile();
|
||||
Utils.toggleAutoRoot(!autoRoot,getApplicationContext());
|
||||
}
|
||||
|
||||
private void updateTile() {
|
||||
|
@ -287,7 +287,7 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
tiles.add(tiles.size() + 1, qsTileId);
|
||||
tiles.add(Math.round(tiles.size()/2), qsTileId);
|
||||
String newTiles = TextUtils.join(",", tiles);
|
||||
Logger.dh("Utils: NewtilesString is "+ newTiles);
|
||||
Shell.su("settings put secure sysui_qs_tiles \"" + newTiles + "\"");
|
||||
|
Loading…
Reference in New Issue
Block a user