Create managed profile setup flow
Change-Id: I42f8255bea3c7126526430b28c384538fa204c28
This commit is contained in:
committed by
Michael Bestas
parent
8813787d3f
commit
c9359bfe37
37
res/raw/lineage_wizard_script_managed_profile.xml
Normal file
37
res/raw/lineage_wizard_script_managed_profile.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright (C) 2016 The CyanogenMod Project
|
||||
Copyright (C) 2021 The Calyx Institute
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<WizardScript xmlns:wizard="http://schemas.android.com/apk/res/com.google.android.setupwizard"
|
||||
wizard:firstAction="welcome">
|
||||
|
||||
<WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_WELCOME;end" id="welcome">
|
||||
<result wizard:action="restore" />
|
||||
</WizardAction>
|
||||
|
||||
<WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_RESTORE_BACKUP;end" id="restore">
|
||||
<result wizard:action="finish" />
|
||||
</WizardAction>
|
||||
|
||||
<WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_SETUP_COMPLETE;end" id="finish">
|
||||
<result wizard:action="exit" />
|
||||
</WizardAction>
|
||||
|
||||
<WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.EXIT;end" id="exit" />
|
||||
|
||||
</WizardScript>
|
@@ -21,6 +21,7 @@
|
||||
|
||||
<string name="lineage_wizard_script_uri" translatable="false">android.resource://org.lineageos.setupwizard/raw/lineage_wizard_script</string>
|
||||
<string name="lineage_wizard_script_user_uri" translatable="false">android.resource://org.lineageos.setupwizard/raw/lineage_wizard_script_user</string>
|
||||
<string name="lineage_wizard_script_managed_profile_uri" translatable="false">android.resource://org.lineageos.setupwizard/raw/lineage_wizard_script_managed_profile</string>
|
||||
|
||||
<string name="activity_label_empty" />
|
||||
|
||||
|
@@ -26,6 +26,7 @@ import static org.lineageos.setupwizard.SetupWizardApp.LOGV;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
@@ -54,6 +55,9 @@ public class SetupWizardActivity extends BaseSetupWizardActivity {
|
||||
Intent intent = new Intent(ACTION_LOAD);
|
||||
if (isPrimaryUser()) {
|
||||
intent.putExtra(EXTRA_SCRIPT_URI, getString(R.string.lineage_wizard_script_uri));
|
||||
} else if (getSystemService(UserManager.class).isManagedProfile()) {
|
||||
intent.putExtra(EXTRA_SCRIPT_URI, getString(
|
||||
R.string.lineage_wizard_script_managed_profile_uri));
|
||||
} else {
|
||||
intent.putExtra(EXTRA_SCRIPT_URI,
|
||||
getString(R.string.lineage_wizard_script_user_uri));
|
||||
|
@@ -24,6 +24,7 @@ import static org.lineageos.setupwizard.SetupWizardApp.LOGV;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserManager;
|
||||
import android.util.Log;
|
||||
|
||||
import org.lineageos.setupwizard.util.PhoneMonitor;
|
||||
@@ -41,7 +42,9 @@ public class SetupWizardExitActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
SetupWizardUtils.enableCaptivePortalDetection(this);
|
||||
PhoneMonitor.onSetupFinished();
|
||||
launchHome();
|
||||
if (!getSystemService(UserManager.class).isManagedProfile()) {
|
||||
launchHome();
|
||||
}
|
||||
finish();
|
||||
applyForwardTransition(TRANSITION_ID_FADE);
|
||||
Intent i = new Intent();
|
||||
|
Reference in New Issue
Block a user