Merge "Remove protobuf dumping support from FaceService" into qt-r1-dev
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 3016fa9..440df89 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1131,7 +1131,13 @@
*/
public void registerRtFrameCallback(FrameDrawingCallback callback) {
if (mAttachInfo.mThreadedRenderer != null) {
- mAttachInfo.mThreadedRenderer.registerRtFrameCallback(callback);
+ mAttachInfo.mThreadedRenderer.registerRtFrameCallback(frame -> {
+ try {
+ callback.onFrameDraw(frame);
+ } catch (Exception e) {
+ Log.e(TAG, "Exception while executing onFrameDraw", e);
+ }
+ });
}
}
diff --git a/core/java/com/android/internal/policy/DecorContext.java b/core/java/com/android/internal/policy/DecorContext.java
index 56a40a3..da1b72f 100644
--- a/core/java/com/android/internal/policy/DecorContext.java
+++ b/core/java/com/android/internal/policy/DecorContext.java
@@ -16,6 +16,7 @@
package com.android.internal.policy;
+import android.content.AutofillOptions;
import android.content.ContentCaptureOptions;
import android.content.Context;
import android.content.res.AssetManager;
@@ -98,6 +99,15 @@
}
@Override
+ public AutofillOptions getAutofillOptions() {
+ Context activityContext = mActivityContext.get();
+ if (activityContext != null) {
+ return activityContext.getAutofillOptions();
+ }
+ return null;
+ }
+
+ @Override
public ContentCaptureOptions getContentCaptureOptions() {
Context activityContext = mActivityContext.get();
if (activityContext != null) {
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 890ad5e..6aff8b8 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -824,6 +824,11 @@
grants your app this permission. If you don't need this permission, be sure your <a
href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
targetSdkVersion}</a> is 4 or higher.
+ <p>Is this permission is not whitelisted for an app that targets an API level before
+ {@link android.os.Build.VERSION_CODES#Q} this permission cannot be granted to apps.</p>
+ <p>Is this permission is not whitelisted for an app that targets an API level
+ {@link android.os.Build.VERSION_CODES#Q} or later the app will be forced into isolated storage.
+ </p>
-->
<permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:permissionGroup="android.permission-group.UNDEFINED"
@@ -845,6 +850,8 @@
read/write files in your application-specific directories returned by
{@link android.content.Context#getExternalFilesDir} and
{@link android.content.Context#getExternalCacheDir}.
+ <p>Is this permission is not whitelisted for an app that targets an API level before
+ {@link android.os.Build.VERSION_CODES#Q} this permission cannot be granted to apps.</p>
-->
<permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:permissionGroup="android.permission-group.UNDEFINED"
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 8dfb969..77fca8f 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -326,6 +326,8 @@
grantable in its full form to apps that meet special criteria
per platform policy. Otherwise, a weaker form of the permission
would be granted. The weak grant depends on the permission.
+ <p>What weak grant means is described in the documentation of
+ the permissions.
-->
<flag name="softRestricted" value="0x8" />
<!-- This permission is restricted immutably which means that its
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
index 6f9a6ec..cd97722 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
@@ -13,7 +13,6 @@
import androidx.annotation.NonNull;
import androidx.collection.ArrayMap;
-import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.util.ContrastColorUtil;
import com.android.settingslib.Utils;
@@ -24,7 +23,6 @@
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.CrossFadeHelper;
-import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.StatusBarIconView;
@@ -242,11 +240,15 @@
protected boolean shouldShowNotificationIcon(NotificationEntry entry,
boolean showAmbient, boolean showLowPriority, boolean hideDismissed,
boolean hideRepliedMessages, boolean hideCurrentMedia, boolean hideCenteredIcon,
- boolean hidePulsing) {
+ boolean hidePulsing, boolean onlyShowCenteredIcon) {
- final boolean isCenteredNotificationIcon = entry.centeredIcon != null
+ final boolean isCenteredNotificationIcon = mCenteredIconView != null
+ && entry.centeredIcon != null
&& Objects.equals(entry.centeredIcon, mCenteredIconView);
- if (hideCenteredIcon == isCenteredNotificationIcon) {
+ if (onlyShowCenteredIcon) {
+ return isCenteredNotificationIcon;
+ }
+ if (hideCenteredIcon && isCenteredNotificationIcon) {
return false;
}
if (mEntryManager.getNotificationData().isAmbient(entry.key) && !showAmbient) {
@@ -299,8 +301,9 @@
false /* hideDismissed */,
false /* hideRepliedMessages */,
false /* hideCurrentMedia */,
- true /* hide centered icon */,
- false /* hidePulsing */);
+ false /* hide centered icon */,
+ false /* hidePulsing */,
+ false /* onlyShowCenteredIcon */);
}
public void updateStatusBarIcons() {
@@ -311,7 +314,8 @@
true /* hideRepliedMessages */,
false /* hideCurrentMedia */,
true /* hide centered icon */,
- false /* hidePulsing */);
+ false /* hidePulsing */,
+ false /* onlyShowCenteredIcon */);
}
private void updateCenterIcon() {
@@ -322,7 +326,8 @@
false /* hideRepliedMessages */,
false /* hideCurrentMedia */,
false /* hide centered icon */,
- false /* hidePulsing */);
+ false /* hidePulsing */,
+ true/* onlyShowCenteredIcon */);
}
public void updateAodNotificationIcons() {
@@ -333,7 +338,8 @@
true /* hideRepliedMessages */,
true /* hideCurrentMedia */,
true /* hide centered icon */,
- mBypassController.getBypassEnabled() /* hidePulsing */);
+ mBypassController.getBypassEnabled() /* hidePulsing */,
+ false /* onlyShowCenteredIcon */);
}
/**
@@ -349,7 +355,7 @@
private void updateIconsForLayout(Function<NotificationEntry, StatusBarIconView> function,
NotificationIconContainer hostLayout, boolean showAmbient, boolean showLowPriority,
boolean hideDismissed, boolean hideRepliedMessages, boolean hideCurrentMedia,
- boolean hideCenteredIcon, boolean hidePulsing) {
+ boolean hideCenteredIcon, boolean hidePulsing, boolean onlyShowCenteredIcon) {
ArrayList<StatusBarIconView> toShow = new ArrayList<>(
mNotificationScrollLayout.getChildCount());
@@ -359,7 +365,8 @@
if (view instanceof ExpandableNotificationRow) {
NotificationEntry ent = ((ExpandableNotificationRow) view).getEntry();
if (shouldShowNotificationIcon(ent, showAmbient, showLowPriority, hideDismissed,
- hideRepliedMessages, hideCurrentMedia, hideCenteredIcon, hidePulsing)) {
+ hideRepliedMessages, hideCurrentMedia, hideCenteredIcon, hidePulsing,
+ onlyShowCenteredIcon)) {
StatusBarIconView iconView = function.apply(ent);
if (iconView != null) {
toShow.add(iconView);
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 1a6faec..e66e596 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -1255,23 +1255,21 @@
}
}
- public void notifyPhysicalChannelConfiguration(List<PhysicalChannelConfig> configs) {
- notifyPhysicalChannelConfigurationForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID,
- configs);
- }
-
- public void notifyPhysicalChannelConfigurationForSubscriber(int subId,
+ /**
+ * Notify physical channel configuration according to subscripton ID and phone ID
+ */
+ public void notifyPhysicalChannelConfigurationForSubscriber(int phoneId, int subId,
List<PhysicalChannelConfig> configs) {
if (!checkNotifyPermission("notifyPhysicalChannelConfiguration()")) {
return;
}
if (VDBG) {
- log("notifyPhysicalChannelConfiguration: subId=" + subId + " configs=" + configs);
+ log("notifyPhysicalChannelConfiguration: subId=" + subId + " phoneId=" + phoneId
+ + " configs=" + configs);
}
synchronized (mRecords) {
- int phoneId = SubscriptionManager.getPhoneId(subId);
if (validatePhoneId(phoneId)) {
mPhysicalChannelConfigs.set(phoneId, configs);
for (Record r : mRecords) {
diff --git a/services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java b/services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java
index 1658833..d53f685 100644
--- a/services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java
+++ b/services/core/java/com/android/server/policy/SoftRestrictedPermissionPolicy.java
@@ -91,8 +91,7 @@
// Storage uses a special app op to decide the mount state and supports soft restriction
// where the restricted state allows the permission but only for accessing the medial
// collections.
- case READ_EXTERNAL_STORAGE:
- case WRITE_EXTERNAL_STORAGE: {
+ case READ_EXTERNAL_STORAGE: {
final int flags;
final boolean applyRestriction;
final boolean isWhiteListed;
@@ -148,6 +147,42 @@
}
};
}
+ case WRITE_EXTERNAL_STORAGE: {
+ final boolean isWhiteListed;
+ final int targetSDK;
+
+ if (appInfo != null) {
+ final int flags = context.getPackageManager().getPermissionFlags(permission,
+ appInfo.packageName, user);
+ isWhiteListed = (flags & FLAGS_PERMISSION_RESTRICTION_ANY_EXEMPT) != 0;
+ targetSDK = appInfo.targetSdkVersion;
+ } else {
+ isWhiteListed = false;
+ targetSDK = 0;
+ }
+
+ return new SoftRestrictedPermissionPolicy() {
+ @Override
+ public int resolveAppOp() {
+ return OP_NONE;
+ }
+
+ @Override
+ public int getDesiredOpMode() {
+ return MODE_DEFAULT;
+ }
+
+ @Override
+ public boolean shouldSetAppOpIfNotDefault() {
+ return false;
+ }
+
+ @Override
+ public boolean canBeGranted() {
+ return isWhiteListed || targetSDK >= Build.VERSION_CODES.Q;
+ }
+ };
+ }
default:
return DUMMY_POLICY;
}
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index 7badc7a..bbfb3c5 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -1494,8 +1494,6 @@
}
sTmpRect.setEmpty();
- sTmpDockedFrame.set(displayFrames.mDock);
-
final int displayId = displayFrames.mDisplayId;
final Rect dockFrame = displayFrames.mDock;
final int displayHeight = displayFrames.mDisplayHeight;
@@ -1508,11 +1506,13 @@
continue;
}
- w.getWindowFrames().setFrames(sTmpDockedFrame /* parentFrame */,
- sTmpDockedFrame /* displayFrame */, sTmpDockedFrame /* overscanFrame */,
- sTmpDockedFrame /* contentFrame */, sTmpDockedFrame /* visibleFrame */,
- sTmpRect /* decorFrame */, sTmpDockedFrame /* stableFrame */,
- sTmpDockedFrame /* outsetFrame */);
+ w.getWindowFrames().setFrames(displayFrames.mUnrestricted /* parentFrame */,
+ displayFrames.mUnrestricted /* displayFrame */,
+ displayFrames.mUnrestricted /* overscanFrame */,
+ displayFrames.mUnrestricted /* contentFrame */,
+ displayFrames.mUnrestricted /* visibleFrame */, sTmpRect /* decorFrame */,
+ displayFrames.mUnrestricted /* stableFrame */,
+ displayFrames.mUnrestricted /* outsetFrame */);
w.getWindowFrames().setDisplayCutout(displayFrames.mDisplayCutout);
w.computeFrameLw();
final Rect frame = w.getFrameLw();
diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java
index 4a87aa4..de184b8 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java
@@ -16,6 +16,10 @@
package com.android.server.wm;
+import static android.view.Gravity.BOTTOM;
+import static android.view.Gravity.LEFT;
+import static android.view.Gravity.RIGHT;
+import static android.view.Gravity.TOP;
import static android.view.Surface.ROTATION_0;
import static android.view.Surface.ROTATION_270;
import static android.view.Surface.ROTATION_90;
@@ -26,9 +30,11 @@
import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
+import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_SCREEN_DECOR;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
@@ -66,6 +72,7 @@
private WindowState mWindow;
private int mRotation = ROTATION_0;
private boolean mHasDisplayCutout;
+ private static final int DECOR_WINDOW_INSET = 50;
@Before
public void setUp() throws Exception {
@@ -520,6 +527,58 @@
}
}
+ @Test
+ public void testScreenDecorWindows() {
+ synchronized (mWm.mGlobalLock) {
+ final WindowState decorWindow = createWindow(null, TYPE_APPLICATION_OVERLAY,
+ "decorWindow");
+ decorWindow.mAttrs.flags |= FLAG_NOT_FOCUSABLE;
+ decorWindow.mAttrs.privateFlags |= PRIVATE_FLAG_IS_SCREEN_DECOR;
+ addWindow(decorWindow);
+ addWindow(mWindow);
+
+ // Decor on top
+ updateDecorWindow(decorWindow, MATCH_PARENT, DECOR_WINDOW_INSET, TOP);
+ mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
+ mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
+ assertInsetByTopBottom(mWindow.getContentFrameLw(), DECOR_WINDOW_INSET, NAV_BAR_HEIGHT);
+
+ // Decor on bottom
+ updateDecorWindow(decorWindow, MATCH_PARENT, DECOR_WINDOW_INSET, BOTTOM);
+ mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
+ mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
+ assertInsetByTopBottom(mWindow.getContentFrameLw(), STATUS_BAR_HEIGHT,
+ DECOR_WINDOW_INSET);
+
+ // Decor on the left
+ updateDecorWindow(decorWindow, DECOR_WINDOW_INSET, MATCH_PARENT, LEFT);
+ mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
+ mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
+ assertInsetBy(mWindow.getContentFrameLw(), DECOR_WINDOW_INSET, STATUS_BAR_HEIGHT, 0,
+ NAV_BAR_HEIGHT);
+
+ // Decor on the right
+ updateDecorWindow(decorWindow, DECOR_WINDOW_INSET, MATCH_PARENT, RIGHT);
+ mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
+ mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
+ assertInsetBy(mWindow.getContentFrameLw(), 0, STATUS_BAR_HEIGHT, DECOR_WINDOW_INSET,
+ NAV_BAR_HEIGHT);
+
+ // Decor not allowed as inset
+ updateDecorWindow(decorWindow, DECOR_WINDOW_INSET, DECOR_WINDOW_INSET, TOP);
+ mDisplayPolicy.beginLayoutLw(mFrames, 0 /* UI mode */);
+ mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
+ assertInsetByTopBottom(mWindow.getContentFrameLw(), STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
+ }
+ }
+
+ private void updateDecorWindow(WindowState decorWindow, int width, int height, int gravity) {
+ decorWindow.mAttrs.width = width;
+ decorWindow.mAttrs.height = height;
+ decorWindow.mAttrs.gravity = gravity;
+ decorWindow.setRequestedSize(width, height);
+ }
+
/**
* Asserts that {@code actual} is inset by the given amounts from the full display rect.
*
diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
index f2f3c2d..dc026d4 100644
--- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
@@ -68,8 +68,7 @@
void notifyOtaspChanged(in int subId, in int otaspMode);
@UnsupportedAppUsage
void notifyCellInfo(in List<CellInfo> cellInfo);
- void notifyPhysicalChannelConfiguration(in List<PhysicalChannelConfig> configs);
- void notifyPhysicalChannelConfigurationForSubscriber(in int subId,
+ void notifyPhysicalChannelConfigurationForSubscriber(in int phoneId, in int subId,
in List<PhysicalChannelConfig> configs);
void notifyPreciseCallState(int phoneId, int subId, int ringingCallState,
int foregroundCallState, int backgroundCallState);