Loading core/java/android/app/ActivityThread.java +12 −14 Original line number Diff line number Diff line Loading @@ -5863,20 +5863,20 @@ public final class ActivityThread extends ClientTransactionHandler final boolean movedToDifferentDisplay = isDifferentDisplay(activity.getDisplayId(), displayId); final Configuration currentConfig = activity.mCurrentConfig; final int diff = currentConfig.diffPublicOnly(newConfig); final boolean hasPublicConfigChange = diff != 0; final Configuration currentResConfig = activity.getResources().getConfiguration(); final int diff = currentResConfig.diffPublicOnly(newConfig); final boolean hasPublicResConfigChange = diff != 0; final ActivityClientRecord r = getActivityClient(activityToken); // TODO(b/173090263): Use diff instead after the improvement of AssetManager and // ResourcesImpl constructions. final boolean shouldUpdateResources = hasPublicConfigChange || shouldUpdateResources(activityToken, currentConfig, newConfig, amOverrideConfig, movedToDifferentDisplay, hasPublicConfigChange); final boolean shouldReportChange = shouldReportChange(diff, currentConfig, newConfig, final boolean shouldUpdateResources = hasPublicResConfigChange || shouldUpdateResources(activityToken, currentResConfig, newConfig, amOverrideConfig, movedToDifferentDisplay, hasPublicResConfigChange); final boolean shouldReportChange = shouldReportChange(activity.mCurrentConfig, newConfig, r != null ? r.mSizeConfigurations : null, activity.mActivityInfo.getRealConfigChanged()); // Nothing significant, don't proceed with updating and reporting. if (!shouldUpdateResources) { if (!shouldUpdateResources && !shouldReportChange) { return null; } Loading @@ -5896,9 +5896,6 @@ public final class ActivityThread extends ClientTransactionHandler amOverrideConfig, contextThemeWrapperOverrideConfig); mResourcesManager.updateResourcesForActivity(activityToken, finalOverrideConfig, displayId); activity.mConfigChangeFlags = 0; activity.mCurrentConfig = new Configuration(newConfig); // Apply the ContextThemeWrapper override if necessary. // NOTE: Make sure the configurations are not modified, as they are treated as immutable // in many places. Loading @@ -5909,8 +5906,10 @@ public final class ActivityThread extends ClientTransactionHandler activity.dispatchMovedToDisplay(displayId, configToReport); } activity.mConfigChangeFlags = 0; if (shouldReportChange) { activity.mCalled = false; activity.mCurrentConfig = new Configuration(newConfig); activity.onConfigurationChanged(configToReport); if (!activity.mCalled) { throw new SuperNotCalledException("Activity " + activity.getLocalClassName() + Loading @@ -5925,8 +5924,6 @@ public final class ActivityThread extends ClientTransactionHandler * Returns {@code true} if {@link Activity#onConfigurationChanged(Configuration)} should be * dispatched. * * @param publicDiff Usually computed by {@link Configuration#diffPublicOnly(Configuration)}. * This parameter is to prevent we compute it again. * @param currentConfig The current configuration cached in {@link Activity#mCurrentConfig}. * It is {@code null} before the first config update from the server side. * @param newConfig The updated {@link Configuration} Loading @@ -5935,9 +5932,10 @@ public final class ActivityThread extends ClientTransactionHandler * @return {@code true} if the config change should be reported to the Activity */ @VisibleForTesting public static boolean shouldReportChange(int publicDiff, @Nullable Configuration currentConfig, public static boolean shouldReportChange(@Nullable Configuration currentConfig, @NonNull Configuration newConfig, @Nullable SizeConfigurationBuckets sizeBuckets, int handledConfigChanges) { final int publicDiff = currentConfig.diffPublicOnly(newConfig); // Don't report the change if there's no public diff between current and new config. if (publicDiff == 0) { return false; Loading core/java/com/android/internal/app/ResolverListAdapter.java +8 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,7 @@ public class ResolverListAdapter extends BaseAdapter { return mResolverListController.getResolversForIntent( /* shouldGetResolvedFilter= */ true, mResolverListCommunicator.shouldGetActivityMetadata(), mResolverListCommunicator.shouldGetOnlyDefaultActivities(), mIntents); } } Loading Loading @@ -727,6 +728,7 @@ public class ResolverListAdapter extends BaseAdapter { protected List<ResolvedComponentInfo> getResolversForUser(UserHandle userHandle) { return mResolverListController.getResolversForIntentAsUser(true, mResolverListCommunicator.shouldGetActivityMetadata(), mResolverListCommunicator.shouldGetOnlyDefaultActivities(), mIntents, userHandle); } Loading Loading @@ -820,6 +822,12 @@ public class ResolverListAdapter extends BaseAdapter { boolean shouldGetActivityMetadata(); /** * @return true to filter only apps that can handle * {@link android.content.Intent#CATEGORY_DEFAULT} intents */ default boolean shouldGetOnlyDefaultActivities() { return true; }; Intent getTargetIntent(); void onHandlePackagesChanged(ResolverListAdapter listAdapter); Loading core/java/com/android/internal/app/ResolverListController.java +4 −2 Original line number Diff line number Diff line Loading @@ -110,17 +110,19 @@ public class ResolverListController { public List<ResolverActivity.ResolvedComponentInfo> getResolversForIntent( boolean shouldGetResolvedFilter, boolean shouldGetActivityMetadata, boolean shouldGetOnlyDefaultActivities, List<Intent> intents) { return getResolversForIntentAsUser(shouldGetResolvedFilter, shouldGetActivityMetadata, intents, mUserHandle); shouldGetOnlyDefaultActivities, intents, mUserHandle); } public List<ResolverActivity.ResolvedComponentInfo> getResolversForIntentAsUser( boolean shouldGetResolvedFilter, boolean shouldGetActivityMetadata, boolean shouldGetOnlyDefaultActivities, List<Intent> intents, UserHandle userHandle) { int baseFlags = PackageManager.MATCH_DEFAULT_ONLY int baseFlags = (shouldGetOnlyDefaultActivities ? PackageManager.MATCH_DEFAULT_ONLY : 0) | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE | (shouldGetResolvedFilter ? PackageManager.GET_RESOLVED_FILTER : 0) Loading core/java/com/android/internal/statusbar/IStatusBar.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.view.InsetsVisibilities; import com.android.internal.statusbar.IAddTileResultCallback; import com.android.internal.statusbar.IUndoMediaTransferCallback; import com.android.internal.statusbar.LetterboxDetails; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.view.AppearanceRegion; Loading Loading @@ -202,10 +203,12 @@ oneway interface IStatusBar * @param behavior the behavior of the focused window. * @param requestedVisibilities the collection of the requested visibilities of system insets. * @param packageName the package name of the focused app. * @param letterboxDetails a set of letterbox details of apps visible on the screen. */ void onSystemBarAttributesChanged(int displayId, int appearance, in AppearanceRegion[] appearanceRegions, boolean navbarColorManagedByIme, int behavior, in InsetsVisibilities requestedVisibilities, String packageName); int behavior, in InsetsVisibilities requestedVisibilities, String packageName, in LetterboxDetails[] letterboxDetails); /** * Notifies System UI to show transient bars. The transient bars are system bars, e.g., status Loading core/java/com/android/internal/statusbar/LetterboxDetails.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.statusbar; parcelable LetterboxDetails; Loading
core/java/android/app/ActivityThread.java +12 −14 Original line number Diff line number Diff line Loading @@ -5863,20 +5863,20 @@ public final class ActivityThread extends ClientTransactionHandler final boolean movedToDifferentDisplay = isDifferentDisplay(activity.getDisplayId(), displayId); final Configuration currentConfig = activity.mCurrentConfig; final int diff = currentConfig.diffPublicOnly(newConfig); final boolean hasPublicConfigChange = diff != 0; final Configuration currentResConfig = activity.getResources().getConfiguration(); final int diff = currentResConfig.diffPublicOnly(newConfig); final boolean hasPublicResConfigChange = diff != 0; final ActivityClientRecord r = getActivityClient(activityToken); // TODO(b/173090263): Use diff instead after the improvement of AssetManager and // ResourcesImpl constructions. final boolean shouldUpdateResources = hasPublicConfigChange || shouldUpdateResources(activityToken, currentConfig, newConfig, amOverrideConfig, movedToDifferentDisplay, hasPublicConfigChange); final boolean shouldReportChange = shouldReportChange(diff, currentConfig, newConfig, final boolean shouldUpdateResources = hasPublicResConfigChange || shouldUpdateResources(activityToken, currentResConfig, newConfig, amOverrideConfig, movedToDifferentDisplay, hasPublicResConfigChange); final boolean shouldReportChange = shouldReportChange(activity.mCurrentConfig, newConfig, r != null ? r.mSizeConfigurations : null, activity.mActivityInfo.getRealConfigChanged()); // Nothing significant, don't proceed with updating and reporting. if (!shouldUpdateResources) { if (!shouldUpdateResources && !shouldReportChange) { return null; } Loading @@ -5896,9 +5896,6 @@ public final class ActivityThread extends ClientTransactionHandler amOverrideConfig, contextThemeWrapperOverrideConfig); mResourcesManager.updateResourcesForActivity(activityToken, finalOverrideConfig, displayId); activity.mConfigChangeFlags = 0; activity.mCurrentConfig = new Configuration(newConfig); // Apply the ContextThemeWrapper override if necessary. // NOTE: Make sure the configurations are not modified, as they are treated as immutable // in many places. Loading @@ -5909,8 +5906,10 @@ public final class ActivityThread extends ClientTransactionHandler activity.dispatchMovedToDisplay(displayId, configToReport); } activity.mConfigChangeFlags = 0; if (shouldReportChange) { activity.mCalled = false; activity.mCurrentConfig = new Configuration(newConfig); activity.onConfigurationChanged(configToReport); if (!activity.mCalled) { throw new SuperNotCalledException("Activity " + activity.getLocalClassName() + Loading @@ -5925,8 +5924,6 @@ public final class ActivityThread extends ClientTransactionHandler * Returns {@code true} if {@link Activity#onConfigurationChanged(Configuration)} should be * dispatched. * * @param publicDiff Usually computed by {@link Configuration#diffPublicOnly(Configuration)}. * This parameter is to prevent we compute it again. * @param currentConfig The current configuration cached in {@link Activity#mCurrentConfig}. * It is {@code null} before the first config update from the server side. * @param newConfig The updated {@link Configuration} Loading @@ -5935,9 +5932,10 @@ public final class ActivityThread extends ClientTransactionHandler * @return {@code true} if the config change should be reported to the Activity */ @VisibleForTesting public static boolean shouldReportChange(int publicDiff, @Nullable Configuration currentConfig, public static boolean shouldReportChange(@Nullable Configuration currentConfig, @NonNull Configuration newConfig, @Nullable SizeConfigurationBuckets sizeBuckets, int handledConfigChanges) { final int publicDiff = currentConfig.diffPublicOnly(newConfig); // Don't report the change if there's no public diff between current and new config. if (publicDiff == 0) { return false; Loading
core/java/com/android/internal/app/ResolverListAdapter.java +8 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,7 @@ public class ResolverListAdapter extends BaseAdapter { return mResolverListController.getResolversForIntent( /* shouldGetResolvedFilter= */ true, mResolverListCommunicator.shouldGetActivityMetadata(), mResolverListCommunicator.shouldGetOnlyDefaultActivities(), mIntents); } } Loading Loading @@ -727,6 +728,7 @@ public class ResolverListAdapter extends BaseAdapter { protected List<ResolvedComponentInfo> getResolversForUser(UserHandle userHandle) { return mResolverListController.getResolversForIntentAsUser(true, mResolverListCommunicator.shouldGetActivityMetadata(), mResolverListCommunicator.shouldGetOnlyDefaultActivities(), mIntents, userHandle); } Loading Loading @@ -820,6 +822,12 @@ public class ResolverListAdapter extends BaseAdapter { boolean shouldGetActivityMetadata(); /** * @return true to filter only apps that can handle * {@link android.content.Intent#CATEGORY_DEFAULT} intents */ default boolean shouldGetOnlyDefaultActivities() { return true; }; Intent getTargetIntent(); void onHandlePackagesChanged(ResolverListAdapter listAdapter); Loading
core/java/com/android/internal/app/ResolverListController.java +4 −2 Original line number Diff line number Diff line Loading @@ -110,17 +110,19 @@ public class ResolverListController { public List<ResolverActivity.ResolvedComponentInfo> getResolversForIntent( boolean shouldGetResolvedFilter, boolean shouldGetActivityMetadata, boolean shouldGetOnlyDefaultActivities, List<Intent> intents) { return getResolversForIntentAsUser(shouldGetResolvedFilter, shouldGetActivityMetadata, intents, mUserHandle); shouldGetOnlyDefaultActivities, intents, mUserHandle); } public List<ResolverActivity.ResolvedComponentInfo> getResolversForIntentAsUser( boolean shouldGetResolvedFilter, boolean shouldGetActivityMetadata, boolean shouldGetOnlyDefaultActivities, List<Intent> intents, UserHandle userHandle) { int baseFlags = PackageManager.MATCH_DEFAULT_ONLY int baseFlags = (shouldGetOnlyDefaultActivities ? PackageManager.MATCH_DEFAULT_ONLY : 0) | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE | (shouldGetResolvedFilter ? PackageManager.GET_RESOLVED_FILTER : 0) Loading
core/java/com/android/internal/statusbar/IStatusBar.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.view.InsetsVisibilities; import com.android.internal.statusbar.IAddTileResultCallback; import com.android.internal.statusbar.IUndoMediaTransferCallback; import com.android.internal.statusbar.LetterboxDetails; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.view.AppearanceRegion; Loading Loading @@ -202,10 +203,12 @@ oneway interface IStatusBar * @param behavior the behavior of the focused window. * @param requestedVisibilities the collection of the requested visibilities of system insets. * @param packageName the package name of the focused app. * @param letterboxDetails a set of letterbox details of apps visible on the screen. */ void onSystemBarAttributesChanged(int displayId, int appearance, in AppearanceRegion[] appearanceRegions, boolean navbarColorManagedByIme, int behavior, in InsetsVisibilities requestedVisibilities, String packageName); int behavior, in InsetsVisibilities requestedVisibilities, String packageName, in LetterboxDetails[] letterboxDetails); /** * Notifies System UI to show transient bars. The transient bars are system bars, e.g., status Loading
core/java/com/android/internal/statusbar/LetterboxDetails.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.statusbar; parcelable LetterboxDetails;