Loading cmds/pm/src/com/android/commands/pm/Pm.java +26 −52 Original line number Diff line number Diff line Loading @@ -764,8 +764,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 @@ -868,8 +867,7 @@ public final class Pm { } } else { System.err.println("Error: unknown option: " + opt); showUsage(); return 1; return showUsage(); } } Loading @@ -877,16 +875,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 @@ -955,8 +951,7 @@ public final class Pm { } } else { System.err.println("Error: unknown option: " + opt); showUsage(); return 1; return showUsage(); } } Loading @@ -964,8 +959,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 @@ -1370,8 +1364,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 @@ -1379,8 +1372,7 @@ public final class Pm { flags |= UserInfo.FLAG_MANAGED_PROFILE; } else { System.err.println("Error: unknown option " + opt); showUsage(); return 1; return showUsage(); } } String arg = nextArg(); Loading Loading @@ -1557,8 +1549,7 @@ public final class Pm { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified"); showUsage(); return 1; return showUsage(); } if (userId == UserHandle.USER_ALL) { Loading Loading @@ -1626,8 +1617,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 @@ -1636,8 +1626,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 @@ -1698,8 +1687,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 @@ -1708,8 +1696,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 @@ -1747,8 +1734,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 @@ -1757,8 +1743,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 @@ -1785,14 +1770,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 @@ -1808,8 +1791,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 @@ -1826,8 +1808,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 @@ -1838,14 +1819,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 @@ -1857,8 +1836,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 @@ -1884,8 +1862,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 @@ -1899,8 +1876,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 @@ -1909,8 +1885,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 @@ -1934,8 +1909,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 @@ -764,8 +764,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 @@ -868,8 +867,7 @@ public final class Pm { } } else { System.err.println("Error: unknown option: " + opt); showUsage(); return 1; return showUsage(); } } Loading @@ -877,16 +875,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 @@ -955,8 +951,7 @@ public final class Pm { } } else { System.err.println("Error: unknown option: " + opt); showUsage(); return 1; return showUsage(); } } Loading @@ -964,8 +959,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 @@ -1370,8 +1364,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 @@ -1379,8 +1372,7 @@ public final class Pm { flags |= UserInfo.FLAG_MANAGED_PROFILE; } else { System.err.println("Error: unknown option " + opt); showUsage(); return 1; return showUsage(); } } String arg = nextArg(); Loading Loading @@ -1557,8 +1549,7 @@ public final class Pm { String pkg = nextArg(); if (pkg == null) { System.err.println("Error: no package specified"); showUsage(); return 1; return showUsage(); } if (userId == UserHandle.USER_ALL) { Loading Loading @@ -1626,8 +1617,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 @@ -1636,8 +1626,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 @@ -1698,8 +1687,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 @@ -1708,8 +1696,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 @@ -1747,8 +1734,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 @@ -1757,8 +1743,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 @@ -1785,14 +1770,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 @@ -1808,8 +1791,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 @@ -1826,8 +1808,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 @@ -1838,14 +1819,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 @@ -1857,8 +1836,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 @@ -1884,8 +1862,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 @@ -1899,8 +1876,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 @@ -1909,8 +1885,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 @@ -1934,8 +1909,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