summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/SharedPreferencesImpl.java3
-rw-r--r--core/java/android/content/SharedPreferences.java11
-rw-r--r--core/java/android/service/dreams/Sandman.java13
-rw-r--r--core/java/android/view/HardwareRenderer.java7
-rw-r--r--core/java/android/view/ViewRootImpl.java11
-rw-r--r--core/java/android/view/WindowManagerGlobal.java1
-rw-r--r--core/java/android/widget/PopupWindow.java20
-rw-r--r--core/java/com/android/internal/net/VpnProfile.java50
8 files changed, 95 insertions, 21 deletions
diff --git a/core/java/android/app/SharedPreferencesImpl.java b/core/java/android/app/SharedPreferencesImpl.java
index 201d7b2..86fd7b9 100644
--- a/core/java/android/app/SharedPreferencesImpl.java
+++ b/core/java/android/app/SharedPreferencesImpl.java
@@ -312,7 +312,8 @@ final class SharedPreferencesImpl implements SharedPreferences {
}
public Editor putStringSet(String key, Set<String> values) {
synchronized (this) {
- mModified.put(key, values);
+ mModified.put(key,
+ (values == null) ? null : new HashSet<String>(values));
return this;
}
}
diff --git a/core/java/android/content/SharedPreferences.java b/core/java/android/content/SharedPreferences.java
index bdc38d6..da5480e 100644
--- a/core/java/android/content/SharedPreferences.java
+++ b/core/java/android/content/SharedPreferences.java
@@ -25,7 +25,8 @@ import java.util.Set;
* there is a single instance of this class that all clients share.
* Modifications to the preferences must go through an {@link Editor} object
* to ensure the preference values remain in a consistent state and control
- * when they are committed to storage.
+ * when they are committed to storage. Objects that are returned from the
+ * various <code>get</code> methods must be treated as immutable by the application.
*
* <p><em>Note: currently this class does not support use across multiple
* processes. This will be added later.</em>
@@ -226,6 +227,10 @@ public interface SharedPreferences {
/**
* Retrieve all values from the preferences.
*
+ * <p>Note that you <em>must not</em> modify the collection returned
+ * by this method, or alter any of its contents. The consistency of your
+ * stored data is not guaranteed if you do.
+ *
* @return Returns a map containing a list of pairs key/value representing
* the preferences.
*
@@ -250,6 +255,10 @@ public interface SharedPreferences {
/**
* Retrieve a set of String values from the preferences.
*
+ * <p>Note that you <em>must not</em> modify the set instance returned
+ * by this call. The consistency of the stored data is not guaranteed
+ * if you do, nor is your ability to modify the instance at all.
+ *
* @param key The name of the preference to retrieve.
* @param defValues Values to return if this preference does not exist.
*
diff --git a/core/java/android/service/dreams/Sandman.java b/core/java/android/service/dreams/Sandman.java
index 70142ce..5f5b079 100644
--- a/core/java/android/service/dreams/Sandman.java
+++ b/core/java/android/service/dreams/Sandman.java
@@ -36,9 +36,6 @@ import android.util.Slog;
public final class Sandman {
private static final String TAG = "Sandman";
- private static final int DEFAULT_SCREENSAVER_ENABLED = 1;
- private static final int DEFAULT_SCREENSAVER_ACTIVATED_ON_DOCK = 1;
-
// The component name of a special dock app that merely launches a dream.
// We don't want to launch this app when docked because it causes an unnecessary
// activity transition. We just want to start the dream.
@@ -109,14 +106,18 @@ public final class Sandman {
}
private static boolean isScreenSaverEnabled(Context context) {
+ int def = context.getResources().getBoolean(
+ com.android.internal.R.bool.config_dreamsEnabledByDefault) ? 1 : 0;
return Settings.Secure.getIntForUser(context.getContentResolver(),
- Settings.Secure.SCREENSAVER_ENABLED, DEFAULT_SCREENSAVER_ENABLED,
+ Settings.Secure.SCREENSAVER_ENABLED, def,
UserHandle.USER_CURRENT) != 0;
}
private static boolean isScreenSaverActivatedOnDock(Context context) {
+ int def = context.getResources().getBoolean(
+ com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault) ? 1 : 0;
return Settings.Secure.getIntForUser(context.getContentResolver(),
- Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK,
- DEFAULT_SCREENSAVER_ACTIVATED_ON_DOCK, UserHandle.USER_CURRENT) != 0;
+ Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK, def,
+ UserHandle.USER_CURRENT) != 0;
}
}
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index ec1695e..59f941d 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -1200,7 +1200,12 @@ public abstract class HardwareRenderer {
Trace.traceEnd(Trace.TRACE_TAG_VIEW);
}
- status = onPreDraw(dirty);
+ Trace.traceBegin(Trace.TRACE_TAG_VIEW, "prepareFrame");
+ try {
+ status = onPreDraw(dirty);
+ } finally {
+ Trace.traceEnd(Trace.TRACE_TAG_VIEW);
+ }
saveCount = canvas.save();
callbacks.onHardwarePreDraw(canvas);
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 67452ec..8a82a54 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -317,6 +317,8 @@ public final class ViewRootImpl implements ViewParent,
private final int mDensity;
private final int mNoncompatDensity;
+ private int mViewLayoutDirectionInitial;
+
/**
* Consistency verifier for debugging purposes.
*/
@@ -465,6 +467,7 @@ public final class ViewRootImpl implements ViewParent,
synchronized (this) {
if (mView == null) {
mView = view;
+ mViewLayoutDirectionInitial = mView.getRawLayoutDirection();
mFallbackEventHandler.setView(view);
mWindowAttributes.copyFrom(attrs);
attrs = mWindowAttributes;
@@ -1186,7 +1189,10 @@ public final class ViewRootImpl implements ViewParent,
viewVisibilityChanged = false;
mLastConfiguration.setTo(host.getResources().getConfiguration());
mLastSystemUiVisibility = mAttachInfo.mSystemUiVisibility;
- host.setLayoutDirection(mLastConfiguration.getLayoutDirection());
+ // Set the layout direction if it has not been set before (inherit is the default)
+ if (mViewLayoutDirectionInitial == View.LAYOUT_DIRECTION_INHERIT) {
+ host.setLayoutDirection(mLastConfiguration.getLayoutDirection());
+ }
host.dispatchAttachedToWindow(attachInfo, 0);
mFitSystemWindowsInsets.set(mAttachInfo.mContentInsets);
host.fitSystemWindows(mFitSystemWindowsInsets);
@@ -2682,7 +2688,8 @@ public final class ViewRootImpl implements ViewParent,
final int lastLayoutDirection = mLastConfiguration.getLayoutDirection();
final int currentLayoutDirection = config.getLayoutDirection();
mLastConfiguration.setTo(config);
- if (lastLayoutDirection != currentLayoutDirection) {
+ if (lastLayoutDirection != currentLayoutDirection &&
+ mViewLayoutDirectionInitial == View.LAYOUT_DIRECTION_INHERIT) {
mView.setLayoutDirection(currentLayoutDirection);
}
mView.dispatchConfigurationChanged(config);
diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java
index 7855763c..5cdc1ed 100644
--- a/core/java/android/view/WindowManagerGlobal.java
+++ b/core/java/android/view/WindowManagerGlobal.java
@@ -99,6 +99,7 @@ public final class WindowManagerGlobal {
public static final int ADD_STARTING_NOT_NEEDED = -6;
public static final int ADD_MULTIPLE_SINGLETON = -7;
public static final int ADD_PERMISSION_DENIED = -8;
+ public static final int ADD_INVALID_DISPLAY = -9;
private static WindowManagerGlobal sDefaultWindowManager;
private static IWindowManager sWindowManagerService;
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index af3365e..b71649a 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -142,6 +142,8 @@ public class PopupWindow {
};
private int mAnchorXoff, mAnchorYoff;
+ private boolean mPopupViewInitialLayoutDirectionInherited;
+
/**
* <p>Create a new empty, non focusable popup window of dimension (0,0).</p>
*
@@ -968,6 +970,8 @@ public class PopupWindow {
} else {
mPopupView = mContentView;
}
+ mPopupViewInitialLayoutDirectionInherited =
+ (mPopupView.getRawLayoutDirection() == View.LAYOUT_DIRECTION_INHERIT);
mPopupWidth = p.width;
mPopupHeight = p.height;
}
@@ -985,9 +989,19 @@ public class PopupWindow {
p.packageName = mContext.getPackageName();
}
mPopupView.setFitsSystemWindows(mLayoutInsetDecor);
+ setLayoutDirectionFromAnchor();
mWindowManager.addView(mPopupView, p);
}
+ private void setLayoutDirectionFromAnchor() {
+ if (mAnchor != null) {
+ View anchor = mAnchor.get();
+ if (anchor != null && mPopupViewInitialLayoutDirectionInherited) {
+ mPopupView.setLayoutDirection(anchor.getLayoutDirection());
+ }
+ }
+ }
+
/**
* <p>Generate the layout parameters for the popup window.</p>
*
@@ -1304,8 +1318,9 @@ public class PopupWindow {
p.flags = newFlags;
update = true;
}
-
+
if (update) {
+ setLayoutDirectionFromAnchor();
mWindowManager.updateViewLayout(mPopupView, p);
}
}
@@ -1406,6 +1421,7 @@ public class PopupWindow {
}
if (update) {
+ setLayoutDirectionFromAnchor();
mWindowManager.updateViewLayout(mPopupView, p);
}
}
@@ -1482,7 +1498,7 @@ public class PopupWindow {
} else {
updateAboveAnchor(findDropDownPosition(anchor, p, mAnchorXoff, mAnchorYoff));
}
-
+
update(p.x, p.y, width, height, x != p.x || y != p.y);
}
diff --git a/core/java/com/android/internal/net/VpnProfile.java b/core/java/com/android/internal/net/VpnProfile.java
index 7287327..c9b7cb3 100644
--- a/core/java/com/android/internal/net/VpnProfile.java
+++ b/core/java/com/android/internal/net/VpnProfile.java
@@ -70,6 +70,47 @@ public class VpnProfile implements Cloneable, Parcelable {
this.key = key;
}
+ public VpnProfile(Parcel in) {
+ key = in.readString();
+ name = in.readString();
+ type = in.readInt();
+ server = in.readString();
+ username = in.readString();
+ password = in.readString();
+ dnsServers = in.readString();
+ searchDomains = in.readString();
+ routes = in.readString();
+ mppe = in.readInt() != 0;
+ l2tpSecret = in.readString();
+ ipsecIdentifier = in.readString();
+ ipsecSecret = in.readString();
+ ipsecUserCert = in.readString();
+ ipsecCaCert = in.readString();
+ ipsecServerCert = in.readString();
+ saveLogin = in.readInt() != 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeString(key);
+ out.writeString(name);
+ out.writeInt(type);
+ out.writeString(server);
+ out.writeString(username);
+ out.writeString(password);
+ out.writeString(dnsServers);
+ out.writeString(searchDomains);
+ out.writeString(routes);
+ out.writeInt(mppe ? 1 : 0);
+ out.writeString(l2tpSecret);
+ out.writeString(ipsecIdentifier);
+ out.writeString(ipsecSecret);
+ out.writeString(ipsecUserCert);
+ out.writeString(ipsecCaCert);
+ out.writeString(ipsecServerCert);
+ out.writeInt(saveLogin ? 1 : 0);
+ }
+
public static VpnProfile decode(String key, byte[] value) {
try {
if (key == null) {
@@ -155,17 +196,10 @@ public class VpnProfile implements Cloneable, Parcelable {
}
}
- @Override
- public void writeToParcel(Parcel out, int flags) {
- out.writeString(key);
- out.writeByteArray(encode());
- }
-
public static final Creator<VpnProfile> CREATOR = new Creator<VpnProfile>() {
@Override
public VpnProfile createFromParcel(Parcel in) {
- final String key = in.readString();
- return decode(key, in.createByteArray());
+ return new VpnProfile(in);
}
@Override