Loading services/core/java/com/android/server/dreams/DreamShellCommand.java +20 −16 Original line number Diff line number Diff line Loading @@ -39,27 +39,25 @@ public class DreamShellCommand extends ShellCommand { @Override public int onCommand(String cmd) { final int callingUid = Binder.getCallingUid(); if (callingUid != Process.ROOT_UID) { Slog.e(TAG, "Must be root before calling Dream shell commands"); return -1; } if (TextUtils.isEmpty(cmd)) { return super.handleDefaultCommands(cmd); } if (DEBUG) { Slog.d(TAG, "onCommand:" + cmd); } try { switch (cmd) { case "start-dreaming": enforceCallerIsRoot(); return startDreaming(); case "stop-dreaming": enforceCallerIsRoot(); return stopDreaming(); default: return super.handleDefaultCommands(cmd); } } catch (SecurityException e) { getOutPrintWriter().println(e); return -1; } } private int startDreaming() { Loading @@ -72,6 +70,12 @@ public class DreamShellCommand extends ShellCommand { return 0; } private void enforceCallerIsRoot() { if (Binder.getCallingUid() != Process.ROOT_UID) { throw new SecurityException("Must be root to call Dream shell commands"); } } @Override public void onHelp() { PrintWriter pw = getOutPrintWriter(); Loading Loading
services/core/java/com/android/server/dreams/DreamShellCommand.java +20 −16 Original line number Diff line number Diff line Loading @@ -39,27 +39,25 @@ public class DreamShellCommand extends ShellCommand { @Override public int onCommand(String cmd) { final int callingUid = Binder.getCallingUid(); if (callingUid != Process.ROOT_UID) { Slog.e(TAG, "Must be root before calling Dream shell commands"); return -1; } if (TextUtils.isEmpty(cmd)) { return super.handleDefaultCommands(cmd); } if (DEBUG) { Slog.d(TAG, "onCommand:" + cmd); } try { switch (cmd) { case "start-dreaming": enforceCallerIsRoot(); return startDreaming(); case "stop-dreaming": enforceCallerIsRoot(); return stopDreaming(); default: return super.handleDefaultCommands(cmd); } } catch (SecurityException e) { getOutPrintWriter().println(e); return -1; } } private int startDreaming() { Loading @@ -72,6 +70,12 @@ public class DreamShellCommand extends ShellCommand { return 0; } private void enforceCallerIsRoot() { if (Binder.getCallingUid() != Process.ROOT_UID) { throw new SecurityException("Must be root to call Dream shell commands"); } } @Override public void onHelp() { PrintWriter pw = getOutPrintWriter(); Loading