blob: cf224466e7650e34bb78235fe431b699c61874ff [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2008 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.server;
18
19import android.content.Context;
20import android.content.pm.PackageManager;
21import android.os.Binder;
22import android.os.ICheckinService;
23import android.os.IParentalControlCallback;
24import android.util.Log;
25
26import java.io.IOException;
27
28import com.android.internal.os.RecoverySystem;
29import com.google.android.net.ParentalControlState;
30
31/**
32 * @hide
33 */
34public final class FallbackCheckinService extends ICheckinService.Stub {
35 static final String TAG = "FallbackCheckinService";
36 final Context mContext;
37
38 public FallbackCheckinService(Context context) {
39 mContext = context;
40 }
41
42 public boolean checkin() {
43 return false; // failure, because not implemented
44 }
45
46 public void reportCrashSync(byte[] crashData) {
47 }
48
49 public void reportCrashAsync(byte[] crashData) {
50 }
51
52 public void masterClear() {
53 if (mContext.checkCallingOrSelfPermission("android.permission.MASTER_CLEAR") !=
54 PackageManager.PERMISSION_GRANTED) {
55 Log.e(TAG, "Permission Denial: can't invoke masterClear from "
56 + "pid=" + Binder.getCallingPid() + ", "
57 + "uid=" + Binder.getCallingUid());
58 return;
59 }
60
61 // Save the android ID so the new system can get it erased.
62 try {
63 RecoverySystem.rebootAndWipe();
64 } catch (IOException e) {
65 Log.e(TAG, "Reboot for masterClear() failed", e);
66 }
67 }
68
69 public void getParentalControlState(IParentalControlCallback p, String requestingApp)
70 throws android.os.RemoteException {
71 ParentalControlState state = new ParentalControlState();
72 state.isEnabled = false;
73 p.onResult(state);
74 }
75}