PageRenderTime 52ms CodeModel.GetById 15ms app.highlight 30ms RepoModel.GetById 2ms app.codeStats 0ms

/policy/src/com/android/internal/policy/impl/keyguard/KeyguardServiceWrapper.java

https://github.com/aizuzi/platform_frameworks_base
Java | 208 lines | 157 code | 28 blank | 23 comment | 0 complexity | f31423a9052b042c38cbaefd4ecf8962 MD5 | raw file
  1/*
  2 * Copyright (C) 2013 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.internal.policy.impl.keyguard;
 18
 19import android.os.Bundle;
 20import android.os.IBinder;
 21import android.os.RemoteException;
 22import android.util.Slog;
 23import android.view.MotionEvent;
 24
 25import com.android.internal.policy.IKeyguardShowCallback;
 26import com.android.internal.policy.IKeyguardExitCallback;
 27import com.android.internal.policy.IKeyguardService;
 28
 29/**
 30 * A wrapper class for KeyguardService.  It implements IKeyguardService to ensure the interface
 31 * remains consistent.
 32 *
 33 */
 34public class KeyguardServiceWrapper implements IKeyguardService {
 35    private IKeyguardService mService;
 36    private String TAG = "KeyguardServiceWrapper";
 37
 38    public KeyguardServiceWrapper(IKeyguardService service) {
 39        mService = service;
 40    }
 41
 42    public boolean isShowing() {
 43        try {
 44            return mService.isShowing();
 45        } catch (RemoteException e) {
 46            Slog.w(TAG , "Remote Exception", e);
 47        }
 48        return false;
 49    }
 50
 51    public boolean isSecure() {
 52        try {
 53            return mService.isSecure();
 54        } catch (RemoteException e) {
 55            Slog.w(TAG , "Remote Exception", e);
 56        }
 57        return false; // TODO cache state
 58    }
 59
 60    public boolean isShowingAndNotHidden() {
 61        try {
 62            return mService.isShowingAndNotHidden();
 63        } catch (RemoteException e) {
 64            Slog.w(TAG , "Remote Exception", e);
 65        }
 66        return false; // TODO cache state
 67    }
 68
 69    public boolean isInputRestricted() {
 70        try {
 71            return mService.isInputRestricted();
 72        } catch (RemoteException e) {
 73            Slog.w(TAG , "Remote Exception", e);
 74        }
 75        return false; // TODO cache state
 76    }
 77
 78    public boolean isDismissable() {
 79        try {
 80            return mService.isDismissable();
 81        } catch (RemoteException e) {
 82            Slog.w(TAG , "Remote Exception", e);
 83        }
 84        return true; // TODO cache state
 85    }
 86
 87    public void verifyUnlock(IKeyguardExitCallback callback) {
 88        try {
 89            mService.verifyUnlock(callback);
 90        } catch (RemoteException e) {
 91            Slog.w(TAG , "Remote Exception", e);
 92        }
 93    }
 94
 95    public void keyguardDone(boolean authenticated, boolean wakeup) {
 96        try {
 97            mService.keyguardDone(authenticated, wakeup);
 98        } catch (RemoteException e) {
 99            Slog.w(TAG , "Remote Exception", e);
100        }
101    }
102
103    public void setHidden(boolean isHidden) {
104        try {
105            mService.setHidden(isHidden);
106        } catch (RemoteException e) {
107            Slog.w(TAG , "Remote Exception", e);
108        }
109    }
110
111    public void dismiss() {
112        try {
113            mService.dismiss();
114        } catch (RemoteException e) {
115            Slog.w(TAG , "Remote Exception", e);
116        }
117    }
118
119    public void onDreamingStarted() {
120        try {
121            mService.onDreamingStarted();
122        } catch (RemoteException e) {
123            Slog.w(TAG , "Remote Exception", e);
124        }
125    }
126
127    public void onDreamingStopped() {
128        try {
129            mService.onDreamingStopped();
130        } catch (RemoteException e) {
131            Slog.w(TAG , "Remote Exception", e);
132        }
133    }
134
135    public void onScreenTurnedOff(int reason) {
136        try {
137            mService.onScreenTurnedOff(reason);
138        } catch (RemoteException e) {
139            Slog.w(TAG , "Remote Exception", e);
140        }
141    }
142
143    public void onScreenTurnedOn(IKeyguardShowCallback result) {
144        try {
145            mService.onScreenTurnedOn(result);
146        } catch (RemoteException e) {
147            Slog.w(TAG , "Remote Exception", e);
148        }
149    }
150
151    public void setKeyguardEnabled(boolean enabled) {
152        try {
153            mService.setKeyguardEnabled(enabled);
154        } catch (RemoteException e) {
155            Slog.w(TAG , "Remote Exception", e);
156        }
157    }
158
159    public void onSystemReady() {
160        try {
161            mService.onSystemReady();
162        } catch (RemoteException e) {
163            Slog.w(TAG , "Remote Exception", e);
164        }
165    }
166
167    public void doKeyguardTimeout(Bundle options) {
168        try {
169            mService.doKeyguardTimeout(options);
170        } catch (RemoteException e) {
171            Slog.w(TAG , "Remote Exception", e);
172        }
173    }
174
175    public void setCurrentUser(int userId) {
176        try {
177            mService.setCurrentUser(userId);
178        } catch (RemoteException e) {
179            Slog.w(TAG , "Remote Exception", e);
180        }
181    }
182
183    public void onBootCompleted() {
184        try {
185            mService.onBootCompleted();
186        } catch (RemoteException e) {
187            Slog.w(TAG , "Remote Exception", e);
188        }
189    }
190
191    public void showAssistant() {
192        // Not used by PhoneWindowManager
193    }
194
195    public void dispatch(MotionEvent event) {
196        // Not used by PhoneWindowManager.  See code in {@link NavigationBarView}
197    }
198
199    public void launchCamera() {
200        // Not used by PhoneWindowManager.  See code in {@link NavigationBarView}
201    }
202
203    @Override
204    public IBinder asBinder() {
205        return mService.asBinder();
206    }
207
208}