I think...that...might be it?

This commit is contained in:
d8ahazard 2016-09-23 16:42:25 -05:00
parent f9513ca802
commit 4b49331d97
2 changed files with 11 additions and 19 deletions

View File

@ -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() {

View File

@ -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 + "\"");