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

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

Snap for 9823610 from 8d71de9f to tm-qpr3-release

Change-Id: I12d3249243290d75e67dfdb3c4cb306c2e73334f
parents da5edf83 8d71de9f
Loading
Loading
Loading
Loading
+36 −2
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import static android.app.servertransaction.ActivityLifecycleItem.ON_STOP;
import static android.app.servertransaction.ActivityLifecycleItem.PRE_ON_CREATE;
import static android.content.ContentResolver.DEPRECATE_DATA_COLUMNS;
import static android.content.ContentResolver.DEPRECATE_DATA_PREFIX;
import static android.content.res.Configuration.UI_MODE_TYPE_DESK;
import static android.content.res.Configuration.UI_MODE_TYPE_MASK;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.INVALID_DISPLAY;
import static android.window.ConfigurationHelper.freeTextLayoutCachesIfNeeded;
@@ -194,6 +196,7 @@ import android.window.SplashScreen;
import android.window.SplashScreenView;
import android.window.WindowProviderService;

import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IVoiceInteractor;
@@ -5890,9 +5893,21 @@ public final class ActivityThread extends ClientTransactionHandler
        final boolean shouldUpdateResources = hasPublicResConfigChange
                || shouldUpdateResources(activityToken, currentResConfig, newConfig,
                amOverrideConfig, movedToDifferentDisplay, hasPublicResConfigChange);

        // TODO(b/266924897): temporary workaround, remove for U.
        boolean skipActivityRelaunchWhenDocking = activity.getResources().getBoolean(
                R.bool.config_skipActivityRelaunchWhenDocking);
        int handledConfigChanges = activity.mActivityInfo.getRealConfigChanged();
        if (skipActivityRelaunchWhenDocking && onlyDeskInUiModeChanged(activity.mCurrentConfig,
                newConfig)) {
            // If we're not relaunching this activity when docking, we should send the configuration
            // changed event. Pretend as if the activity is handling uiMode config changes in its
            // manifest so that we'll report any dock changes.
            handledConfigChanges |= ActivityInfo.CONFIG_UI_MODE;
        }

        final boolean shouldReportChange = shouldReportChange(activity.mCurrentConfig, newConfig,
                r != null ? r.mSizeConfigurations : null,
                activity.mActivityInfo.getRealConfigChanged());
                r != null ? r.mSizeConfigurations : null, handledConfigChanges);
        // Nothing significant, don't proceed with updating and reporting.
        if (!shouldUpdateResources && !shouldReportChange) {
            return null;
@@ -5938,6 +5953,25 @@ public final class ActivityThread extends ClientTransactionHandler
        return configToReport;
    }

    /**
     * Returns true if the uiMode configuration changed, and desk mode
     * ({@link android.content.res.Configuration#UI_MODE_TYPE_DESK}) was the only change to uiMode.
     */
    private boolean onlyDeskInUiModeChanged(Configuration oldConfig, Configuration newConfig) {
        boolean deskModeChanged = isInDeskUiMode(oldConfig) != isInDeskUiMode(newConfig);

        // UI mode contains fields other than the UI mode type, so determine if any other fields
        // changed.
        boolean uiModeOtherFieldsChanged =
                (oldConfig.uiMode & ~UI_MODE_TYPE_MASK) != (newConfig.uiMode & ~UI_MODE_TYPE_MASK);

        return deskModeChanged && !uiModeOtherFieldsChanged;
    }

    private static boolean isInDeskUiMode(Configuration config) {
        return (config.uiMode & UI_MODE_TYPE_MASK) == UI_MODE_TYPE_DESK;
    }

    /**
     * Returns {@code true} if {@link Activity#onConfigurationChanged(Configuration)} should be
     * dispatched.
+11 −2
Original line number Diff line number Diff line
@@ -241,6 +241,12 @@ public class TaskInfo {
     */
    public boolean isLetterboxDoubleTapEnabled;

    /**
     * Whether the update comes from a letterbox double-tap action from the user or not.
     * @hide
     */
    public boolean isFromLetterboxDoubleTap;

    /**
     * If {@link isLetterboxDoubleTapEnabled} it contains the current letterbox vertical position or
     * {@link TaskInfo.PROPERTY_VALUE_UNSET} otherwise.
@@ -488,7 +494,7 @@ public class TaskInfo {
                && isResizeable == that.isResizeable
                && supportsMultiWindow == that.supportsMultiWindow
                && displayAreaFeatureId == that.displayAreaFeatureId
                && isLetterboxDoubleTapEnabled == that.isLetterboxDoubleTapEnabled
                && isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap
                && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition
                && topActivityLetterboxWidth == that.topActivityLetterboxWidth
                && topActivityLetterboxHeight == that.topActivityLetterboxHeight
@@ -520,9 +526,9 @@ public class TaskInfo {
        return displayId == that.displayId
                && taskId == that.taskId
                && topActivityInSizeCompat == that.topActivityInSizeCompat
                && isFromLetterboxDoubleTap == that.isFromLetterboxDoubleTap
                && topActivityEligibleForLetterboxEducation
                    == that.topActivityEligibleForLetterboxEducation
                && isLetterboxDoubleTapEnabled == that.isLetterboxDoubleTapEnabled
                && topActivityLetterboxVerticalPosition == that.topActivityLetterboxVerticalPosition
                && topActivityLetterboxHorizontalPosition
                    == that.topActivityLetterboxHorizontalPosition
@@ -583,6 +589,7 @@ public class TaskInfo {
        displayAreaFeatureId = source.readInt();
        cameraCompatControlState = source.readInt();
        isLetterboxDoubleTapEnabled = source.readBoolean();
        isFromLetterboxDoubleTap = source.readBoolean();
        topActivityLetterboxVerticalPosition = source.readInt();
        topActivityLetterboxHorizontalPosition = source.readInt();
        topActivityLetterboxWidth = source.readInt();
@@ -635,6 +642,7 @@ public class TaskInfo {
        dest.writeInt(displayAreaFeatureId);
        dest.writeInt(cameraCompatControlState);
        dest.writeBoolean(isLetterboxDoubleTapEnabled);
        dest.writeBoolean(isFromLetterboxDoubleTap);
        dest.writeInt(topActivityLetterboxVerticalPosition);
        dest.writeInt(topActivityLetterboxHorizontalPosition);
        dest.writeInt(topActivityLetterboxWidth);
@@ -675,6 +683,7 @@ public class TaskInfo {
                + " topActivityEligibleForLetterboxEducation= "
                        + topActivityEligibleForLetterboxEducation
                + " topActivityLetterboxed= " + isLetterboxDoubleTapEnabled
                + " isFromDoubleTap= " + isFromLetterboxDoubleTap
                + " topActivityLetterboxVerticalPosition= " + topActivityLetterboxVerticalPosition
                + " topActivityLetterboxHorizontalPosition= "
                        + topActivityLetterboxHorizontalPosition
+11 −0
Original line number Diff line number Diff line
@@ -1452,6 +1452,16 @@ public final class AssetManager implements AutoCloseable {
        }
    }

    /**
     * @hide
     */
    Configuration[] getSizeAndUiModeConfigurations() {
        synchronized (this) {
            ensureValidLocked();
            return nativeGetSizeAndUiModeConfigurations(mObject);
        }
    }

    /**
     * Change the configuration used when retrieving resources.  Not for use by
     * applications.
@@ -1603,6 +1613,7 @@ public final class AssetManager implements AutoCloseable {
    private static native @Nullable String nativeGetResourceEntryName(long ptr, @AnyRes int resid);
    private static native @Nullable String[] nativeGetLocales(long ptr, boolean excludeSystem);
    private static native @Nullable Configuration[] nativeGetSizeConfigurations(long ptr);
    private static native @Nullable Configuration[] nativeGetSizeAndUiModeConfigurations(long ptr);
    private static native void nativeSetResourceResolutionLoggingEnabled(long ptr, boolean enabled);
    private static native @Nullable String nativeGetLastResourceResolution(long ptr);

+5 −0
Original line number Diff line number Diff line
@@ -2207,6 +2207,11 @@ public class Resources {
        return mResourcesImpl.getSizeConfigurations();
    }

    /** @hide */
    public Configuration[] getSizeAndUiModeConfigurations() {
        return mResourcesImpl.getSizeAndUiModeConfigurations();
    }

    /**
     * Return the compatibility mode information for the application.
     * The returned object should be treated as read-only.
+4 −0
Original line number Diff line number Diff line
@@ -203,6 +203,10 @@ public class ResourcesImpl {
        return mAssets.getSizeConfigurations();
    }

    Configuration[] getSizeAndUiModeConfigurations() {
        return mAssets.getSizeAndUiModeConfigurations();
    }

    CompatibilityInfo getCompatibilityInfo() {
        return mDisplayAdjustments.getCompatibilityInfo();
    }
Loading