Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8c2eef7 authored by Joel Galenson's avatar Joel Galenson
Browse files

Add the recently used widget to the list of permissions.

This adds a widget that shows the three most recent permission usages
to the top of ManageStandardPermissions.

Bug: 63532550
Test: Open this screen, see widget, click to get to Permissions Hub.
Change-Id: Ia61619e347d68ef8d5b71336ba8ace5adbc69e2c
parent 1ce1a950
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -32,7 +32,8 @@ LOCAL_STATIC_ANDROID_LIBRARIES += \
    SettingsLibSettingsSpinner \
    SettingsLibLayoutPreference \
    SettingsLibActionButtonsPreference \
    SettingsLibBarChartPreference
    SettingsLibBarChartPreference \
    SettingsLibEntityHeaderWidgets

LOCAL_STATIC_JAVA_LIBRARIES := \
    androidx.annotation_annotation
+34 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2019 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.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <include layout="@layout/app_entities_header" />

    <View
        android:id="@+id/divider"
        android:layout_width="match_parent"
        android:layout_height=".75dp"
        android:layout_marginTop="@dimen/app_permission_divider_margin_top"
        android:layout_marginBottom="@dimen/app_permission_divider_margin_bottom"
        android:background="?android:attr/dividerHorizontal"/>

</LinearLayout>
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
@@ -126,6 +126,12 @@
    <!-- Summary of number of apps currently granted a single permission [CHAR LIMIT=45] -->
   <string name="app_permissions_group_summary"><xliff:g id="count" example="10">%1$d</xliff:g> of <xliff:g id="count" example="10">%2$d</xliff:g> apps allowed</string>

    <!-- The header for the widget showing recent permission usage [CHAR LIMIT=50] -->
    <string name="permission_usage_header">Recent usage</string>

    <!-- The button to bring the user to view the details of recent permission accesses [CHAR LIMIT=30] -->
    <string name="permission_usage_view_details">View details</string>

   <!-- [CHAR LIMIT=NONE] Menu for manage permissions to control whether system apps are shown -->
   <string name="menu_show_system">Show system</string>
   <!-- [CHAR LIMIT=NONE] Menu for manage permissions to control whether system apps are hidden -->
+4 −0
Original line number Diff line number Diff line
@@ -169,6 +169,10 @@ public class AppPermissionUsageFragment extends SettingsWithButtonHeader {
                continue;
            }
            final AppPermissionGroup group = groupUsage.getGroup();
            // STOPSHIP: Ignore {READ,WRITE}_EXTERNAL_STORAGE since they're going away.
            if (group.getLabel().equals("Storage")) {
                continue;
            }
            Preference pref = new PermissionControlPreference(context, group);
            pref.setTitle(groupUsage.getGroup().getLabel());
            if (groupUsage.getAccessDuration() == 0) {
+1 −1
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ public final class AppPermissionsFragment extends SettingsWithButtonHeader {
            preference.setTitle(group.getLabel());
            String timeDiffStr = Utils.getLastUsageString(context,
                    PermissionUsages.loadLastGroupUsage(context, group));
            // Ignore {READ,WRITE}_EXTERNAL_STORAGE since they're going away.
            // STOPSHIP: Ignore {READ,WRITE}_EXTERNAL_STORAGE since they're going away.
            if (timeDiffStr != null && !group.getLabel().equals("Storage")) {
                preference.setSummary(
                        context.getString(R.string.app_permission_most_recent_summary,
Loading