summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorClark Scheff <clark@cyngn.com>2015-02-18 16:15:29 -0800
committerClark Scheff <clark@cyngn.com>2015-10-27 10:40:35 -0700
commitd23b0fcb5f2be06951676d85aa5cae50c6abd9a0 (patch)
tree5a2ddd80bb4ce6e66bdde62878f6964e3571f6d6 /cmds
parentd12db22f546d6d55f9c6d1ec729875282c6f4097 (diff)
downloadframeworks_base-d23b0fcb5f2be06951676d85aa5cae50c6abd9a0.zip
frameworks_base-d23b0fcb5f2be06951676d85aa5cae50c6abd9a0.tar.gz
frameworks_base-d23b0fcb5f2be06951676d85aa5cae50c6abd9a0.tar.bz2
Themes: Enhanced theming capabilities [1/3]
This patch includes a new class, ThemeChangeRequest, which will be used to facilitate theme changes. This class includes a builder that will be used to create a ThemeChangeRequest. Change-Id: I60144f8a6505aefcc570feb15ccc50e77bcb1114
Diffstat (limited to 'cmds')
-rw-r--r--cmds/tm/src/com/android/commands/tm/Tm.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/cmds/tm/src/com/android/commands/tm/Tm.java b/cmds/tm/src/com/android/commands/tm/Tm.java
index 14101f7..af1ac75 100644
--- a/cmds/tm/src/com/android/commands/tm/Tm.java
+++ b/cmds/tm/src/com/android/commands/tm/Tm.java
@@ -23,6 +23,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.ParceledListSlice;
import android.content.pm.ThemeUtils;
import android.content.res.IThemeService;
+import android.content.res.ThemeChangeRequest;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
@@ -54,13 +55,14 @@ public class Tm extends BaseCommand {
StringBuilder sb = new StringBuilder();
sb.append("usage: tm [subcommand] [options]\n");
sb.append(" tm list\n");
- sb.append(" tm apply <PACKAGE_NAME> [-c <COMPONENT> [-c <COMPONENT>] ...]\n");
+ sb.append(" tm apply <PACKAGE_NAME> [-r] [-c <COMPONENT> [-c <COMPONENT>] ...]\n");
sb.append(" tm rebuild\n");
sb.append(" tm process <PACKAGE_NAME>\n");
sb.append("\n");
sb.append("tm list: return a list of theme packages.\n");
sb.append("\n");
sb.append("tm apply: applies the components for the theme specified by PACKAGE_NAME.\n");
+ sb.append(" -r: remove per app themes\n");
sb.append(" [-c <COMPONENT> [-c <COMPONENT>] ...]\n");
sb.append(" if no components are specified all components will be applied.\n");
sb.append(" Valid components are:\n");
@@ -143,22 +145,27 @@ public class Tm extends BaseCommand {
}
}
- Map<String, String> componentMap = new HashMap<String, String>();
+ boolean removePerAppThemes = false;
+
+ ThemeChangeRequest.Builder builder = new ThemeChangeRequest.Builder();
String opt;
while ((opt=nextOption()) != null) {
if (opt.equals("-c")) {
- componentMap.put(nextArgRequired(), pkgName);
+ builder.setComponent(nextArgRequired(), pkgName);
+ } else if (opt.equals("-r")) {
+ removePerAppThemes = true;
}
}
// No components specified so let's just try and apply EVERYTHING!
+ Map<String, String> componentMap = builder.build().getThemeComponentsMap();
if (componentMap.size() == 0) {
List<String> components = ThemeUtils.getAllComponents();
for (String component : components) {
- componentMap.put(component, pkgName);
+ builder.setComponent(component, pkgName);
}
}
- mTs.requestThemeChange(componentMap);
+ mTs.requestThemeChange(builder.build(), removePerAppThemes);
}
private void runRebuildResourceCache() throws Exception {