Disabling KeyGuard for device info app.

Also deleted the old way which used a deprecated method.
bug: 11676070
Change-Id: I7e027a4d34d761f4a6c939bd03c753f6ae6932e6
diff --git a/tools/device-setup/TestDeviceSetup/AndroidManifest.xml b/tools/device-setup/TestDeviceSetup/AndroidManifest.xml
index d55ecdf..0a20e1c 100644
--- a/tools/device-setup/TestDeviceSetup/AndroidManifest.xml
+++ b/tools/device-setup/TestDeviceSetup/AndroidManifest.xml
@@ -30,12 +30,6 @@
                 <category android:name="android.intent.category.LAUNCHER"/>
             </intent-filter>
         </activity>
-
-    <receiver android:name="android.tests.util.DisableKeyguardReceiver">
-            <intent-filter>
-                <action android:name="android.tests.util.disablekeyguard" />
-            </intent-filter>
-        </receiver>
     </application>
 
     <instrumentation android:name="android.tests.getinfo.DeviceInfoInstrument"
diff --git a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoActivity.java b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoActivity.java
index 28f4d53..7ee7436 100644
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoActivity.java
+++ b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoActivity.java
@@ -22,6 +22,8 @@
 import android.content.pm.ConfigurationInfo;
 import android.content.res.Configuration;
 import android.os.Bundle;
+import android.view.Window;
+import android.view.WindowManager;
 
 import java.util.HashSet;
 import java.util.Locale;
@@ -54,9 +56,9 @@
             final CountDownLatch done = new CountDownLatch(1);
             final int version = i;
             DeviceInfoActivity.this.runOnUiThread(new Runnable() {
-              public void run() {
-                setContentView(new GLESSurfaceView(DeviceInfoActivity.this, version, done));
-              }
+                public void run() {
+                    setContentView(new GLESSurfaceView(DeviceInfoActivity.this, version, done));
+                }
             });
             try {
                 done.await();
@@ -94,15 +96,18 @@
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        Window w = getWindow();
+        w.setFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED,
+                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
 
         ActivityManager am =
                 (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
         ConfigurationInfo info = am.getDeviceConfigurationInfo();
         final int glVersion = (info.reqGlEsVersion & 0xffff0000) >> 16;
         new Thread() {
-          public void run() {
-            runIterations(glVersion);
-          }
+            public void run() {
+                runIterations(glVersion);
+            }
         }.start();
 
         Configuration con = getResources().getConfiguration();
diff --git a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
index 29b29bf..cdf1df3 100644
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
+++ b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
@@ -60,7 +60,6 @@
 
     @Override
     public void onStart() {
-
         addResult(BUILD_ID, Build.ID);
         addResult(PRODUCT_NAME, Build.PRODUCT);
         addResult(BUILD_DEVICE, Build.DEVICE);
diff --git a/tools/device-setup/TestDeviceSetup/src/android/tests/util/DisableKeyguardReceiver.java b/tools/device-setup/TestDeviceSetup/src/android/tests/util/DisableKeyguardReceiver.java
deleted file mode 100644
index 3e5012d..0000000
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/util/DisableKeyguardReceiver.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package android.tests.util;
-
-import android.app.KeyguardManager;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-
-/**
- * A utility receiver to disable the keyguard on devices.
- * Intended to be used so UI related tests can be executed successfully.
- */
-public class DisableKeyguardReceiver extends BroadcastReceiver {
-
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        KeyguardManager keyguardManager =
-            (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
-        keyguardManager.newKeyguardLock("cts").disableKeyguard();
-    }
-}