summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/os/UserManager.java17
-rw-r--r--core/java/android/view/HardwareRenderer.java53
2 files changed, 42 insertions, 28 deletions
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 898c766..d73f99a 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -122,7 +122,7 @@ public class UserManager {
* @param userHandle the user handle of the user whose information is being requested.
* @return the UserInfo object for a specific user.
* @hide
- * */
+ */
public UserInfo getUserInfo(int userHandle) {
try {
return mService.getUserInfo(userHandle);
@@ -134,10 +134,11 @@ public class UserManager {
/**
* Return the serial number for a user. This is a device-unique
- * number assigned to that user; if the user is deleted and new users
- * created, the new users will not be given the same serial number.
+ * number assigned to that user; if the user is deleted and then a new
+ * user created, the new users will not be given the same serial number.
* @param user The user whose serial number is to be retrieved.
- * @return The serial number of the given user.
+ * @return The serial number of the given user; returns -1 if the
+ * given UserHandle does not exist.
* @see #getUserForSerialNumber(long)
*/
public long getSerialNumberForUser(UserHandle user) {
@@ -179,6 +180,14 @@ public class UserManager {
}
/**
+ * Return the number of users currently created on the device.
+ */
+ public int getUserCount() {
+ List<UserInfo> users = getUsers();
+ return users != null ? users.size() : 1;
+ }
+
+ /**
* Returns information for all users on this device.
* Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
* @return the list of users that were created.
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 59f941d..1c613245 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -1526,30 +1526,6 @@ public abstract class HardwareRenderer {
}
@Override
- void destroyLayers(View view) {
- if (view != null && isEnabled() && checkCurrent() != SURFACE_STATE_ERROR) {
- if (mCanvas != null) {
- mCanvas.clearLayerUpdates();
- }
- destroyHardwareLayer(view);
- GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS);
- }
- }
-
- private static void destroyHardwareLayer(View view) {
- view.destroyLayer(true);
-
- if (view instanceof ViewGroup) {
- ViewGroup group = (ViewGroup) view;
-
- int count = group.getChildCount();
- for (int i = 0; i < count; i++) {
- destroyHardwareLayer(group.getChildAt(i));
- }
- }
- }
-
- @Override
boolean safelyRun(Runnable action) {
boolean needsContext = true;
if (isEnabled() && checkCurrent() != SURFACE_STATE_ERROR) needsContext = false;
@@ -1574,6 +1550,35 @@ public abstract class HardwareRenderer {
}
@Override
+ void destroyLayers(final View view) {
+ if (view != null) {
+ safelyRun(new Runnable() {
+ @Override
+ public void run() {
+ if (mCanvas != null) {
+ mCanvas.clearLayerUpdates();
+ }
+ destroyHardwareLayer(view);
+ GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS);
+ }
+ });
+ }
+ }
+
+ private static void destroyHardwareLayer(View view) {
+ view.destroyLayer(true);
+
+ if (view instanceof ViewGroup) {
+ ViewGroup group = (ViewGroup) view;
+
+ int count = group.getChildCount();
+ for (int i = 0; i < count; i++) {
+ destroyHardwareLayer(group.getChildAt(i));
+ }
+ }
+ }
+
+ @Override
void destroyHardwareResources(final View view) {
if (view != null) {
safelyRun(new Runnable() {