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
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
root = Utils.rootEnabled();
|
updateRoots();
|
||||||
autoRoot = Utils.autoToggleEnabled(getApplicationContext());
|
|
||||||
updateTile();
|
updateTile();
|
||||||
return super.onStartCommand(intent, flags, startId);
|
return super.onStartCommand(intent, flags, startId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateRoots() {
|
||||||
|
root = Utils.rootEnabled();
|
||||||
|
autoRoot = Utils.autoToggleEnabled(getApplicationContext());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void registerClickTileReceiver() {
|
private void registerClickTileReceiver() {
|
||||||
@ -70,26 +73,15 @@ public class TileServiceCompat extends Service {
|
|||||||
|
|
||||||
|
|
||||||
private void onSimpleClick() {
|
private void onSimpleClick() {
|
||||||
|
updateRoots();
|
||||||
|
updateTile();
|
||||||
Utils.toggleRoot(!root);
|
Utils.toggleRoot(!root);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onLongClick() {
|
private void onLongClick() {
|
||||||
Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
updateRoots();
|
||||||
sendBroadcast(it);
|
updateTile();
|
||||||
Utils.toggleAutoRoot(!Utils.autoToggleEnabled(getApplicationContext()),getApplicationContext());
|
Utils.toggleAutoRoot(!autoRoot,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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTile() {
|
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);
|
String newTiles = TextUtils.join(",", tiles);
|
||||||
Logger.dh("Utils: NewtilesString is "+ newTiles);
|
Logger.dh("Utils: NewtilesString is "+ newTiles);
|
||||||
Shell.su("settings put secure sysui_qs_tiles \"" + newTiles + "\"");
|
Shell.su("settings put secure sysui_qs_tiles \"" + newTiles + "\"");
|
||||||
|
Loading…
Reference in New Issue
Block a user