summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Barbier de Reuille <pbdr@google.com>2021-05-19 10:05:51 +0100
committerPierre Barbier de Reuille <pbdr@google.com>2021-05-19 09:28:02 +0000
commit2debc0a8493a1b4fa31a1daaa33c60b887689e5f (patch)
tree418b5276b1820953f552fcd752979b43ec5ea349
parentf5bb3549999fc7838217a719ee50be62c7f9ac82 (diff)
Correct AppWidget layout when WP is off
When the work profile (WP) is off, the layout of the widget is provided by the system. The layout must have a background with android:id/background as view id and clip its outline, or it will be considered "legacy" and have the wrong outline when moved. Bug: 187907544 Test: Add a widget for the WP and turn the WP off. Change-Id: Ibee31f5f0e510313ae7f8dc78c208c45a4d0e1fd
-rw-r--r--core/res/res/layout/work_widget_mask_view.xml5
-rw-r--r--core/res/res/values/symbols.xml1
-rw-r--r--services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java2
3 files changed, 4 insertions, 4 deletions
diff --git a/core/res/res/layout/work_widget_mask_view.xml b/core/res/res/layout/work_widget_mask_view.xml
index 86c5d13ede40..a6fb17aa4f6d 100644
--- a/core/res/res/layout/work_widget_mask_view.xml
+++ b/core/res/res/layout/work_widget_mask_view.xml
@@ -15,12 +15,13 @@ Copyright (C) 2015 The Android Open Source Project
limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/work_widget_mask_frame"
+ android:id="@android:id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/work_widget_mask_view_background"
android:importantForAccessibility="noHideDescendants"
- android:clickable="true">
+ android:clickable="true"
+ android:clipToOutline="true">
<com.android.internal.widget.DisableImageView
android:id="@+id/work_widget_app_icon"
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index f2328567e577..5bbe4151b053 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2962,7 +2962,6 @@
<java-symbol type="string" name="importance_from_person" />
<java-symbol type="layout" name="work_widget_mask_view" />
- <java-symbol type="id" name="work_widget_mask_frame" />
<java-symbol type="id" name="work_widget_app_icon" />
<java-symbol type="id" name="work_widget_badge_icon" />
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
index 85084f497807..13340ba06a5b 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
@@ -554,7 +554,7 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
}
if (onClickIntent != null) {
- views.setOnClickPendingIntent(R.id.work_widget_mask_frame,
+ views.setOnClickPendingIntent(android.R.id.background,
PendingIntent.getActivity(mContext, 0, onClickIntent,
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE));
}