Loading core/java/android/service/trust/TrustAgentService.java +21 −0 Original line number Diff line number Diff line Loading @@ -16,12 +16,17 @@ package android.service.trust; import android.Manifest; import android.annotation.SdkConstant; import android.app.Service; import android.content.ComponentName; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ServiceInfo; import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; import android.util.Slog; /** Loading Loading @@ -83,6 +88,22 @@ public class TrustAgentService extends Service { }; }; @Override public void onCreate() { super.onCreate(); ComponentName component = new ComponentName(this, getClass()); try { ServiceInfo serviceInfo = getPackageManager().getServiceInfo(component, 0 /* flags */); if (!Manifest.permission.BIND_TRUST_AGENT.equals(serviceInfo.permission)) { throw new IllegalStateException(component.flattenToShortString() + " is not declared with the permission " + "\"" + Manifest.permission.BIND_TRUST_AGENT + "\""); } } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "Can't get ServiceInfo for " + component.toShortString()); } } /** * Called when the user attempted to authenticate on the device. * Loading packages/Keyguard/test/SampleTrustAgent/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ <service android:name=".SampleTrustAgent" android:label="@string/app_name" android:permission="android.permission.BIND_TRUST_AGENT" android:exported="true"> <intent-filter> <action android:name="android.service.trust.TrustAgentService" /> Loading Loading
core/java/android/service/trust/TrustAgentService.java +21 −0 Original line number Diff line number Diff line Loading @@ -16,12 +16,17 @@ package android.service.trust; import android.Manifest; import android.annotation.SdkConstant; import android.app.Service; import android.content.ComponentName; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ServiceInfo; import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; import android.util.Slog; /** Loading Loading @@ -83,6 +88,22 @@ public class TrustAgentService extends Service { }; }; @Override public void onCreate() { super.onCreate(); ComponentName component = new ComponentName(this, getClass()); try { ServiceInfo serviceInfo = getPackageManager().getServiceInfo(component, 0 /* flags */); if (!Manifest.permission.BIND_TRUST_AGENT.equals(serviceInfo.permission)) { throw new IllegalStateException(component.flattenToShortString() + " is not declared with the permission " + "\"" + Manifest.permission.BIND_TRUST_AGENT + "\""); } } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "Can't get ServiceInfo for " + component.toShortString()); } } /** * Called when the user attempted to authenticate on the device. * Loading
packages/Keyguard/test/SampleTrustAgent/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ <service android:name=".SampleTrustAgent" android:label="@string/app_name" android:permission="android.permission.BIND_TRUST_AGENT" android:exported="true"> <intent-filter> <action android:name="android.service.trust.TrustAgentService" /> Loading