Merge "Add @SystemApi to related VR functions that will be used by VrCore Services."
This commit is contained in:
@@ -255,6 +255,7 @@ package android.app {
|
||||
method public int getUidImportance(int);
|
||||
method public void killUid(int, java.lang.String);
|
||||
method public void removeOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener);
|
||||
method public static void setPersistentVrThread(int);
|
||||
}
|
||||
|
||||
public static abstract interface ActivityManager.OnUidImportanceListener {
|
||||
@@ -409,9 +410,49 @@ package android.app {
|
||||
ctor public StatsManager.StatsUnavailableException(java.lang.String, java.lang.Throwable);
|
||||
}
|
||||
|
||||
public final class Vr2dDisplayProperties implements android.os.Parcelable {
|
||||
ctor public Vr2dDisplayProperties(int, int, int);
|
||||
method public int describeContents();
|
||||
method public void dump(java.io.PrintWriter, java.lang.String);
|
||||
method public int getAddedFlags();
|
||||
method public int getDpi();
|
||||
method public int getHeight();
|
||||
method public int getRemovedFlags();
|
||||
method public int getWidth();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.app.Vr2dDisplayProperties> CREATOR;
|
||||
field public static final int FLAG_VIRTUAL_DISPLAY_ENABLED = 1; // 0x1
|
||||
}
|
||||
|
||||
public static class Vr2dDisplayProperties.Builder {
|
||||
ctor public Vr2dDisplayProperties.Builder();
|
||||
method public android.app.Vr2dDisplayProperties.Builder addFlags(int);
|
||||
method public android.app.Vr2dDisplayProperties build();
|
||||
method public android.app.Vr2dDisplayProperties.Builder removeFlags(int);
|
||||
method public android.app.Vr2dDisplayProperties.Builder setDimensions(int, int, int);
|
||||
method public android.app.Vr2dDisplayProperties.Builder setEnabled(boolean);
|
||||
}
|
||||
|
||||
public static abstract class Vr2dDisplayProperties.Vr2dDisplayFlag implements java.lang.annotation.Annotation {
|
||||
}
|
||||
|
||||
public class VrManager {
|
||||
method public int getVr2dDisplayId();
|
||||
method public boolean isPersistentVrModeEnabled();
|
||||
method public boolean isVrModeEnabled();
|
||||
method public void registerVrStateCallback(java.util.concurrent.Executor, android.app.VrStateCallback);
|
||||
method public void setAndBindVrCompositor(android.content.ComponentName);
|
||||
method public void setPersistentVrModeEnabled(boolean);
|
||||
method public void setStandbyEnabled(boolean);
|
||||
method public void setVr2dDisplayProperties(android.app.Vr2dDisplayProperties);
|
||||
method public void setVrInputMethod(android.content.ComponentName);
|
||||
method public void unregisterVrStateCallback(android.app.VrStateCallback);
|
||||
}
|
||||
|
||||
public abstract class VrStateCallback {
|
||||
ctor public VrStateCallback();
|
||||
method public void onPersistentVrStateChanged(boolean);
|
||||
method public void onVrStateChanged(boolean);
|
||||
}
|
||||
|
||||
public class WallpaperManager {
|
||||
|
||||
@@ -76,7 +76,6 @@ Landroid/app/ActivityManager;->isUserRunning(I)Z
|
||||
Landroid/app/ActivityManager;->mContext:Landroid/content/Context;
|
||||
Landroid/app/ActivityManager;->PROCESS_STATE_IMPORTANT_BACKGROUND:I
|
||||
Landroid/app/ActivityManager;->PROCESS_STATE_TOP:I
|
||||
Landroid/app/ActivityManager;->setPersistentVrThread(I)V
|
||||
Landroid/app/ActivityManagerNative;->asInterface(Landroid/os/IBinder;)Landroid/app/IActivityManager;
|
||||
Landroid/app/ActivityManagerNative;->getDefault()Landroid/app/IActivityManager;
|
||||
Landroid/app/ActivityOptions;->makeMultiThumbFutureAspectScaleAnimation(Landroid/content/Context;Landroid/os/Handler;Landroid/view/IAppTransitionAnimationSpecsFuture;Landroid/app/ActivityOptions$OnAnimationStartedListener;Z)Landroid/app/ActivityOptions;
|
||||
@@ -464,15 +463,6 @@ Landroid/app/usage/UsageStats;->mLastEvent:I
|
||||
Landroid/app/usage/UsageStats;->mLaunchCount:I
|
||||
Landroid/app/usage/UsageStats;->mTotalTimeInForeground:J
|
||||
Landroid/app/usage/UsageStatsManager;->mService:Landroid/app/usage/IUsageStatsManager;
|
||||
Landroid/app/Vr2dDisplayProperties$Builder;-><init>()V
|
||||
Landroid/app/Vr2dDisplayProperties$Builder;->build()Landroid/app/Vr2dDisplayProperties;
|
||||
Landroid/app/Vr2dDisplayProperties$Builder;->setEnabled(Z)Landroid/app/Vr2dDisplayProperties$Builder;
|
||||
Landroid/app/Vr2dDisplayProperties;-><init>(III)V
|
||||
Landroid/app/VrManager;->getPersistentVrModeEnabled()Z
|
||||
Landroid/app/VrManager;->mService:Landroid/service/vr/IVrManager;
|
||||
Landroid/app/VrManager;->registerVrStateCallback(Landroid/app/VrStateCallback;Landroid/os/Handler;)V
|
||||
Landroid/app/VrManager;->setVr2dDisplayProperties(Landroid/app/Vr2dDisplayProperties;)V
|
||||
Landroid/app/VrManager;->unregisterVrStateCallback(Landroid/app/VrStateCallback;)V
|
||||
Landroid/app/WallpaperColors;->getColorHints()I
|
||||
Landroid/app/WallpaperManager;->getBitmap()Landroid/graphics/Bitmap;
|
||||
Landroid/app/WallpaperManager;->getBitmap(Z)Landroid/graphics/Bitmap;
|
||||
@@ -2284,7 +2274,6 @@ Landroid/service/notification/StatusBarNotification;->getUid()I
|
||||
Landroid/service/persistentdata/IPersistentDataBlockService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/persistentdata/IPersistentDataBlockService;
|
||||
Landroid/service/voice/AlwaysOnHotwordDetector$EventPayload;->getCaptureSession()Ljava/lang/Integer;
|
||||
Landroid/service/voice/VoiceInteractionService;->isKeyphraseAndLocaleSupportedForHotword(Ljava/lang/String;Ljava/util/Locale;)Z
|
||||
Landroid/service/vr/IVrManager;->getVr2dDisplayId()I
|
||||
Landroid/service/wallpaper/WallpaperService$Engine;->setFixedSizeAllowed(Z)V
|
||||
Landroid/speech/tts/TextToSpeech;->getCurrentEngine()Ljava/lang/String;
|
||||
Landroid/system/Int32Ref;->value:I
|
||||
|
||||
@@ -58,8 +58,6 @@ Landroid/app/TaskStackListener;->onTaskProfileLocked(II)V
|
||||
Landroid/app/TaskStackListener;->onTaskRemoved(I)V
|
||||
Landroid/app/TaskStackListener;->onTaskSnapshotChanged(ILandroid/app/ActivityManager$TaskSnapshot;)V
|
||||
Landroid/app/TaskStackListener;->onTaskStackChanged()V
|
||||
Landroid/app/VrStateCallback;-><init>()V
|
||||
Landroid/app/VrStateCallback;->onPersistentVrStateChanged(Z)V
|
||||
Landroid/app/WallpaperColors;-><init>(Landroid/graphics/Color;Landroid/graphics/Color;Landroid/graphics/Color;I)V
|
||||
Landroid/bluetooth/BluetoothHeadset;->phoneStateChanged(IIILjava/lang/String;I)V
|
||||
Landroid/bluetooth/IBluetooth;->sendConnectionStateChange(Landroid/bluetooth/BluetoothDevice;III)V
|
||||
|
||||
@@ -4257,6 +4257,7 @@ public class ActivityManager {
|
||||
* @param tid tid of the VR thread
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(Manifest.permission.RESTRICTED_VR_ACCESS)
|
||||
public static void setPersistentVrThread(int tid) {
|
||||
try {
|
||||
|
||||
@@ -16,20 +16,31 @@
|
||||
|
||||
package android.app;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Display properties to be used by VR mode when creating a virtual display.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public final class Vr2dDisplayProperties implements Parcelable {
|
||||
|
||||
public static final int FLAG_VIRTUAL_DISPLAY_ENABLED = 1;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({
|
||||
FLAG_VIRTUAL_DISPLAY_ENABLED
|
||||
})
|
||||
public @interface Vr2dDisplayFlag {}
|
||||
|
||||
/**
|
||||
* The actual width, height and dpi.
|
||||
*/
|
||||
@@ -79,7 +90,7 @@ public final class Vr2dDisplayProperties implements Parcelable {
|
||||
|
||||
Vr2dDisplayProperties that = (Vr2dDisplayProperties) o;
|
||||
|
||||
if (getFlags() != that.getFlags()) return false;
|
||||
if (getAddedFlags() != that.getAddedFlags()) return false;
|
||||
if (getRemovedFlags() != that.getRemovedFlags()) return false;
|
||||
if (getWidth() != that.getWidth()) return false;
|
||||
if (getHeight() != that.getHeight()) return false;
|
||||
@@ -121,26 +132,46 @@ public final class Vr2dDisplayProperties implements Parcelable {
|
||||
mRemovedFlags = source.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out dump info.
|
||||
*/
|
||||
public void dump(PrintWriter pw, String prefix) {
|
||||
pw.println(prefix + toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the width of VR 2d display.
|
||||
*/
|
||||
public int getWidth() {
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the height of VR 2d display.
|
||||
*/
|
||||
public int getHeight() {
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the dpi of VR 2d display.
|
||||
*/
|
||||
public int getDpi() {
|
||||
return mDpi;
|
||||
}
|
||||
|
||||
public int getFlags() {
|
||||
/**
|
||||
* Returns the added flags of VR 2d display. Flags are combined by logic or.
|
||||
*/
|
||||
@Vr2dDisplayFlag
|
||||
public int getAddedFlags() {
|
||||
return mAddedFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the removed flags of VR 2d display. Flags are combined by logic or.
|
||||
*/
|
||||
@Vr2dDisplayFlag
|
||||
public int getRemovedFlags() {
|
||||
return mRemovedFlags;
|
||||
}
|
||||
@@ -193,7 +224,7 @@ public final class Vr2dDisplayProperties implements Parcelable {
|
||||
/**
|
||||
* Adds property flags.
|
||||
*/
|
||||
public Builder addFlags(int flags) {
|
||||
public Builder addFlags(@Vr2dDisplayFlag int flags) {
|
||||
mAddedFlags |= flags;
|
||||
mRemovedFlags &= ~flags;
|
||||
return this;
|
||||
@@ -202,7 +233,7 @@ public final class Vr2dDisplayProperties implements Parcelable {
|
||||
/**
|
||||
* Removes property flags.
|
||||
*/
|
||||
public Builder removeFlags(int flags) {
|
||||
public Builder removeFlags(@Vr2dDisplayFlag int flags) {
|
||||
mRemovedFlags |= flags;
|
||||
mAddedFlags &= ~flags;
|
||||
return this;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package android.app;
|
||||
|
||||
import android.annotation.CallbackExecutor;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.annotation.SystemApi;
|
||||
@@ -7,14 +8,15 @@ import android.annotation.SystemService;
|
||||
import android.annotation.TestApi;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.RemoteException;
|
||||
import android.service.vr.IPersistentVrStateCallbacks;
|
||||
import android.service.vr.IVrManager;
|
||||
import android.service.vr.IVrStateCallbacks;
|
||||
import android.util.ArrayMap;
|
||||
import android.view.Display;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
* Used to control aspects of a devices Virtual Reality (VR) capabilities.
|
||||
@@ -28,7 +30,7 @@ public class VrManager {
|
||||
final IVrStateCallbacks mStateCallback = new IVrStateCallbacks.Stub() {
|
||||
@Override
|
||||
public void onVrStateChanged(boolean enabled) {
|
||||
mHandler.post(() -> mCallback.onVrStateChanged(enabled));
|
||||
mExecutor.execute(() -> mCallback.onVrStateChanged(enabled));
|
||||
}
|
||||
|
||||
};
|
||||
@@ -36,15 +38,15 @@ public class VrManager {
|
||||
new IPersistentVrStateCallbacks.Stub() {
|
||||
@Override
|
||||
public void onPersistentVrStateChanged(boolean enabled) {
|
||||
mHandler.post(() -> mCallback.onPersistentVrStateChanged(enabled));
|
||||
mExecutor.execute(() -> mCallback.onPersistentVrStateChanged(enabled));
|
||||
}
|
||||
};
|
||||
final VrStateCallback mCallback;
|
||||
final Handler mHandler;
|
||||
final Executor mExecutor;
|
||||
|
||||
CallbackEntry(VrStateCallback callback, Handler handler) {
|
||||
CallbackEntry(VrStateCallback callback, Executor executor) {
|
||||
mCallback = callback;
|
||||
mHandler = handler;
|
||||
mExecutor = executor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,18 +64,18 @@ public class VrManager {
|
||||
* Registers a callback to be notified of changes to the VR Mode state.
|
||||
*
|
||||
* @param callback The callback to register.
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.RESTRICTED_VR_ACCESS,
|
||||
android.Manifest.permission.ACCESS_VR_STATE
|
||||
})
|
||||
public void registerVrStateCallback(VrStateCallback callback, @NonNull Handler handler) {
|
||||
public void registerVrStateCallback(@NonNull @CallbackExecutor Executor executor,
|
||||
VrStateCallback callback) {
|
||||
if (callback == null || mCallbackMap.containsKey(callback)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CallbackEntry entry = new CallbackEntry(callback, handler);
|
||||
CallbackEntry entry = new CallbackEntry(callback, executor);
|
||||
mCallbackMap.put(callback, entry);
|
||||
try {
|
||||
mService.registerListener(entry.mStateCallback);
|
||||
@@ -91,7 +93,6 @@ public class VrManager {
|
||||
* Deregisters VR State callbacks.
|
||||
*
|
||||
* @param callback The callback to deregister.
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.RESTRICTED_VR_ACCESS,
|
||||
@@ -116,13 +117,12 @@ public class VrManager {
|
||||
|
||||
/**
|
||||
* Returns the current VrMode state.
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.RESTRICTED_VR_ACCESS,
|
||||
android.Manifest.permission.ACCESS_VR_STATE
|
||||
})
|
||||
public boolean getVrModeEnabled() {
|
||||
public boolean isVrModeEnabled() {
|
||||
try {
|
||||
return mService.getVrModeState();
|
||||
} catch (RemoteException e) {
|
||||
@@ -133,13 +133,12 @@ public class VrManager {
|
||||
|
||||
/**
|
||||
* Returns the current VrMode state.
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(anyOf = {
|
||||
android.Manifest.permission.RESTRICTED_VR_ACCESS,
|
||||
android.Manifest.permission.ACCESS_VR_STATE
|
||||
})
|
||||
public boolean getPersistentVrModeEnabled() {
|
||||
public boolean isPersistentVrModeEnabled() {
|
||||
try {
|
||||
return mService.getPersistentVrModeEnabled();
|
||||
} catch (RemoteException e) {
|
||||
@@ -172,7 +171,6 @@ public class VrManager {
|
||||
* @param vr2dDisplayProp properties to be set to the virtual display for
|
||||
* 2D applications in VR mode.
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
|
||||
public void setVr2dDisplayProperties(
|
||||
@@ -205,7 +203,6 @@ public class VrManager {
|
||||
* devices. Standby mode is a deep sleep state where it's appropriate to turn off vr mode.
|
||||
*
|
||||
* @param standby True if the device is entering standby, false if it's exiting standby.
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.ACCESS_VR_MANAGER)
|
||||
public void setStandbyEnabled(boolean standby) {
|
||||
@@ -222,7 +219,6 @@ public class VrManager {
|
||||
* regular phone IME.
|
||||
* @param componentName ComponentName of a VR InputMethod that should be set as selected
|
||||
* input by InputMethodManagerService.
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
@RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
|
||||
@@ -233,4 +229,19 @@ public class VrManager {
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the display id of VR's {@link VirtualDisplay}.
|
||||
*
|
||||
* @see DisplayManager#getDisplay(int)
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.RESTRICTED_VR_ACCESS)
|
||||
public int getVr2dDisplayId() {
|
||||
try {
|
||||
return mService.getVr2dDisplayId();
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
}
|
||||
return Display.INVALID_DISPLAY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,14 @@
|
||||
*/
|
||||
package android.app;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
|
||||
/**
|
||||
* Listens to VR Mode state changes. Use with methods in {@link VrManager}.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public abstract class VrStateCallback {
|
||||
|
||||
/**
|
||||
|
||||
@@ -230,7 +230,8 @@ class Vr2dDisplay {
|
||||
resized = true;
|
||||
}
|
||||
|
||||
if ((displayProperties.getFlags() & Vr2dDisplayProperties.FLAG_VIRTUAL_DISPLAY_ENABLED)
|
||||
if ((displayProperties.getAddedFlags() &
|
||||
Vr2dDisplayProperties.FLAG_VIRTUAL_DISPLAY_ENABLED)
|
||||
== Vr2dDisplayProperties.FLAG_VIRTUAL_DISPLAY_ENABLED) {
|
||||
mIsVirtualDisplayAllowed = true;
|
||||
} else if ((displayProperties.getRemovedFlags() &
|
||||
|
||||
Reference in New Issue
Block a user