• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019, The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.managedprovisioning.finalization;
18 
19 import android.app.admin.DevicePolicyManager;
20 
21 /**
22  * This class is used to make sure that we start the MDM after we shut the setup wizard down.
23  * The shut down of the setup wizard is initiated in the
24  * {@link com.android.managedprovisioning.provisioning.ProvisioningActivity} by calling
25  * {@link DevicePolicyManager#setUserProvisioningState(int, int)}. This will cause the
26  * Setup wizard to shut down and send a ACTION_PROVISIONING_FINALIZATION intent. This intent is
27  * caught by this receiver instead which will send the
28  * ACTION_PROFILE_PROVISIONING_COMPLETE broadcast to the MDM, which can then present it's own
29  * activities.
30  */
31 public class FinalizationPostSuwActivity extends FinalizationActivityBase {
32 
33     @Override
createFinalizationController()34     protected FinalizationController createFinalizationController() {
35         return new FinalizationController(this, new FinalizationPostSuwControllerLogic(this));
36     }
37 
38     @Override
onFinalizationCompletedWithChildActivityLaunched()39     protected void onFinalizationCompletedWithChildActivityLaunched() {
40         // Commit state immediately, without waiting for child activity to complete.
41         getFinalizationController().commitFinalizedState();
42         // To prevent b/131315856, we don't call finish() when we have launched the admin app.
43         // Instead, we let android:noHistory automatically finish this activity.
44     }
45 }
46