Loading api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -4195,6 +4195,7 @@ package android.app { method public final boolean performGlobalAction(int); method public final boolean performGlobalAction(int); method public void setOnAccessibilityEventListener(android.app.UiAutomation.OnAccessibilityEventListener); method public void setOnAccessibilityEventListener(android.app.UiAutomation.OnAccessibilityEventListener); method public boolean setRotation(int); method public boolean setRotation(int); method public void setRunAsMonkey(boolean); method public final void setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo); method public final void setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo); method public android.graphics.Bitmap takeScreenshot(); method public android.graphics.Bitmap takeScreenshot(); method public void waitForIdle(long, long) throws java.util.concurrent.TimeoutException; method public void waitForIdle(long, long) throws java.util.concurrent.TimeoutException; core/java/android/app/ActivityManagerNative.java +20 −1 Original line number Original line Diff line number Diff line Loading @@ -1413,6 +1413,14 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; return true; } } case SET_USER_IS_MONKEY_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); final boolean monkey = (data.readInt() == 1); setUserIsMonkey(monkey); reply.writeNoException(); return true; } case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: { case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); data.enforceInterface(IActivityManager.descriptor); finishHeavyWeightApp(); finishHeavyWeightApp(); Loading Loading @@ -3634,6 +3642,17 @@ class ActivityManagerProxy implements IActivityManager return res; return res; } } public void setUserIsMonkey(boolean monkey) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeInt(monkey ? 1 : 0); mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); reply.recycle(); } public void finishHeavyWeightApp() throws RemoteException { public void finishHeavyWeightApp() throws RemoteException { Parcel data = Parcel.obtain(); Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); Parcel reply = Parcel.obtain(); Loading core/java/android/app/IActivityManager.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -286,6 +286,8 @@ public interface IActivityManager extends IInterface { public boolean isUserAMonkey() throws RemoteException; public boolean isUserAMonkey() throws RemoteException; public void setUserIsMonkey(boolean monkey) throws RemoteException; public void finishHeavyWeightApp() throws RemoteException; public void finishHeavyWeightApp() throws RemoteException; public void setImmersive(IBinder token, boolean immersive) throws RemoteException; public void setImmersive(IBinder token, boolean immersive) throws RemoteException; Loading Loading @@ -635,4 +637,5 @@ public interface IActivityManager extends IInterface { int REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+162; int REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+162; int GET_LAUNCHED_FROM_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+163; int GET_LAUNCHED_FROM_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+163; int KILL_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+164; int KILL_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+164; int SET_USER_IS_MONKEY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+165; } } core/java/android/app/Instrumentation.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -189,6 +189,10 @@ public class Instrumentation { if (mPerfMetrics != null) { if (mPerfMetrics != null) { results.putAll(mPerfMetrics); results.putAll(mPerfMetrics); } } if (mUiAutomation != null) { mUiAutomation.disconnect(); mUiAutomation = null; } mThread.finishInstrumentation(resultCode, results); mThread.finishInstrumentation(resultCode, results); } } Loading Loading @@ -1695,10 +1699,6 @@ public class Instrumentation { startPerformanceSnapshot(); startPerformanceSnapshot(); } } onStart(); onStart(); if (mUiAutomation != null) { mUiAutomation.disconnect(); mUiAutomation = null; } } } } } Loading core/java/android/app/UiAutomation.java +19 −0 Original line number Original line Diff line number Diff line Loading @@ -619,6 +619,25 @@ public final class UiAutomation { return screenShot; return screenShot; } } /** * Sets whether this UiAutomation to run in a "monkey" mode. Applications can query whether * they are executed in a "monkey" mode, i.e. run by a test framework, and avoid doing * potentially undesirable actions such as calling 911 or posting on public forums etc. * * @param enable whether to run in a "monkey" mode or not. Default is not. * @see {@link ActivityManager#isUserAMonkey()} */ public void setRunAsMonkey(boolean enable) { synchronized (mLock) { throwIfNotConnectedLocked(); } try { ActivityManagerNative.getDefault().setUserIsMonkey(enable); } catch (RemoteException re) { Log.e(LOG_TAG, "Error while setting run as monkey!", re); } } private static float getDegreesForRotation(int value) { private static float getDegreesForRotation(int value) { switch (value) { switch (value) { case Surface.ROTATION_90: { case Surface.ROTATION_90: { Loading Loading
api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -4195,6 +4195,7 @@ package android.app { method public final boolean performGlobalAction(int); method public final boolean performGlobalAction(int); method public void setOnAccessibilityEventListener(android.app.UiAutomation.OnAccessibilityEventListener); method public void setOnAccessibilityEventListener(android.app.UiAutomation.OnAccessibilityEventListener); method public boolean setRotation(int); method public boolean setRotation(int); method public void setRunAsMonkey(boolean); method public final void setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo); method public final void setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo); method public android.graphics.Bitmap takeScreenshot(); method public android.graphics.Bitmap takeScreenshot(); method public void waitForIdle(long, long) throws java.util.concurrent.TimeoutException; method public void waitForIdle(long, long) throws java.util.concurrent.TimeoutException;
core/java/android/app/ActivityManagerNative.java +20 −1 Original line number Original line Diff line number Diff line Loading @@ -1413,6 +1413,14 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; return true; } } case SET_USER_IS_MONKEY_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); final boolean monkey = (data.readInt() == 1); setUserIsMonkey(monkey); reply.writeNoException(); return true; } case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: { case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); data.enforceInterface(IActivityManager.descriptor); finishHeavyWeightApp(); finishHeavyWeightApp(); Loading Loading @@ -3634,6 +3642,17 @@ class ActivityManagerProxy implements IActivityManager return res; return res; } } public void setUserIsMonkey(boolean monkey) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeInt(monkey ? 1 : 0); mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0); reply.readException(); data.recycle(); reply.recycle(); } public void finishHeavyWeightApp() throws RemoteException { public void finishHeavyWeightApp() throws RemoteException { Parcel data = Parcel.obtain(); Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); Parcel reply = Parcel.obtain(); Loading
core/java/android/app/IActivityManager.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -286,6 +286,8 @@ public interface IActivityManager extends IInterface { public boolean isUserAMonkey() throws RemoteException; public boolean isUserAMonkey() throws RemoteException; public void setUserIsMonkey(boolean monkey) throws RemoteException; public void finishHeavyWeightApp() throws RemoteException; public void finishHeavyWeightApp() throws RemoteException; public void setImmersive(IBinder token, boolean immersive) throws RemoteException; public void setImmersive(IBinder token, boolean immersive) throws RemoteException; Loading Loading @@ -635,4 +637,5 @@ public interface IActivityManager extends IInterface { int REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+162; int REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+162; int GET_LAUNCHED_FROM_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+163; int GET_LAUNCHED_FROM_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+163; int KILL_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+164; int KILL_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+164; int SET_USER_IS_MONKEY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+165; } }
core/java/android/app/Instrumentation.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -189,6 +189,10 @@ public class Instrumentation { if (mPerfMetrics != null) { if (mPerfMetrics != null) { results.putAll(mPerfMetrics); results.putAll(mPerfMetrics); } } if (mUiAutomation != null) { mUiAutomation.disconnect(); mUiAutomation = null; } mThread.finishInstrumentation(resultCode, results); mThread.finishInstrumentation(resultCode, results); } } Loading Loading @@ -1695,10 +1699,6 @@ public class Instrumentation { startPerformanceSnapshot(); startPerformanceSnapshot(); } } onStart(); onStart(); if (mUiAutomation != null) { mUiAutomation.disconnect(); mUiAutomation = null; } } } } } Loading
core/java/android/app/UiAutomation.java +19 −0 Original line number Original line Diff line number Diff line Loading @@ -619,6 +619,25 @@ public final class UiAutomation { return screenShot; return screenShot; } } /** * Sets whether this UiAutomation to run in a "monkey" mode. Applications can query whether * they are executed in a "monkey" mode, i.e. run by a test framework, and avoid doing * potentially undesirable actions such as calling 911 or posting on public forums etc. * * @param enable whether to run in a "monkey" mode or not. Default is not. * @see {@link ActivityManager#isUserAMonkey()} */ public void setRunAsMonkey(boolean enable) { synchronized (mLock) { throwIfNotConnectedLocked(); } try { ActivityManagerNative.getDefault().setUserIsMonkey(enable); } catch (RemoteException re) { Log.e(LOG_TAG, "Error while setting run as monkey!", re); } } private static float getDegreesForRotation(int value) { private static float getDegreesForRotation(int value) { switch (value) { switch (value) { case Surface.ROTATION_90: { case Surface.ROTATION_90: { Loading