blob: 246726db0bd9691a64fa1f2b2f1048b25d7001a0 [file] [log] [blame]
Joe Delfinod0f29282015-03-19 08:26:09 -04001/*
2 * Copyright 2015, 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
17package com.android.managedprovisioning;
18
19import android.app.admin.DevicePolicyManager;
20import android.content.BroadcastReceiver;
21import android.content.Context;
22import android.content.Intent;
23import android.text.TextUtils;
24
25/**
26 * Starts a service which reads the primary user's ca certs and sends them to the secondary user
27 * that asked for them. Runs on the primary user on EDU managed devices.
28 */
29public class InstallCertRequestReceiver extends BroadcastReceiver {
30 public static final String REQUEST_CERT_ACTION =
31 "com.android.managedprovisioning.REQUEST_CERT_ACTION";
32
33 @Override
34 public void onReceive(Context context, Intent intent) {
35 ProvisionLogger.logi("Got ca cert request.");
Joe Delfinod0f29282015-03-19 08:26:09 -040036
Joe Delfino84e56f52015-03-27 09:56:18 -040037 if (Utils.isCurrentUserOwner() && Utils.hasDeviceOwner(context) &&
Joe Delfinod0f29282015-03-19 08:26:09 -040038 REQUEST_CERT_ACTION.equals(intent.getAction())) {
39 CertService.startService(context, intent);
40 }
41 }
42}