diff options
| -rw-r--r-- | core/java/android/widget/RelativeLayout.java | 8 | ||||
| -rw-r--r-- | core/java/android/widget/TabWidget.java | 2 | ||||
| -rw-r--r-- | core/jni/android/graphics/Picture.cpp | 5 | ||||
| -rw-r--r-- | core/res/AndroidManifest.xml | 46 | ||||
| -rw-r--r-- | graphics/java/android/graphics/RenderNode.java | 4 | ||||
| -rw-r--r-- | libs/hwui/SkiaCanvas.cpp | 7 | ||||
| -rw-r--r-- | libs/hwui/SkiaCanvas.h | 4 | ||||
| -rw-r--r-- | libs/hwui/hwui/Canvas.h | 15 | ||||
| -rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 3 | ||||
| -rw-r--r-- | libs/hwui/tests/unit/SkiaCanvasTests.cpp | 2 | ||||
| -rw-r--r-- | media/java/android/media/MediaPlayer.java | 2 | ||||
| -rw-r--r-- | packages/CarSystemUI/res/values/dimens.xml | 6 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java | 152 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java | 21 | ||||
| -rw-r--r-- | services/core/java/com/android/server/compat/CompatChange.java | 6 | ||||
| -rw-r--r-- | services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java | 28 |
16 files changed, 100 insertions, 211 deletions
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index d985528c38fb..6b324a541c42 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -1202,13 +1202,13 @@ public class RelativeLayout extends ViewGroup { * determine where to position the view on the screen. If the view is not contained * within a relative layout, these attributes are ignored. * - * See the <a href="/guide/topics/ui/layout/relative.html"> - * Relative Layout</a> guide for example code demonstrating how to use relative layout’s + * See the <a href="{@docRoot}guide/topics/ui/layout/relative.html">Relative + * Layout</a> guide for example code demonstrating how to use relative layout's * layout parameters in a layout XML. * * To learn more about layout parameters and how they differ from typical view attributes, - * see the <a href="/guide/topics/ui/declaring-layout.html#attributes"> - * Layouts guide</a>. + * see the <a href="{@docRoot}guide/topics/ui/declaring-layout.html#attributes">Layouts + * guide</a>. * * * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignWithParentIfMissing diff --git a/core/java/android/widget/TabWidget.java b/core/java/android/widget/TabWidget.java index 49a0f39b3bad..4c67b080252a 100644 --- a/core/java/android/widget/TabWidget.java +++ b/core/java/android/widget/TabWidget.java @@ -433,7 +433,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { * to the next tabbed view, in this example). * <p> * To move both the focus AND the selected tab at once, please use - * {@link #setCurrentTab}. Normally, the view logic takes care of + * {@link #focusCurrentTab}. Normally, the view logic takes care of * adjusting the focus, so unless you're circumventing the UI, * you'll probably just focus your interest here. * diff --git a/core/jni/android/graphics/Picture.cpp b/core/jni/android/graphics/Picture.cpp index d29857d0cf12..d1b952130e88 100644 --- a/core/jni/android/graphics/Picture.cpp +++ b/core/jni/android/graphics/Picture.cpp @@ -100,8 +100,9 @@ void Picture::draw(Canvas* canvas) { this->endRecording(); SkASSERT(NULL != mPicture.get()); } - if (NULL != mPicture.get()) { - mPicture->playback(canvas->asSkCanvas()); + + if (mPicture) { + canvas->drawPicture(*mPicture); } } diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 40acebc40abd..f48783fc804e 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -860,7 +860,7 @@ meaning that the whitelist state can be specified only at install time and cannot change until the app is installed. For more details see {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. - --> + <p>Protection level: dangerous --> <permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_sdcardRead" @@ -881,8 +881,9 @@ 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 + <p>If 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>Protection level: dangerous</p> --> <permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:permissionGroup="android.permission-group.UNDEFINED" @@ -892,7 +893,8 @@ android:protectionLevel="dangerous" /> <!-- Allows an application to access any geographic locations persisted in the - user's shared collection. --> + user's shared collection. + <p>Protection level: dangerous --> <permission android:name="android.permission.ACCESS_MEDIA_LOCATION" android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_mediaLocation" @@ -1694,7 +1696,7 @@ <!-- Allows applications to pair bluetooth devices without user interaction, and to allow or disallow phonebook access or message access. - This is not available to third party applications. --> + <p>Not for use by third-party applications. --> <permission android:name="android.permission.BLUETOOTH_PRIVILEGED" android:protectionLevel="signature|privileged" /> @@ -2544,7 +2546,8 @@ android:protectionLevel="signature" /> <!-- Allows an application to modify the current configuration, such - as locale. --> + as locale. + <p>Protection level: signature|privileged|development --> <permission android:name="android.permission.CHANGE_CONFIGURATION" android:protectionLevel="signature|privileged|development" /> @@ -2843,7 +2846,8 @@ <!-- ==================================== --> <eat-comment /> - <!-- Allows access to the list of accounts in the Accounts Service. --> + <!-- Allows access to the list of accounts in the Accounts Service. + <p>Protection level: signature|privileged --> <permission android:name="android.permission.GET_ACCOUNTS_PRIVILEGED" android:protectionLevel="signature|privileged" /> @@ -3429,7 +3433,8 @@ android:protectionLevel="signature" /> <!-- Old permission for deleting an app's cache files, no longer used, - but signals for us to quietly ignore calls instead of throwing an exception. --> + but signals for us to quietly ignore calls instead of throwing an exception. + <p>Protection level: signature|privileged --> <permission android:name="android.permission.DELETE_CACHE_FILES" android:protectionLevel="signature|privileged" /> @@ -3792,7 +3797,8 @@ <!-- Allows an application to collect component usage statistics <p>Declaring the permission implies intention to use the API and the user of the - device can grant permission through the Settings application. --> + device can grant permission through the Settings application. + <p>Protection level: signature|privileged|development|appop --> <permission android:name="android.permission.PACKAGE_USAGE_STATS" android:protectionLevel="signature|privileged|development|appop" /> <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /> @@ -3815,14 +3821,14 @@ <!-- Permission an application must hold in order to use {@link android.provider.Settings#ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS}. - This is a normal permission: an app requesting it will always be granted the - permission, without the user needing to approve or see it. --> + <p>Protection level: normal --> <permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" android:label="@string/permlab_requestIgnoreBatteryOptimizations" android:description="@string/permdesc_requestIgnoreBatteryOptimizations" android:protectionLevel="normal" /> - <!-- Allows an application to collect battery statistics --> + <!-- Allows an application to collect battery statistics + <p>Protection level: signature|privileged|development --> <permission android:name="android.permission.BATTERY_STATS" android:protectionLevel="signature|privileged|development" /> @@ -3852,7 +3858,8 @@ android:protectionLevel="signature" /> <!-- Must be required by a {@link android.widget.RemoteViewsService}, - to ensure that only the system can bind to it. --> + to ensure that only the system can bind to it. + <p>Protection level: signature|privileged --> <permission android:name="android.permission.BIND_REMOTEVIEWS" android:protectionLevel="signature|privileged" /> @@ -3894,7 +3901,8 @@ to the path in the provider where global search queries are performed. This permission can not be held by regular applications; it is used by applications to protect themselves from everyone else - besides global search. --> + besides global search. + <p>Protection level: signature|privileged --> <permission android:name="android.permission.GLOBAL_SEARCH" android:protectionLevel="signature|privileged" /> @@ -4433,7 +4441,8 @@ <permission android:name="android.permission.MODIFY_THEME_OVERLAY" android:protectionLevel="signature" /> - <!-- Allows an instant app to create foreground services. --> + <!-- Allows an instant app to create foreground services. + <p>Protection level: signature|development|instant|appop --> <permission android:name="android.permission.INSTANT_APP_FOREGROUND_SERVICE" android:protectionLevel="signature|development|instant|appop" /> @@ -4503,7 +4512,8 @@ <permission android:name="android.permission.MONITOR_DEFAULT_SMS_PACKAGE" android:protectionLevel="signature|privileged" /> - <!-- A subclass of {@link android.service.carrier.CarrierMessagingClientService} must be protected with this permission. --> + <!-- A subclass of {@link android.service.carrier.CarrierMessagingClientService} must be protected with this permission. + <p>Protection level: signature --> <permission android:name="android.permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE" android:protectionLevel="signature" /> @@ -4535,13 +4545,15 @@ <permission android:name="android.permission.GRANT_PROFILE_OWNER_DEVICE_IDS_ACCESS" android:protectionLevel="signature" /> - <!-- Allows financial apps to read filtered sms messages. --> + <!-- Allows financial apps to read filtered sms messages. + Protection level: signature|appop --> <permission android:name="android.permission.SMS_FINANCIAL_TRANSACTIONS" android:protectionLevel="signature|appop" /> <!-- Required for apps targeting {@link android.os.Build.VERSION_CODES#Q} that want to use {@link android.app.Notification.Builder#setFullScreenIntent notification full screen - intents}. --> + intents}. + <p>Protection level: normal --> <permission android:name="android.permission.USE_FULL_SCREEN_INTENT" android:protectionLevel="normal" /> diff --git a/graphics/java/android/graphics/RenderNode.java b/graphics/java/android/graphics/RenderNode.java index ae7fe6c46f2f..0e635c774c84 100644 --- a/graphics/java/android/graphics/RenderNode.java +++ b/graphics/java/android/graphics/RenderNode.java @@ -63,7 +63,7 @@ import java.lang.annotation.RetentionPolicy; * <h3>Creating a RenderNode</h3> * <pre class="prettyprint"> * RenderNode renderNode = new RenderNode("myRenderNode"); - * renderNode.setLeftTopRightBottom(0, 0, 50, 50); // Set the size to 50x50 + * renderNode.setPosition(0, 0, 50, 50); // Set the size to 50x50 * RecordingCanvas canvas = renderNode.beginRecording(); * try { * // Draw with the canvas @@ -104,7 +104,7 @@ import java.lang.annotation.RetentionPolicy; * <pre class="prettyprint"> * private void createDisplayList() { * mRenderNode = new RenderNode("MyRenderNode"); - * mRenderNode.setLeftTopRightBottom(0, 0, width, height); + * mRenderNode.setPosition(0, 0, width, height); * RecordingCanvas canvas = mRenderNode.beginRecording(); * try { * for (Bitmap b : mBitmaps) { diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp index 6ea6af8f2935..f01b1bfa780d 100644 --- a/libs/hwui/SkiaCanvas.cpp +++ b/libs/hwui/SkiaCanvas.cpp @@ -778,6 +778,13 @@ void SkiaCanvas::drawCircle(uirenderer::CanvasPropertyPrimitive* x, mCanvas->drawDrawable(drawable.get()); } +void SkiaCanvas::drawPicture(const SkPicture& picture) { + // TODO: Change to mCanvas->drawPicture()? SkCanvas::drawPicture seems to be + // where the logic is for playback vs. ref picture. Using picture.playback here + // to stay behavior-identical for now, but should revisit this at some point. + picture.playback(mCanvas); +} + // ---------------------------------------------------------------------------- // Canvas draw operations: View System // ---------------------------------------------------------------------------- diff --git a/libs/hwui/SkiaCanvas.h b/libs/hwui/SkiaCanvas.h index 05a6d0dda42d..799a89158298 100644 --- a/libs/hwui/SkiaCanvas.h +++ b/libs/hwui/SkiaCanvas.h @@ -46,8 +46,6 @@ public: virtual ~SkiaCanvas(); - virtual SkCanvas* asSkCanvas() override { return mCanvas; } - virtual void resetRecording(int width, int height, uirenderer::RenderNode* renderNode) override { LOG_ALWAYS_FATAL("SkiaCanvas cannot be reset as a recording canvas"); @@ -155,9 +153,11 @@ public: virtual void drawRenderNode(uirenderer::RenderNode* renderNode) override; virtual void callDrawGLFunction(Functor* functor, uirenderer::GlFunctorLifecycleListener* listener) override; + virtual void drawPicture(const SkPicture& picture) override; protected: SkiaCanvas(); + SkCanvas* asSkCanvas() { return mCanvas; } void reset(SkCanvas* skiaCanvas); void drawDrawable(SkDrawable* drawable) { mCanvas->drawDrawable(drawable); } diff --git a/libs/hwui/hwui/Canvas.h b/libs/hwui/hwui/Canvas.h index ac8db216b059..ee4fa1d689ef 100644 --- a/libs/hwui/hwui/Canvas.h +++ b/libs/hwui/hwui/Canvas.h @@ -131,20 +131,6 @@ public: */ static void setCompatibilityVersion(int apiLevel); - /** - * Provides a Skia SkCanvas interface that acts as a proxy to this Canvas. - * It is useful for testing and clients (e.g. Picture/Movie) that expect to - * draw their contents into an SkCanvas. - * - * The SkCanvas returned is *only* valid until another Canvas call is made - * that would change state (e.g. matrix or clip). Clients of asSkCanvas() - * are responsible for *not* persisting this pointer. - * - * Further, the returned SkCanvas should NOT be unref'd and is valid until - * this canvas is destroyed or a new bitmap is set. - */ - virtual SkCanvas* asSkCanvas() = 0; - virtual void setBitmap(const SkBitmap& bitmap) = 0; virtual bool isOpaque() = 0; @@ -264,6 +250,7 @@ public: const SkPaint* paint) = 0; virtual double drawAnimatedImage(AnimatedImageDrawable* imgDrawable) = 0; + virtual void drawPicture(const SkPicture& picture) = 0; /** * Specifies if the positions passed to ::drawText are absolute or relative diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index 550c27d7a051..d97c5ed4c7f5 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -145,7 +145,8 @@ void CanvasContext::setSurface(sp<Surface>&& surface) { if (surface) { mNativeSurface = new ReliableSurface{std::move(surface)}; - mNativeSurface->setDequeueTimeout(500_ms); + // TODO: Fix error handling & re-shorten timeout + mNativeSurface->setDequeueTimeout(4000_ms); } else { mNativeSurface = nullptr; } diff --git a/libs/hwui/tests/unit/SkiaCanvasTests.cpp b/libs/hwui/tests/unit/SkiaCanvasTests.cpp index f6178aff0c2e..2ed1b25efc71 100644 --- a/libs/hwui/tests/unit/SkiaCanvasTests.cpp +++ b/libs/hwui/tests/unit/SkiaCanvasTests.cpp @@ -78,7 +78,7 @@ TEST(SkiaCanvas, colorSpaceXform) { sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture(); // Playback to a software sRGB canvas. The result should be fully red. - canvas.asSkCanvas()->drawPicture(picture); + canvas.drawPicture(*picture); ASSERT_EQ(0xFF0000FF, *skBitmap.getAddr32(0, 0)); } diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java index 353e58e98efa..7906fa34d844 100644 --- a/media/java/android/media/MediaPlayer.java +++ b/media/java/android/media/MediaPlayer.java @@ -246,7 +246,7 @@ import java.util.Vector; * via {@link #setOnBufferingUpdateListener(OnBufferingUpdateListener)}. * This callback allows applications to keep track of the buffering status * while streaming audio/video.</li> - * <li>Calling {@link #start()} has not effect + * <li>Calling {@link #start()} has no effect * on a MediaPlayer object that is already in the <em>Started</em> state.</li> * </ul> * </li> diff --git a/packages/CarSystemUI/res/values/dimens.xml b/packages/CarSystemUI/res/values/dimens.xml index 7592bd227a94..fb422aff51ef 100644 --- a/packages/CarSystemUI/res/values/dimens.xml +++ b/packages/CarSystemUI/res/values/dimens.xml @@ -114,10 +114,10 @@ <!-- Car notification shade--> <dimen name="notification_shade_handle_bar_height">10dp</dimen> <dimen name="notification_shade_handle_bar_radius">20dp</dimen> - <dimen name="notification_shade_handle_bar_margin_start">500dp</dimen> - <dimen name="notification_shade_handle_bar_margin_end">500dp</dimen> + <dimen name="notification_shade_handle_bar_margin_start">200dp</dimen> + <dimen name="notification_shade_handle_bar_margin_end">200dp</dimen> <dimen name="notification_shade_handle_bar_margin_top">20dp</dimen> <dimen name="notification_shade_handle_bar_margin_bottom">10dp</dimen> - <dimen name="notification_shade_list_padding_bottom">0dp</dimen> + <dimen name="notification_shade_list_padding_bottom">50dp</dimen> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java index 64fef55a21d3..1df9411019d2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationModeController.java @@ -32,8 +32,6 @@ import static com.android.systemui.shared.system.QuickStepContract.ACTION_ENABLE import static com.android.systemui.shared.system.QuickStepContract.ACTION_ENABLE_GESTURE_NAV_RESULT; import static com.android.systemui.shared.system.QuickStepContract.EXTRA_RESULT_INTENT; -import android.app.Notification; -import android.app.NotificationManager; import android.app.PendingIntent; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; @@ -42,7 +40,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.om.IOverlayManager; -import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.ApkAssets; import android.os.PatternMatcher; @@ -52,16 +49,13 @@ import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.provider.Settings.Secure; -import android.text.TextUtils; import android.util.Log; import android.util.SparseBooleanArray; import com.android.systemui.Dumpable; -import com.android.systemui.R; import com.android.systemui.UiOffloadThread; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.statusbar.policy.DeviceProvisionedController; -import com.android.systemui.util.NotificationChannels; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -80,11 +74,6 @@ public class NavigationModeController implements Dumpable { private static final String TAG = NavigationModeController.class.getSimpleName(); private static final boolean DEBUG = false; - private static final int SYSTEM_APP_MASK = - ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP; - static final String SHARED_PREFERENCES_NAME = "navigation_mode_controller_preferences"; - static final String PREFS_SWITCHED_FROM_GESTURE_NAV_KEY = "switched_from_gesture_nav"; - public interface ModeChangedListener { void onNavigationModeChanged(int mode); } @@ -100,8 +89,6 @@ public class NavigationModeController implements Dumpable { private int mMode = NAV_BAR_MODE_3BUTTON; private ArrayList<ModeChangedListener> mListeners = new ArrayList<>(); - private String mLastDefaultLauncher; - private BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -112,18 +99,6 @@ public class NavigationModeController implements Dumpable { } updateCurrentInteractionMode(true /* notify */); break; - case ACTION_PREFERRED_ACTIVITY_CHANGED: - if (DEBUG) { - Log.d(TAG, "ACTION_PREFERRED_ACTIVITY_CHANGED"); - } - final String launcher = getDefaultLauncherPackageName(mCurrentUserContext); - // Check if it is a default launcher change - if (!TextUtils.equals(mLastDefaultLauncher, launcher)) { - switchFromGestureNavModeIfNotSupportedByDefaultLauncher(); - showNotificationIfDefaultLauncherSupportsGestureNav(); - mLastDefaultLauncher = launcher; - } - break; } } }; @@ -159,7 +134,6 @@ public class NavigationModeController implements Dumpable { // Update the nav mode for the current user updateCurrentInteractionMode(true /* notify */); - switchFromGestureNavModeIfNotSupportedByDefaultLauncher(); // When switching users, defer enabling the gestural nav overlay until the user // is all set up @@ -190,11 +164,7 @@ public class NavigationModeController implements Dumpable { mContext.registerReceiverAsUser(mReceiver, UserHandle.ALL, preferredActivityFilter, null, null); - // We are only interested in launcher changes, so keeping track of the current default. - mLastDefaultLauncher = getDefaultLauncherPackageName(mContext); - updateCurrentInteractionMode(false /* notify */); - switchFromGestureNavModeIfNotSupportedByDefaultLauncher(); // Check if we need to defer enabling gestural nav deferGesturalNavOverlayIfNecessary(); @@ -216,21 +186,13 @@ public class NavigationModeController implements Dumpable { // Already in gesture mode return true; } - final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext); - if (supported == null || supported) { - Log.d(TAG, "Switching system navigation to full-gesture mode:" - + " defaultLauncher=" - + getDefaultLauncherPackageName(mCurrentUserContext) - + " contextUser=" - + mCurrentUserContext.getUserId()); - - setModeOverlay(NAV_BAR_MODE_GESTURAL_OVERLAY, USER_CURRENT); - return true; - } else { - Log.e(TAG, "Gesture nav is not supported for defaultLauncher=" - + getDefaultLauncherPackageName(mCurrentUserContext)); - return false; - } + + Log.d(TAG, "Switching system navigation to full-gesture mode:" + + " contextUser=" + + mCurrentUserContext.getUserId()); + + setModeOverlay(NAV_BAR_MODE_GESTURAL_OVERLAY, USER_CURRENT); + return true; } private boolean enableGestureNav(Intent intent) { @@ -430,100 +392,6 @@ public class NavigationModeController implements Dumpable { }); } - private void switchFromGestureNavModeIfNotSupportedByDefaultLauncher() { - if (getCurrentInteractionMode(mCurrentUserContext) != NAV_BAR_MODE_GESTURAL) { - return; - } - final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext); - if (supported == null || supported) { - return; - } - - Log.d(TAG, "Switching system navigation to 3-button mode:" - + " defaultLauncher=" + getDefaultLauncherPackageName(mCurrentUserContext) - + " contextUser=" + mCurrentUserContext.getUserId()); - - setModeOverlay(NAV_BAR_MODE_3BUTTON_OVERLAY, USER_CURRENT); - showNotification(mCurrentUserContext, R.string.notification_content_system_nav_changed); - mCurrentUserContext.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) - .edit().putBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, true).apply(); - } - - private void showNotificationIfDefaultLauncherSupportsGestureNav() { - boolean previouslySwitchedFromGestureNav = mCurrentUserContext - .getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) - .getBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false); - if (!previouslySwitchedFromGestureNav) { - return; - } - if (getCurrentInteractionMode(mCurrentUserContext) == NAV_BAR_MODE_GESTURAL) { - return; - } - final Boolean supported = isGestureNavSupportedByDefaultLauncher(mCurrentUserContext); - if (supported == null || !supported) { - return; - } - - showNotification(mCurrentUserContext, R.string.notification_content_gesture_nav_available); - mCurrentUserContext.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) - .edit().putBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false).apply(); - } - - /** - * Returns null if there is no default launcher set for the current user. Returns true if the - * current default launcher supports Gesture Navigation. Returns false otherwise. - */ - private Boolean isGestureNavSupportedByDefaultLauncher(Context context) { - final String defaultLauncherPackageName = getDefaultLauncherPackageName(context); - if (DEBUG) { - Log.d(TAG, "isGestureNavSupportedByDefaultLauncher:" - + " defaultLauncher=" + defaultLauncherPackageName - + " contextUser=" + context.getUserId()); - } - if (defaultLauncherPackageName == null) { - return null; - } - if (isSystemApp(context, defaultLauncherPackageName)) { - return true; - } - return false; - } - - private String getDefaultLauncherPackageName(Context context) { - final ComponentName cn = context.getPackageManager().getHomeActivities(new ArrayList<>()); - if (cn == null) { - return null; - } - return cn.getPackageName(); - } - - /** Returns true if the app for the given package name is a system app for this device */ - private boolean isSystemApp(Context context, String packageName) { - try { - ApplicationInfo ai = context.getPackageManager().getApplicationInfo(packageName, - PackageManager.GET_META_DATA); - return ai != null && ((ai.flags & SYSTEM_APP_MASK) != 0); - } catch (PackageManager.NameNotFoundException e) { - return false; - } - } - - private void showNotification(Context context, int resId) { - final CharSequence message = context.getResources().getString(resId); - if (DEBUG) { - Log.d(TAG, "showNotification: message=" + message); - } - - final Notification.Builder builder = - new Notification.Builder(mContext, NotificationChannels.ALERTS) - .setContentText(message) - .setStyle(new Notification.BigTextStyle()) - .setSmallIcon(R.drawable.ic_info) - .setAutoCancel(true) - .setContentIntent(PendingIntent.getActivity(context, 0, new Intent(), 0)); - context.getSystemService(NotificationManager.class).notify(TAG, 0, builder.build()); - } - @Override public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("NavigationModeController:"); @@ -536,12 +404,6 @@ public class NavigationModeController implements Dumpable { } pw.println(" defaultOverlays=" + defaultOverlays); dumpAssetPaths(mCurrentUserContext); - - pw.println(" defaultLauncher=" + mLastDefaultLauncher); - boolean previouslySwitchedFromGestureNav = mCurrentUserContext - .getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE) - .getBoolean(PREFS_SWITCHED_FROM_GESTURE_NAV_KEY, false); - pw.println(" previouslySwitchedFromGestureNav=" + previouslySwitchedFromGestureNav); } private void dumpAssetPaths(Context context) { 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 d2159ca15b24..21de8a59836e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java @@ -4,7 +4,6 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Color; import android.graphics.Rect; -import android.provider.Settings; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -32,7 +31,6 @@ import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; -import com.android.systemui.tuner.TunerService; import java.util.ArrayList; import java.util.Objects; @@ -58,7 +56,6 @@ public class NotificationIconAreaController implements DarkReceiver, private final KeyguardBypassController mBypassController; private final DozeParameters mDozeParameters; - private boolean mShowSilentOnLockscreen = true; private int mIconSize; private int mIconHPadding; private int mIconTint = Color.WHITE; @@ -101,11 +98,6 @@ public class NotificationIconAreaController implements DarkReceiver, initializeNotificationAreaViews(context); reloadAodColor(); - - TunerService tunerService = Dependency.get(TunerService.class); - tunerService.addTunable((key, newValue) -> { - mShowSilentOnLockscreen = "1".equals(newValue); - }, Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS); } protected View inflateIconArea(LayoutInflater inflater) { @@ -238,7 +230,7 @@ public class NotificationIconAreaController implements DarkReceiver, } protected boolean shouldShowNotificationIcon(NotificationEntry entry, - boolean showAmbient, boolean showLowPriority, boolean hideDismissed, + boolean showAmbient, boolean hideDismissed, boolean hideRepliedMessages, boolean hideCurrentMedia, boolean hideCenteredIcon, boolean hidePulsing, boolean onlyShowCenteredIcon) { @@ -257,9 +249,6 @@ public class NotificationIconAreaController implements DarkReceiver, if (hideCurrentMedia && entry.key.equals(mMediaManager.getMediaNotificationKey())) { return false; } - if (!showLowPriority && !entry.isHighPriority()) { - return false; - } if (!entry.isTopLevelChild()) { return false; } @@ -297,7 +286,6 @@ public class NotificationIconAreaController implements DarkReceiver, private void updateShelfIcons() { updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons, true /* showAmbient */, - true /* showLowPriority */, false /* hideDismissed */, false /* hideRepliedMessages */, false /* hideCurrentMedia */, @@ -309,7 +297,6 @@ public class NotificationIconAreaController implements DarkReceiver, public void updateStatusBarIcons() { updateIconsForLayout(entry -> entry.icon, mNotificationIcons, false /* showAmbient */, - true /* showLowPriority */, true /* hideDismissed */, true /* hideRepliedMessages */, false /* hideCurrentMedia */, @@ -321,7 +308,6 @@ public class NotificationIconAreaController implements DarkReceiver, private void updateCenterIcon() { updateIconsForLayout(entry -> entry.centeredIcon, mCenteredIcon, false /* showAmbient */, - true /* showLowPriority */, false /* hideDismissed */, false /* hideRepliedMessages */, false /* hideCurrentMedia */, @@ -333,7 +319,6 @@ public class NotificationIconAreaController implements DarkReceiver, public void updateAodNotificationIcons() { updateIconsForLayout(entry -> entry.aodIcon, mAodIcons, false /* showAmbient */, - mShowSilentOnLockscreen /* showLowPriority */, true /* hideDismissed */, true /* hideRepliedMessages */, true /* hideCurrentMedia */, @@ -353,7 +338,7 @@ public class NotificationIconAreaController implements DarkReceiver, * @param hidePulsing should pulsing notifications be hidden */ private void updateIconsForLayout(Function<NotificationEntry, StatusBarIconView> function, - NotificationIconContainer hostLayout, boolean showAmbient, boolean showLowPriority, + NotificationIconContainer hostLayout, boolean showAmbient, boolean hideDismissed, boolean hideRepliedMessages, boolean hideCurrentMedia, boolean hideCenteredIcon, boolean hidePulsing, boolean onlyShowCenteredIcon) { ArrayList<StatusBarIconView> toShow = new ArrayList<>( @@ -364,7 +349,7 @@ public class NotificationIconAreaController implements DarkReceiver, View view = mNotificationScrollLayout.getChildAt(i); if (view instanceof ExpandableNotificationRow) { NotificationEntry ent = ((ExpandableNotificationRow) view).getEntry(); - if (shouldShowNotificationIcon(ent, showAmbient, showLowPriority, hideDismissed, + if (shouldShowNotificationIcon(ent, showAmbient, hideDismissed, hideRepliedMessages, hideCurrentMedia, hideCenteredIcon, hidePulsing, onlyShowCenteredIcon)) { StatusBarIconView iconView = function.apply(ent); diff --git a/services/core/java/com/android/server/compat/CompatChange.java b/services/core/java/com/android/server/compat/CompatChange.java index bb3b9be2bd2f..2a866f390283 100644 --- a/services/core/java/com/android/server/compat/CompatChange.java +++ b/services/core/java/com/android/server/compat/CompatChange.java @@ -106,6 +106,12 @@ public final class CompatChange { * @return {@code true} if the change should be enabled for the package. */ boolean isEnabled(ApplicationInfo app) { + if (app.isSystemApp()) { + // All changes are enabled for system apps, and we do not support overrides. + // Compatibility issues for system apps should be addressed in the app itself when + // the compatibility change is made. + return true; + } if (mPackageOverrides != null && mPackageOverrides.containsKey(app.packageName)) { return mPackageOverrides.get(app.packageName); } diff --git a/services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java b/services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java index e6c484a8dbbc..d008ca66b762 100644 --- a/services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java +++ b/services/tests/servicestests/src/com/android/server/compat/CompatConfigTest.java @@ -142,4 +142,32 @@ public class CompatConfigTest { CompatConfig pc = new CompatConfig(); assertThat(pc.lookupChangeId("MY_CHANGE")).isEqualTo(-1L); } + + @Test + public void testSystemAppDisabledChangeEnabled() { + CompatConfig pc = new CompatConfig(); + pc.addChange(new CompatChange(1234L, "MY_CHANGE", -1, true)); // disabled + ApplicationInfo sysApp = makeAppInfo("system.app", 1); + sysApp.flags |= ApplicationInfo.FLAG_SYSTEM; + assertThat(pc.isChangeEnabled(1234L, sysApp)).isTrue(); + } + + @Test + public void testSystemAppOverrideIgnored() { + CompatConfig pc = new CompatConfig(); + pc.addChange(new CompatChange(1234L, "MY_CHANGE", -1, false)); + pc.addOverride(1234L, "system.app", false); + ApplicationInfo sysApp = makeAppInfo("system.app", 1); + sysApp.flags |= ApplicationInfo.FLAG_SYSTEM; + assertThat(pc.isChangeEnabled(1234L, sysApp)).isTrue(); + } + + @Test + public void testSystemAppTargetSdkIgnored() { + CompatConfig pc = new CompatConfig(); + pc.addChange(new CompatChange(1234L, "MY_CHANGE", 2, false)); + ApplicationInfo sysApp = makeAppInfo("system.app", 1); + sysApp.flags |= ApplicationInfo.FLAG_SYSTEM; + assertThat(pc.isChangeEnabled(1234L, sysApp)).isTrue(); + } } |