Compare commits
No commits in common. "684e5a035078c0abb8b6fb7f147f7dbcc67f28ac" and "6b18f2c355c06663479e13bf8adc8061588bf20f" have entirely different histories.
684e5a0350
...
6b18f2c355
1 changed files with 17 additions and 32 deletions
|
@ -18,7 +18,6 @@ import android.os.RemoteException;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -92,8 +91,6 @@ public class DummyActivity extends Activity {
|
||||||
private static final int REQUEST_PERMISSION_EXTERNAL_STORAGE= 2;
|
private static final int REQUEST_PERMISSION_EXTERNAL_STORAGE= 2;
|
||||||
private static final int REQUEST_PERMISSION_POST_NOTIFICATIONS = 3;
|
private static final int REQUEST_PERMISSION_POST_NOTIFICATIONS = 3;
|
||||||
|
|
||||||
private static boolean sHasRequestedPermission = false;
|
|
||||||
|
|
||||||
// A state variable to record the last time DummyActivity was informed that someone
|
// A state variable to record the last time DummyActivity was informed that someone
|
||||||
// in the same process needs to call an action without signature
|
// in the same process needs to call an action without signature
|
||||||
// Since they must be in the same process as DummyActivity, it will be totally fine
|
// Since they must be in the same process as DummyActivity, it will be totally fine
|
||||||
|
@ -136,16 +133,11 @@ public class DummyActivity extends Activity {
|
||||||
Utility.enforceUserRestrictions(this);
|
Utility.enforceUserRestrictions(this);
|
||||||
SettingsManager.getInstance().applyAll();
|
SettingsManager.getInstance().applyAll();
|
||||||
|
|
||||||
synchronized (DummyActivity.class) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
// Do not show permission dialog during finalization -- it will conflict with the provisioning UI
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && !sHasRequestedPermission
|
|
||||||
&& !FINALIZE_PROVISION.equals(getIntent().getAction())) {
|
|
||||||
// Avoid requesting permission multiple times in one session
|
|
||||||
// This also prevents multiple instances of DummyActivity from being blocked on each other
|
|
||||||
sHasRequestedPermission = true;
|
|
||||||
// We pretty much only send notifications to keep the process inside work profile alive
|
// We pretty much only send notifications to keep the process inside work profile alive
|
||||||
// as such, only request the notification permission from inside the profile
|
// as such, only request the notification permission from inside the profile
|
||||||
// This will ideally be shown and done when the user sees the app list UI for the first time
|
// This will ideally be shown and done when finalizing the profile (since it will go
|
||||||
|
// through this activity)
|
||||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS)
|
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS)
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
requestPermissions(new String[]{Manifest.permission.POST_NOTIFICATIONS}, REQUEST_PERMISSION_POST_NOTIFICATIONS);
|
requestPermissions(new String[]{Manifest.permission.POST_NOTIFICATIONS}, REQUEST_PERMISSION_POST_NOTIFICATIONS);
|
||||||
|
@ -154,7 +146,6 @@ public class DummyActivity extends Activity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -257,11 +248,6 @@ public class DummyActivity extends Activity {
|
||||||
|
|
||||||
private void actionFinalizeProvision() {
|
private void actionFinalizeProvision() {
|
||||||
if (mIsProfileOwner) {
|
if (mIsProfileOwner) {
|
||||||
// Only notify the main profile on pre-Oreo
|
|
||||||
// After Oreo, since we use the activity-based finalization flow,
|
|
||||||
// the setup wizard will wait until we finish finalization before returning
|
|
||||||
// (Note: the actual finalization is done by common code in onCreate)
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
|
||||||
// This is the action used by DeviceAdminReceiver to finalize the setup
|
// This is the action used by DeviceAdminReceiver to finalize the setup
|
||||||
// The work has been finished in onCreate(), now we just have to
|
// The work has been finished in onCreate(), now we just have to
|
||||||
// inform the main profile about this
|
// inform the main profile about this
|
||||||
|
@ -269,7 +255,6 @@ public class DummyActivity extends Activity {
|
||||||
// We don't need signature for this intent
|
// We don't need signature for this intent
|
||||||
Utility.transferIntentToProfileUnsigned(this, intent);
|
Utility.transferIntentToProfileUnsigned(this, intent);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
// Set the flag telling MainActivity that we have now finished provisioning
|
// Set the flag telling MainActivity that we have now finished provisioning
|
||||||
|
|
Loading…
Add table
Reference in a new issue