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

Commit 03729e78 authored by Joel Galenson's avatar Joel Galenson
Browse files

Make links to Permissions Hub only show last day.

Default to showing only the last day of accesses.

Also fix a bug caused by the API changing from seconds to
milliseconds.

Test: Click links and see correct filter.
Change-Id: I8456723a434c7144e9115e1834f48d3c1da24d4b
parent d3be3630
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@
 */
package com.android.settings.location;

import static java.util.concurrent.TimeUnit.DAYS;

import android.Manifest;
import android.content.Context;
import android.content.Intent;
@@ -74,6 +76,7 @@ public class RecentLocationAccessPreferenceController extends AbstractPreference
                    final Intent intent = new Intent(Intent.ACTION_REVIEW_PERMISSION_USAGE);
                    intent.putExtra(Intent.EXTRA_PERMISSION_NAME,
                            Manifest.permission.ACCESS_FINE_LOCATION);
                    intent.putExtra(Intent.EXTRA_DURATION_MILLIS, DAYS.toMillis(1));
                    mContext.startActivity(intent);
                });
    }
+2 −1
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ public class PermissionBarChartPreferenceController extends BasePreferenceContro
                .setEmptyText(R.string.permission_bar_chart_empty_text)
                .setDetailsOnClickListener((View v) -> {
                    final Intent intent = new Intent(Intent.ACTION_REVIEW_PERMISSION_USAGE);
                    intent.putExtra(Intent.EXTRA_DURATION_MILLIS, DAYS.toMillis(1));
                    mContext.startActivity(intent);
                })
                .build();
@@ -102,7 +103,7 @@ public class PermissionBarChartPreferenceController extends BasePreferenceContro

    private void retrievePermissionUsageData() {
        mContext.getSystemService(PermissionControllerManager.class).getPermissionUsages(
                false /* countSystem */, (int) DAYS.toSeconds(1),
                false /* countSystem */, (int) DAYS.toMillis(1),
                mContext.getMainExecutor() /* executor */, this /* callback */);
    }