diff options
author | Mariia Sandrikova <mariiasand@google.com> | 2022-01-13 15:21:38 +0000 |
---|---|---|
committer | Mariia Sandrikova <mariiasand@google.com> | 2022-01-13 15:21:38 +0000 |
commit | 7617679a6197f210fb0ef92f59e589e6d800df4b (patch) | |
tree | 2ceaab34bc27ceaffae4e9d99094f9db25fcf4b7 /core | |
parent | aec26c4f686a7a21d789d2880d1061432507482a (diff) |
DO NOT MERGE Revert "[2/n] Camera Compat UI: Add interfaces for client-server..."
Revert submission 16468379
Reason for revert: Feature development is moving to T.
Reverted Changes:
Id9b9a8930:[3/n] Camera Compat UI: Add a camera compat contro...
Id6be4a954:Enable a camera app compat control on Large screen...
I083aa6718:[2/n] Camera Compat UI: Add interfaces for client-...
Bug: 206602997
Change-Id: I9ad876043fd61f708a8f468fffd1ef371bfa0866
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/ActivityClient.java | 23 | ||||
-rw-r--r-- | core/java/android/app/ActivityThread.java | 39 | ||||
-rw-r--r-- | core/java/android/app/IActivityClientController.aidl | 12 | ||||
-rw-r--r-- | core/java/android/app/ICompatCameraControlCallback.aidl | 30 | ||||
-rw-r--r-- | core/java/android/app/Instrumentation.java | 2 | ||||
-rw-r--r-- | core/java/android/app/TaskInfo.java | 88 | ||||
-rw-r--r-- | core/java/android/view/ViewRootImpl.java | 38 | ||||
-rw-r--r-- | core/java/android/window/ITaskOrganizerController.aidl | 3 | ||||
-rw-r--r-- | core/java/android/window/TaskOrganizer.java | 15 | ||||
-rw-r--r-- | core/res/res/values/config.xml | 4 | ||||
-rw-r--r-- | core/res/res/values/symbols.xml | 1 |
11 files changed, 21 insertions, 234 deletions
diff --git a/core/java/android/app/ActivityClient.java b/core/java/android/app/ActivityClient.java index eb4a355c8ae7..db7ab1a6f379 100644 --- a/core/java/android/app/ActivityClient.java +++ b/core/java/android/app/ActivityClient.java @@ -20,7 +20,6 @@ import android.annotation.Nullable; import android.content.ComponentName; import android.content.Intent; import android.content.res.Configuration; -import android.content.res.Resources; import android.os.Bundle; import android.os.IBinder; import android.os.PersistableBundle; @@ -499,28 +498,6 @@ public class ActivityClient { } } - /** - * Shows or hides a Camera app compat toggle for stretched issues with the requested state. - * - * @param token The token for the window that needs a control. - * @param showControl Whether the control should be shown or hidden. - * @param transformationApplied Whether the treatment is already applied. - * @param callback The callback executed when the user clicks on a control. - */ - void requestCompatCameraControl(Resources res, IBinder token, boolean showControl, - boolean transformationApplied, ICompatCameraControlCallback callback) { - if (!res.getBoolean(com.android.internal.R.bool - .config_isCameraCompatControlForStretchedIssuesEnabled)) { - return; - } - try { - getActivityClientController().requestCompatCameraControl( - token, showControl, transformationApplied, callback); - } catch (RemoteException e) { - e.rethrowFromSystemServer(); - } - } - public static ActivityClient getInstance() { return sInstance.get(); } diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 131bfd337b18..8af74edb88ff 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -561,8 +561,8 @@ public final class ActivityThread extends ClientTransactionHandler private Configuration mPendingOverrideConfig; // Used for consolidating configs before sending on to Activity. private Configuration tmpConfig = new Configuration(); - // Callback used for updating activity override config and camera compat control state. - ViewRootImpl.ActivityConfigCallback activityConfigCallback; + // Callback used for updating activity override config. + ViewRootImpl.ActivityConfigCallback configCallback; ActivityClientRecord nextIdle; // Indicates whether this activity is currently the topmost resumed one in the system. @@ -660,30 +660,13 @@ public final class ActivityThread extends ClientTransactionHandler stopped = false; hideForNow = false; nextIdle = null; - activityConfigCallback = new ViewRootImpl.ActivityConfigCallback() { - @Override - public void onConfigurationChanged(Configuration overrideConfig, - int newDisplayId) { - if (activity == null) { - throw new IllegalStateException( - "Received config update for non-existing activity"); - } - activity.mMainThread.handleActivityConfigurationChanged( - ActivityClientRecord.this, overrideConfig, newDisplayId); + configCallback = (Configuration overrideConfig, int newDisplayId) -> { + if (activity == null) { + throw new IllegalStateException( + "Received config update for non-existing activity"); } - - @Override - public void requestCompatCameraControl(boolean showControl, - boolean transformationApplied, ICompatCameraControlCallback callback) { - if (activity == null) { - throw new IllegalStateException( - "Received camera compat control update for non-existing activity"); - } - ActivityClient.getInstance().requestCompatCameraControl( - activity.getResources(), token, showControl, transformationApplied, - callback); - } - + activity.mMainThread.handleActivityConfigurationChanged(this, overrideConfig, + newDisplayId); }; } @@ -3674,7 +3657,7 @@ public final class ActivityThread extends ClientTransactionHandler activity.attach(appContext, this, getInstrumentation(), r.token, r.ident, app, r.intent, r.activityInfo, title, r.parent, r.embeddedID, r.lastNonConfigurationInstances, config, - r.referrer, r.voiceInteractor, window, r.activityConfigCallback, + r.referrer, r.voiceInteractor, window, r.configCallback, r.assistToken, r.shareableActivityToken); if (customIntent != null) { @@ -5522,8 +5505,8 @@ public final class ActivityThread extends ClientTransactionHandler } else { final ViewRootImpl viewRoot = v.getViewRootImpl(); if (viewRoot != null) { - // Clear callbacks to avoid the destroyed activity from receiving - // configuration or camera compat changes that are no longer effective. + // Clear the callback to avoid the destroyed activity from receiving + // configuration changes that are no longer effective. viewRoot.setActivityConfigCallback(null); } wm.removeViewImmediate(v); diff --git a/core/java/android/app/IActivityClientController.aidl b/core/java/android/app/IActivityClientController.aidl index 83c57c573b82..aba6eb9229f2 100644 --- a/core/java/android/app/IActivityClientController.aidl +++ b/core/java/android/app/IActivityClientController.aidl @@ -17,7 +17,6 @@ package android.app; import android.app.ActivityManager; -import android.app.ICompatCameraControlCallback; import android.app.IRequestFinishCallback; import android.app.PictureInPictureParams; import android.content.ComponentName; @@ -144,15 +143,4 @@ interface IActivityClientController { /** Reports that the splash screen view has attached to activity. */ oneway void splashScreenAttached(in IBinder token); - - /** - * Shows or hides a Camera app compat toggle for stretched issues with the requested state. - * - * @param token The token for the window that needs a control. - * @param showControl Whether the control should be shown or hidden. - * @param transformationApplied Whether the treatment is already applied. - * @param callback The callback executed when the user clicks on a control. - */ - oneway void requestCompatCameraControl(in IBinder token, boolean showControl, - boolean transformationApplied, in ICompatCameraControlCallback callback); } diff --git a/core/java/android/app/ICompatCameraControlCallback.aidl b/core/java/android/app/ICompatCameraControlCallback.aidl deleted file mode 100644 index 1a7f21066630..000000000000 --- a/core/java/android/app/ICompatCameraControlCallback.aidl +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2021 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 android.app; - -/** - * This callback allows ActivityRecord to ask the calling View to apply the treatment for stretched - * issues affecting camera viewfinders when the user clicks on the camera compat control. - * - * {@hide} - */ -oneway interface ICompatCameraControlCallback { - - void applyCameraCompatTreatment(); - - void revertCameraCompatTreatment(); -} diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index 9f4107c30b7c..fd6fa57b9e8d 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -1259,7 +1259,7 @@ public class Instrumentation { info, title, parent, id, (Activity.NonConfigurationInstances)lastNonConfigurationInstance, new Configuration(), null /* referrer */, null /* voiceInteractor */, - null /* window */, null /* activityCallback */, null /*assistToken*/, + null /* window */, null /* activityConfigCallback */, null /*assistToken*/, null /*shareableActivityToken*/); return activity; } diff --git a/core/java/android/app/TaskInfo.java b/core/java/android/app/TaskInfo.java index cd885c1b13ca..ddde27220b96 100644 --- a/core/java/android/app/TaskInfo.java +++ b/core/java/android/app/TaskInfo.java @@ -19,7 +19,6 @@ package android.app; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.window.DisplayAreaOrganizer.FEATURE_UNDEFINED; -import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.TestApi; @@ -40,8 +39,6 @@ import android.view.DisplayCutout; import android.window.TaskSnapshot; import android.window.WindowContainerToken; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.Objects; @@ -259,51 +256,6 @@ public class TaskInfo { */ public boolean isSleeping; - /** - * Camera compat control isn't shown because it's not requested by heuristics. - * @hide - */ - public static final int CAMERA_COMPAT_CONTROL_HIDDEN = 0; - - /** - * Camera compat control is shown with the treatment suggested. - * @hide - */ - public static final int CAMERA_COMPAT_CONTROL_TREATMENT_SUGGESTED = 1; - - /** - * Camera compat control is shown to allow reverting the applied treatment. - * @hide - */ - public static final int CAMERA_COMPAT_CONTROL_TREATMENT_APPLIED = 2; - - /** - * Camera compat control is dismissed by user. - * @hide - */ - public static final int CAMERA_COMPAT_CONTROL_DISMISSED = 3; - - /** - * Enum for the Camera app compat control states. - * @hide - */ - @Retention(RetentionPolicy.SOURCE) - @IntDef(prefix = { "CAMERA_COMPAT_CONTROL_" }, value = { - CAMERA_COMPAT_CONTROL_HIDDEN, - CAMERA_COMPAT_CONTROL_TREATMENT_SUGGESTED, - CAMERA_COMPAT_CONTROL_TREATMENT_APPLIED, - CAMERA_COMPAT_CONTROL_DISMISSED, - }) - public @interface CameraCompatControlState {}; - - /** - * State of the Camera app compat control which is used to correct stretched viewfinder - * in apps that don't handle all possible configurations and changes between them correctly. - * @hide - */ - @CameraCompatControlState - public int cameraCompatControlState = CAMERA_COMPAT_CONTROL_HIDDEN; - TaskInfo() { // Do nothing } @@ -372,17 +324,6 @@ public class TaskInfo { launchCookies.add(cookie); } - /** @hide */ - public boolean hasCameraCompatControl() { - return cameraCompatControlState != CAMERA_COMPAT_CONTROL_HIDDEN - && cameraCompatControlState != CAMERA_COMPAT_CONTROL_DISMISSED; - } - - /** @hide */ - public boolean hasCompatUI() { - return hasCameraCompatControl() || topActivityInSizeCompat; - } - /** * @return {@code true} if this task contains the launch cookie. * @hide @@ -435,20 +376,19 @@ public class TaskInfo { * @return {@code true} if parameters that are important for size compat have changed. * @hide */ - public boolean equalsForCompatUi(@Nullable TaskInfo that) { + public boolean equalsForSizeCompat(@Nullable TaskInfo that) { if (that == null) { return false; } return displayId == that.displayId && taskId == that.taskId && topActivityInSizeCompat == that.topActivityInSizeCompat - && cameraCompatControlState == that.cameraCompatControlState - // Bounds are important if top activity has compat controls. - && (!hasCompatUI() || configuration.windowConfiguration.getBounds() + // Bounds are important if top activity is in size compat + && (!topActivityInSizeCompat || configuration.windowConfiguration.getBounds() .equals(that.configuration.windowConfiguration.getBounds())) - && (!hasCompatUI() || configuration.getLayoutDirection() + && (!topActivityInSizeCompat || configuration.getLayoutDirection() == that.configuration.getLayoutDirection()) - && (!hasCompatUI() || isVisible == that.isVisible); + && (!topActivityInSizeCompat || isVisible == that.isVisible); } /** @@ -488,7 +428,6 @@ public class TaskInfo { topActivityInSizeCompat = source.readBoolean(); mTopActivityLocusId = source.readTypedObject(LocusId.CREATOR); displayAreaFeatureId = source.readInt(); - cameraCompatControlState = source.readInt(); } /** @@ -529,7 +468,6 @@ public class TaskInfo { dest.writeBoolean(topActivityInSizeCompat); dest.writeTypedObject(mTopActivityLocusId, flags); dest.writeInt(displayAreaFeatureId); - dest.writeInt(cameraCompatControlState); } @Override @@ -560,22 +498,6 @@ public class TaskInfo { + " topActivityInSizeCompat=" + topActivityInSizeCompat + " locusId=" + mTopActivityLocusId + " displayAreaFeatureId=" + displayAreaFeatureId - + " cameraCompatControlState=" - + cameraCompatControlStateToString(cameraCompatControlState) + "}"; } - - /** @hide */ - public static String cameraCompatControlStateToString( - @CameraCompatControlState int cameraCompatControlState) { - switch (cameraCompatControlState) { - case CAMERA_COMPAT_CONTROL_HIDDEN: return "hidden"; - case CAMERA_COMPAT_CONTROL_TREATMENT_SUGGESTED: return "treatment-suggested"; - case CAMERA_COMPAT_CONTROL_TREATMENT_APPLIED: return "treatment-applied"; - case CAMERA_COMPAT_CONTROL_DISMISSED: return "dismissed"; - default: - throw new AssertionError( - "Unexpected camera compat control state: " + cameraCompatControlState); - } - } } diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 74b97312b805..f1eb783726db 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -89,7 +89,6 @@ import android.annotation.Nullable; import android.annotation.UiContext; import android.app.ActivityManager; import android.app.ActivityThread; -import android.app.ICompatCameraControlCallback; import android.app.ResourcesManager; import android.compat.annotation.UnsupportedAppUsage; import android.content.ClipData; @@ -330,7 +329,7 @@ public final class ViewRootImpl implements ViewParent, private static final ArrayList<ConfigChangedCallback> sConfigCallbacks = new ArrayList<>(); /** - * Callback for notifying activities. + * Callback for notifying activities about override configuration changes. */ public interface ActivityConfigCallback { @@ -340,23 +339,11 @@ public final class ViewRootImpl implements ViewParent, * @param newDisplayId New display id, {@link Display#INVALID_DISPLAY} if not changed. */ void onConfigurationChanged(Configuration overrideConfig, int newDisplayId); - - /** - * Notify the corresponding activity about the request to show or hide a camera compat - * control for stretched issues in the viewfinder. - * - * @param showControl Whether the control should be shown or hidden. - * @param transformationApplied Whether the treatment is already applied. - * @param callback The callback executed when the user clicks on a control. - */ - void requestCompatCameraControl(boolean showControl, boolean transformationApplied, - ICompatCameraControlCallback callback); } /** - * Callback used to notify corresponding activity about camera compat control changes, override - * configuration change and make sure that all resources are set correctly before updating the - * ViewRootImpl's internal state. + * Callback used to notify corresponding activity about override configuration change and make + * sure that all resources are set correctly before updating the ViewRootImpl's internal state. */ private ActivityConfigCallback mActivityConfigCallback; @@ -908,10 +895,7 @@ public final class ViewRootImpl implements ViewParent, } } - /** - * Add activity config callback to be notified about override config changes and camera - * compat control state updates. - */ + /** Add activity config callback to be notified about override config changes. */ public void setActivityConfigCallback(ActivityConfigCallback callback) { mActivityConfigCallback = callback; } @@ -10616,20 +10600,6 @@ public final class ViewRootImpl implements ViewParent, } /** - * Shows or hides a Camera app compat toggle for stretched issues with the requested state - * for the corresponding activity. - * - * @param showControl Whether the control should be shown or hidden. - * @param transformationApplied Whether the treatment is already applied. - * @param callback The callback executed when the user clicks on a control. - */ - public void requestCompatCameraControl(boolean showControl, boolean transformationApplied, - ICompatCameraControlCallback callback) { - mActivityConfigCallback.requestCompatCameraControl( - showControl, transformationApplied, callback); - } - - /** * Redirect the next draw of this ViewRoot (from the UI thread perspective) * to the passed in consumer. This can be used to create P2P synchronization * between ViewRoot's however it comes with many caveats. diff --git a/core/java/android/window/ITaskOrganizerController.aidl b/core/java/android/window/ITaskOrganizerController.aidl index 022d05da8825..a833600e1fbc 100644 --- a/core/java/android/window/ITaskOrganizerController.aidl +++ b/core/java/android/window/ITaskOrganizerController.aidl @@ -66,7 +66,4 @@ interface ITaskOrganizerController { * Restarts the top activity in the given task by killing its process if it is visible. */ void restartTaskTopActivityProcessIfVisible(in WindowContainerToken task); - - /** Updates a state of camera compat control for stretched issues in the viewfinder. */ - void updateCameraCompatControlState(in WindowContainerToken task, int state); } diff --git a/core/java/android/window/TaskOrganizer.java b/core/java/android/window/TaskOrganizer.java index 3ec18dbe0ebc..27c7d3158f95 100644 --- a/core/java/android/window/TaskOrganizer.java +++ b/core/java/android/window/TaskOrganizer.java @@ -24,7 +24,6 @@ import android.annotation.RequiresPermission; import android.annotation.SuppressLint; import android.annotation.TestApi; import android.app.ActivityManager; -import android.app.TaskInfo.CameraCompatControlState; import android.os.IBinder; import android.os.RemoteException; import android.view.SurfaceControl; @@ -239,20 +238,6 @@ public class TaskOrganizer extends WindowOrganizer { } /** - * Updates a state of camera compat control for stretched issues in the viewfinder. - * @hide - */ - @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) - public void updateCameraCompatControlState(@NonNull WindowContainerToken task, - @CameraCompatControlState int state) { - try { - mTaskOrganizerController.updateCameraCompatControlState(task, state); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - } - - /** * Gets the executor to run callbacks on. * @hide */ diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 7bedcc67dc6d..1c31b1b76f85 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -4938,10 +4938,6 @@ If given value is outside of this range, the option 1 (center) is assummed. --> <integer name="config_letterboxDefaultPositionForReachability">1</integer> - <!-- Whether a camera compat controller is enabled to allow the user to apply or revert - treatment for stretched issues in camera viewfinder. --> - <bool name="config_isCameraCompatControlForStretchedIssuesEnabled">false</bool> - <!-- If true, hide the display cutout with display area --> <bool name="config_hideDisplayCutoutWithDisplayArea">false</bool> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 46b249e5be6d..b017a30cb5f2 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -4273,7 +4273,6 @@ <java-symbol type="dimen" name="config_letterboxHorizontalPositionMultiplier" /> <java-symbol type="bool" name="config_letterboxIsReachabilityEnabled" /> <java-symbol type="integer" name="config_letterboxDefaultPositionForReachability" /> - <java-symbol type="bool" name="config_isCameraCompatControlForStretchedIssuesEnabled" /> <java-symbol type="bool" name="config_hideDisplayCutoutWithDisplayArea" /> |