Loading cmds/pm/src/com/android/commands/pm/Pm.java +26 −52 Original line number Diff line number Diff line Loading @@ -324,8 +324,7 @@ public final class Pm { String optionData = nextOptionData(); if (optionData == null || !isNumber(optionData)) { System.err.println("Error: no USER_ID specified"); showUsage(); return 1; return showUsage(); } else { userId = Integer.parseInt(optionData); } Loading Loading @@ -428,8 +427,7 @@ public final class Pm { } } else { System.err.println("Error: unknown option: " + opt); showUsage(); return 1; return showUsage(); } } Loading @@ -437,16 +435,14 @@ public final class Pm { final String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified."); showUsage(); return 1; return showUsage(); } // State to apply; {always|ask|never|undefined}, required final String modeString = nextArg(); if (modeString == null) { System.err.println("Error: no app link state specified."); showUsage(); return 1; return showUsage(); } final int newMode; Loading Loading @@ -515,8 +511,7 @@ public final class Pm { } } else { System.err.println("Error: unknown option: " + opt); showUsage(); return 1; return showUsage(); } } Loading @@ -524,8 +519,7 @@ public final class Pm { final String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified."); showUsage(); return 1; return showUsage(); } try { Loading Loading @@ -942,8 +936,7 @@ public final class Pm { String optionData = nextOptionData(); if (optionData == null || !isNumber(optionData)) { System.err.println("Error: no USER_ID specified"); showUsage(); return 1; return showUsage(); } else { userId = Integer.parseInt(optionData); } Loading @@ -953,8 +946,7 @@ public final class Pm { flags |= UserInfo.FLAG_RESTRICTED; } else { System.err.println("Error: unknown option " + opt); showUsage(); return 1; return showUsage(); } } String arg = nextArg(); Loading Loading @@ -1114,8 +1106,7 @@ public final class Pm { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified"); showUsage(); return 1; return showUsage(); } userId = translateUserId(userId, "runUninstall"); Loading Loading @@ -1184,8 +1175,7 @@ public final class Pm { String optionData = nextOptionData(); if (optionData == null || !isNumber(optionData)) { System.err.println("Error: no USER_ID specified"); showUsage(); return 1; return showUsage(); } else { userId = Integer.parseInt(optionData); } Loading @@ -1194,8 +1184,7 @@ public final class Pm { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified"); showUsage(); return 1; return showUsage(); } ClearDataObserver obs = new ClearDataObserver(); Loading Loading @@ -1256,8 +1245,7 @@ public final class Pm { String optionData = nextOptionData(); if (optionData == null || !isNumber(optionData)) { System.err.println("Error: no USER_ID specified"); showUsage(); return 1; return showUsage(); } else { userId = Integer.parseInt(optionData); } Loading @@ -1266,8 +1254,7 @@ public final class Pm { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package or component specified"); showUsage(); return 1; return showUsage(); } ComponentName cn = ComponentName.unflattenFromString(pkg); if (cn == null) { Loading Loading @@ -1305,8 +1292,7 @@ public final class Pm { String optionData = nextOptionData(); if (optionData == null || !isNumber(optionData)) { System.err.println("Error: no USER_ID specified"); showUsage(); return 1; return showUsage(); } else { userId = Integer.parseInt(optionData); } Loading @@ -1315,8 +1301,7 @@ public final class Pm { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package or component specified"); showUsage(); return 1; return showUsage(); } try { mPm.setApplicationHiddenSettingAsUser(pkg, state, userId); Loading @@ -1343,14 +1328,12 @@ public final class Pm { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified"); showUsage(); return 1; return showUsage(); } String perm = nextArg(); if (perm == null) { System.err.println("Error: no permission specified"); showUsage(); return 1; return showUsage(); } try { Loading @@ -1366,8 +1349,7 @@ public final class Pm { return 1; } catch (IllegalArgumentException e) { System.err.println("Bad argument: " + e.toString()); showUsage(); return 1; return showUsage(); } catch (SecurityException e) { System.err.println("Operation not allowed: " + e.toString()); return 1; Loading @@ -1384,8 +1366,7 @@ public final class Pm { return 1; } catch (IllegalArgumentException e) { System.err.println("Bad argument: " + e.toString()); showUsage(); return 1; return showUsage(); } catch (SecurityException e) { System.err.println("Operation not allowed: " + e.toString()); return 1; Loading @@ -1396,14 +1377,12 @@ public final class Pm { final String permission = nextArg(); if (permission == null) { System.err.println("Error: no permission specified"); showUsage(); return 1; return showUsage(); } final String enforcedRaw = nextArg(); if (enforcedRaw == null) { System.err.println("Error: no enforcement specified"); showUsage(); return 1; return showUsage(); } final boolean enforced = Boolean.parseBoolean(enforcedRaw); try { Loading @@ -1415,8 +1394,7 @@ public final class Pm { return 1; } catch (IllegalArgumentException e) { System.err.println("Bad argument: " + e.toString()); showUsage(); return 1; return showUsage(); } catch (SecurityException e) { System.err.println("Operation not allowed: " + e.toString()); return 1; Loading @@ -1442,8 +1420,7 @@ public final class Pm { String size = nextArg(); if (size == null) { System.err.println("Error: no size specified"); showUsage(); return 1; return showUsage(); } int len = size.length(); long multiplier = 1; Loading @@ -1457,8 +1434,7 @@ public final class Pm { multiplier = 1024L*1024L*1024L; } else { System.err.println("Invalid suffix: " + c); showUsage(); return 1; return showUsage(); } size = size.substring(0, len-1); } Loading @@ -1467,8 +1443,7 @@ public final class Pm { sizeVal = Long.parseLong(size) * multiplier; } catch (NumberFormatException e) { System.err.println("Error: expected number at: " + size); showUsage(); return 1; return showUsage(); } String volumeUuid = nextArg(); if ("internal".equals(volumeUuid)) { Loading @@ -1492,8 +1467,7 @@ public final class Pm { return 1; } catch (IllegalArgumentException e) { System.err.println("Bad argument: " + e.toString()); showUsage(); return 1; return showUsage(); } catch (SecurityException e) { System.err.println("Operation not allowed: " + e.toString()); return 1; Loading cmds/sm/src/com/android/commands/sm/Sm.java +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ public final class Sm { } catch (Exception e) { if (e instanceof IllegalArgumentException) { showUsage(); System.exit(1); } Log.e(TAG, "Error", e); System.err.println("Error: " + e); Loading Loading
cmds/pm/src/com/android/commands/pm/Pm.java +26 −52 Original line number Diff line number Diff line Loading @@ -324,8 +324,7 @@ public final class Pm { String optionData = nextOptionData(); if (optionData == null || !isNumber(optionData)) { System.err.println("Error: no USER_ID specified"); showUsage(); return 1; return showUsage(); } else { userId = Integer.parseInt(optionData); } Loading Loading @@ -428,8 +427,7 @@ public final class Pm { } } else { System.err.println("Error: unknown option: " + opt); showUsage(); return 1; return showUsage(); } } Loading @@ -437,16 +435,14 @@ public final class Pm { final String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified."); showUsage(); return 1; return showUsage(); } // State to apply; {always|ask|never|undefined}, required final String modeString = nextArg(); if (modeString == null) { System.err.println("Error: no app link state specified."); showUsage(); return 1; return showUsage(); } final int newMode; Loading Loading @@ -515,8 +511,7 @@ public final class Pm { } } else { System.err.println("Error: unknown option: " + opt); showUsage(); return 1; return showUsage(); } } Loading @@ -524,8 +519,7 @@ public final class Pm { final String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified."); showUsage(); return 1; return showUsage(); } try { Loading Loading @@ -942,8 +936,7 @@ public final class Pm { String optionData = nextOptionData(); if (optionData == null || !isNumber(optionData)) { System.err.println("Error: no USER_ID specified"); showUsage(); return 1; return showUsage(); } else { userId = Integer.parseInt(optionData); } Loading @@ -953,8 +946,7 @@ public final class Pm { flags |= UserInfo.FLAG_RESTRICTED; } else { System.err.println("Error: unknown option " + opt); showUsage(); return 1; return showUsage(); } } String arg = nextArg(); Loading Loading @@ -1114,8 +1106,7 @@ public final class Pm { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified"); showUsage(); return 1; return showUsage(); } userId = translateUserId(userId, "runUninstall"); Loading Loading @@ -1184,8 +1175,7 @@ public final class Pm { String optionData = nextOptionData(); if (optionData == null || !isNumber(optionData)) { System.err.println("Error: no USER_ID specified"); showUsage(); return 1; return showUsage(); } else { userId = Integer.parseInt(optionData); } Loading @@ -1194,8 +1184,7 @@ public final class Pm { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified"); showUsage(); return 1; return showUsage(); } ClearDataObserver obs = new ClearDataObserver(); Loading Loading @@ -1256,8 +1245,7 @@ public final class Pm { String optionData = nextOptionData(); if (optionData == null || !isNumber(optionData)) { System.err.println("Error: no USER_ID specified"); showUsage(); return 1; return showUsage(); } else { userId = Integer.parseInt(optionData); } Loading @@ -1266,8 +1254,7 @@ public final class Pm { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package or component specified"); showUsage(); return 1; return showUsage(); } ComponentName cn = ComponentName.unflattenFromString(pkg); if (cn == null) { Loading Loading @@ -1305,8 +1292,7 @@ public final class Pm { String optionData = nextOptionData(); if (optionData == null || !isNumber(optionData)) { System.err.println("Error: no USER_ID specified"); showUsage(); return 1; return showUsage(); } else { userId = Integer.parseInt(optionData); } Loading @@ -1315,8 +1301,7 @@ public final class Pm { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package or component specified"); showUsage(); return 1; return showUsage(); } try { mPm.setApplicationHiddenSettingAsUser(pkg, state, userId); Loading @@ -1343,14 +1328,12 @@ public final class Pm { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified"); showUsage(); return 1; return showUsage(); } String perm = nextArg(); if (perm == null) { System.err.println("Error: no permission specified"); showUsage(); return 1; return showUsage(); } try { Loading @@ -1366,8 +1349,7 @@ public final class Pm { return 1; } catch (IllegalArgumentException e) { System.err.println("Bad argument: " + e.toString()); showUsage(); return 1; return showUsage(); } catch (SecurityException e) { System.err.println("Operation not allowed: " + e.toString()); return 1; Loading @@ -1384,8 +1366,7 @@ public final class Pm { return 1; } catch (IllegalArgumentException e) { System.err.println("Bad argument: " + e.toString()); showUsage(); return 1; return showUsage(); } catch (SecurityException e) { System.err.println("Operation not allowed: " + e.toString()); return 1; Loading @@ -1396,14 +1377,12 @@ public final class Pm { final String permission = nextArg(); if (permission == null) { System.err.println("Error: no permission specified"); showUsage(); return 1; return showUsage(); } final String enforcedRaw = nextArg(); if (enforcedRaw == null) { System.err.println("Error: no enforcement specified"); showUsage(); return 1; return showUsage(); } final boolean enforced = Boolean.parseBoolean(enforcedRaw); try { Loading @@ -1415,8 +1394,7 @@ public final class Pm { return 1; } catch (IllegalArgumentException e) { System.err.println("Bad argument: " + e.toString()); showUsage(); return 1; return showUsage(); } catch (SecurityException e) { System.err.println("Operation not allowed: " + e.toString()); return 1; Loading @@ -1442,8 +1420,7 @@ public final class Pm { String size = nextArg(); if (size == null) { System.err.println("Error: no size specified"); showUsage(); return 1; return showUsage(); } int len = size.length(); long multiplier = 1; Loading @@ -1457,8 +1434,7 @@ public final class Pm { multiplier = 1024L*1024L*1024L; } else { System.err.println("Invalid suffix: " + c); showUsage(); return 1; return showUsage(); } size = size.substring(0, len-1); } Loading @@ -1467,8 +1443,7 @@ public final class Pm { sizeVal = Long.parseLong(size) * multiplier; } catch (NumberFormatException e) { System.err.println("Error: expected number at: " + size); showUsage(); return 1; return showUsage(); } String volumeUuid = nextArg(); if ("internal".equals(volumeUuid)) { Loading @@ -1492,8 +1467,7 @@ public final class Pm { return 1; } catch (IllegalArgumentException e) { System.err.println("Bad argument: " + e.toString()); showUsage(); return 1; return showUsage(); } catch (SecurityException e) { System.err.println("Operation not allowed: " + e.toString()); return 1; Loading
cmds/sm/src/com/android/commands/sm/Sm.java +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ public final class Sm { } catch (Exception e) { if (e instanceof IllegalArgumentException) { showUsage(); System.exit(1); } Log.e(TAG, "Error", e); System.err.println("Error: " + e); Loading