Skip to content
Snippets Groups Projects
Commit ec96cc3e authored by Kiran S's avatar Kiran S
Browse files

Restrict USB poups while setup is in progress

Test: Cherry pick of http://ag/27094197
Bug: 294105066
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:2ce2e54a040342373e401f9c2e70035ede4e63ad)
Merged-In: I7d54534696fd73f3b94c5b4250142eed9341c5d8
Merged-In: I7de666b9c807f0458bf0df291bab4da2cb98f886
Change-Id: I7d54534696fd73f3b94c5b4250142eed9341c5d8
parent 9ebd148a
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,8 @@
package com.android.server.usb;
import static android.provider.Settings.Secure.USER_SETUP_COMPLETE;
import static com.android.internal.app.IntentForwarderActivity.FORWARD_INTENT_TO_MANAGED_PROFILE;
import android.annotation.NonNull;
......@@ -42,6 +44,7 @@ import android.os.AsyncTask;
import android.os.Environment;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.service.usb.UsbProfileGroupSettingsManagerProto;
import android.service.usb.UsbSettingsAccessoryPreferenceProto;
import android.service.usb.UsbSettingsDevicePreferenceProto;
......@@ -908,10 +911,28 @@ class UsbProfileGroupSettingsManager {
return;
}
if (shouldRestrictOverlayActivities()) {
return;
}
// Start activity with registered intent
resolveActivity(intent, matches, defaultActivity, device, null);
}
private boolean shouldRestrictOverlayActivities() {
if (Settings.Secure.getIntForUser(
mContext.getContentResolver(),
USER_SETUP_COMPLETE,
/* defaultValue= */ 1,
UserHandle.CURRENT.getIdentifier())
== 0) {
Slog.d(TAG, "restricting usb overlay activities as setup is not complete");
return true;
}
return false;
}
public void deviceAttachedForFixedHandler(UsbDevice device, ComponentName component) {
final Intent intent = createDeviceAttachedIntent(device);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment