diff options
17 files changed, 189 insertions, 37 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 7ab234ab3e40..95af71cfa074 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -4369,7 +4369,7 @@ package android.app { method public final android.media.session.MediaController getMediaController(); method @NonNull public android.view.MenuInflater getMenuInflater(); method @NonNull public android.window.OnBackInvokedDispatcher getOnBackInvokedDispatcher(); - method public final android.app.Activity getParent(); + method @Deprecated public final android.app.Activity getParent(); method @Nullable public android.content.Intent getParentActivityIntent(); method public android.content.SharedPreferences getPreferences(int); method @Nullable public android.net.Uri getReferrer(); @@ -4387,7 +4387,7 @@ package android.app { method public void invalidateOptionsMenu(); method public boolean isActivityTransitionRunning(); method public boolean isChangingConfigurations(); - method public final boolean isChild(); + method @Deprecated public final boolean isChild(); method public boolean isDestroyed(); method public boolean isFinishing(); method public boolean isImmersive(); diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 5674a108baaa..5d4d5e23d6db 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -1174,12 +1174,23 @@ public class Activity extends ContextThemeWrapper return mApplication; } - /** Is this activity embedded inside of another activity? */ + /** + * Whether this is a child {@link Activity} of an {@link ActivityGroup}. + * + * @deprecated {@link ActivityGroup} is deprecated. + */ + @Deprecated public final boolean isChild() { return mParent != null; } - /** Return the parent activity if this view is an embedded child. */ + /** + * Returns the parent {@link Activity} if this is a child {@link Activity} of an + * {@link ActivityGroup}. + * + * @deprecated {@link ActivityGroup} is deprecated. + */ + @Deprecated public final Activity getParent() { return mParent; } diff --git a/core/java/android/app/AutomaticZenRule.java b/core/java/android/app/AutomaticZenRule.java index 343348b89625..f9ab55e00dc6 100644 --- a/core/java/android/app/AutomaticZenRule.java +++ b/core/java/android/app/AutomaticZenRule.java @@ -70,6 +70,8 @@ public final class AutomaticZenRule implements Parcelable { public static final int TYPE_SCHEDULE_CALENDAR = 2; /** * The type for rules triggered by bedtime/sleeping, like time of day, or snore detection. + * + * <p>Only the 'Wellbeing' app may own rules of this type. */ @FlaggedApi(Flags.FLAG_MODES_API) public static final int TYPE_BEDTIME = 3; @@ -95,6 +97,8 @@ public final class AutomaticZenRule implements Parcelable { /** * The type for rules created and managed by a device owner. These rules may not be fully * editable by the device user. + * + * <p>Only a 'Device Owner' app may own rules of this type. */ @FlaggedApi(Flags.FLAG_MODES_API) public static final int TYPE_MANAGED = 7; diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 4a6349b1b02f..5c42b0ed975a 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -2598,8 +2598,8 @@ public class DevicePolicyManager { * There can be at most one app that has this delegation. * If another app already had delegated certificate selection access, * it will lose the delegation when a new app is delegated. - * <p> The delegaetd app can also call {@link #grantKeyPairToApp} and - * {@link #revokeKeyPairFromApp} to directly grant KeyCain keys to other apps. + * <p> The delegated app can also call {@link #grantKeyPairToApp} and + * {@link #revokeKeyPairFromApp} to directly grant KeyChain keys to other apps. * <p> Can be granted by Device Owner or Profile Owner. */ public static final String DELEGATION_CERT_SELECTION = "delegation-cert-selection"; diff --git a/core/java/com/android/internal/foldables/FoldGracePeriodProvider.java b/core/java/com/android/internal/foldables/FoldGracePeriodProvider.java new file mode 100644 index 000000000000..53164f3e1ec9 --- /dev/null +++ b/core/java/com/android/internal/foldables/FoldGracePeriodProvider.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2023 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.foldables; + +import android.os.Build; +import android.sysprop.FoldLockBehaviorProperties; +import android.util.Slog; + +import com.android.internal.foldables.flags.Flags; + +import java.util.function.Supplier; + +/** + * Wrapper class to access {@link FoldLockBehaviorProperties}. + */ +public class FoldGracePeriodProvider { + + private static final String TAG = "FoldGracePeriodProvider"; + private final Supplier<Boolean> mFoldGracePeriodEnabled = Flags::foldGracePeriodEnabled; + + /** + * Whether the fold grace period feature is enabled. + */ + public boolean isEnabled() { + if ((Build.IS_ENG || Build.IS_USERDEBUG) + && FoldLockBehaviorProperties.fold_grace_period_enabled().orElse(false)) { + return true; + } + try { + return mFoldGracePeriodEnabled.get(); + } catch (Throwable ex) { + Slog.i(TAG, + "Flags not ready yet. Return false for " + + Flags.FLAG_FOLD_GRACE_PERIOD_ENABLED, + ex); + return false; + } + } +} diff --git a/core/java/com/android/internal/foldables/fold_lock_setting_flags.aconfig b/core/java/com/android/internal/foldables/fold_lock_setting_flags.aconfig index 44f436eaaa19..d73e62373732 100644 --- a/core/java/com/android/internal/foldables/fold_lock_setting_flags.aconfig +++ b/core/java/com/android/internal/foldables/fold_lock_setting_flags.aconfig @@ -7,3 +7,11 @@ flag { bug: "274447767" is_fixed_read_only: true } + +flag { + name: "fold_grace_period_enabled" + namespace: "display_manager" + description: "Feature flag for Folding Grace Period" + bug: "308417021" + is_fixed_read_only: true +} diff --git a/core/sysprop/FoldLockBehaviorProperties.sysprop b/core/sysprop/FoldLockBehaviorProperties.sysprop index d337954ff2a0..120e4bbc743a 100644 --- a/core/sysprop/FoldLockBehaviorProperties.sysprop +++ b/core/sysprop/FoldLockBehaviorProperties.sysprop @@ -22,3 +22,11 @@ prop { scope: Internal access: Readonly } + +prop { + api_name: "fold_grace_period_enabled" + type: Boolean + prop_name: "persist.fold_grace_period_enabled" + scope: Internal + access: Readonly +} diff --git a/data/etc/preinstalled-packages-platform.xml b/data/etc/preinstalled-packages-platform.xml index 421bc25d60e9..bf6094469215 100644 --- a/data/etc/preinstalled-packages-platform.xml +++ b/data/etc/preinstalled-packages-platform.xml @@ -128,4 +128,9 @@ to pre-existing users, but cannot uninstall pre-existing system packages from pr <install-in-user-type package="com.android.wallpaperbackup"> <install-in user-type="FULL" /> </install-in-user-type> + + <!-- AvatarPicker (AvatarPicker app)--> + <install-in-user-type package="com.android.avatarpicker"> + <install-in user-type="FULL" /> + </install-in-user-type> </config> diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java index a25c78871115..92300efdc930 100644 --- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java @@ -112,6 +112,7 @@ import com.android.systemui.statusbar.notification.people.PeopleHubModule; import com.android.systemui.statusbar.notification.row.dagger.ExpandableNotificationRowComponent; import com.android.systemui.statusbar.notification.row.dagger.NotificationRowComponent; import com.android.systemui.statusbar.phone.CentralSurfaces; +import com.android.systemui.statusbar.phone.ConfigurationControllerModule; import com.android.systemui.statusbar.phone.LetterboxModule; import com.android.systemui.statusbar.phone.NotificationIconAreaControllerModule; import com.android.systemui.statusbar.pipeline.dagger.StatusBarPipelineModule; @@ -178,6 +179,7 @@ import javax.inject.Named; ClockRegistryModule.class, CommunalModule.class, CommonDataLayerModule.class, + ConfigurationControllerModule.class, ConnectivityModule.class, ControlsModule.class, CoroutinesModule.class, diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 286037ef1961..fb6bc38c9a0b 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -2478,6 +2478,13 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump return 0; } if (!mKeyguardBypassController.getBypassEnabled()) { + if (migrateClocksToBlueprint()) { + View nsslPlaceholder = mView.getRootView().findViewById(R.id.nssl_placeholder); + if (!mSplitShadeEnabled && nsslPlaceholder != null) { + return nsslPlaceholder.getTop(); + } + } + return mClockPositionResult.stackScrollerPadding; } int collapsedPosition = mHeadsUpInset; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ConfigurationControllerModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ConfigurationControllerModule.kt new file mode 100644 index 000000000000..fc3456ad6a23 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ConfigurationControllerModule.kt @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2024 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.systemui.statusbar.phone + +import com.android.systemui.CoreStartable +import dagger.Binds +import dagger.Module +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap + +@Module +interface ConfigurationControllerModule { + + /** Starts [ConfigurationControllerStartable] */ + @Binds + @IntoMap + @ClassKey(ConfigurationControllerStartable::class) + fun bindConfigControllerStartable(impl: ConfigurationControllerStartable): CoreStartable +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java index b048da492eb1..942d186e7005 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java @@ -16,16 +16,12 @@ package com.android.systemui.statusbar.phone.dagger; -import com.android.systemui.CoreStartable; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.statusbar.phone.CentralSurfaces; import com.android.systemui.statusbar.phone.CentralSurfacesImpl; -import com.android.systemui.statusbar.phone.ConfigurationControllerStartable; import dagger.Binds; import dagger.Module; -import dagger.multibindings.ClassKey; -import dagger.multibindings.IntoMap; /** * Dagger Module providing {@link CentralSurfacesImpl}. @@ -38,12 +34,4 @@ public interface StatusBarPhoneModule { @Binds @SysUISingleton CentralSurfaces bindsCentralSurfaces(CentralSurfacesImpl impl); - - /** - * Starts {@link ConfigurationControllerStartable} - */ - @Binds - @IntoMap - @ClassKey(ConfigurationControllerStartable.class) - CoreStartable bindConfigControllerStartable(ConfigurationControllerStartable impl); } diff --git a/packages/SystemUI/unfold/src/com/android/systemui/unfold/progress/UnfoldRemoteFilter.kt b/packages/SystemUI/unfold/src/com/android/systemui/unfold/progress/UnfoldRemoteFilter.kt index 843cc3b78031..54d805409c51 100644 --- a/packages/SystemUI/unfold/src/com/android/systemui/unfold/progress/UnfoldRemoteFilter.kt +++ b/packages/SystemUI/unfold/src/com/android/systemui/unfold/progress/UnfoldRemoteFilter.kt @@ -41,8 +41,6 @@ class UnfoldRemoteFilter( if (inProgress) { logCounter({ "$TAG#filtered_progress" }, newProgress) listener.onTransitionProgress(newProgress) - } else { - Log.e(TAG, "Filtered progress received received while animation not in progress.") } field = newProgress } diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 155d193a3549..b8a92bbb059b 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -2492,7 +2492,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Creating SnapshotStartingData"); mStartingData = new SnapshotStartingData(mWmService, snapshot, typeParams); - if (task.forAllLeafTaskFragments(TaskFragment::isEmbedded)) { + if ((!mStyleFillsParent && task.getChildCount() > 1) + || task.forAllLeafTaskFragments(TaskFragment::isEmbedded)) { + // Case 1: + // If it is moving a Task{[0]=main activity, [1]=translucent activity} to front, use + // shared starting window so that the transition doesn't need to wait for the activity + // behind the translucent activity. Also, onFirstWindowDrawn will check all visible + // activities are drawn in the task to remove the snapshot starting window. + // Case 2: // Associate with the task so if this activity is resized by task fragment later, the // starting window can keep the same bounds as the task. associateStartingDataWithTask(); @@ -10615,6 +10622,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A @Override boolean isSyncFinished(BLASTSyncEngine.SyncGroup group) { + if (task != null && task.mSharedStartingData != null) { + final WindowState startingWin = task.topStartingWindow(); + if (startingWin != null && startingWin.isSyncFinished(group)) { + // The sync is ready if a drawn starting window covered the task. + return true; + } + } if (!super.isSyncFinished(group)) return false; if (mDisplayContent != null && mDisplayContent.mUnknownAppVisibilityController .isVisibilityUnknown(this)) { diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index d90d017a5570..13f71521c240 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -993,17 +993,6 @@ class ActivityStarter { } } - if (Flags.archiving()) { - PackageArchiver packageArchiver = mService - .getPackageManagerInternalLocked() - .getPackageArchiver(); - if (packageArchiver.isIntentResolvedToArchivedApp(intent, mRequest.userId)) { - return packageArchiver - .requestUnarchiveOnActivityStart( - intent, callingPackage, mRequest.userId, realCallingUid); - } - } - final int launchFlags = intent.getFlags(); if ((launchFlags & Intent.FLAG_ACTIVITY_FORWARD_RESULT) != 0 && sourceRecord != null) { // Transfer the result target from the source activity to the new one being started, @@ -1045,6 +1034,17 @@ class ActivityStarter { } if (err == ActivityManager.START_SUCCESS && aInfo == null) { + if (Flags.archiving()) { + PackageArchiver packageArchiver = mService + .getPackageManagerInternalLocked() + .getPackageArchiver(); + if (packageArchiver.isIntentResolvedToArchivedApp(intent, mRequest.userId)) { + return packageArchiver + .requestUnarchiveOnActivityStart( + intent, callingPackage, mRequest.userId, realCallingUid); + } + } + // We couldn't find the specific class specified in the Intent. // Also the end of the line. err = ActivityManager.START_CLASS_NOT_FOUND; diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index d556f095ae50..3b0634311501 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -1411,12 +1411,13 @@ class Task extends TaskFragment { return isUidPresent; } + WindowState topStartingWindow() { + return getWindow(w -> w.mAttrs.type == TYPE_APPLICATION_STARTING); + } + ActivityRecord topActivityContainsStartingWindow() { - if (getParent() == null) { - return null; - } - return getActivity((r) -> r.getWindow(window -> - window.getBaseType() == TYPE_APPLICATION_STARTING) != null); + final WindowState startingWindow = topStartingWindow(); + return startingWindow != null ? startingWindow.mActivityRecord : null; } /** diff --git a/services/tests/wmtests/src/com/android/server/wm/SyncEngineTests.java b/services/tests/wmtests/src/com/android/server/wm/SyncEngineTests.java index 810cbe8f8080..0f1e4d1e928f 100644 --- a/services/tests/wmtests/src/com/android/server/wm/SyncEngineTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/SyncEngineTests.java @@ -16,6 +16,7 @@ package com.android.server.wm; +import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; @@ -137,6 +138,25 @@ public class SyncEngineTests extends WindowTestsBase { } @Test + public void testFinishSyncByStartingWindow() { + final ActivityRecord taskRoot = new ActivityBuilder(mAtm).setCreateTask(true).build(); + final Task task = taskRoot.getTask(); + final ActivityRecord translucentTop = new ActivityBuilder(mAtm).setTask(task) + .setActivityTheme(android.R.style.Theme_Translucent).build(); + createWindow(null, TYPE_BASE_APPLICATION, taskRoot, "win"); + final WindowState startingWindow = createWindow(null, TYPE_APPLICATION_STARTING, + translucentTop, "starting"); + startingWindow.mStartingData = new SnapshotStartingData(mWm, null, 0); + task.mSharedStartingData = startingWindow.mStartingData; + task.prepareSync(); + + final BLASTSyncEngine.SyncGroup group = mock(BLASTSyncEngine.SyncGroup.class); + assertFalse(task.isSyncFinished(group)); + startingWindow.onSyncFinishedDrawing(); + assertTrue(task.isSyncFinished(group)); + } + + @Test public void testInvisibleSyncCallback() { TestWindowContainer mockWC = new TestWindowContainer(mWm, true /* waiter */); |