summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt8
-rw-r--r--core/java/android/service/trust/ITrustAgentServiceCallback.aidl2
-rw-r--r--core/java/android/service/trust/TrustAgentService.java16
-rw-r--r--core/res/AndroidManifest.xml2
-rw-r--r--core/res/res/values/attrs.xml4
-rw-r--r--packages/Keyguard/test/SampleTrustAgent/res/xml/sample_trust_agent.xml2
-rw-r--r--packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java14
-rw-r--r--packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgentSettings.java3
-rw-r--r--services/core/java/com/android/server/trust/TrustAgentWrapper.java10
-rw-r--r--services/core/java/com/android/server/trust/TrustManagerService.java4
10 files changed, 33 insertions, 32 deletions
diff --git a/api/current.txt b/api/current.txt
index d3996e4..91f20b7 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -29,7 +29,7 @@ package android {
field public static final java.lang.String BIND_REMOTEVIEWS = "android.permission.BIND_REMOTEVIEWS";
field public static final java.lang.String BIND_ROUTE_PROVIDER = "android.permission.BIND_ROUTE_PROVIDER";
field public static final java.lang.String BIND_TEXT_SERVICE = "android.permission.BIND_TEXT_SERVICE";
- field public static final java.lang.String BIND_TRUST_AGENT_SERVICE = "android.permission.BIND_TRUST_AGENT_SERVICE";
+ field public static final java.lang.String BIND_TRUST_AGENT = "android.permission.BIND_TRUST_AGENT";
field public static final java.lang.String BIND_TV_INPUT = "android.permission.BIND_TV_INPUT";
field public static final java.lang.String BIND_VOICE_INTERACTION = "android.permission.BIND_VOICE_INTERACTION";
field public static final java.lang.String BIND_VPN_SERVICE = "android.permission.BIND_VPN_SERVICE";
@@ -25327,10 +25327,10 @@ package android.service.trust {
public class TrustAgentService extends android.app.Service {
ctor public TrustAgentService();
- method protected final void enableTrust(java.lang.String, long, boolean);
+ method public final void grantTrust(java.lang.CharSequence, long, boolean);
method public final android.os.IBinder onBind(android.content.Intent);
- method protected void onUnlockAttempt(boolean);
- method protected final void revokeTrust();
+ method public void onUnlockAttempt(boolean);
+ method public final void revokeTrust();
field public static final java.lang.String SERVICE_INTERFACE = "android.service.trust.TrustAgentService";
field public static final java.lang.String TRUST_AGENT_META_DATA = "android.service.trust.trustagent";
}
diff --git a/core/java/android/service/trust/ITrustAgentServiceCallback.aidl b/core/java/android/service/trust/ITrustAgentServiceCallback.aidl
index c346771..9e4c2bf 100644
--- a/core/java/android/service/trust/ITrustAgentServiceCallback.aidl
+++ b/core/java/android/service/trust/ITrustAgentServiceCallback.aidl
@@ -23,6 +23,6 @@ import android.os.UserHandle;
* @hide
*/
oneway interface ITrustAgentServiceCallback {
- void enableTrust(String message, long durationMs, boolean initiatedByUser);
+ void grantTrust(CharSequence message, long durationMs, boolean initiatedByUser);
void revokeTrust();
}
diff --git a/core/java/android/service/trust/TrustAgentService.java b/core/java/android/service/trust/TrustAgentService.java
index d5ce429..bb40eec 100644
--- a/core/java/android/service/trust/TrustAgentService.java
+++ b/core/java/android/service/trust/TrustAgentService.java
@@ -29,12 +29,12 @@ import android.util.Slog;
* to be trusted.
*
* <p>To extend this class, you must declare the service in your manifest file with
- * the {@link android.Manifest.permission#BIND_TRUST_AGENT_SERVICE} permission
+ * the {@link android.Manifest.permission#BIND_TRUST_AGENT} permission
* and include an intent filter with the {@link #SERVICE_INTERFACE} action. For example:</p>
* <pre>
* &lt;service android:name=".TrustAgent"
* android:label="&#64;string/service_name"
- * android:permission="android.permission.BIND_TRUST_AGENT_SERVICE">
+ * android:permission="android.permission.BIND_TRUST_AGENT">
* &lt;intent-filter>
* &lt;action android:name="android.service.trust.TrustAgentService" />
* &lt;/intent-filter>
@@ -47,7 +47,7 @@ import android.util.Slog;
* {@link android.R.styleable#TrustAgent}. For example:</p>
*
* <pre>
- * &lt;trust_agent xmlns:android="http://schemas.android.com/apk/res/android"
+ * &lt;trust-agent xmlns:android="http://schemas.android.com/apk/res/android"
* android:settingsActivity=".TrustAgentSettings" /></pre>
*/
public class TrustAgentService extends Service {
@@ -88,7 +88,7 @@ public class TrustAgentService extends Service {
*
* @param successful true if the attempt succeeded
*/
- protected void onUnlockAttempt(boolean successful) {
+ public void onUnlockAttempt(boolean successful) {
}
private void onError(String msg) {
@@ -96,7 +96,7 @@ public class TrustAgentService extends Service {
}
/**
- * Call to enable trust on the device.
+ * Call to grant trust on the device.
*
* @param message describes why the device is trusted, e.g. "Trusted by location".
* @param durationMs amount of time in milliseconds to keep the device in a trusted state. Trust
@@ -104,10 +104,10 @@ public class TrustAgentService extends Service {
* @param initiatedByUser indicates that the user has explicitly initiated an action that proves
* the user is about to use the device.
*/
- protected final void enableTrust(String message, long durationMs, boolean initiatedByUser) {
+ public final void grantTrust(CharSequence message, long durationMs, boolean initiatedByUser) {
if (mCallback != null) {
try {
- mCallback.enableTrust(message, durationMs, initiatedByUser);
+ mCallback.grantTrust(message.toString(), durationMs, initiatedByUser);
} catch (RemoteException e) {
onError("calling enableTrust()");
}
@@ -117,7 +117,7 @@ public class TrustAgentService extends Service {
/**
* Call to revoke trust on the device.
*/
- protected final void revokeTrust() {
+ public final void revokeTrust() {
if (mCallback != null) {
try {
mCallback.revokeTrust();
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index cdb77f1..4eac802 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2613,7 +2613,7 @@
<!-- Must be required by an {@link
android.service.trust.TrustAgentService},
to ensure that only the system can bind to it. -->
- <permission android:name="android.permission.BIND_TRUST_AGENT_SERVICE"
+ <permission android:name="android.permission.BIND_TRUST_AGENT"
android:protectionLevel="signature"
android:label="@string/permlab_bind_trust_agent_service"
android:description="@string/permdesc_bind_trust_agent_service" />
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index ac75b38..1d35c84 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -6115,13 +6115,13 @@
<attr name="settingsActivity" />
</declare-styleable>
- <!-- Use <code>trust_agent</code> as the root tag of the XML resource that
+ <!-- Use <code>trust-agent</code> as the root tag of the XML resource that
describes an {@link android.service.trust.TrustAgentService}, which is
referenced from its {@link android.service.trust.TrustAgentService#TRUST_AGENT_META_DATA}
meta-data entry. Described here are the attributes that can be included in that tag. -->
<declare-styleable name="TrustAgent">
<!-- Component name of an activity that allows the user to modify
- the settings for this TrustAgent. -->
+ the settings for this trust agent. -->
<attr name="settingsActivity" />
</declare-styleable>
diff --git a/packages/Keyguard/test/SampleTrustAgent/res/xml/sample_trust_agent.xml b/packages/Keyguard/test/SampleTrustAgent/res/xml/sample_trust_agent.xml
index b48e011..b363ab4 100644
--- a/packages/Keyguard/test/SampleTrustAgent/res/xml/sample_trust_agent.xml
+++ b/packages/Keyguard/test/SampleTrustAgent/res/xml/sample_trust_agent.xml
@@ -14,5 +14,5 @@
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
-<trust_agent xmlns:android="http://schemas.android.com/apk/res/android"
+<trust-agent xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity=".SampleTrustAgentSettings" />
diff --git a/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java b/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java
index 25406d6..a51ea75 100644
--- a/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java
+++ b/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgent.java
@@ -31,7 +31,7 @@ public class SampleTrustAgent extends TrustAgentService {
LocalBroadcastManager mLocalBroadcastManager;
- private static final String ACTION_ENABLE_TRUST = "action.sample_trust_agent.enable_trust";
+ private static final String ACTION_GRANT_TRUST = "action.sample_trust_agent.grant_trust";
private static final String ACTION_REVOKE_TRUST = "action.sample_trust_agent.revoke_trust";
private static final String EXTRA_MESSAGE = "extra.message";
@@ -45,14 +45,14 @@ public class SampleTrustAgent extends TrustAgentService {
public void onCreate() {
super.onCreate();
IntentFilter filter = new IntentFilter();
- filter.addAction(ACTION_ENABLE_TRUST);
+ filter.addAction(ACTION_GRANT_TRUST);
filter.addAction(ACTION_REVOKE_TRUST);
mLocalBroadcastManager = LocalBroadcastManager.getInstance(this);
mLocalBroadcastManager.registerReceiver(mReceiver, filter);
}
@Override
- protected void onUnlockAttempt(boolean successful) {
+ public void onUnlockAttempt(boolean successful) {
if (getReportUnlockAttempts(this)) {
Toast.makeText(this, "onUnlockAttempt(successful=" + successful + ")",
Toast.LENGTH_SHORT).show();
@@ -69,8 +69,8 @@ public class SampleTrustAgent extends TrustAgentService {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
- if (ACTION_ENABLE_TRUST.equals(action)) {
- enableTrust(intent.getStringExtra(EXTRA_MESSAGE),
+ if (ACTION_GRANT_TRUST.equals(action)) {
+ grantTrust(intent.getStringExtra(EXTRA_MESSAGE),
intent.getLongExtra(EXTRA_DURATION, 0),
false /* initiatedByUser */);
} else if (ACTION_REVOKE_TRUST.equals(action)) {
@@ -79,9 +79,9 @@ public class SampleTrustAgent extends TrustAgentService {
}
};
- public static void sendEnableTrust(Context context,
+ public static void sendGrantTrust(Context context,
String message, long durationMs, Bundle extra) {
- Intent intent = new Intent(ACTION_ENABLE_TRUST);
+ Intent intent = new Intent(ACTION_GRANT_TRUST);
intent.putExtra(EXTRA_MESSAGE, message);
intent.putExtra(EXTRA_DURATION, durationMs);
intent.putExtra(EXTRA_EXTRA, extra);
diff --git a/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgentSettings.java b/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgentSettings.java
index 0a6f675..8e293fb 100644
--- a/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgentSettings.java
+++ b/packages/Keyguard/test/SampleTrustAgent/src/com/android/trustagent/test/SampleTrustAgentSettings.java
@@ -19,7 +19,6 @@ package com.android.trustagent.test;
import android.annotation.Nullable;
import android.app.Activity;
import android.os.Bundle;
-import android.preference.CheckBoxPreference;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
@@ -53,7 +52,7 @@ public class SampleTrustAgentSettings extends Activity implements View.OnClickLi
public void onClick(View v) {
int id = v.getId();
if (id == R.id.enable_trust) {
- SampleTrustAgent.sendEnableTrust(this, "SampleTrustAgent", TRUST_DURATION_MS,
+ SampleTrustAgent.sendGrantTrust(this, "SampleTrustAgent", TRUST_DURATION_MS,
null /* extra */);
} else if (id == R.id.revoke_trust) {
SampleTrustAgent.sendRevokeTrust(this);
diff --git a/services/core/java/com/android/server/trust/TrustAgentWrapper.java b/services/core/java/com/android/server/trust/TrustAgentWrapper.java
index a83fa87..d8d3da1 100644
--- a/services/core/java/com/android/server/trust/TrustAgentWrapper.java
+++ b/services/core/java/com/android/server/trust/TrustAgentWrapper.java
@@ -52,7 +52,7 @@ public class TrustAgentWrapper {
// Trust state
private boolean mTrusted;
- private String mMessage;
+ private CharSequence mMessage;
private final Handler mHandler = new Handler() {
@Override
@@ -60,7 +60,7 @@ public class TrustAgentWrapper {
switch (msg.what) {
case MSG_ENABLE_TRUST:
mTrusted = true;
- mMessage = (String) msg.obj;
+ mMessage = (CharSequence) msg.obj;
boolean initiatedByUser = msg.arg1 != 0;
// TODO: Handle handle user initiated trust changes.
mTrustManagerService.updateTrust(mUserId);
@@ -79,7 +79,8 @@ public class TrustAgentWrapper {
private ITrustAgentServiceCallback mCallback = new ITrustAgentServiceCallback.Stub() {
- public void enableTrust(String userMessage, long durationMs, boolean initiatedByUser) {
+ @Override
+ public void grantTrust(CharSequence userMessage, long durationMs, boolean initiatedByUser) {
if (DEBUG) Slog.v(TAG, "enableTrust(" + userMessage + ", durationMs = " + durationMs
+ ", initiatedByUser = " + initiatedByUser + ")");
@@ -91,6 +92,7 @@ public class TrustAgentWrapper {
}
}
+ @Override
public void revokeTrust() {
if (DEBUG) Slog.v(TAG, "revokeTrust()");
mHandler.sendEmptyMessage(MSG_REVOKE_TRUST);
@@ -155,7 +157,7 @@ public class TrustAgentWrapper {
return mTrusted;
}
- public String getMessage() {
+ public CharSequence getMessage() {
return mMessage;
}
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java
index 9061f96..a39c116 100644
--- a/services/core/java/com/android/server/trust/TrustManagerService.java
+++ b/services/core/java/com/android/server/trust/TrustManagerService.java
@@ -221,8 +221,8 @@ public class TrustManagerService extends SystemService {
// Drain preamble.
}
String nodeName = parser.getName();
- if (!"trust_agent".equals(nodeName)) {
- Slog.w(TAG, "Meta-data does not start with trust_agent tag");
+ if (!"trust-agent".equals(nodeName)) {
+ Slog.w(TAG, "Meta-data does not start with trust-agent tag");
return null;
}
TypedArray sa = res