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

Commit 35e21962 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Made a few ATMS methods public that can be accessed from AMS (35/n)"

parents 59a1ff3e 387b34cc
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -1361,14 +1361,6 @@ public class ActivityManagerService extends IActivityManager.Stub
    private static String sTheRealBuildSerial = Build.UNKNOWN;
    /**
     * Current global configuration information. Contains general settings for the entire system,
     * also corresponds to the merged configuration of the default display.
     */
    Configuration getGlobalConfiguration() {
        return mActivityTaskManager.getGlobalConfiguration();
    }
    final class UiHandler extends Handler {
        public UiHandler() {
            super(com.android.server.UiThread.get().getLooper(), null, true);
@@ -10401,7 +10393,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        return mProviderMap.dumpProviderProto(fd, pw, name, args);
    }
    static class ItemMatcher {
    public static class ItemMatcher {
        ArrayList<ComponentName> components;
        ArrayList<String> strings;
        ArrayList<Integer> objects;
+1 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ public class ActivityTaskManagerDebugConfig {
    static final boolean DEBUG_METRICS = DEBUG_ALL || false;

    static final String POSTFIX_APP = APPEND_CATEGORY_NAME ? "_App" : "";
    static final String POSTFIX_CLEANUP = (APPEND_CATEGORY_NAME) ? "_Cleanup" : "";
    static final String POSTFIX_IDLE = APPEND_CATEGORY_NAME ? "_Idle" : "";
    static final String POSTFIX_RELEASE = APPEND_CATEGORY_NAME ? "_Release" : "";
    static final String POSTFIX_USER_LEAVING = APPEND_CATEGORY_NAME ? "_UserLeaving" : "";
+46 −33
Original line number Diff line number Diff line
@@ -612,23 +612,27 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        GL_ES_VERSION = SystemProperties.getInt("ro.opengles.version", GL_ES_VERSION_UNDEFINED);
    }

    void onSystemReady() {
    public void onSystemReady() {
        synchronized (mGlobalLock) {
            mHasHeavyWeightFeature = mContext.getPackageManager().hasSystemFeature(
                    PackageManager.FEATURE_CANT_SAVE_STATE);
            mAssistUtils = new AssistUtils(mContext);
            mVrController.onSystemReady();
            mRecentTasks.onSystemReadyLocked();
        }
    }

    void onInitPowerManagement() {
    public void onInitPowerManagement() {
        synchronized (mGlobalLock) {
            mStackSupervisor.initPowerManagement();
            final PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
            mPowerManagerInternal = LocalServices.getService(PowerManagerInternal.class);
            mVoiceWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "*voice*");
            mVoiceWakeLock.setReferenceCounted(false);
        }
    }

    void installSystemProviders() {
    public void installSystemProviders() {
        mFontScaleSettingObserver = new FontScaleSettingObserver();
    }

@@ -737,10 +741,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        mKeyguardController = mStackSupervisor.getKeyguardController();
    }

    void onActivityManagerInternalAdded() {
    public void onActivityManagerInternalAdded() {
        synchronized (mGlobalLock) {
            mAmInternal = LocalServices.getService(ActivityManagerInternal.class);
            mUgmInternal = LocalServices.getService(UriGrantsManagerInternal.class);
        }
    }

    int increaseConfigurationSeqLocked() {
        mConfigurationSeq = Math.max(++mConfigurationSeq, 1);
@@ -753,15 +759,19 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        return supervisor;
    }

    void setWindowManager(WindowManagerService wm) {
    public void setWindowManager(WindowManagerService wm) {
        synchronized (mGlobalLock) {
            mWindowManager = wm;
            mLockTaskController.setWindowManager(wm);
            mStackSupervisor.setWindowManager(wm);
        }
    }

    void setUsageStatsManager(UsageStatsManagerInternal usageStatsManager) {
    public void setUsageStatsManager(UsageStatsManagerInternal usageStatsManager) {
        synchronized (mGlobalLock) {
            mUsageStatsInternal = usageStatsManager;
        }
    }

    UserManagerService getUserManager() {
        if (mUserManager == null) {
@@ -2136,7 +2146,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        }
    }

    boolean isControllerAMonkey() {
    public boolean isControllerAMonkey() {
        synchronized (mGlobalLock) {
            return mController != null && mControllerIsAMonkey;
        }
@@ -2895,7 +2905,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        });
    }

    void onScreenAwakeChanged(boolean isAwake) {
    public void onScreenAwakeChanged(boolean isAwake) {
        mH.post(() -> {
            for (int i = mScreenObservers.size() - 1; i >= 0; i--) {
                mScreenObservers.get(i).onAwakeStateChanged(isAwake);
@@ -4905,15 +4915,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        }
    }

    boolean canShowErrorDialogs() {
        return mShowDialogs && !mSleeping && !mShuttingDown
                && !mKeyguardController.isKeyguardOrAodShowing(DEFAULT_DISPLAY)
                && !hasUserRestriction(UserManager.DISALLOW_SYSTEM_ERROR_DIALOGS,
                mAmInternal.getCurrentUserId())
                && !(UserManager.isDeviceInDemoMode(mContext)
                && mAmInternal.getCurrentUser().isDemo());
    }

    static long getInputDispatchingTimeoutLocked(ActivityRecord r) {
        if (r == null || !r.hasProcess()) {
            return KEY_DISPATCHING_TIMEOUT_MS;
@@ -6791,5 +6792,17 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                        false /* deferResume */);
            }
        }

        @Override
        public boolean canShowErrorDialogs() {
            synchronized (mGlobalLock) {
                return mShowDialogs && !mSleeping && !mShuttingDown
                        && !mKeyguardController.isKeyguardOrAodShowing(DEFAULT_DISPLAY)
                        && !hasUserRestriction(UserManager.DISALLOW_SYSTEM_ERROR_DIALOGS,
                        mAmInternal.getCurrentUserId())
                        && !(UserManager.isDeviceInDemoMode(mContext)
                        && mAmInternal.getCurrentUser().isDemo());
            }
        }
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -474,7 +474,7 @@ class AppErrors {
                mService.mProcessList.removeProcessLocked(r, false, true, "crash");
                if (taskId != INVALID_TASK_ID) {
                    try {
                        mService.mActivityTaskManager.startActivityFromRecents(taskId,
                        mService.startActivityFromRecents(taskId,
                                ActivityOptions.makeBasic().toBundle());
                    } catch (IllegalArgumentException e) {
                        // Hmm...that didn't work. Task should either be in recents or associated
@@ -794,7 +794,7 @@ class AppErrors {
                    mService.mUserController.getCurrentUserId()) != 0;
            final boolean crashSilenced = mAppsNotReportingCrashes != null &&
                    mAppsNotReportingCrashes.contains(proc.info.packageName);
            if ((mService.mActivityTaskManager.canShowErrorDialogs() || showBackground)
            if ((mService.mAtmInternal.canShowErrorDialogs() || showBackground)
                    && !crashSilenced
                    && (showFirstCrash || showFirstCrashDevOption || data.repeating)) {
                proc.crashDialog = dialogToShow = new AppErrorDialog(mContext, mService, data);
@@ -847,7 +847,7 @@ class AppErrors {

            boolean showBackground = Settings.Secure.getInt(mContext.getContentResolver(),
                    Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0;
            if (mService.mActivityTaskManager.canShowErrorDialogs() || showBackground) {
            if (mService.mAtmInternal.canShowErrorDialogs() || showBackground) {
                dialogToShow = new AppNotRespondingDialog(mService, mContext, data);
                proc.anrDialog = dialogToShow;
            } else {
+3 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ import java.util.regex.Pattern;
/**
 * Static utility methods related to {@link MemoryStat}.
 */
final class MemoryStatUtil {
public final class MemoryStatUtil {
    /**
     * Which native processes to create {@link MemoryStat} for.
     *
@@ -114,7 +114,7 @@ final class MemoryStatUtil {
     * Returns null if no stats can be read.
     */
    @Nullable
    static MemoryStat readMemoryStatFromFilesystem(int uid, int pid) {
    public static MemoryStat readMemoryStatFromFilesystem(int uid, int pid) {
        return hasMemcg() ? readMemoryStatFromMemcg(uid, pid) : readMemoryStatFromProcfs(pid);
    }

@@ -266,7 +266,7 @@ final class MemoryStatUtil {
        return DEVICE_HAS_PER_APP_MEMCG;
    }

    static final class MemoryStat {
    public static final class MemoryStat {
        /** Number of page faults */
        long pgfault;
        /** Number of major page faults */
Loading