aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-11-12 08:31:33 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-11-12 08:31:33 +0000
commit64ebc3136954f5c902a947df0a1d937ce296339f (patch)
tree2e44eae62e428ad33bab5a5f1fe165b788d8b55e
parent7012495833eb8d13b78f3931f4ea0dfa380b4d63 (diff)
parentc2cea36857ad8ac7de989869f3b79dbb98780de3 (diff)
downloadexperimental-64ebc3136954f5c902a947df0a1d937ce296339f.tar.gz
Snap for 4447680 from c2cea36857ad8ac7de989869f3b79dbb98780de3 to pi-release
Change-Id: Ieddfb3bc0af81a67bea74e6c5c356168e4b389b1
-rw-r--r--SlicesApp/res/layout/activity_layout.xml6
-rw-r--r--SlicesApp/src/com/android/experimental/slicesapp/SlicesActivity.java8
2 files changed, 14 insertions, 0 deletions
diff --git a/SlicesApp/res/layout/activity_layout.xml b/SlicesApp/res/layout/activity_layout.xml
index d57f605..7ad0cfe 100644
--- a/SlicesApp/res/layout/activity_layout.xml
+++ b/SlicesApp/res/layout/activity_layout.xml
@@ -58,6 +58,12 @@
</LinearLayout>
+ <Button
+ android:id="@+id/auth"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Auth-everything"/>
+
<Spinner
android:id="@+id/spinner"
android:layout_width="wrap_content"
diff --git a/SlicesApp/src/com/android/experimental/slicesapp/SlicesActivity.java b/SlicesApp/src/com/android/experimental/slicesapp/SlicesActivity.java
index 1690f6b..42f4cb8 100644
--- a/SlicesApp/src/com/android/experimental/slicesapp/SlicesActivity.java
+++ b/SlicesApp/src/com/android/experimental/slicesapp/SlicesActivity.java
@@ -17,7 +17,9 @@ package com.android.experimental.slicesapp;
import android.app.Activity;
import android.app.slice.widget.SliceView;
import android.content.ContentResolver;
+import android.content.Intent;
import android.content.SharedPreferences;
+import android.content.pm.ApplicationInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -64,6 +66,12 @@ public class SlicesActivity extends Activity {
updateState();
getContentResolver().notifyChange(getUri(), null);
});
+ findViewById(R.id.auth).setOnClickListener(v -> {
+ List<ApplicationInfo> packages = getPackageManager().getInstalledApplications(0);
+ packages.forEach(info -> grantUriPermission(info.packageName, getUri(),
+ Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
+ | Intent.FLAG_GRANT_WRITE_URI_PERMISSION));
+ });
Spinner spinner = findViewById(R.id.spinner);
List<String> list = new ArrayList<>();