Loading core/java/android/app/trust/ITrustManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -29,5 +29,6 @@ interface ITrustManager { void reportRequireCredentialEntry(int userId); void registerTrustListener(in ITrustListener trustListener); void unregisterTrustListener(in ITrustListener trustListener); void reportKeyguardShowingChanged(); boolean isDeviceLocked(int userId); } core/java/android/app/trust/TrustManager.java +13 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,19 @@ public class TrustManager { } } /** * Reports that the visibility of the keyguard has changed. * * Requires the {@link android.Manifest.permission#ACCESS_KEYGUARD_SECURE_STORAGE} permission. */ public void reportKeyguardShowingChanged() { try { mService.reportKeyguardShowingChanged(); } catch (RemoteException e) { onError(e); } } /** * Registers a listener for trust events. * Loading core/java/android/service/trust/ITrustAgentService.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import android.service.trust.ITrustAgentServiceCallback; interface ITrustAgentService { oneway void onUnlockAttempt(boolean successful); oneway void onTrustTimeout(); oneway void onDeviceLocked(); oneway void onDeviceUnlocked(); oneway void onConfigure(in List<PersistableBundle> options, IBinder token); oneway void setCallback(ITrustAgentServiceCallback callback); } core/java/android/service/trust/TrustAgentService.java +32 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,8 @@ public class TrustAgentService extends Service { private static final int MSG_UNLOCK_ATTEMPT = 1; private static final int MSG_CONFIGURE = 2; private static final int MSG_TRUST_TIMEOUT = 3; private static final int MSG_DEVICE_LOCKED = 4; private static final int MSG_DEVICE_UNLOCKED = 5; /** * Class containing raw data for a given configuration request. Loading Loading @@ -134,6 +136,12 @@ public class TrustAgentService extends Service { case MSG_TRUST_TIMEOUT: onTrustTimeout(); break; case MSG_DEVICE_LOCKED: onDeviceLocked(); break; case MSG_DEVICE_UNLOCKED: onDeviceUnlocked(); break; } } }; Loading Loading @@ -173,6 +181,20 @@ public class TrustAgentService extends Service { public void onTrustTimeout() { } /** * Called when the device enters a state where a PIN, pattern or * password must be entered to unlock it. */ public void onDeviceLocked() { } /** * Called when the device leaves a state where a PIN, pattern or * password must be entered to unlock it. */ public void onDeviceUnlocked() { } private void onError(String msg) { Slog.v(TAG, "Remote exception while " + msg); } Loading Loading @@ -300,6 +322,16 @@ public class TrustAgentService extends Service { .sendToTarget(); } @Override public void onDeviceLocked() throws RemoteException { mHandler.obtainMessage(MSG_DEVICE_LOCKED).sendToTarget(); } @Override public void onDeviceUnlocked() throws RemoteException { mHandler.obtainMessage(MSG_DEVICE_UNLOCKED).sendToTarget(); } @Override /* Binder API */ public void setCallback(ITrustAgentServiceCallback callback) { synchronized (mLock) { Loading packages/Keyguard/test/SampleTrustAgent/res/layout/sample_trust_agent_settings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,12 @@ android:paddingTop="8dp" android:paddingBottom="8dp" android:text="Report unlock attempts" /> <CheckBox android:id="@+id/report_device_locked" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="8dp" android:paddingBottom="8dp" android:text="Report device locked or unlocked" /> <LinearLayout android:layout_width="match_parent" Loading Loading
core/java/android/app/trust/ITrustManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -29,5 +29,6 @@ interface ITrustManager { void reportRequireCredentialEntry(int userId); void registerTrustListener(in ITrustListener trustListener); void unregisterTrustListener(in ITrustListener trustListener); void reportKeyguardShowingChanged(); boolean isDeviceLocked(int userId); }
core/java/android/app/trust/TrustManager.java +13 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,19 @@ public class TrustManager { } } /** * Reports that the visibility of the keyguard has changed. * * Requires the {@link android.Manifest.permission#ACCESS_KEYGUARD_SECURE_STORAGE} permission. */ public void reportKeyguardShowingChanged() { try { mService.reportKeyguardShowingChanged(); } catch (RemoteException e) { onError(e); } } /** * Registers a listener for trust events. * Loading
core/java/android/service/trust/ITrustAgentService.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ import android.service.trust.ITrustAgentServiceCallback; interface ITrustAgentService { oneway void onUnlockAttempt(boolean successful); oneway void onTrustTimeout(); oneway void onDeviceLocked(); oneway void onDeviceUnlocked(); oneway void onConfigure(in List<PersistableBundle> options, IBinder token); oneway void setCallback(ITrustAgentServiceCallback callback); }
core/java/android/service/trust/TrustAgentService.java +32 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,8 @@ public class TrustAgentService extends Service { private static final int MSG_UNLOCK_ATTEMPT = 1; private static final int MSG_CONFIGURE = 2; private static final int MSG_TRUST_TIMEOUT = 3; private static final int MSG_DEVICE_LOCKED = 4; private static final int MSG_DEVICE_UNLOCKED = 5; /** * Class containing raw data for a given configuration request. Loading Loading @@ -134,6 +136,12 @@ public class TrustAgentService extends Service { case MSG_TRUST_TIMEOUT: onTrustTimeout(); break; case MSG_DEVICE_LOCKED: onDeviceLocked(); break; case MSG_DEVICE_UNLOCKED: onDeviceUnlocked(); break; } } }; Loading Loading @@ -173,6 +181,20 @@ public class TrustAgentService extends Service { public void onTrustTimeout() { } /** * Called when the device enters a state where a PIN, pattern or * password must be entered to unlock it. */ public void onDeviceLocked() { } /** * Called when the device leaves a state where a PIN, pattern or * password must be entered to unlock it. */ public void onDeviceUnlocked() { } private void onError(String msg) { Slog.v(TAG, "Remote exception while " + msg); } Loading Loading @@ -300,6 +322,16 @@ public class TrustAgentService extends Service { .sendToTarget(); } @Override public void onDeviceLocked() throws RemoteException { mHandler.obtainMessage(MSG_DEVICE_LOCKED).sendToTarget(); } @Override public void onDeviceUnlocked() throws RemoteException { mHandler.obtainMessage(MSG_DEVICE_UNLOCKED).sendToTarget(); } @Override /* Binder API */ public void setCallback(ITrustAgentServiceCallback callback) { synchronized (mLock) { Loading
packages/Keyguard/test/SampleTrustAgent/res/layout/sample_trust_agent_settings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,12 @@ android:paddingTop="8dp" android:paddingBottom="8dp" android:text="Report unlock attempts" /> <CheckBox android:id="@+id/report_device_locked" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="8dp" android:paddingBottom="8dp" android:text="Report device locked or unlocked" /> <LinearLayout android:layout_width="match_parent" Loading