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

Commit f1514a0c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add confirmation message for assistant."

parents ea58574d ff327d12
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -551,9 +551,12 @@
    <!-- Summary indicating that a home app is missing work profile support [CHAR LIMIT=60] -->
    <string name="home_missing_work_profile_support">Doesn\u2019t support work profile</string>

    <!-- Dialog body explaining that the app just selected by the user will not work after a reboot until the user enters their credentials, such as a PIN or password. [CHAR LIMIT=NONE] -->
    <!-- Dialog message explaining that the app just selected by the user will not work after a reboot until the user enters their credentials, such as a PIN or password. [CHAR LIMIT=NONE] -->
    <string name="encryption_unaware_confirmation_message">Note: If you restart your device and have a screen lock set, this app can\u2019t start until you unlock your device.</string>

    <!-- Dialog message warning about security implications of setting an assistant, displayed when the user selects an assistant. [CHAR_LIMIT=NONE] -->
    <string name="assistant_confirmation_message">The assistant will be able to read information about apps in use on your system, including information visible on your screen or accessible within the apps.</string>

    <!-- Name for the notification channel for incident / bug report confirmation
    [CHAR LIMIT=50] -->
    <string name="incident_report_channel_name">Share Debugging Data</string>
+11 −5
Original line number Diff line number Diff line
@@ -16,9 +16,6 @@

package com.android.packageinstaller.role.model;

import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
import static org.xmlpull.v1.XmlPullParser.START_TAG;

import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
@@ -38,6 +35,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.packageinstaller.role.utils.UserUtils;
import com.android.permissioncontroller.R;

import org.xmlpull.v1.XmlPullParserException;

@@ -50,6 +48,7 @@ import java.util.Set;
 * Class for behavior of the assistant role.
 */
public class AssistantRoleBehavior implements RoleBehavior {

    private static final Intent ASSIST_SERVICE_PROBE =
            new Intent(VoiceInteractionService.SERVICE_INTERFACE);
    private static final Intent ASSIST_ACTIVITY_PROBE = new Intent(Intent.ACTION_ASSIST);
@@ -75,6 +74,13 @@ public class AssistantRoleBehavior implements RoleBehavior {
        return new Intent(Settings.ACTION_VOICE_INPUT_SETTINGS);
    }

    @Nullable
    @Override
    public CharSequence getConfirmationMessage(@NonNull Role role, @NonNull String packageName,
            @NonNull Context context) {
        return context.getString(R.string.assistant_confirmation_message);
    }

    @Nullable
    @Override
    public List<String> getQualifyingPackagesAsUser(@NonNull Role role, @NonNull UserHandle user,
@@ -113,7 +119,7 @@ public class AssistantRoleBehavior implements RoleBehavior {

        Intent pkgServiceProbe = new Intent(ASSIST_SERVICE_PROBE).setPackage(packageName);
        List<ResolveInfo> services = pm.queryIntentServices(pkgServiceProbe,
                PackageManager.MATCH_DEFAULT_ONLY);
                PackageManager.GET_META_DATA);

        int numServices = services.size();
        for (int i = 0; i < numServices; i++) {
@@ -144,7 +150,7 @@ public class AssistantRoleBehavior implements RoleBehavior {
            int type;
            do {
                type = parser.next();
            } while (type != END_DOCUMENT && type != START_TAG);
            } while (type != XmlResourceParser.END_DOCUMENT && type != XmlResourceParser.START_TAG);

            String sessionService = null;
            String recognitionService = null;