summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jason Monk <jmonk@google.com> 2018-05-25 15:13:16 -0400
committer Jason Monk <jmonk@google.com> 2018-05-25 15:42:16 -0400
commitb14dde0793e6639c74adea33f72cf38a0fad70fb (patch)
treeb202823aa67bb222904e1cec86ee39b758756d8d
parent32256ceb229073d27c5b05d7445bc92a7b8133c7 (diff)
Final cleanups to permission slices
- Add icons to the right and shortcut modes - Add color - Make sure dialogs are secure Test: manual Bug: 79960669 Change-Id: I6d251b0ea5bd3c1b3eed32b184e4aae22c52ffb5
-rw-r--r--core/java/android/app/slice/SliceProvider.java18
-rw-r--r--core/res/res/drawable/ic_arrow_forward.xml24
-rw-r--r--core/res/res/drawable/ic_permission.xml26
-rw-r--r--core/res/res/values/symbols.xml2
-rw-r--r--packages/SystemUI/AndroidManifest.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/SlicePermissionActivity.java6
6 files changed, 77 insertions, 1 deletions
diff --git a/core/java/android/app/slice/SliceProvider.java b/core/java/android/app/slice/SliceProvider.java
index 5e7584122dd6..4c22c94266d7 100644
--- a/core/java/android/app/slice/SliceProvider.java
+++ b/core/java/android/app/slice/SliceProvider.java
@@ -15,6 +15,8 @@
*/
package android.app.slice;
+import static android.app.slice.Slice.SUBTYPE_COLOR;
+
import android.annotation.NonNull;
import android.app.PendingIntent;
import android.content.ComponentName;
@@ -29,6 +31,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ProviderInfo;
import android.database.ContentObserver;
import android.database.Cursor;
+import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
@@ -39,6 +42,8 @@ import android.os.StrictMode;
import android.os.StrictMode.ThreadPolicy;
import android.util.ArraySet;
import android.util.Log;
+import android.util.TypedValue;
+import android.view.ContextThemeWrapper;
import java.util.ArrayList;
import java.util.Arrays;
@@ -472,12 +477,25 @@ public abstract class SliceProvider extends ContentProvider {
}
Slice.Builder parent = new Slice.Builder(sliceUri);
Slice.Builder childAction = new Slice.Builder(parent)
+ .addIcon(Icon.createWithResource(context,
+ com.android.internal.R.drawable.ic_permission), null,
+ Collections.emptyList())
.addHints(Arrays.asList(Slice.HINT_TITLE, Slice.HINT_SHORTCUT))
.addAction(action, new Slice.Builder(parent).build(), null);
+ TypedValue tv = new TypedValue();
+ new ContextThemeWrapper(context, android.R.style.Theme_DeviceDefault_Light)
+ .getTheme().resolveAttribute(android.R.attr.colorAccent, tv, true);
+ int deviceDefaultAccent = tv.data;
+
parent.addSubSlice(new Slice.Builder(sliceUri.buildUpon().appendPath("permission").build())
+ .addIcon(Icon.createWithResource(context,
+ com.android.internal.R.drawable.ic_arrow_forward), null,
+ Collections.emptyList())
.addText(getPermissionString(context, callingPackage), null,
Collections.emptyList())
+ .addInt(deviceDefaultAccent, SUBTYPE_COLOR,
+ Collections.emptyList())
.addSubSlice(childAction.build(), null)
.build(), null);
return parent.addHints(Arrays.asList(Slice.HINT_PERMISSION_REQUEST)).build();
diff --git a/core/res/res/drawable/ic_arrow_forward.xml b/core/res/res/drawable/ic_arrow_forward.xml
new file mode 100644
index 000000000000..f1085703ef13
--- /dev/null
+++ b/core/res/res/drawable/ic_arrow_forward.xml
@@ -0,0 +1,24 @@
+<!--
+ Copyright (C) 2018 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M12.0,4.0l-1.41,1.41L16.17,11.0L4.0,11.0l0.0,2.0l12.17,0.0l-5.58,5.59L12.0,20.0l8.0,-8.0z"/>
+</vector>
diff --git a/core/res/res/drawable/ic_permission.xml b/core/res/res/drawable/ic_permission.xml
new file mode 100644
index 000000000000..00523509fcae
--- /dev/null
+++ b/core/res/res/drawable/ic_permission.xml
@@ -0,0 +1,26 @@
+<!--
+ Copyright (C) 2018 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="16.0"
+ android:viewportHeight="16.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="
+ M9.0,12l-2.0,0.0l0.0,-2.0l2.0,0.0l0.0,2.0z
+ m0.0,-4.0l-2.0,0.0l0.0,-4.0l2.0,0.0l0.0,4.0z"/>
+</vector>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 770891184049..f7ff37738256 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3383,4 +3383,6 @@
<java-symbol type="string" name="battery_saver_description_with_learn_more" />
<java-symbol type="drawable" name="ic_lock_lockdown" />
+ <java-symbol type="drawable" name="ic_arrow_forward" />
+ <java-symbol type="drawable" name="ic_permission" />
</resources>
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 88edd12ab2f4..7871020a92aa 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -211,6 +211,8 @@
<!-- Permission necessary to change car audio volume through CarAudioManager -->
<uses-permission android:name="android.car.permission.CAR_CONTROL_AUDIO_VOLUME" />
+ <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" />
+
<application
android:name=".SystemUIApplication"
android:persistent="true"
diff --git a/packages/SystemUI/src/com/android/systemui/SlicePermissionActivity.java b/packages/SystemUI/src/com/android/systemui/SlicePermissionActivity.java
index 56cb88870d65..19f8416860a2 100644
--- a/packages/SystemUI/src/com/android/systemui/SlicePermissionActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/SlicePermissionActivity.java
@@ -14,6 +14,8 @@
package com.android.systemui;
+import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+
import android.app.Activity;
import android.app.AlertDialog;
import android.app.slice.SliceManager;
@@ -61,7 +63,9 @@ public class SlicePermissionActivity extends Activity implements OnClickListener
.setNegativeButton(R.string.slice_permission_deny, this)
.setPositiveButton(R.string.slice_permission_allow, this)
.setOnDismissListener(this)
- .show();
+ .create();
+ dialog.getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+ dialog.show();
TextView t1 = dialog.getWindow().getDecorView().findViewById(R.id.text1);
t1.setText(getString(R.string.slice_permission_text_1, app2));
TextView t2 = dialog.getWindow().getDecorView().findViewById(R.id.text2);