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

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

Merge cherrypicks of ['googleplex-android-review.googlesource.com/30798484',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/30798484', 'googleplex-android-review.googlesource.com/30825249', 'googleplex-android-review.googlesource.com/30831018', 'googleplex-android-review.googlesource.com/30983335'] into 25Q1-release.

Change-Id: I24ad7a8ae72275cfac65cffcb4cf4f8d5e88a632
parents 843108fd e9ee95af
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -338,6 +338,11 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
            // Make mImeSourceControl point to the new control before starting the animation.
            if (hadImeSourceControl && mImeSourceControl != imeSourceControl) {
                mImeSourceControl.release(SurfaceControl::release);
                if (android.view.inputmethod.Flags.refactorInsetsController()
                        && !hasImeLeash && mAnimation != null) {
                    // In case of losing the leash, the animation should be cancelled.
                    mAnimation.cancel();
                }
            }
            mImeSourceControl = imeSourceControl;

@@ -638,7 +643,9 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
                        t.setPosition(animatingLeash, x, endY);
                        t.setAlpha(animatingLeash, 1.f);
                    }
                    if (!android.view.inputmethod.Flags.refactorInsetsController()) {
                        dispatchEndPositioning(mDisplayId, mCancelled, t);
                    }
                    if (mAnimationDirection == DIRECTION_HIDE && !mCancelled) {
                        ImeTracker.forLogging().onProgress(mStatsToken,
                                ImeTracker.PHASE_WM_ANIMATION_RUNNING);
@@ -654,6 +661,14 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
                        ImeTracker.forLogging().onCancelled(mStatsToken,
                                ImeTracker.PHASE_WM_ANIMATION_RUNNING);
                    }
                    if (android.view.inputmethod.Flags.refactorInsetsController()) {
                        // In split screen, we also set {@link
                        // WindowContainer#mExcludeInsetsTypes} but this should only happen after
                        // the IME client visibility was set. Otherwise the insets will we
                        // dispatched too early, and we get a flicker. Thus, only dispatching it
                        // after reporting that the IME is hidden to system server.
                        dispatchEndPositioning(mDisplayId, mCancelled, t);
                    }
                    if (DEBUG_IME_VISIBILITY) {
                        EventLog.writeEvent(IMF_IME_REMOTE_ANIM_END,
                                mStatsToken != null ? mStatsToken.getTag() : ImeTracker.TOKEN_NONE,
+8 −2
Original line number Diff line number Diff line
@@ -1209,8 +1209,14 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        // Hide soft input before user switch task since switch task may block main handler a while
        // and delayed the hideCurrentInputLocked().
        final var userData = getUserData(userId);
        if (Flags.refactorInsetsController()) {
            final var statsToken = createStatsTokenForFocusedClient(false /* show */,
                    SoftInputShowHideReason.HIDE_SWITCH_USER, userId);
            setImeVisibilityOnFocusedWindowClient(false, userData, statsToken);
        } else {
            hideCurrentInputLocked(userData.mImeBindingState.mFocusedWindow, 0 /* flags */,
                    SoftInputShowHideReason.HIDE_SWITCH_USER, userId);
        }
        final UserSwitchHandlerTask task = new UserSwitchHandlerTask(this, userId,
                clientToBeReset);
        mUserSwitchHandlerTask = task;
+7 −3
Original line number Diff line number Diff line
@@ -5723,7 +5723,9 @@ public class BatteryStatsImpl extends BatteryStats {
                    displayStats.screenDozeTimer.stopRunningLocked(elapsedRealtimeMs);
                    shouldScheduleSync = true;
                    break;
                case Display.STATE_OFF: // fallthrough
                case Display.STATE_OFF:
                    shouldScheduleSync = true;
                    break;
                case Display.STATE_UNKNOWN:
                    // Not tracked by timers.
                    break;
@@ -5756,7 +5758,9 @@ public class BatteryStatsImpl extends BatteryStats {
                    displayStats.screenDozeTimer.startRunningLocked(elapsedRealtimeMs);
                    shouldScheduleSync = true;
                    break;
                case Display.STATE_OFF: // fallthrough
                case Display.STATE_OFF:
                    shouldScheduleSync = true;
                    break;
                case Display.STATE_UNKNOWN:
                    // Not tracked by timers.
                    break;
@@ -5873,7 +5877,7 @@ public class BatteryStatsImpl extends BatteryStats {
        if (shouldScheduleSync) {
            if (mPowerStatsCollectorEnabled.get(BatteryConsumer.POWER_COMPONENT_SCREEN)) {
                mScreenPowerStatsCollector.schedule();
                mScreenPowerStatsCollector.onScreenStateChange();
            } else {
                final int numDisplays = mPerDisplayBatteryStats.length;
                final int[] displayStates = new int[numDisplays];
+21 −4
Original line number Diff line number Diff line
@@ -111,6 +111,22 @@ public class ScreenPowerStatsCollector extends PowerStatsCollector {
        return true;
    }

    /**
     * Must be called whenever the screen state (on/off/doze) changes.
     */
    public void onScreenStateChange() {
        if (ensureInitialized() && mConsumedEnergyHelper.getEnergyConsumerCount() != 0) {
            // Sync power monitor reading immediately, because the estimation algorithm
            // distributes consumed power proportionally between screen states.
            // Since screen power consumption differs dramatically between different states,
            // this would lead an overestimation in the screen-off state.
            forceSchedule();
            return;
        }
        // Perhaps schedule a sync, allowing throttling
        schedule();
    }

    @Override
    public PowerStats collectStats() {
        if (!ensureInitialized()) {
@@ -126,7 +142,7 @@ public class ScreenPowerStatsCollector extends PowerStatsCollector {
            long screenOnTimeMs = mScreenUsageTimeRetriever.getScreenOnTimeMs(display);
            if (!mFirstSample) {
                mLayout.setScreenOnDuration(mPowerStats.stats, display,
                        screenOnTimeMs - mLastScreenOnTime[display]);
                        Math.max(0, screenOnTimeMs - mLastScreenOnTime[display]));
            }
            mLastScreenOnTime[display] = screenOnTimeMs;

@@ -135,14 +151,15 @@ public class ScreenPowerStatsCollector extends PowerStatsCollector {
                        mScreenUsageTimeRetriever.getBrightnessLevelTimeMs(display, level);
                if (!mFirstSample) {
                    mLayout.setBrightnessLevelDuration(mPowerStats.stats, display, level,
                            brightnessLevelTimeMs - mLastBrightnessLevelTime[display][level]);
                            Math.max(0, brightnessLevelTimeMs
                                    - mLastBrightnessLevelTime[display][level]));
                }
                mLastBrightnessLevelTime[display][level] = brightnessLevelTimeMs;
            }
            long screenDozeTimeMs = mScreenUsageTimeRetriever.getScreenDozeTimeMs(display);
            if (!mFirstSample) {
                mLayout.setScreenDozeDuration(mPowerStats.stats, display,
                        screenDozeTimeMs - mLastDozeTime[display]);
                        Math.max(0, screenDozeTimeMs - mLastDozeTime[display]));
            }
            mLastDozeTime[display] = screenDozeTimeMs;
        }
@@ -162,7 +179,7 @@ public class ScreenPowerStatsCollector extends PowerStatsCollector {
            }

            mLayout.setUidTopActivityDuration(uidStats,
                    mLayout.getUidTopActivityDuration(uidStats) + topActivityDuration);
                    Math.max(0, mLayout.getUidTopActivityDuration(uidStats) + topActivityDuration));
        });

        long elapsedRealtime = mClock.elapsedRealtime();