improve audio client: unlock keyguard and ignore orientation change
- otherwise, keyguard should be manually unlocked
- device orientation change can stop audio recording / playback
Change-Id: I90c427d5cc9a764d0c50a489b92aee2264a9a8e8
diff --git a/suite/audio_quality/client/AndroidManifest.xml b/suite/audio_quality/client/AndroidManifest.xml
index 9f1c6dd..70a6b7e 100644
--- a/suite/audio_quality/client/AndroidManifest.xml
+++ b/suite/audio_quality/client/AndroidManifest.xml
@@ -17,6 +17,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.cts.audiotest" >
+<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
@@ -24,7 +25,8 @@
android:label="@string/app_name" >
<activity
android:name=".CtsAudioClientActivity"
- android:label="@string/app_name" >
+ android:label="@string/app_name"
+ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
diff --git a/suite/audio_quality/client/src/com/android/cts/audiotest/CtsAudioClientActivity.java b/suite/audio_quality/client/src/com/android/cts/audiotest/CtsAudioClientActivity.java
index 7f801e8..7fc4960 100644
--- a/suite/audio_quality/client/src/com/android/cts/audiotest/CtsAudioClientActivity.java
+++ b/suite/audio_quality/client/src/com/android/cts/audiotest/CtsAudioClientActivity.java
@@ -17,6 +17,7 @@
package com.android.cts.audiotest;
import android.app.Activity;
+import android.app.KeyguardManager;
import android.content.Context;
import android.media.AudioManager;
import android.os.Bundle;
@@ -54,6 +55,9 @@
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
+ KeyguardManager keyguardManager =
+ (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
+ keyguardManager.newKeyguardLock("cts-audio").disableKeyguard();
}
/**