在 android 应用中使用信任代理
Using Trust Agents in android app
我正在尝试使用最近添加的 TrustAgents。
Git 官方 Android sources 中的评论制作的清单。正如在实施此类清单后所说,我将能够从 TrustAgentService 扩展 类。
就是这样:
<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>
但我仍然无法从 TrustAgentService 扩展。使用API 22. SDK更新到最新版本
很遗憾,您不能使用这些 API..我也不能..
您不能直接子类化 TrustAgentService 的原因是它通过 @SystemApi 注释从 SDK jar 中隐藏了。
另外android.permission.BIND_TRUST_AGENT需要签名权限
我正在尝试使用最近添加的 TrustAgents。 Git 官方 Android sources 中的评论制作的清单。正如在实施此类清单后所说,我将能够从 TrustAgentService 扩展 类。
就是这样:
<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>
但我仍然无法从 TrustAgentService 扩展。使用API 22. SDK更新到最新版本
很遗憾,您不能使用这些 API..我也不能..
您不能直接子类化 TrustAgentService 的原因是它通过 @SystemApi 注释从 SDK jar 中隐藏了。
另外android.permission.BIND_TRUST_AGENT需要签名权限