Add new voice request for picking from a list.

Also add API for voice interaction service to control
whether the system should hold a wake lock while it is
working with an activity (and actually *do* hold a wake
lock while doing so, duh!).

And while in there, clean up the launching wake lock to
correctly give blame to the app that is launching.

Change-Id: I7cc4d566b80f59fe0a9ac51ae9bbb7188a01f433
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 997f69d..1484af8 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -2440,6 +2440,16 @@
             reply.writeNoException();
             return true;
         }
+
+        case SET_VOICE_KEEP_AWAKE_TRANSACTION: {
+            data.enforceInterface(IActivityManager.descriptor);
+            IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
+                    data.readStrongBinder());
+            boolean keepAwake = data.readInt() != 0;
+            setVoiceKeepAwake(session, keepAwake);
+            reply.writeNoException();
+            return true;
+        }
         }
 
         return super.onTransact(code, data, reply, flags);
@@ -5658,5 +5668,19 @@
         reply.recycle();
     }
 
+    @Override
+    public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)
+            throws RemoteException {
+        Parcel data = Parcel.obtain();
+        Parcel reply = Parcel.obtain();
+        data.writeInterfaceToken(IActivityManager.descriptor);
+        data.writeStrongBinder(session.asBinder());
+        data.writeInt(keepAwake ? 1 : 0);
+        mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0);
+        reply.readException();
+        data.recycle();
+        reply.recycle();
+    }
+
     private IBinder mRemote;
 }