diff options
Diffstat (limited to 'core/java/android/app')
| -rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 38 | ||||
| -rw-r--r-- | core/java/android/app/IActivityManager.java | 5 | ||||
| -rw-r--r-- | core/java/android/app/IUserSwitchObserver.aidl | 25 | ||||
| -rw-r--r-- | core/java/android/app/IWallpaperManager.aidl | 5 | ||||
| -rw-r--r-- | core/java/android/app/WallpaperManager.java | 19 |
5 files changed, 92 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index bf77f6e..eae3b1f 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -1734,6 +1734,22 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } + case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface( + data.readStrongBinder()); + registerUserSwitchObserver(observer); + return true; + } + + case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface( + data.readStrongBinder()); + unregisterUserSwitchObserver(observer); + return true; + } + } return super.onTransact(code, data, reply, flags); @@ -3955,5 +3971,27 @@ class ActivityManagerProxy implements IActivityManager return result; } + public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(observer != null ? observer.asBinder() : null); + mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0); + reply.readException(); + data.recycle(); + reply.recycle(); + } + + public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(observer != null ? observer.asBinder() : null); + mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0); + reply.readException(); + data.recycle(); + reply.recycle(); + } + private IBinder mRemote; } diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 4c0e2a7..9ef375a 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -360,6 +360,9 @@ public interface IActivityManager extends IInterface { // manage your activity to make sure it is always the uid you expect. public int getLaunchedFromUid(IBinder activityToken) throws RemoteException; + public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException; + public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException; + /* * Private non-Binder interfaces */ @@ -609,4 +612,6 @@ public interface IActivityManager extends IInterface { int IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+151; int START_ACTIVITY_AS_USER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+152; int STOP_USER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+153; + int REGISTER_USER_SWITCH_OBSERVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+154; + int UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+155; } diff --git a/core/java/android/app/IUserSwitchObserver.aidl b/core/java/android/app/IUserSwitchObserver.aidl new file mode 100644 index 0000000..845897b --- /dev/null +++ b/core/java/android/app/IUserSwitchObserver.aidl @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2012 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.app; + +import android.os.IRemoteCallback; + +/** {@hide} */ +oneway interface IUserSwitchObserver { + void onUserSwitching(int newUserId, IRemoteCallback reply); + void onUserSwitchComplete(int newUserId); +} diff --git a/core/java/android/app/IWallpaperManager.aidl b/core/java/android/app/IWallpaperManager.aidl index 69f64a1..3efd3c0 100644 --- a/core/java/android/app/IWallpaperManager.aidl +++ b/core/java/android/app/IWallpaperManager.aidl @@ -52,6 +52,11 @@ interface IWallpaperManager { void clearWallpaper(); /** + * Return whether there is a wallpaper set with the given name. + */ + boolean hasNamedWallpaper(String name); + + /** * Sets the dimension hint for the wallpaper. These hints indicate the desired * minimum width and height for the wallpaper. */ diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index 1ad2e6d..9c0064e 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -590,6 +590,25 @@ public class WallpaperManager { } /** + * Return whether any users are currently set to use the wallpaper + * with the given resource ID. That is, their wallpaper has been + * set through {@link #setResource(int)} with the same resource id. + */ + public boolean hasResourceWallpaper(int resid) { + if (sGlobals.mService == null) { + Log.w(TAG, "WallpaperService not running"); + return false; + } + try { + Resources resources = mContext.getResources(); + String name = "res:" + resources.getResourceName(resid); + return sGlobals.mService.hasNamedWallpaper(name); + } catch (RemoteException e) { + return false; + } + } + + /** * Returns the desired minimum width for the wallpaper. Callers of * {@link #setBitmap(android.graphics.Bitmap)} or * {@link #setStream(java.io.InputStream)} should check this value |
