• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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 package com.android.managedprovisioning.e2eui;
17 
18 import android.app.admin.DeviceAdminReceiver;
19 import android.app.admin.DevicePolicyManager;
20 import android.content.ComponentName;
21 import android.content.Context;
22 import android.content.Intent;
23 
24 import com.android.managedprovisioning.TestInstrumentationRunner;
25 
26 public class ManagedProfileAdminReceiver extends DeviceAdminReceiver {
27     public static final ComponentName COMPONENT_NAME = new ComponentName(
28             TestInstrumentationRunner.TEST_PACKAGE_NAME,
29             ManagedProfileAdminReceiver.class.getName());
30 
31     public static final Intent INTENT_PROVISION_MANAGED_PROFILE =
32             E2eUiTestUtils.insertProvisioningExtras(new Intent(
33                     DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE)
34                     .putExtra(DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME,
35                             COMPONENT_NAME)
36                     .putExtra(DevicePolicyManager.EXTRA_PROVISIONING_SKIP_ENCRYPTION, true));
37 
38     @Override
onProfileProvisioningComplete(Context context, Intent intent)39     public void onProfileProvisioningComplete(Context context, Intent intent) {
40         // Verify that managed profile has been successfully created.
41         boolean testResult = E2eUiTestUtils.verifyProfile(context, intent, getManager(context));
42         // Informs the result to provisioning result listener.
43         E2eUiTestUtils.sendResult(ProvisioningResultListener.ACTION_PROVISION_RESULT_BROADCAST, context,
44                 testResult);
45     }
46 }
47