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

Commit 1d9ecae3 authored by vadimt's avatar vadimt
Browse files

Using an official API for opening DWB properties of a task

Bug: 118319143
Test: Manual
Change-Id: Icd0851787e08f2ce06c4fc33048f8a632903476a
parent 206b8bcc
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.quickstep.views;

import static android.provider.Settings.ACTION_APP_USAGE_SETTINGS;

import android.app.ActivityOptions;
import android.content.ActivityNotFoundException;
import android.content.Context;
@@ -47,6 +49,8 @@ import java.time.Duration;
import java.util.Locale;

public final class DigitalWellBeingToast extends LinearLayout {
    static final Intent OPEN_APP_USAGE_SETTINGS_TEMPLATE = new Intent(ACTION_APP_USAGE_SETTINGS);

    public interface InitializeCallback {
        void call(float saturation, String contentDescription);
    }
@@ -189,7 +193,7 @@ public final class DigitalWellBeingToast extends LinearLayout {
    }

    public void openAppUsageSettings() {
        final Intent intent = new Intent(TaskView.SEE_TIME_IN_APP_TEMPLATE)
        final Intent intent = new Intent(OPEN_APP_USAGE_SETTINGS_TEMPLATE)
                .putExtra(Intent.EXTRA_PACKAGE_NAME,
                        mTask.getTopComponent().getPackageName()).addFlags(
                        Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+0 −3
Original line number Diff line number Diff line
@@ -133,9 +133,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
                }
            };

    static final Intent SEE_TIME_IN_APP_TEMPLATE =
            new Intent("com.android.settings.action.TIME_SPENT_IN_APP");

    private final OnAttachStateChangeListener mTaskMenuStateListener =
            new OnAttachStateChangeListener() {
                @Override