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

Commit c3243e24 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Further improvements to window management!"

parents 0f344060 b8b11a0b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.IContentProvider;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
@@ -989,6 +990,11 @@ public final class Settings {
            return Settings.System.putFloat(cr, FONT_SCALE, config.fontScale);
        }

        /** @hide */
        public static boolean hasInterestingConfigurationChanges(int changes) {
            return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0;
        }
        
        public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
            return getInt(cr, SHOW_GTALK_SERVICE_STATUS, 0) != 0;
        }
+9 −5
Original line number Diff line number Diff line
@@ -627,8 +627,9 @@ public interface WindowManagerPolicy {
     * returned, all windows given to layoutWindow() <em>must</em> have had a
     * frame assigned.
     *  
     * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT}
     * and {@link #FINISH_LAYOUT_REDO_CONFIG}.
     * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT},
     * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER},
     * or {@link #FINISH_LAYOUT_REDO_ANIM}.
     */
    public int finishLayoutLw();

@@ -638,6 +639,8 @@ public interface WindowManagerPolicy {
    static final int FINISH_LAYOUT_REDO_CONFIG = 0x0002;
    /** Wallpaper may need to move */
    static final int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004;
    /** Need to recompute animations */
    static final int FINISH_LAYOUT_REDO_ANIM = 0x0008;
    
    /**
     * Called when animation of the windows is about to start.
@@ -661,10 +664,11 @@ public interface WindowManagerPolicy {
     * something that may have modified the animation state of another window, 
     * be sure to return true in order to perform another animation frame. 
     *  
     * @return Return true if animation state may have changed (so that another 
     *         frame of animation will be run).
     * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT},
     * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER},
     * or {@link #FINISH_LAYOUT_REDO_ANIM}.
     */
    public boolean finishAnimationLw();
    public int finishAnimationLw();

    /**
     * Return true if it is okay to perform animations for an app transition
+72 −51
Original line number Diff line number Diff line
@@ -88,7 +88,9 @@ class UiModeManagerService extends IUiModeManager.Stub {

    private boolean mComputedNightMode;
    private int mCurUiMode = 0;
    private int mSetUiMode = 0;
    
    private boolean mHoldingConfiguration = false;
    private Configuration mConfiguration = new Configuration();
    
    private boolean mSystemReady;
@@ -114,6 +116,7 @@ class UiModeManagerService extends IUiModeManager.Stub {
                return;
            }

            synchronized (mLock) {
                // Launch a dock activity
                String category;
                if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(intent.getAction())) {
@@ -135,6 +138,12 @@ class UiModeManagerService extends IUiModeManager.Stub {
                        Slog.w(TAG, e.getCause());
                    }
                }
                
                if (mHoldingConfiguration) {
                    mHoldingConfiguration = false;
                    updateConfigurationLocked();
                }
            }
        }
    };

@@ -370,10 +379,7 @@ class UiModeManagerService extends IUiModeManager.Stub {
        }
    }

    final void updateLocked() {
        long ident = Binder.clearCallingIdentity();
        
        try {
    final void updateConfigurationLocked() {
        int uiMode = 0;
        if (mCarModeEnabled) {
            uiMode = Configuration.UI_MODE_TYPE_CAR;
@@ -394,9 +400,11 @@ class UiModeManagerService extends IUiModeManager.Stub {
                    Configuration.UI_MODE_NIGHT_NO;
        }
        
            if (uiMode != mCurUiMode) {
        mCurUiMode = uiMode;
        
        if (!mHoldingConfiguration && uiMode != mSetUiMode) {
            mSetUiMode = uiMode;
            
            try {
                final IActivityManager am = ActivityManagerNative.getDefault();
                mConfiguration.uiMode = uiMode;
@@ -405,7 +413,12 @@ class UiModeManagerService extends IUiModeManager.Stub {
                Slog.w(TAG, "Failure communicating with activity manager", e);
            }
        }
    }
    
    final void updateLocked() {
        long ident = Binder.clearCallingIdentity();
        
        try {
            String action = null;
            String oldAction = null;
            if (mLastBroadcastState == Intent.EXTRA_DOCK_STATE_CAR) {
@@ -450,8 +463,14 @@ class UiModeManagerService extends IUiModeManager.Stub {
                // placed into a dock.
                mContext.sendOrderedBroadcast(new Intent(action), null,
                        mResultReceiver, null, Activity.RESULT_OK, null, null);
                // Attempting to make this transition a little more clean, we are going
                // to hold off on doing a configuration change until we have finished
                // the broacast and started the home activity.
                mHoldingConfiguration = true;
            }
            
            updateConfigurationLocked();

            // keep screen on when charging and in car mode
            boolean keepScreenOn = mCharging &&
                    ((mCarModeEnabled && mCarModeKeepsScreenOn) ||
@@ -685,6 +704,8 @@ class UiModeManagerService extends IUiModeManager.Stub {
                    pw.print(" mCarModeEnabled="); pw.print(mCarModeEnabled);
                    pw.print(" mComputedNightMode="); pw.println(mComputedNightMode);
            pw.print("  mCurUiMode=0x"); pw.print(Integer.toHexString(mCurUiMode));
                    pw.print(" mSetUiMode=0x"); pw.println(Integer.toHexString(mSetUiMode));
            pw.print("  mHoldingConfiguration="); pw.print(mHoldingConfiguration);
                    pw.print(" mSystemReady="); pw.println(mSystemReady);
            if (mLocation != null) {
                pw.print("  mLocation="); pw.println(mLocation);
+251 −191

File changed.

Preview size limit exceeded, changes collapsed.

+5 −3
Original line number Diff line number Diff line
@@ -13226,9 +13226,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
                    ac.updateConfiguration(mConfiguration);
                }
                if (Settings.System.hasInterestingConfigurationChanges(changes)) {
                    Message msg = mHandler.obtainMessage(UPDATE_CONFIGURATION_MSG);
                    msg.obj = new Configuration(mConfiguration);
                    mHandler.sendMessage(msg);
                }
        
                for (int i=mLruProcesses.size()-1; i>=0; i--) {
                    ProcessRecord app = mLruProcesses.get(i);