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

Commit 27e2ac32 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6586393 from a840c1f3 to rvc-release

Change-Id: I2ee507de15484671c09c996a38d5a0a47564658e
parents db7c52d2 a840c1f3
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentat
import static org.hamcrest.core.AnyOf.anyOf;
import static org.hamcrest.core.Is.is;

import android.app.ActivityManager;
import android.app.ActivityManager.TaskSnapshot;
import android.app.ActivityTaskManager;
import android.app.IActivityTaskManager;
@@ -121,6 +122,12 @@ public class RecentsAnimationPerfTest extends WindowManagerPerfTestBase {
    @AfterClass
    public static void tearDownClass() {
        sSetUpClassException = null;
        try {
            // Recents activity may stop app switches. Restore the state to avoid affecting
            // the next test.
            ActivityManager.resumeAppSwitches();
        } catch (RemoteException ignored) {
        }
        sUiAutomation.dropShellPermissionIdentity();
    }

+1 −4
Original line number Diff line number Diff line
@@ -88,10 +88,7 @@ public class RelayoutPerfTest extends WindowManagerPerfTestBase {
    public void testRelayout() throws Throwable {
        final Activity activity = mActivityRule.getActivity();
        final ContentView contentView = new ContentView(activity);
        mActivityRule.runOnUiThread(() -> {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
            activity.setContentView(contentView);
        });
        mActivityRule.runOnUiThread(() -> activity.setContentView(contentView));
        getInstrumentation().waitForIdleSync();

        final RelayoutRunner relayoutRunner = new RelayoutRunner(activity, contentView.getWindow(),
+17 −7
Original line number Diff line number Diff line
@@ -19,11 +19,13 @@ package android.wm;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;

import android.app.Activity;
import android.app.KeyguardManager;
import android.app.UiAutomation;
import android.content.Context;
import android.content.Intent;
import android.os.BatteryManager;
import android.os.ParcelFileDescriptor;
import android.os.PowerManager;
import android.perftests.utils.PerfTestActivity;
import android.provider.Settings;

@@ -61,25 +63,33 @@ public class WindowManagerPerfTestBase {
    @BeforeClass
    public static void setUpOnce() {
        final Context context = getInstrumentation().getContext();
        sOriginalStayOnWhilePluggedIn = Settings.Global.getInt(context.getContentResolver(),
        final int stayOnWhilePluggedIn = Settings.Global.getInt(context.getContentResolver(),
                Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0);
        sOriginalStayOnWhilePluggedIn = -1;
        if (stayOnWhilePluggedIn != BatteryManager.BATTERY_PLUGGED_ANY) {
            sOriginalStayOnWhilePluggedIn = stayOnWhilePluggedIn;
            // Keep the device awake during testing.
        setStayOnWhilePluggedIn(BatteryManager.BATTERY_PLUGGED_USB);
            setStayOnWhilePluggedIn(BatteryManager.BATTERY_PLUGGED_ANY);
        }

        if (!BASE_OUT_PATH.exists()) {
            executeShellCommand("mkdir -p " + BASE_OUT_PATH);
        }
        // In order to be closer to the real use case.
        if (!context.getSystemService(PowerManager.class).isInteractive()
                || context.getSystemService(KeyguardManager.class).isKeyguardLocked()) {
            executeShellCommand("input keyevent KEYCODE_WAKEUP");
            executeShellCommand("wm dismiss-keyguard");
        }
        context.startActivity(new Intent(Intent.ACTION_MAIN)
                .addCategory(Intent.CATEGORY_HOME).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
    }

    @AfterClass
    public static void tearDownOnce() {
        if (sOriginalStayOnWhilePluggedIn != -1) {
            setStayOnWhilePluggedIn(sOriginalStayOnWhilePluggedIn);
        }
    }

    private static void setStayOnWhilePluggedIn(int value) {
        executeShellCommand(String.format("settings put global %s %d",
+33 −17
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ public class AppStandbyController implements AppStandbyInternal {
     * Set of system apps that are headless (don't have any declared activities, enabled or
     * disabled). Presence in this map indicates that the app is a headless system app.
     */
    @GuardedBy("mAppIdleLock")
    @GuardedBy("mHeadlessSystemApps")
    private final ArrayMap<String, Boolean> mHeadlessSystemApps = new ArrayMap<>();

    private final CountDownLatch mAdminDataAvailableLatch = new CountDownLatch(1);
@@ -447,7 +447,8 @@ public class AppStandbyController implements AppStandbyInternal {
                userFileExists = mAppIdleHistory.userFileExists(UserHandle.USER_SYSTEM);
            }

            loadHeadlessSystemAppCache();
            // Offload to handler thread to avoid boottime impact.
            mHandler.post(this::loadHeadlessSystemAppCache);

            if (mPendingInitializeDefaults || !userFileExists) {
                initializeDefaultsForSystemApps(UserHandle.USER_SYSTEM);
@@ -1121,8 +1122,10 @@ public class AppStandbyController implements AppStandbyInternal {
    }

    private boolean isHeadlessSystemApp(String packageName) {
        synchronized (mHeadlessSystemApps) {
            return mHeadlessSystemApps.containsKey(packageName);
        }
    }

    @Override
    public boolean isAppIdleFiltered(String packageName, int appId, int userId,
@@ -1697,19 +1700,24 @@ public class AppStandbyController implements AppStandbyInternal {
                    userId);
            evaluateSystemAppException(pi);
        } catch (PackageManager.NameNotFoundException e) {
            synchronized (mHeadlessSystemApps) {
                mHeadlessSystemApps.remove(packageName);
            }
        }
    }

    private void evaluateSystemAppException(@Nullable PackageInfo pkgInfo) {
        if (pkgInfo.applicationInfo != null && pkgInfo.applicationInfo.isSystemApp()) {
            synchronized (mAppIdleLock) {
    /** Returns true if the exception status changed. */
    private boolean evaluateSystemAppException(@Nullable PackageInfo pkgInfo) {
        if (pkgInfo == null || pkgInfo.applicationInfo == null
                || !pkgInfo.applicationInfo.isSystemApp()) {
            return false;
        }
        synchronized (mHeadlessSystemApps) {
            if (pkgInfo.activities == null || pkgInfo.activities.length == 0) {
                // Headless system app.
                    mHeadlessSystemApps.put(pkgInfo.packageName, true);
                return mHeadlessSystemApps.put(pkgInfo.packageName, true) == null;
            } else {
                    mHeadlessSystemApps.remove(pkgInfo.packageName);
                }
                return mHeadlessSystemApps.remove(pkgInfo.packageName) != null;
            }
        }
    }
@@ -1754,7 +1762,12 @@ public class AppStandbyController implements AppStandbyInternal {
                UserHandle.USER_SYSTEM);
        final int packageCount = packages.size();
        for (int i = 0; i < packageCount; i++) {
            evaluateSystemAppException(packages.get(i));
            PackageInfo pkgInfo = packages.get(i);
            if (pkgInfo != null && evaluateSystemAppException(pkgInfo)) {
                mHandler.obtainMessage(MSG_CHECK_PACKAGE_IDLE_STATE,
                        UserHandle.USER_SYSTEM, -1, pkgInfo.packageName)
                    .sendToTarget();
            }
        }
    }

@@ -1852,10 +1865,13 @@ public class AppStandbyController implements AppStandbyInternal {
        pw.println();

        pw.println("mHeadlessSystemApps=[");
        synchronized (mHeadlessSystemApps) {
            for (int i = mHeadlessSystemApps.size() - 1; i >= 0; --i) {
                pw.print("  ");
                pw.print(mHeadlessSystemApps.keyAt(i));
                pw.println(",");
            }
        }
        pw.println("]");
        pw.println();
    }
+1 −0
Original line number Diff line number Diff line
@@ -3323,6 +3323,7 @@ package android.provider {
    field public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component";
    field public static final String NOTIFICATION_BADGING = "notification_badging";
    field public static final String POWER_MENU_LOCKED_SHOW_CONTENT = "power_menu_locked_show_content";
    field public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
    field @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds";
    field public static final String USER_SETUP_COMPLETE = "user_setup_complete";
    field public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
Loading