Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc11917d authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8572535 from 5815b882 to tm-release

Change-Id: I22b413ab1267d42f42dd2d04a0529823890a8247
parents 9baa913f 5815b882
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -568,14 +568,15 @@ public abstract class ActivityManagerInternal {
    public abstract void unregisterProcessObserver(IProcessObserver processObserver);

    /**
     * Checks if there is an unfinished instrumentation that targets the given uid.
     * Gets the uid of the instrumentation source if there is an unfinished instrumentation that
     * targets the given uid.
     *
     * @param uid The uid to be checked for
     *
     * @return True, if there is an instrumentation whose target application uid matches the given
     * uid, false otherwise
     * @return the uid of the instrumentation source, if there is an instrumentation whose target
     * application uid matches the given uid, and {@link android.os.Process#INVALID_UID} otherwise.
     */
    public abstract boolean isUidCurrentlyInstrumented(int uid);
    public abstract int getInstrumentationSourceUid(int uid);

    /** Is this a device owner app? */
    public abstract boolean isDeviceOwner(int uid);
+50 −37
Original line number Diff line number Diff line
@@ -1058,10 +1058,11 @@ public class Instrumentation {
    }
    
    /**
     * Sends the key events corresponding to the text to the app being
     * instrumented.
     * Sends the key events that result in the given text being typed into the currently focused
     * window, and waits for it to be processed.
     *
     * @param text The text to be sent.
     * @see #sendKeySync(KeyEvent)
     */
    public void sendStringSync(String text) {
        if (text == null) {
@@ -1084,11 +1085,12 @@ public class Instrumentation {
    }

    /**
     * Send a key event to the currently focused window/view and wait for it to
     * be processed.  Finished at some point after the recipient has returned
     * from its event processing, though it may <em>not</em> have completely
     * finished reacting from the event -- for example, if it needs to update
     * its display as a result, it may still be in the process of doing that.
     * Sends a key event to the currently focused window, and waits for it to be processed.
     * <p>
     * This method blocks until the recipient has finished handling the event. Note that the
     * recipient may <em>not</em> have completely finished reacting from the event when this method
     * returns. For example, it may still be in the process of updating its display or UI contents
     * upon reacting to the injected event.
     *
     * @param event The event to send to the current focus.
     */
@@ -1116,34 +1118,42 @@ public class Instrumentation {
    }

    /**
     * Sends an up and down key event sync to the currently focused window.
     * Sends up and down key events with the given key code to the currently focused window, and
     * waits for it to be processed.
     * 
     * @param key The integer keycode for the event.
     * @param keyCode The key code for the events to send.
     * @see #sendKeySync(KeyEvent)
     */
    public void sendKeyDownUpSync(int key) {        
        sendKeySync(new KeyEvent(KeyEvent.ACTION_DOWN, key));
        sendKeySync(new KeyEvent(KeyEvent.ACTION_UP, key));
    public void sendKeyDownUpSync(int keyCode) {
        sendKeySync(new KeyEvent(KeyEvent.ACTION_DOWN, keyCode));
        sendKeySync(new KeyEvent(KeyEvent.ACTION_UP, keyCode));
    }

    /**
     * Higher-level method for sending both the down and up key events for a
     * particular character key code.  Equivalent to creating both KeyEvent
     * objects by hand and calling {@link #sendKeySync}.  The event appears
     * as if it came from keyboard 0, the built in one.
     * Sends up and down key events with the given key code to the currently focused window, and
     * waits for it to be processed.
     * <p>
     * Equivalent to {@link #sendKeyDownUpSync(int)}.
     *
     * @param keyCode The key code of the character to send.
     * @see #sendKeySync(KeyEvent)
     */
    public void sendCharacterSync(int keyCode) {
        sendKeySync(new KeyEvent(KeyEvent.ACTION_DOWN, keyCode));
        sendKeySync(new KeyEvent(KeyEvent.ACTION_UP, keyCode));
        sendKeyDownUpSync(keyCode);
    }

    /**
     * Dispatch a pointer event. Finished at some point after the recipient has
     * returned from its event processing, though it may <em>not</em> have
     * completely finished reacting from the event -- for example, if it needs
     * to update its display as a result, it may still be in the process of
     * doing that.
     * Dispatches a pointer event into a window owned by the instrumented application, and waits for
     * it to be processed.
     * <p>
     * If the motion event being injected is targeted at a window that is not owned by the
     * instrumented application, the input injection will fail. See {@link #getUiAutomation()} for
     * injecting events into all windows.
     * <p>
     * This method blocks until the recipient has finished handling the event. Note that the
     * recipient may <em>not</em> have completely finished reacting from the event when this method
     * returns. For example, it may still be in the process of updating its display or UI contents
     * upon reacting to the injected event.
     * 
     * @param event A motion event describing the pointer action.  (As noted in 
     * {@link MotionEvent#obtain(long, long, int, float, float, int)}, be sure to use 
@@ -1155,10 +1165,10 @@ public class Instrumentation {
            event.setSource(InputDevice.SOURCE_TOUCHSCREEN);
        }

        syncInputTransactionsAndInjectEvent(event);
        syncInputTransactionsAndInjectEventIntoSelf(event);
    }

    private void syncInputTransactionsAndInjectEvent(MotionEvent event) {
    private void syncInputTransactionsAndInjectEventIntoSelf(MotionEvent event) {
        final boolean syncBefore = event.getAction() == MotionEvent.ACTION_DOWN
                || event.isFromSource(InputDevice.SOURCE_MOUSE);
        final boolean syncAfter = event.getAction() == MotionEvent.ACTION_UP;
@@ -1169,8 +1179,9 @@ public class Instrumentation {
                        .syncInputTransactions(true /*waitForAnimations*/);
            }

            // Direct the injected event into windows owned by the instrumentation target.
            InputManager.getInstance().injectInputEvent(
                    event, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
                    event, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH, Process.myUid());

            if (syncAfter) {
                WindowManagerGlobal.getWindowManagerService()
@@ -1182,11 +1193,13 @@ public class Instrumentation {
    }

    /**
     * Dispatch a trackball event. Finished at some point after the recipient has
     * returned from its event processing, though it may <em>not</em> have
     * completely finished reacting from the event -- for example, if it needs
     * to update its display as a result, it may still be in the process of
     * doing that.
     * Dispatches a trackball event into the currently focused window, and waits for it to be
     * processed.
     * <p>
     * This method blocks until the recipient has finished handling the event. Note that the
     * recipient may <em>not</em> have completely finished reacting from the event when this method
     * returns. For example, it may still be in the process of updating its display or UI contents
     * upon reacting to the injected event.
     *
     * @param event A motion event describing the trackball action.  (As noted in 
     * {@link MotionEvent#obtain(long, long, int, float, float, int)}, be sure to use 
@@ -1194,7 +1207,7 @@ public class Instrumentation {
     */
    public void sendTrackballEventSync(MotionEvent event) {
        validateNotAppThread();
        if ((event.getSource() & InputDevice.SOURCE_CLASS_TRACKBALL) == 0) {
        if (!event.isFromSource(InputDevice.SOURCE_CLASS_TRACKBALL)) {
            event.setSource(InputDevice.SOURCE_TRACKBALL);
        }
        InputManager.getInstance().injectInputEvent(event,
+6 −0
Original line number Diff line number Diff line
@@ -183,6 +183,12 @@ public final class DevicePolicyResources {
            public static final String WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK =
                    PREFIX + "WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK";

            /**
             * Text shown on the CTA link shown to user to set a separate lock for work apps
             */
            public static final String WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK_ACTION =
                    PREFIX + "WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK_ACTION";

            /**
             * Message shown in screen lock picker for setting up a work profile screen lock
             */
+32 −9
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.RemoteException;
import android.provider.DeviceConfig;
import android.util.DisplayMetrics;
import android.util.Log;

@@ -40,6 +41,9 @@ import java.util.function.Supplier;
public class DevicePolicyResourcesManager {
    private static String TAG = "DevicePolicyResourcesManager";

    private static String DISABLE_RESOURCES_UPDATABILITY_FLAG = "disable_resources_updatability";
    private static boolean DEFAULT_DISABLE_RESOURCES_UPDATABILITY = false;

    private final Context mContext;
    private final IDevicePolicyManager mService;

@@ -194,16 +198,20 @@ public class DevicePolicyResourcesManager {
        Objects.requireNonNull(drawableSource, "drawableSource can't be null");
        Objects.requireNonNull(defaultDrawableLoader, "defaultDrawableLoader can't be null");

        if (drawableId.equals(DevicePolicyResources.UNDEFINED)) {
        if (drawableId.equals(DevicePolicyResources.UNDEFINED)
                || DeviceConfig.getBoolean(
                        DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER,
                        DISABLE_RESOURCES_UPDATABILITY_FLAG,
                        DEFAULT_DISABLE_RESOURCES_UPDATABILITY)) {
            return ParcelableResource.loadDefaultDrawable(defaultDrawableLoader);
        }

        if (mService != null) {
            try {
                ParcelableResource resource = mService.getDrawable(
                        drawableId, drawableStyle, drawableSource);
                if (resource == null) {
                    return ParcelableResource.loadDefaultDrawable(
                            defaultDrawableLoader);
                    return ParcelableResource.loadDefaultDrawable(defaultDrawableLoader);
                }
                return resource.getDrawable(
                        mContext,
@@ -287,16 +295,20 @@ public class DevicePolicyResourcesManager {
        Objects.requireNonNull(drawableSource, "drawableSource can't be null");
        Objects.requireNonNull(defaultDrawableLoader, "defaultDrawableLoader can't be null");

        if (drawableId.equals(DevicePolicyResources.UNDEFINED)) {
        if (drawableId.equals(DevicePolicyResources.UNDEFINED)
                || DeviceConfig.getBoolean(
                        DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER,
                        DISABLE_RESOURCES_UPDATABILITY_FLAG,
                        DEFAULT_DISABLE_RESOURCES_UPDATABILITY)) {
            return ParcelableResource.loadDefaultDrawable(defaultDrawableLoader);
        }

        if (mService != null) {
            try {
                ParcelableResource resource = mService.getDrawable(
                        drawableId, drawableStyle, drawableSource);
                if (resource == null) {
                    return ParcelableResource.loadDefaultDrawable(
                            defaultDrawableLoader);
                    return ParcelableResource.loadDefaultDrawable(defaultDrawableLoader);
                }
                return resource.getDrawable(mContext, density, defaultDrawableLoader);
            } catch (RemoteException e) {
@@ -330,9 +342,14 @@ public class DevicePolicyResourcesManager {
        Objects.requireNonNull(drawableSource, "drawableSource can't be null");
        Objects.requireNonNull(defaultIcon, "defaultIcon can't be null");

        if (drawableId.equals(DevicePolicyResources.UNDEFINED)) {
        if (drawableId.equals(DevicePolicyResources.UNDEFINED)
                || DeviceConfig.getBoolean(
                        DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER,
                        DISABLE_RESOURCES_UPDATABILITY_FLAG,
                        DEFAULT_DISABLE_RESOURCES_UPDATABILITY)) {
            return defaultIcon;
        }

        if (mService != null) {
            try {
                ParcelableResource resource = mService.getDrawable(
@@ -463,7 +480,10 @@ public class DevicePolicyResourcesManager {
        Objects.requireNonNull(stringId, "stringId can't be null");
        Objects.requireNonNull(defaultStringLoader, "defaultStringLoader can't be null");

        if (stringId.equals(DevicePolicyResources.UNDEFINED)) {
        if (stringId.equals(DevicePolicyResources.UNDEFINED) || DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER,
                DISABLE_RESOURCES_UPDATABILITY_FLAG,
                DEFAULT_DISABLE_RESOURCES_UPDATABILITY)) {
            return ParcelableResource.loadDefaultString(defaultStringLoader);
        }
        if (mService != null) {
@@ -508,7 +528,10 @@ public class DevicePolicyResourcesManager {
        Objects.requireNonNull(stringId, "stringId can't be null");
        Objects.requireNonNull(defaultStringLoader, "defaultStringLoader can't be null");

        if (stringId.equals(DevicePolicyResources.UNDEFINED)) {
        if (stringId.equals(DevicePolicyResources.UNDEFINED) || DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER,
                DISABLE_RESOURCES_UPDATABILITY_FLAG,
                DEFAULT_DISABLE_RESOURCES_UPDATABILITY)) {
            return ParcelableResource.loadDefaultString(defaultStringLoader);
        }
        if (mService != null) {
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ public final class SmartspaceTarget implements Parcelable {
    public static final int FEATURE_MEDIA_HEADS_UP = 36;
    public static final int FEATURE_STEP_COUNTING = 37;
    public static final int FEATURE_EARTHQUAKE_ALERT = 38;
    public static final int FEATURE_STEP_DATE = 39;
    public static final int FEATURE_STEP_DATE = 39; // This represents a DATE. "STEP" is a typo.
    public static final int FEATURE_BLAZE_BUILD_PROGRESS = 40;
    public static final int FEATURE_EARTHQUAKE_OCCURRED = 41;

Loading