diff options
author | Adrian Roos <roosa@google.com> | 2014-07-24 16:00:46 +0200 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2014-07-24 21:44:02 +0200 |
commit | c5f95cea2639b698594a85acbde6a5519941d7b1 (patch) | |
tree | fa123927e9bbc021bf1ac0b39733d826dd675546 /packages/Keyguard/test | |
parent | 866cf65cc3c53f67836c9157d5c661adfdbd25e1 (diff) | |
download | frameworks_base-c5f95cea2639b698594a85acbde6a5519941d7b1.zip frameworks_base-c5f95cea2639b698594a85acbde6a5519941d7b1.tar.gz frameworks_base-c5f95cea2639b698594a85acbde6a5519941d7b1.tar.bz2 |
Restart trust agents when updated or when they are dead
ActivityManager restarts the trust agent service for us
when it gets killed automatically. This does not apply
when its process crashes too often or when its package
gets updated however.
To catch the update case, the trust agent connection
is removed as soon as the package disappears, and then
readded when the new package appears.
To catch the repeated crashing case, the connection is
reset if it hasn't successfully connected for several minutes.
Also adds a button to SampleTrustAgent to simulate a crash.
Bug: 16137258
Change-Id: I1b18fc7a3025e23e25ca1623b6af658d5430a94b
Diffstat (limited to 'packages/Keyguard/test')
3 files changed, 14 insertions, 3 deletions
diff --git a/packages/Keyguard/test/SampleTrustAgent/AndroidManifest.xml b/packages/Keyguard/test/SampleTrustAgent/AndroidManifest.xml index f3125f1..a7c9105 100644 --- a/packages/Keyguard/test/SampleTrustAgent/AndroidManifest.xml +++ b/packages/Keyguard/test/SampleTrustAgent/AndroidManifest.xml @@ -38,6 +38,10 @@ android:label="@string/app_name" android:exported="true" android:launchMode="singleInstance" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> </activity> </application> </manifest> diff --git a/packages/Keyguard/test/SampleTrustAgent/res/layout/sample_trust_agent_settings.xml b/packages/Keyguard/test/SampleTrustAgent/res/layout/sample_trust_agent_settings.xml index 01b107b..06a06bf 100644 --- a/packages/Keyguard/test/SampleTrustAgent/res/layout/sample_trust_agent_settings.xml +++ b/packages/Keyguard/test/SampleTrustAgent/res/layout/sample_trust_agent_settings.xml @@ -17,9 +17,9 @@ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent"> + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent"> <Button android:id="@+id/enable_trust" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -28,6 +28,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Revoke trust" /> + <Button android:id="@+id/crash" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Crash" /> <CheckBox android:id="@+id/report_unlock_attempts" android:layout_width="match_parent" android:layout_height="wrap_content" 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 8e293fb..6b5f78b 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 @@ -37,6 +37,7 @@ public class SampleTrustAgentSettings extends Activity implements View.OnClickLi findViewById(R.id.enable_trust).setOnClickListener(this); findViewById(R.id.revoke_trust).setOnClickListener(this); + findViewById(R.id.crash).setOnClickListener(this); mReportUnlockAttempts = (CheckBox) findViewById(R.id.report_unlock_attempts); mReportUnlockAttempts.setOnCheckedChangeListener(this); @@ -56,6 +57,8 @@ public class SampleTrustAgentSettings extends Activity implements View.OnClickLi null /* extra */); } else if (id == R.id.revoke_trust) { SampleTrustAgent.sendRevokeTrust(this); + } else if (id == R.id.crash) { + throw new RuntimeException("crash"); } } |