summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PermissionController.mk1
-rw-r--r--res/drawable/ic_delete.xml31
-rw-r--r--res/drawable/ic_force_stop.xml31
-rw-r--r--res/drawable/ic_open.xml25
-rw-r--r--res/layout/app_permission.xml2
-rw-r--r--res/layout/header_large.xml (renamed from res/layout/button_header.xml)7
-rw-r--r--res/values/strings.xml9
-rw-r--r--src/com/android/packageinstaller/permission/ui/handheld/AppPermissionFragment.java6
-rw-r--r--src/com/android/packageinstaller/permission/ui/handheld/AppPermissionUsageFragment.java4
-rw-r--r--src/com/android/packageinstaller/permission/ui/handheld/AppPermissionsFragment.java17
-rw-r--r--src/com/android/packageinstaller/permission/ui/handheld/PermissionUsageFragment.java4
-rw-r--r--src/com/android/packageinstaller/permission/ui/handheld/SettingsWithLargeHeader.java (renamed from src/com/android/packageinstaller/permission/ui/handheld/SettingsWithButtonHeader.java)53
12 files changed, 31 insertions, 159 deletions
diff --git a/PermissionController.mk b/PermissionController.mk
index f6aa9869..6ecd5eb8 100644
--- a/PermissionController.mk
+++ b/PermissionController.mk
@@ -32,7 +32,6 @@ LOCAL_STATIC_ANDROID_LIBRARIES += \
SettingsLibSearchWidget \
SettingsLibSettingsSpinner \
SettingsLibLayoutPreference \
- SettingsLibActionButtonsPreference \
SettingsLibBarChartPreference \
SettingsLibActionBarShadow \
SettingsLibProgressBar
diff --git a/res/drawable/ic_delete.xml b/res/drawable/ic_delete.xml
deleted file mode 100644
index 84e8982c..00000000
--- a/res/drawable/ic_delete.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
- 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="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path
- android:fillColor="#FF000000"
- android:pathData="M15,4V3H9v1H4v2h1v13c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2V6h1V4H15zM17,19H7V6h10V19z"/>
- <path
- android:fillColor="#FF000000"
- android:pathData="M9,8h2v9h-2z"/>
- <path
- android:fillColor="#FF000000"
- android:pathData="M13,8h2v9h-2z"/>
-</vector> \ No newline at end of file
diff --git a/res/drawable/ic_force_stop.xml b/res/drawable/ic_force_stop.xml
deleted file mode 100644
index ca9f02f3..00000000
--- a/res/drawable/ic_force_stop.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
- 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="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path
- android:fillColor="#FF000000"
- android:pathData="M12,5.99L19.53,19H4.47L12,5.99M12,2L1,21h22L12,2L12,2z"/>
- <path
- android:fillColor="#FF000000"
- android:pathData="M13,16l-2,0l0,2l2,0l0,-2z"/>
- <path
- android:fillColor="#FF000000"
- android:pathData="M13,10l-2,0l0,4l2,0l0,-4z"/>
-</vector> \ No newline at end of file
diff --git a/res/drawable/ic_open.xml b/res/drawable/ic_open.xml
deleted file mode 100644
index 81ad64d6..00000000
--- a/res/drawable/ic_open.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
- 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="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
- <path
- android:fillColor="#FF000000"
- android:pathData="M19,19H5V5h7V3H5C3.89,3 3,3.9 3,5v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2V19zM14,3v2h3.59l-9.83,9.83l1.41,1.41L19,6.41V10h2V3H14z"/>
-</vector> \ No newline at end of file
diff --git a/res/layout/app_permission.xml b/res/layout/app_permission.xml
index c6e98768..930e3091 100644
--- a/res/layout/app_permission.xml
+++ b/res/layout/app_permission.xml
@@ -33,7 +33,7 @@
android:layout_height="wrap_content"
android:orientation="vertical">
- <include layout="@layout/button_header" />
+ <include layout="@layout/header_large" />
<LinearLayout
android:layout_width="match_parent"
diff --git a/res/layout/button_header.xml b/res/layout/header_large.xml
index ccad937a..568a97c5 100644
--- a/res/layout/button_header.xml
+++ b/res/layout/header_large.xml
@@ -36,11 +36,4 @@
android:layout_height=".75dp"
android:background="?android:attr/dividerHorizontal"/>
- <include layout="@layout/settings_action_buttons" />
-
- <View
- android:layout_width="match_parent"
- android:layout_height=".75dp"
- android:background="?android:attr/dividerHorizontal"/>
-
</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 55d38a89..10f0494f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -468,15 +468,6 @@
<!-- Label when no apps have been denied a given permission [CHAR LIMIT=none] -->
<string name="no_apps_denied">No apps denied</string>
- <!-- Label for button that allows user to launch the app [CHAR LIMIT=25] -->
- <string name="launch_app">Open</string>
-
- <!-- Label for button that allows user to uninstall the app [CHAR LIMIT=25] -->
- <string name="uninstall_app">Uninstall</string>
-
- <!-- Label for button that allows user to force stop the app [CHAR LIMIT=25] -->
- <string name="force_stop_app">Force stop</string>
-
<!-- Label for button that opens up the Settings [CHAR LIMIT=20] -->
<string name="settings">Settings</string>
diff --git a/src/com/android/packageinstaller/permission/ui/handheld/AppPermissionFragment.java b/src/com/android/packageinstaller/permission/ui/handheld/AppPermissionFragment.java
index 5bfc5dcd..7fe7d037 100644
--- a/src/com/android/packageinstaller/permission/ui/handheld/AppPermissionFragment.java
+++ b/src/com/android/packageinstaller/permission/ui/handheld/AppPermissionFragment.java
@@ -71,7 +71,7 @@ import java.util.List;
*
* <p>Allows the user to control whether the app is granted the permission.
*/
-public class AppPermissionFragment extends SettingsWithButtonHeader {
+public class AppPermissionFragment extends SettingsWithLargeHeader {
private static final String LOG_TAG = "AppPermissionFragment";
@Retention(SOURCE)
@@ -178,8 +178,8 @@ public class AppPermissionFragment extends SettingsWithButtonHeader {
}
String appLabel = Utils.getFullAppLabel(mGroup.getApp().applicationInfo, context);
- setHeader(getAppIcon(), appLabel, true);
- updateHeader(root.requireViewById(R.id.button_header), true);
+ setHeader(getAppIcon(), appLabel, null);
+ updateHeader(root.requireViewById(R.id.button_header));
((TextView) root.requireViewById(R.id.permission_message)).setText(
context.getString(R.string.app_permission_header, mGroup.getLabel(), appLabel));
diff --git a/src/com/android/packageinstaller/permission/ui/handheld/AppPermissionUsageFragment.java b/src/com/android/packageinstaller/permission/ui/handheld/AppPermissionUsageFragment.java
index b0d5c296..923b6f90 100644
--- a/src/com/android/packageinstaller/permission/ui/handheld/AppPermissionUsageFragment.java
+++ b/src/com/android/packageinstaller/permission/ui/handheld/AppPermissionUsageFragment.java
@@ -57,7 +57,7 @@ import java.util.List;
* <p>Shows a list of app usage of permission groups, each of which links to
* AppPermissionsFragment.
*/
-public class AppPermissionUsageFragment extends SettingsWithButtonHeader implements
+public class AppPermissionUsageFragment extends SettingsWithLargeHeader implements
OnItemSelectedListener {
private static final String LOG_TAG = "AppPermissionUsageFragment";
@@ -154,7 +154,7 @@ public class AppPermissionUsageFragment extends SettingsWithButtonHeader impleme
return;
}
Drawable icon = Utils.getBadgedIcon(getActivity(), mAppInfo);
- setHeader(icon, Utils.getFullAppLabel(mAppInfo, getContext()), true);
+ setHeader(icon, Utils.getFullAppLabel(mAppInfo, getContext()), null);
}
@Override
diff --git a/src/com/android/packageinstaller/permission/ui/handheld/AppPermissionsFragment.java b/src/com/android/packageinstaller/permission/ui/handheld/AppPermissionsFragment.java
index 4c6f52e6..bb7eff79 100644
--- a/src/com/android/packageinstaller/permission/ui/handheld/AppPermissionsFragment.java
+++ b/src/com/android/packageinstaller/permission/ui/handheld/AppPermissionsFragment.java
@@ -24,8 +24,10 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
+import android.net.Uri;
import android.os.Bundle;
import android.os.UserHandle;
+import android.provider.Settings;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
@@ -54,7 +56,7 @@ import java.util.ArrayList;
*
* <p>Shows the list of permission groups the app has requested at one permission for.
*/
-public final class AppPermissionsFragment extends SettingsWithButtonHeader {
+public final class AppPermissionsFragment extends SettingsWithLargeHeader {
private static final String LOG_TAG = "ManagePermsFragment";
@@ -165,12 +167,17 @@ public final class AppPermissionsFragment extends SettingsWithButtonHeader {
.commit();
}
- private static void bindUi(SettingsWithButtonHeader fragment, PackageInfo packageInfo) {
+ private static void bindUi(SettingsWithLargeHeader fragment, PackageInfo packageInfo) {
Activity activity = fragment.getActivity();
ApplicationInfo appInfo = packageInfo.applicationInfo;
+ Intent infoIntent = null;
+ if (!activity.getIntent().getBooleanExtra(EXTRA_HIDE_INFO_BUTTON, false)) {
+ infoIntent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
+ .setData(Uri.fromParts("package", packageInfo.packageName, null));
+ }
Drawable icon = Utils.getBadgedIcon(activity, appInfo);
- fragment.setHeader(icon, Utils.getFullAppLabel(appInfo, activity), true);
+ fragment.setHeader(icon, Utils.getFullAppLabel(appInfo, activity), infoIntent);
ActionBar ab = activity.getActionBar();
if (ab != null) {
@@ -323,14 +330,14 @@ public final class AppPermissionsFragment extends SettingsWithButtonHeader {
/**
* Class that shows additional permissions.
*/
- public static class AdditionalPermissionsFragment extends SettingsWithButtonHeader {
+ public static class AdditionalPermissionsFragment extends SettingsWithLargeHeader {
AppPermissionsFragment mOuterFragment;
@Override
public void onCreate(Bundle savedInstanceState) {
mOuterFragment = (AppPermissionsFragment) getTargetFragment();
super.onCreate(savedInstanceState);
- setHeader(mOuterFragment.mIcon, mOuterFragment.mLabel, true);
+ setHeader(mOuterFragment.mIcon, mOuterFragment.mLabel, null);
setHasOptionsMenu(true);
setPreferenceScreen(mOuterFragment.mExtraScreen);
}
diff --git a/src/com/android/packageinstaller/permission/ui/handheld/PermissionUsageFragment.java b/src/com/android/packageinstaller/permission/ui/handheld/PermissionUsageFragment.java
index 5b77abdb..b3929d7d 100644
--- a/src/com/android/packageinstaller/permission/ui/handheld/PermissionUsageFragment.java
+++ b/src/com/android/packageinstaller/permission/ui/handheld/PermissionUsageFragment.java
@@ -76,7 +76,7 @@ import java.util.Set;
* <p>Shows a filterable list of app usage of permission groups, each of which links to
* AppPermissionsFragment.
*/
-public class PermissionUsageFragment extends SettingsWithButtonHeader implements
+public class PermissionUsageFragment extends SettingsWithLargeHeader implements
PermissionUsages.PermissionsUsagesChangeCallback, OnItemSelectedListener {
private static final String LOG_TAG = "PermissionUsageFragment";
@@ -429,7 +429,7 @@ public class PermissionUsageFragment extends SettingsWithButtonHeader implements
setHeader(Utils.applyTint(context, context.getDrawable(group.getIconResId()),
android.R.attr.colorControlNormal),
context.getString(R.string.app_permission_usage_filter_label,
- group.getLabel()), false);
+ group.getLabel()), null);
setSummary(context.getString(R.string.app_permission_usage_remove_filter), v -> {
mFilterGroup = null;
// We already loaded all data, so don't reload
diff --git a/src/com/android/packageinstaller/permission/ui/handheld/SettingsWithButtonHeader.java b/src/com/android/packageinstaller/permission/ui/handheld/SettingsWithLargeHeader.java
index d7b08755..85bffd9e 100644
--- a/src/com/android/packageinstaller/permission/ui/handheld/SettingsWithButtonHeader.java
+++ b/src/com/android/packageinstaller/permission/ui/handheld/SettingsWithLargeHeader.java
@@ -16,16 +16,15 @@
package com.android.packageinstaller.permission.ui.handheld;
+import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
-import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -33,11 +32,12 @@ import com.android.packageinstaller.DeviceUtils;
import com.android.permissioncontroller.R;
/**
- * A class that contains a header with a row of buttons.
+ * A class that contains a header.
*/
-public abstract class SettingsWithButtonHeader extends PermissionsFrameFragment {
+public abstract class SettingsWithLargeHeader extends PermissionsFrameFragment {
private View mHeader;
+ protected Intent mInfoIntent;
protected Drawable mIcon;
protected CharSequence mLabel;
@@ -47,7 +47,7 @@ public abstract class SettingsWithButtonHeader extends PermissionsFrameFragment
ViewGroup root = (ViewGroup) super.onCreateView(inflater, container, savedInstanceState);
if (!DeviceUtils.isTelevision(getContext())) {
- mHeader = inflater.inflate(R.layout.button_header, root, false);
+ mHeader = inflater.inflate(R.layout.header_large, root, false);
getPreferencesContainer().addView(mHeader, 0);
}
@@ -59,22 +59,22 @@ public abstract class SettingsWithButtonHeader extends PermissionsFrameFragment
*
* @param icon the icon
* @param label the label
- * @param showButtons whether to show the app action buttons
+ * @param infoIntent the intent to show on click
*/
public void setHeader(@NonNull Drawable icon, @NonNull CharSequence label,
- boolean showButtons) {
+ Intent infoIntent) {
mIcon = icon;
mLabel = label;
- updateHeader(mHeader, showButtons);
+ mInfoIntent = infoIntent;
+ updateHeader(mHeader);
}
/**
- * Updates the header to use the correct icon, title, and buttons.
+ * Updates the header to use the correct icon and title.
*
* @param header the View that contains the components.
- * @param showButtons whether to show the app action buttons
*/
- protected void updateHeader(@NonNull View header, boolean showButtons) {
+ protected void updateHeader(@NonNull View header) {
if (header != null) {
header.setVisibility(View.VISIBLE);
@@ -87,32 +87,6 @@ public abstract class SettingsWithButtonHeader extends PermissionsFrameFragment
header.requireViewById(R.id.entity_header_summary).setVisibility(View.GONE);
header.requireViewById(R.id.entity_header_second_summary).setVisibility(View.GONE);
header.requireViewById(R.id.header_link).setVisibility(View.GONE);
-
- if (showButtons) {
- Button button1 = header.requireViewById(R.id.button1);
- button1.setText(R.string.launch_app);
- setButtonIcon(button1, R.drawable.ic_open);
- button1.setVisibility(View.VISIBLE);
- button1.setEnabled(false);
-
- Button button2 = header.requireViewById(R.id.button2);
- button2.setText(R.string.uninstall_app);
- setButtonIcon(button2, R.drawable.ic_delete);
- button2.setVisibility(View.VISIBLE);
- button2.setEnabled(false);
-
- Button button3 = header.requireViewById(R.id.button3);
- button3.setText(R.string.force_stop_app);
- setButtonIcon(button3, R.drawable.ic_force_stop);
- button3.setVisibility(View.VISIBLE);
- button3.setEnabled(false);
- } else {
- header.requireViewById(R.id.button1).setVisibility(View.GONE);
- header.requireViewById(R.id.button2).setVisibility(View.GONE);
- header.requireViewById(R.id.button3).setVisibility(View.GONE);
- }
-
- header.requireViewById(R.id.button4).setVisibility(View.GONE);
}
}
@@ -137,9 +111,4 @@ public abstract class SettingsWithButtonHeader extends PermissionsFrameFragment
summaryView.setOnClickListener(listener);
}
}
-
- private void setButtonIcon(@NonNull Button button, @DrawableRes int iconResId) {
- button.setCompoundDrawablesWithIntrinsicBounds(null, getContext().getDrawable(iconResId),
- null, null);
- }
}