I'm trying to use recently added TrustAgents. Manifest made by comments in official Android sources on Git. As there is said after implementing such manifest I will be able to extend classes from TrustAgentService.
That's it:
<uses-permission android:name="android.permission.CONTROL_KEYGUARD" />
<uses-permission android:name="android.permission.PROVIDE_TRUST_AGENT" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<service android:exported="true"
android:label="@string/app_name"
android:name=".CustomTrustAgent"
android:permission="android.permission.BIND_TRUST_AGENT">
<intent-filter>
<action android:name="android.service.trust.TrustAgentService" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="android.service.trust.trustagent"
android:value="@xml/trust_agent" />
</service>
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
But I still can't extend from TrustAgentService. Using API 22. SDK is updated to latest version.
Unfortunately you can't use these APIs..and me neither..
The reason why you can't directly subclass the TrustAgentService is that it's hidden from SDK jars by the @SystemApi annotation.
Furthermore the android.permission.BIND_TRUST_AGENT requires having the signature permission.