diff options
author | Jainam Shah <jainams@google.com> | 2023-11-02 15:05:55 -0700 |
---|---|---|
committer | Jainam Shah <jainams@google.com> | 2023-11-30 11:28:07 -0800 |
commit | 720c5aed36bfd0a2ee2597e97d3e357c94b0abf1 (patch) | |
tree | 13b03e25b7c1747ae8009fd0bc1e787742200083 | |
parent | e46fb2972365fea653fd76aaf78469a55e804006 (diff) | |
download | SystemUI-720c5aed36bfd0a2ee2597e97d3e357c94b0abf1.tar.gz |
Register Dock broadcast listener
Registering dock through Manifest created user issues where the receiver
was registered to a different user than the current user. Registering
through context gives us more control on which user should the receiver
be registered.
Bug: 301483111
Bug: 301482374
Test: atest CarSystemUITests
Change-Id: I3540a4ec6c251775c47335197a9f1f9cb45749d6
-rw-r--r-- | Android.bp | 2 | ||||
-rw-r--r-- | AndroidManifest.xml | 3 | ||||
-rw-r--r-- | src/com/android/systemui/CarSystemUIApplication.java | 8 | ||||
-rw-r--r-- | tests/AndroidManifest.xml | 8 |
4 files changed, 21 insertions, 0 deletions
@@ -60,6 +60,7 @@ android_library { "dagger2", "//external/kotlinc:kotlin-annotations", "animationlib", + "CarDockLib", ], libs: [ @@ -126,6 +127,7 @@ android_library { "testng", "dagger2", "//external/kotlinc:kotlin-annotations", + "CarDockLib", ], libs: [ "android.test.runner", diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 10474b3f..bd7b1e9b 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -58,6 +58,9 @@ <!-- use for querying AutoEnhance packages --> <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/> <uses-permission android:name="android.car.permission.QUERY_DISPLAY_COMPATIBILITY"/> + <!-- Permission to allow receiving broadcast events for the dock --> + <uses-permission android:name="com.android.car.docklib.permission.BROADCAST_RECEIVER" /> + <application tools:replace="android:name,android:appComponentFactory" android:name=".CarSystemUIApplication" diff --git a/src/com/android/systemui/CarSystemUIApplication.java b/src/com/android/systemui/CarSystemUIApplication.java index 15ede2d9..6a85818d 100644 --- a/src/com/android/systemui/CarSystemUIApplication.java +++ b/src/com/android/systemui/CarSystemUIApplication.java @@ -18,6 +18,8 @@ package com.android.systemui; import static android.car.CarOccupantZoneManager.DISPLAY_TYPE_MAIN; +import static com.android.car.docklib.events.DockEventsReceiver.registerDockReceiver; + import android.car.Car; import android.car.CarOccupantZoneManager; import android.view.Display; @@ -54,6 +56,12 @@ public class CarSystemUIApplication extends SystemUIApplication { } car.disconnect(); } + + boolean isDockEnabled = getResources().getBoolean(R.bool.config_enableDock); + if (isDockEnabled) { + // todo(b/308651703): create and register receiver when the dock view is created + registerDockReceiver(this); + } } @Override diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml index 998bf046..af0ecfe9 100644 --- a/tests/AndroidManifest.xml +++ b/tests/AndroidManifest.xml @@ -20,6 +20,14 @@ android:sharedUserId="android.uid.system" package="com.android.systemui.tests"> + <permission + android:name="com.android.car.docklib.permission.BROADCAST_SENDER" + tools:node="remove" /> + + <permission + android:name="com.android.car.docklib.permission.BROADCAST_RECEIVER" + tools:node="remove" /> + <application android:name="com.android.systemui.SystemUIApplication" android:debuggable="true" |