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

Commit d59f3670 authored by Roman Birg's avatar Roman Birg
Browse files

framework: don't allow assist activities while not provisioned



Ticket: CYNGNOS-3233

Change-Id: I40dae6b6fd1da497024965469fea0adc78a661c3
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 0d928141
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -957,6 +957,15 @@ public final class ActivityStackSupervisor implements DisplayListener {
                return ActivityManager.START_CANCELED;
            }

            if (intent.getAction() != null && !isProvisioned()) {
                switch (intent.getAction()) {
                    case Intent.ACTION_PROCESS_TEXT:
                    case Intent.ACTION_ASSIST:
                    case Intent.ACTION_VOICE_ASSIST:
                        Slog.w(TAG, "not starting assist intent while not provisioned");
                        return ActivityManager.START_NOT_CURRENT_USER_ACTIVITY;
                }
            }
            try {
                //TODO: This needs to be a flushed out API in the future.
                boolean isProtected = intent.getComponent() != null
@@ -4677,4 +4686,9 @@ public final class ActivityStackSupervisor implements DisplayListener {

        return onLeanbackOnly;
    }

    private boolean isProvisioned() {
        return Settings.Global.getInt(mService.mContext.getContentResolver(),
                Settings.Global.DEVICE_PROVISIONED, 0) == 1;
    }
}