Merge "Add unit tests for convert (with relaxed precision)." into jb-dev
diff --git a/Android.mk b/Android.mk
index eef900a..b0a3dac 100644
--- a/Android.mk
+++ b/Android.mk
@@ -61,7 +61,6 @@
LOCAL_SRC_FILES += \
core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl \
core/java/android/accessibilityservice/IAccessibilityServiceClient.aidl \
- core/java/android/accessibilityservice/IAccessibilityServiceClientCallback.aidl \
core/java/android/accounts/IAccountManager.aidl \
core/java/android/accounts/IAccountManagerResponse.aidl \
core/java/android/accounts/IAccountAuthenticator.aidl \
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 939c117..539b84e 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -129,6 +129,9 @@
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/accessibilityservice/IEventListener.java)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/accessibilityservice/IEventListener.P)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/view/accessibility/IAccessibilityManager.P)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/accessibilityservice/IAccessibilityServiceClientCallback.java)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/accessibilityservice/IAccessibilityServiceClientCallback.P)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/accessibilityservice/IAccessibilityServiceClient.P)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index c0fb06f..1d5f207 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -55,6 +55,10 @@
#define SYSTEM_BOOTANIMATION_FILE "/system/media/bootanimation.zip"
#define SYSTEM_ENCRYPTED_BOOTANIMATION_FILE "/system/media/bootanimation-encrypted.zip"
+extern "C" int clock_nanosleep(clockid_t clock_id, int flags,
+ const struct timespec *request,
+ struct timespec *remain);
+
namespace android {
// ---------------------------------------------------------------------------
@@ -476,6 +480,7 @@
for (int r=0 ; !part.count || r<part.count ; r++) {
for (int j=0 ; j<fcount && !exitPending(); j++) {
const Animation::Frame& frame(part.frames[j]);
+ nsecs_t lastFrame = systemTime();
if (r > 0) {
glBindTexture(GL_TEXTURE_2D, frame.tid);
@@ -508,10 +513,18 @@
nsecs_t now = systemTime();
nsecs_t delay = frameDuration - (now - lastFrame);
+ //ALOGD("%lld, %lld", ns2ms(now - lastFrame), ns2ms(delay));
lastFrame = now;
- long wait = ns2us(delay);
- if (wait > 0)
- usleep(wait);
+
+ if (delay > 0) {
+ struct timespec spec;
+ spec.tv_sec = (now + delay) / 1000000000;
+ spec.tv_nsec = (now + delay) % 1000000000;
+ int err;
+ do {
+ err = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &spec, NULL);
+ } while (err<0 && errno == EINTR);
+ }
}
usleep(part.pause * ns2us(frameDuration));
}
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java
index 850fe48..044c0c2 100644
--- a/core/java/android/accessibilityservice/AccessibilityService.java
+++ b/core/java/android/accessibilityservice/AccessibilityService.java
@@ -371,7 +371,7 @@
*
* <strong>Note:</strong> To receive gestures an accessibility service must
* request that the device is in touch exploration mode by setting the
- * {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_INCLUDE_NOT_IMPORTANT_VIEWS}
+ * {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_REQUEST_TOUCH_EXPLORATION_MODE}
* flag.
*
* @param gestureId The unique id of the performed gesture.
@@ -565,10 +565,8 @@
mCaller.sendMessage(message);
}
- public void onGesture(int gestureId, IAccessibilityServiceClientCallback callback,
- int interactionId) {
- Message message = mCaller.obtainMessageIIO(DO_ON_GESTURE, gestureId, interactionId,
- callback);
+ public void onGesture(int gestureId) {
+ Message message = mCaller.obtainMessageI(DO_ON_GESTURE, gestureId);
mCaller.sendMessage(message);
}
@@ -601,15 +599,7 @@
return;
case DO_ON_GESTURE :
final int gestureId = message.arg1;
- final int interactionId = message.arg2;
- IAccessibilityServiceClientCallback callback =
- (IAccessibilityServiceClientCallback) message.obj;
- final boolean handled = mCallback.onGesture(gestureId);
- try {
- callback.setGestureResult(gestureId, handled, interactionId);
- } catch (RemoteException re) {
- Log.e(LOG_TAG, "Error calling back with the gesture resut.", re);
- }
+ mCallback.onGesture(gestureId);
return;
default :
Log.w(LOG_TAG, "Unknown message type " + message.what);
diff --git a/core/java/android/accessibilityservice/IAccessibilityServiceClient.aidl b/core/java/android/accessibilityservice/IAccessibilityServiceClient.aidl
index 0257aa4..d459fd5 100644
--- a/core/java/android/accessibilityservice/IAccessibilityServiceClient.aidl
+++ b/core/java/android/accessibilityservice/IAccessibilityServiceClient.aidl
@@ -16,7 +16,6 @@
package android.accessibilityservice;
-import android.accessibilityservice.IAccessibilityServiceClientCallback;
import android.accessibilityservice.IAccessibilityServiceConnection;
import android.view.accessibility.AccessibilityEvent;
@@ -33,5 +32,5 @@
void onInterrupt();
- void onGesture(int gesture, in IAccessibilityServiceClientCallback callback, int interactionId);
+ void onGesture(int gesture);
}
diff --git a/core/java/android/accessibilityservice/IAccessibilityServiceClientCallback.aidl b/core/java/android/accessibilityservice/IAccessibilityServiceClientCallback.aidl
deleted file mode 100644
index 9061398..0000000
--- a/core/java/android/accessibilityservice/IAccessibilityServiceClientCallback.aidl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-** Copyright 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.accessibilityservice;
-
-import android.accessibilityservice.IAccessibilityServiceConnection;
-import android.view.accessibility.AccessibilityEvent;
-
-/**
- * Callback for IAccessibilityServiceClient.
- *
- * @hide
- */
- oneway interface IAccessibilityServiceClientCallback {
-
- void setGestureResult(int gestureId, boolean handled, int interactionId);
-}
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index e2ebeba..b29035d 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -275,7 +275,7 @@
}
public String toString() {
- ComponentName componentName = intent.getComponent();
+ ComponentName componentName = intent != null ? intent.getComponent() : null;
return "ActivityRecord{"
+ Integer.toHexString(System.identityHashCode(this))
+ " token=" + token + " " + (componentName == null
@@ -2090,8 +2090,15 @@
r.activity.mCalled = false;
mInstrumentation.callActivityOnPause(r.activity);
// We need to keep around the original state, in case
- // we need to be created again.
- r.state = oldState;
+ // we need to be created again. But we only do this
+ // for pre-Honeycomb apps, which always save their state
+ // when pausing, so we can not have them save their state
+ // when restarting from a paused state. For HC and later,
+ // we want to (and can) let the state be saved as the normal
+ // part of stopping the activity.
+ if (r.isPreHoneycomb()) {
+ r.state = oldState;
+ }
if (!r.activity.mCalled) {
throw new SuperNotCalledException(
"Activity " + r.intent.getComponent().toShortString() +
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index d3ba497..5e6b090 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -28,6 +28,7 @@
import android.util.AndroidRuntimeException;
import android.util.AttributeSet;
import android.util.DebugUtils;
+import android.util.Log;
import android.util.SparseArray;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
@@ -108,7 +109,9 @@
mInstance.mRetainInstance = mRetainInstance;
mInstance.mDetached = mDetached;
mInstance.mFragmentManager = activity.mFragments;
-
+ if (FragmentManagerImpl.DEBUG) Log.v(FragmentManagerImpl.TAG,
+ "Instantiated fragment " + mInstance);
+
return mInstance;
}
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index 7e1daa4..6058bdc 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -1074,6 +1074,7 @@
f.setIndex(mAvailIndices.remove(mAvailIndices.size()-1));
mActive.set(f.mIndex, f);
}
+ if (DEBUG) Log.v(TAG, "Allocated fragment index " + f);
}
void makeInactive(Fragment f) {
@@ -1081,7 +1082,7 @@
return;
}
- if (DEBUG) Log.v(TAG, "Freeing fragment index " + f.mIndex);
+ if (DEBUG) Log.v(TAG, "Freeing fragment index " + f);
mActive.set(f.mIndex, null);
if (mAvailIndices == null) {
mAvailIndices = new ArrayList<Integer>();
@@ -1493,6 +1494,7 @@
fragments.add(f);
f.mRetaining = true;
f.mTargetIndex = f.mTarget != null ? f.mTarget.mIndex : -1;
+ if (DEBUG) Log.v(TAG, "retainNonConfig: keeping retained " + f);
}
}
}
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index c791e47..da09a18 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -810,11 +810,17 @@
* <p>
* As a convenience, an Intent of this form can be created with the
* {@link #createChooser} function.
- * <p>Input: No data should be specified. get*Extra must have
+ * <p>
+ * If the target {@link #EXTRA_INTENT} contains {@link ClipData}, you should
+ * also copy it to this intent along with relevant flags, such as
+ * {@link #FLAG_GRANT_READ_URI_PERMISSION}.
+ * <p>
+ * Input: No data should be specified. get*Extra must have
* a {@link #EXTRA_INTENT} field containing the Intent being executed,
* and can optionally have a {@link #EXTRA_TITLE} field containing the
* title text to display in the chooser.
- * <p>Output: Depends on the protocol of {@link #EXTRA_INTENT}.
+ * <p>
+ * Output: Depends on the protocol of {@link #EXTRA_INTENT}.
*/
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_CHOOSER = "android.intent.action.CHOOSER";
@@ -835,8 +841,17 @@
if (title != null) {
intent.putExtra(EXTRA_TITLE, title);
}
+
+ // Migrate any clip data and flags from target.
+ final ClipData targetClipData = target.getClipData();
+ if (targetClipData != null) {
+ intent.setClipData(targetClipData);
+ intent.addFlags(target.getFlags()
+ & (FLAG_GRANT_READ_URI_PERMISSION | FLAG_GRANT_WRITE_URI_PERMISSION));
+ }
return intent;
}
+
/**
* Activity Action: Allow the user to select a particular kind of data and
* return it. This is different than {@link #ACTION_PICK} in that here we
@@ -6587,19 +6602,35 @@
/**
* Migrate any {@link #EXTRA_STREAM} in {@link #ACTION_SEND} and
- * {@link #ACTION_SEND_MULTIPLE} to {@link ClipData}.
+ * {@link #ACTION_SEND_MULTIPLE} to {@link ClipData}. Also inspects nested
+ * intents in {@link #ACTION_CHOOSER}.
*
+ * @return Whether any contents were migrated.
* @hide
*/
- public void migrateExtraStreamToClipData() {
+ public boolean migrateExtraStreamToClipData() {
// Refuse to touch if extras already parcelled
- if (mExtras != null && mExtras.isParcelled()) return;
+ if (mExtras != null && mExtras.isParcelled()) return false;
// Bail when someone already gave us ClipData
- if (getClipData() != null) return;
+ if (getClipData() != null) return false;
final String action = getAction();
- if (ACTION_SEND.equals(action)) {
+ if (ACTION_CHOOSER.equals(action)) {
+ // Inspect target intent to see if we need to migrate
+ final Intent target = getParcelableExtra(EXTRA_INTENT);
+ if (target.migrateExtraStreamToClipData()) {
+ // Since we migrated in child, we need to promote ClipData and
+ // flags to ourselves to grant.
+ setClipData(target.getClipData());
+ addFlags(target.getFlags()
+ & (FLAG_GRANT_READ_URI_PERMISSION | FLAG_GRANT_WRITE_URI_PERMISSION));
+ return true;
+ } else {
+ return false;
+ }
+
+ } else if (ACTION_SEND.equals(action)) {
try {
final Uri stream = getParcelableExtra(EXTRA_STREAM);
final CharSequence text = getCharSequenceExtra(EXTRA_TEXT);
@@ -6610,6 +6641,7 @@
new ClipData.Item(text, htmlText, null, stream));
setClipData(clipData);
addFlags(FLAG_GRANT_READ_URI_PERMISSION);
+ return true;
}
} catch (ClassCastException e) {
}
@@ -6626,14 +6658,14 @@
if (texts != null) {
if (num >= 0 && num != texts.size()) {
// Wha...! F- you.
- return;
+ return false;
}
num = texts.size();
}
if (htmlTexts != null) {
if (num >= 0 && num != htmlTexts.size()) {
// Wha...! F- you.
- return;
+ return false;
}
num = htmlTexts.size();
}
@@ -6648,10 +6680,13 @@
setClipData(clipData);
addFlags(FLAG_GRANT_READ_URI_PERMISSION);
+ return true;
}
} catch (ClassCastException e) {
}
}
+
+ return false;
}
private static ClipData.Item makeClipItem(ArrayList<Uri> streams, ArrayList<CharSequence> texts,
diff --git a/core/java/android/database/sqlite/SQLiteGlobal.java b/core/java/android/database/sqlite/SQLiteGlobal.java
index 5d8f80e..5ff199a 100644
--- a/core/java/android/database/sqlite/SQLiteGlobal.java
+++ b/core/java/android/database/sqlite/SQLiteGlobal.java
@@ -18,6 +18,7 @@
import android.content.res.Resources;
import android.os.StatFs;
+import android.os.SystemProperties;
/**
* Provides access to SQLite functions that affect all database connection,
@@ -62,7 +63,7 @@
if (sDefaultPageSize == 0) {
sDefaultPageSize = new StatFs("/data").getBlockSize();
}
- return sDefaultPageSize;
+ return SystemProperties.getInt("debug.sqlite.pagesize", sDefaultPageSize);
}
}
@@ -70,47 +71,55 @@
* Gets the default journal mode when WAL is not in use.
*/
public static String getDefaultJournalMode() {
- return Resources.getSystem().getString(
- com.android.internal.R.string.db_default_journal_mode);
+ return SystemProperties.get("debug.sqlite.journalmode",
+ Resources.getSystem().getString(
+ com.android.internal.R.string.db_default_journal_mode));
}
/**
* Gets the journal size limit in bytes.
*/
public static int getJournalSizeLimit() {
- return Resources.getSystem().getInteger(
- com.android.internal.R.integer.db_journal_size_limit);
+ return SystemProperties.getInt("debug.sqlite.journalsizelimit",
+ Resources.getSystem().getInteger(
+ com.android.internal.R.integer.db_journal_size_limit));
}
/**
* Gets the default database synchronization mode when WAL is not in use.
*/
public static String getDefaultSyncMode() {
- return Resources.getSystem().getString(
- com.android.internal.R.string.db_default_sync_mode);
+ return SystemProperties.get("debug.sqlite.syncmode",
+ Resources.getSystem().getString(
+ com.android.internal.R.string.db_default_sync_mode));
}
/**
* Gets the database synchronization mode when in WAL mode.
*/
public static String getWALSyncMode() {
- return Resources.getSystem().getString(
- com.android.internal.R.string.db_wal_sync_mode);
+ return SystemProperties.get("debug.sqlite.wal.syncmode",
+ Resources.getSystem().getString(
+ com.android.internal.R.string.db_wal_sync_mode));
}
/**
* Gets the WAL auto-checkpoint integer in database pages.
*/
public static int getWALAutoCheckpoint() {
- return Math.max(1, Resources.getSystem().getInteger(
+ int value = SystemProperties.getInt("debug.sqlite.wal.autocheckpoint",
+ Resources.getSystem().getInteger(
com.android.internal.R.integer.db_wal_autocheckpoint));
+ return Math.max(1, value);
}
/**
* Gets the connection pool size when in WAL mode.
*/
public static int getWALConnectionPoolSize() {
- return Math.max(2, Resources.getSystem().getInteger(
+ int value = SystemProperties.getInt("debug.sqlite.wal.poolsize",
+ Resources.getSystem().getInteger(
com.android.internal.R.integer.db_connection_pool_size));
+ return Math.max(2, value);
}
}
diff --git a/core/java/android/os/Power.java b/core/java/android/os/Power.java
deleted file mode 100644
index 58df940..0000000
--- a/core/java/android/os/Power.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2007 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.os;
-
-import java.io.IOException;
-import android.os.ServiceManager;
-
-/**
- * Class that provides access to some of the power management functions.
- *
- * {@hide}
- */
-public class Power
-{
- // can't instantiate this class
- private Power()
- {
- }
-
- /**
- * Wake lock that ensures that the CPU is running. The screen might
- * not be on.
- */
- public static final int PARTIAL_WAKE_LOCK = 1;
-
- /**
- * Wake lock that ensures that the screen is on.
- */
- public static final int FULL_WAKE_LOCK = 2;
-
- public static native void acquireWakeLock(int lock, String id);
- public static native void releaseWakeLock(String id);
-
- /**
- * Brightness value for fully off
- */
- public static final int BRIGHTNESS_OFF = 0;
-
- /**
- * Brightness value for dim backlight
- */
- public static final int BRIGHTNESS_DIM = 20;
-
- /**
- * Brightness value for fully on
- */
- public static final int BRIGHTNESS_ON = 255;
-
- /**
- * Brightness value to use when battery is low
- */
- public static final int BRIGHTNESS_LOW_BATTERY = 10;
-
- /**
- * Threshold for BRIGHTNESS_LOW_BATTERY (percentage)
- * Screen will stay dim if battery level is <= LOW_BATTERY_THRESHOLD
- */
- public static final int LOW_BATTERY_THRESHOLD = 10;
-
- /**
- * Turn the screen on or off
- *
- * @param on Whether you want the screen on or off
- */
- public static native int setScreenState(boolean on);
-
- public static native int setLastUserActivityTimeout(long ms);
-
- /**
- * Low-level function turn the device off immediately, without trying
- * to be clean. Most people should use
- * {@link android.internal.app.ShutdownThread} for a clean shutdown.
- *
- * @deprecated
- * @hide
- */
- @Deprecated
- public static native void shutdown();
-
- /**
- * Reboot the device.
- * @param reason code to pass to the kernel (e.g. "recovery"), or null.
- *
- * @throws IOException if reboot fails for some reason (eg, lack of
- * permission)
- */
- public static void reboot(String reason) throws IOException
- {
- rebootNative(reason);
- }
-
- private static native void rebootNative(String reason) throws IOException ;
-
- public static native int powerInitNative();
-}
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 21373ec..903c8b3 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -197,7 +197,31 @@
* Does not work with PARTIAL_WAKE_LOCKs.
*/
public static final int ON_AFTER_RELEASE = 0x20000000;
-
+
+ /**
+ * Brightness value to use when battery is low.
+ * @hide
+ */
+ public static final int BRIGHTNESS_LOW_BATTERY = 10;
+
+ /**
+ * Brightness value for fully on.
+ * @hide
+ */
+ public static final int BRIGHTNESS_ON = 255;
+
+ /**
+ * Brightness value for dim backlight.
+ * @hide
+ */
+ public static final int BRIGHTNESS_DIM = 20;
+
+ /**
+ * Brightness value for fully off.
+ * @hide
+ */
+ public static final int BRIGHTNESS_OFF = 0;
+
/**
* Class lets you say that you need to have the device on.
* <p>
diff --git a/core/java/android/os/Trace.java b/core/java/android/os/Trace.java
index 911183d..c0240fe 100644
--- a/core/java/android/os/Trace.java
+++ b/core/java/android/os/Trace.java
@@ -38,6 +38,7 @@
public static final long TRACE_TAG_ACTIVITY_MANAGER = 1L << 6;
public static final long TRACE_TAG_SYNC_MANAGER = 1L << 7;
public static final long TRACE_TAG_AUDIO = 1L << 8;
+ public static final long TRACE_TAG_VIDEO = 1L << 9;
public static final int TRACE_FLAGS_START_BIT = 1;
public static final String[] TRACE_TAGS = {
diff --git a/core/java/android/preference/VolumePreference.java b/core/java/android/preference/VolumePreference.java
index fe5e76c..caf55d7 100644
--- a/core/java/android/preference/VolumePreference.java
+++ b/core/java/android/preference/VolumePreference.java
@@ -239,9 +239,7 @@
public void onChange(boolean selfChange) {
super.onChange(selfChange);
if (mSeekBar != null && mAudioManager != null) {
- int volume = mAudioManager.isStreamMute(mStreamType) ?
- mAudioManager.getLastAudibleStreamVolume(mStreamType)
- : mAudioManager.getStreamVolume(mStreamType);
+ int volume = mAudioManager.getStreamVolume(mStreamType);
mSeekBar.setProgress(volume);
}
}
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 9d36677..3e0942c 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -154,7 +154,6 @@
int mCurWindowPrivateFlags = mWindowPrivateFlags;
final Rect mVisibleInsets = new Rect();
final Rect mWinFrame = new Rect();
- final Rect mSystemInsets = new Rect();
final Rect mContentInsets = new Rect();
final Configuration mConfiguration = new Configuration();
@@ -254,7 +253,7 @@
final BaseIWindow mWindow = new BaseIWindow() {
@Override
- public void resized(int w, int h, Rect systemInsets, Rect contentInsets,
+ public void resized(int w, int h, Rect contentInsets,
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
Message msg = mCaller.obtainMessageI(MSG_WINDOW_RESIZED,
reportDraw ? 1 : 0);
@@ -621,7 +620,7 @@
final int relayoutResult = mSession.relayout(
mWindow, mWindow.mSeq, mLayout, mWidth, mHeight,
- View.VISIBLE, 0, mWinFrame, mSystemInsets, mContentInsets,
+ View.VISIBLE, 0, mWinFrame, mContentInsets,
mVisibleInsets, mConfiguration, mSurfaceHolder.mSurface);
if (DEBUG) Log.v(TAG, "New surface: " + mSurfaceHolder.mSurface
diff --git a/core/java/android/text/DynamicLayout.java b/core/java/android/text/DynamicLayout.java
index dc58ef2..d909362 100644
--- a/core/java/android/text/DynamicLayout.java
+++ b/core/java/android/text/DynamicLayout.java
@@ -35,6 +35,7 @@
public class DynamicLayout extends Layout
{
private static final int PRIORITY = 128;
+ private static final int BLOCK_MINIMUM_CHARACTER_LENGTH = 400;
/**
* Make a layout for the specified text that will be updated as
@@ -117,10 +118,6 @@
mObjects = new PackedObjectVector<Directions>(1);
- mBlockEndLines = new int[] { 0 };
- mBlockIndices = new int[] { INVALID_BLOCK_INDEX };
- mNumberOfBlocks = 1;
-
mIncludePad = includepad;
/*
@@ -170,7 +167,6 @@
mObjects.insertAt(0, dirs);
// Update from 0 characters to whatever the real text is
-
reflow(base, 0, 0, base.length());
if (base instanceof Spannable) {
@@ -295,14 +291,12 @@
// the very end of the buffer, then we already have a line that
// starts there, so disregard the blank line.
- if (where + after != len &&
- reflowed.getLineStart(n - 1) == where + after)
+ if (where + after != len && reflowed.getLineStart(n - 1) == where + after)
n--;
// remove affected lines from old layout
mInts.deleteAt(startline, endline - startline);
mObjects.deleteAt(startline, endline - startline);
- updateBlocks(startline, endline - 1, n);
// adjust offsets in layout for new height and offsets
@@ -362,6 +356,8 @@
mObjects.insertAt(startline + i, objects);
}
+ updateBlocks(startline, endline - 1, n);
+
synchronized (sLock) {
sStaticLayout = reflowed;
reflowed.finish();
@@ -369,6 +365,62 @@
}
/**
+ * Create the initial block structure, cutting the text into blocks of at least
+ * BLOCK_MINIMUM_CHARACTER_SIZE characters, aligned on the ends of paragraphs.
+ */
+ private void createBlocks() {
+ int offset = BLOCK_MINIMUM_CHARACTER_LENGTH;
+ mNumberOfBlocks = 0;
+ final CharSequence text = mDisplay;
+
+ while (true) {
+ offset = TextUtils.indexOf(text, '\n', offset);
+ if (offset < 0) {
+ addBlockAtOffset(text.length());
+ break;
+ } else {
+ addBlockAtOffset(offset);
+ offset += BLOCK_MINIMUM_CHARACTER_LENGTH;
+ }
+ }
+
+ // mBlockIndices and mBlockEndLines should have the same length
+ mBlockIndices = new int[mBlockEndLines.length];
+ for (int i = 0; i < mBlockEndLines.length; i++) {
+ mBlockIndices[i] = INVALID_BLOCK_INDEX;
+ }
+ }
+
+ /**
+ * Create a new block, ending at the specified character offset.
+ * A block will actually be created only if has at least one line, i.e. this offset is
+ * not on the end line of the previous block.
+ */
+ private void addBlockAtOffset(int offset) {
+ final int line = getLineForOffset(offset);
+
+ if (mBlockEndLines == null) {
+ // Initial creation of the array, no test on previous block ending line
+ mBlockEndLines = new int[ArrayUtils.idealIntArraySize(1)];
+ mBlockEndLines[mNumberOfBlocks] = line;
+ mNumberOfBlocks++;
+ return;
+ }
+
+ final int previousBlockEndLine = mBlockEndLines[mNumberOfBlocks - 1];
+ if (line > previousBlockEndLine) {
+ if (mNumberOfBlocks == mBlockEndLines.length) {
+ // Grow the array if needed
+ int[] blockEndLines = new int[ArrayUtils.idealIntArraySize(mNumberOfBlocks + 1)];
+ System.arraycopy(mBlockEndLines, 0, blockEndLines, 0, mNumberOfBlocks);
+ mBlockEndLines = blockEndLines;
+ }
+ mBlockEndLines[mNumberOfBlocks] = line;
+ mNumberOfBlocks++;
+ }
+ }
+
+ /**
* This method is called every time the layout is reflowed after an edition.
* It updates the internal block data structure. The text is split in blocks
* of contiguous lines, with at least one block for the entire text.
@@ -388,6 +440,11 @@
* @hide
*/
void updateBlocks(int startLine, int endLine, int newLineCount) {
+ if (mBlockEndLines == null) {
+ createBlocks();
+ return;
+ }
+
int firstBlock = -1;
int lastBlock = -1;
for (int i = 0; i < mNumberOfBlocks; i++) {
diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java
index d42757d..16f9a18 100644
--- a/core/java/android/view/AccessibilityInteractionController.java
+++ b/core/java/android/view/AccessibilityInteractionController.java
@@ -330,7 +330,7 @@
if (provider != null) {
List<AccessibilityNodeInfo> infosFromProvider =
provider.findAccessibilityNodeInfosByText(text,
- virtualDescendantId);
+ AccessibilityNodeInfo.UNDEFINED);
if (infosFromProvider != null) {
infos.addAll(infosFromProvider);
}
@@ -491,20 +491,28 @@
if ((direction & View.FOCUS_ACCESSIBILITY) == View.FOCUS_ACCESSIBILITY) {
AccessibilityNodeProvider provider = root.getAccessibilityNodeProvider();
if (provider != null) {
- next = provider.accessibilityFocusSearch(direction,
- virtualDescendantId);
- } else if (virtualDescendantId == View.NO_ID) {
- View nextView = root.focusSearch(direction);
- if (nextView != null) {
- // If the focus search reached a node with a provider
- // we delegate to the provider to find the next one.
- provider = nextView.getAccessibilityNodeProvider();
- if (provider != null) {
- next = provider.accessibilityFocusSearch(direction,
- virtualDescendantId);
- } else {
- next = nextView.createAccessibilityNodeInfo();
- }
+ next = provider.accessibilityFocusSearch(direction, virtualDescendantId);
+ if (next != null) {
+ return;
+ }
+ }
+ View nextView = root.focusSearch(direction);
+ while (nextView != null) {
+ // If the focus search reached a node with a provider
+ // we delegate to the provider to find the next one.
+ // If the provider does not return a virtual view to
+ // take accessibility focus we try the next view found
+ // by the focus search algorithm.
+ provider = nextView.getAccessibilityNodeProvider();
+ if (provider != null) {
+ next = provider.accessibilityFocusSearch(direction, View.NO_ID);
+ if (next != null) {
+ break;
+ }
+ nextView = nextView.focusSearch(direction);
+ } else {
+ next = nextView.createAccessibilityNodeInfo();
+ break;
}
}
} else {
diff --git a/core/java/android/view/FocusFinder.java b/core/java/android/view/FocusFinder.java
index 6bf1888..9063cea 100644
--- a/core/java/android/view/FocusFinder.java
+++ b/core/java/android/view/FocusFinder.java
@@ -276,7 +276,10 @@
return focusables.get(position + 1);
}
}
- return focusables.get(0);
+ if (!focusables.isEmpty()) {
+ return focusables.get(0);
+ }
+ return null;
}
private static View getBackwardFocusable(ViewGroup root, View focused,
@@ -293,7 +296,10 @@
return focusables.get(position - 1);
}
}
- return focusables.get(count - 1);
+ if (!focusables.isEmpty()) {
+ return focusables.get(count - 1);
+ }
+ return null;
}
/**
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index 0bb5f9f..1631fb3 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -833,19 +833,40 @@
@Override
public void drawBitmap(int[] colors, int offset, int stride, float x, float y,
int width, int height, boolean hasAlpha, Paint paint) {
+ if (width < 0) {
+ throw new IllegalArgumentException("width must be >= 0");
+ }
+
+ if (height < 0) {
+ throw new IllegalArgumentException("height must be >= 0");
+ }
+
+ if (Math.abs(stride) < width) {
+ throw new IllegalArgumentException("abs(stride) must be >= width");
+ }
+
+ int lastScanline = offset + (height - 1) * stride;
+ int length = colors.length;
+
+ if (offset < 0 || (offset + width > length) || lastScanline < 0 ||
+ (lastScanline + width > length)) {
+ throw new ArrayIndexOutOfBoundsException();
+ }
+
// Shaders are ignored when drawing bitmaps
int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
try {
- final Bitmap.Config config = hasAlpha ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
- final Bitmap b = Bitmap.createBitmap(colors, offset, stride, width, height, config);
final int nativePaint = paint == null ? 0 : paint.mNativePaint;
- nDrawBitmap(mRenderer, b.mNativeBitmap, b.mBuffer, x, y, nativePaint);
- b.recycle();
+ nDrawBitmap(mRenderer, colors, offset, stride, x, y,
+ width, height, hasAlpha, nativePaint);
} finally {
if (modifier != MODIFIER_NONE) nResetModifiers(mRenderer, modifier);
}
}
+ private static native void nDrawBitmap(int renderer, int[] colors, int offset, int stride,
+ float x, float y, int width, int height, boolean hasAlpha, int nativePaint);
+
@Override
public void drawBitmap(int[] colors, int offset, int stride, int x, int y,
int width, int height, boolean hasAlpha, Paint paint) {
diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl
index 555f306..b4caad3 100644
--- a/core/java/android/view/IWindow.aidl
+++ b/core/java/android/view/IWindow.aidl
@@ -45,7 +45,7 @@
*/
void executeCommand(String command, String parameters, in ParcelFileDescriptor descriptor);
- void resized(int w, int h, in Rect systemInsets, in Rect contentInsets,
+ void resized(int w, int h, in Rect contentInsets,
in Rect visibleInsets, boolean reportDraw, in Configuration newConfig);
void dispatchAppVisibility(boolean visible);
void dispatchGetNewSurface();
diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl
index f26d5e1..d4a03ce 100644
--- a/core/java/android/view/IWindowSession.aidl
+++ b/core/java/android/view/IWindowSession.aidl
@@ -58,10 +58,6 @@
* {@link WindowManagerImpl#RELAYOUT_DEFER_SURFACE_DESTROY}.
* @param outFrame Rect in which is placed the new position/size on
* screen.
- * @param outSystemInsets Rect in which is placed the offsets from
- * <var>outFrame</var> over which any core system UI elements are
- * currently covering the window. This is not generally used for
- * layout, but just to know where the window is obscured.
* @param outContentInsets Rect in which is placed the offsets from
* <var>outFrame</var> in which the content of the window should be
* placed. This can be used to modify the window layout to ensure its
@@ -83,7 +79,7 @@
*/
int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs,
int requestedWidth, int requestedHeight, int viewVisibility,
- int flags, out Rect outFrame, out Rect outSystemInsets,
+ int flags, out Rect outFrame,
out Rect outContentInsets, out Rect outVisibleInsets,
out Configuration outConfig, out Surface outSurface);
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index 1011d7a..a968768 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -511,7 +511,7 @@
/** @hide */
public native void setFlags(int flags, int mask);
/** @hide */
- public native void setActiveRect(Rect activeRect);
+ public native void setWindowCrop(Rect crop);
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index ee322f8..fd302dc 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -98,7 +98,6 @@
MyWindow mWindow;
final Rect mVisibleInsets = new Rect();
final Rect mWinFrame = new Rect();
- final Rect mSystemInsets = new Rect();
final Rect mContentInsets = new Rect();
final Configuration mConfiguration = new Configuration();
@@ -231,7 +230,17 @@
public void setVisibility(int visibility) {
super.setVisibility(visibility);
mViewVisibility = visibility == VISIBLE;
- mRequestedVisible = mWindowVisibility && mViewVisibility;
+ boolean newRequestedVisible = mWindowVisibility && mViewVisibility;
+ if (newRequestedVisible != mRequestedVisible) {
+ // our base class (View) invalidates the layout only when
+ // we go from/to the GONE state. However, SurfaceView needs
+ // to request a re-layout when the visibility changes at all.
+ // This is needed because the transparent region is computed
+ // as part of the layout phase, and it changes (obviously) when
+ // the visibility changes.
+ requestLayout();
+ }
+ mRequestedVisible = newRequestedVisible;
updateWindow(false, false);
}
@@ -472,7 +481,7 @@
mWindow, mWindow.mSeq, mLayout, mWidth, mHeight,
visible ? VISIBLE : GONE,
WindowManagerImpl.RELAYOUT_DEFER_SURFACE_DESTROY,
- mWinFrame, mSystemInsets, mContentInsets,
+ mWinFrame, mContentInsets,
mVisibleInsets, mConfiguration, mNewSurface);
if ((relayoutResult&WindowManagerImpl.RELAYOUT_RES_FIRST_TIME) != 0) {
mReportDrawNeeded = true;
@@ -606,7 +615,7 @@
mSurfaceView = new WeakReference<SurfaceView>(surfaceView);
}
- public void resized(int w, int h, Rect systemInsets, Rect contentInsets,
+ public void resized(int w, int h, Rect contentInsets,
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
SurfaceView surfaceView = mSurfaceView.get();
if (surfaceView != null) {
diff --git a/core/java/android/view/VelocityTracker.java b/core/java/android/view/VelocityTracker.java
index f703e34..f5870e1 100644
--- a/core/java/android/view/VelocityTracker.java
+++ b/core/java/android/view/VelocityTracker.java
@@ -60,8 +60,7 @@
private static native void nativeComputeCurrentVelocity(int ptr, int units, float maxVelocity);
private static native float nativeGetXVelocity(int ptr, int id);
private static native float nativeGetYVelocity(int ptr, int id);
- private static native boolean nativeGetEstimator(int ptr, int id,
- int degree, int horizonMillis, Estimator outEstimator);
+ private static native boolean nativeGetEstimator(int ptr, int id, Estimator outEstimator);
/**
* Retrieve a new VelocityTracker object to watch the velocity of a
@@ -227,21 +226,17 @@
* this method.
*
* @param id Which pointer's velocity to return.
- * @param degree The desired polynomial degree. The actual estimator may have
- * a lower degree than what is requested here. If -1, uses the default degree.
- * @param horizonMillis The maximum age of the oldest sample to consider, in milliseconds.
- * If -1, uses the default horizon.
* @param outEstimator The estimator to populate.
* @return True if an estimator was obtained, false if there is no information
* available about the pointer.
*
* @hide For internal use only. Not a final API.
*/
- public boolean getEstimator(int id, int degree, int horizonMillis, Estimator outEstimator) {
+ public boolean getEstimator(int id, Estimator outEstimator) {
if (outEstimator == null) {
throw new IllegalArgumentException("outEstimator must not be null");
}
- return nativeGetEstimator(mPtr, id, degree, horizonMillis, outEstimator);
+ return nativeGetEstimator(mPtr, id, outEstimator);
}
/**
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 55ea938..a4fcd41 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -666,7 +666,7 @@
protected static final String VIEW_LOG_TAG = "View";
/**
- * When set to true, apps will draw debugging information about their layouts.
+ * When set to true, apps will draw debugging information about their layouts.
*
* @hide
*/
@@ -4737,11 +4737,9 @@
getBoundsOnScreen(bounds);
info.setBoundsInScreen(bounds);
- if ((mPrivateFlags & IS_ROOT_NAMESPACE) == 0) {
- ViewParent parent = getParentForAccessibility();
- if (parent instanceof View) {
- info.setParent((View) parent);
- }
+ ViewParent parent = getParentForAccessibility();
+ if (parent instanceof View) {
+ info.setParent((View) parent);
}
info.setVisibleToUser(isVisibleToUser());
@@ -4801,17 +4799,46 @@
* entirely by its predecessors, and has an alpha greater than zero.
*
* @return Whether the view is visible on the screen.
+ *
+ * @hide
*/
- private boolean isVisibleToUser() {
+ protected boolean isVisibleToUser() {
+ return isVisibleToUser(null);
+ }
+
+ /**
+ * Computes whether the given portion of this view is visible to the user. Such a view is
+ * attached, visible, all its predecessors are visible, has an alpha greater than zero, and
+ * the specified portion is not clipped entirely by its predecessors.
+ *
+ * @param boundInView the portion of the view to test; coordinates should be relative; may be
+ * <code>null</code>, and the entire view will be tested in this case.
+ * When <code>true</code> is returned by the function, the actual visible
+ * region will be stored in this parameter; that is, if boundInView is fully
+ * contained within the view, no modification will be made, otherwise regions
+ * outside of the visible area of the view will be clipped.
+ *
+ * @return Whether the specified portion of the view is visible on the screen.
+ *
+ * @hide
+ */
+ protected boolean isVisibleToUser(Rect boundInView) {
+ Rect visibleRect = mAttachInfo.mTmpInvalRect;
+ Point offset = mAttachInfo.mPoint;
// The first two checks are made also made by isShown() which
// however traverses the tree up to the parent to catch that.
// Therefore, we do some fail fast check to minimize the up
// tree traversal.
- return (mAttachInfo != null
- && mAttachInfo.mWindowVisibility == View.VISIBLE
- && getAlpha() > 0
- && isShown()
- && getGlobalVisibleRect(mAttachInfo.mTmpInvalRect));
+ boolean isVisible = mAttachInfo != null
+ && mAttachInfo.mWindowVisibility == View.VISIBLE
+ && getAlpha() > 0
+ && isShown()
+ && getGlobalVisibleRect(visibleRect, offset);
+ if (isVisible && boundInView != null) {
+ visibleRect.offset(-offset.x, -offset.y);
+ isVisible &= boundInView.intersect(visibleRect);
+ }
+ return isVisible;
}
/**
@@ -5584,7 +5611,7 @@
"unmatched pair of setHasTransientState calls");
}
if ((hasTransientState && mTransientStateCount == 1) ||
- (hasTransientState && mTransientStateCount == 0)) {
+ (!hasTransientState && mTransientStateCount == 0)) {
// update flag if we've just incremented up from 0 or decremented down to 0
mPrivateFlags2 = (mPrivateFlags2 & ~HAS_TRANSIENT_STATE) |
(hasTransientState ? HAS_TRANSIENT_STATE : 0);
@@ -6000,8 +6027,7 @@
return;
}
if ((focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) {
- if (AccessibilityManager.getInstance(mContext).isEnabled()
- && includeForAccessibility()) {
+ if (canTakeAccessibilityFocusFromHover() || getAccessibilityNodeProvider() != null) {
views.add(this);
return;
}
@@ -6130,12 +6156,15 @@
* @hide
*/
public void clearAccessibilityFocus() {
- if ((mPrivateFlags2 & ACCESSIBILITY_FOCUSED) != 0) {
- mPrivateFlags2 &= ~ACCESSIBILITY_FOCUSED;
- ViewRootImpl viewRootImpl = getViewRootImpl();
- if (viewRootImpl != null) {
+ ViewRootImpl viewRootImpl = getViewRootImpl();
+ if (viewRootImpl != null) {
+ View focusHost = viewRootImpl.getAccessibilityFocusedHost();
+ if (focusHost != null && ViewRootImpl.isViewDescendantOf(focusHost, this)) {
viewRootImpl.setAccessibilityFocusedHost(null);
}
+ }
+ if ((mPrivateFlags2 & ACCESSIBILITY_FOCUSED) != 0) {
+ mPrivateFlags2 &= ~ACCESSIBILITY_FOCUSED;
invalidate();
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
notifyAccessibilityStateChanged();
@@ -6154,57 +6183,28 @@
}
}
- /**
- * Find the best view to take accessibility focus from a hover.
- * This function finds the deepest actionable view and if that
- * fails ask the parent to take accessibility focus from hover.
- *
- * @param x The X hovered location in this view coorditantes.
- * @param y The Y hovered location in this view coorditantes.
- * @return Whether the request was handled.
- *
- * @hide
- */
- public boolean requestAccessibilityFocusFromHover(float x, float y) {
- if (onRequestAccessibilityFocusFromHover(x, y)) {
- return true;
- }
- ViewParent parent = mParent;
- if (parent instanceof View) {
- View parentView = (View) parent;
-
- float[] position = mAttachInfo.mTmpTransformLocation;
- position[0] = x;
- position[1] = y;
-
- // Compensate for the transformation of the current matrix.
- if (!hasIdentityMatrix()) {
- getMatrix().mapPoints(position);
+ private void requestAccessibilityFocusFromHover() {
+ if (includeForAccessibility() && isActionableForAccessibility()) {
+ requestAccessibilityFocus();
+ } else {
+ if (mParent != null) {
+ View nextFocus = mParent.findViewToTakeAccessibilityFocusFromHover(this, this);
+ if (nextFocus != null) {
+ nextFocus.requestAccessibilityFocus();
+ }
}
-
- // Compensate for the parent scroll and the offset
- // of this view stop from the parent top.
- position[0] += mLeft - parentView.mScrollX;
- position[1] += mTop - parentView.mScrollY;
-
- return parentView.requestAccessibilityFocusFromHover(position[0], position[1]);
}
- return false;
}
/**
- * Requests to give this View focus from hover.
- *
- * @param x The X hovered location in this view coorditantes.
- * @param y The Y hovered location in this view coorditantes.
- * @return Whether the request was handled.
- *
* @hide
*/
- public boolean onRequestAccessibilityFocusFromHover(float x, float y) {
- if (includeForAccessibility()
- && (isActionableForAccessibility() || hasListenersForAccessibility())) {
- return requestAccessibilityFocus();
+ public boolean canTakeAccessibilityFocusFromHover() {
+ if (includeForAccessibility() && isActionableForAccessibility()) {
+ return true;
+ }
+ if (mParent != null) {
+ return (mParent.findViewToTakeAccessibilityFocusFromHover(this, this) == this);
}
return false;
}
@@ -6466,14 +6466,15 @@
* important for accessibility are regarded.
*
* @return Whether to regard the view for accessibility.
+ *
+ * @hide
*/
- boolean includeForAccessibility() {
+ public boolean includeForAccessibility() {
if (mAttachInfo != null) {
if (!mAttachInfo.mIncludeNotImportantViews) {
return isImportantForAccessibility();
- } else {
- return true;
}
+ return true;
}
return false;
}
@@ -6484,8 +6485,10 @@
* accessiiblity.
*
* @return True if the view is actionable for accessibility.
+ *
+ * @hide
*/
- private boolean isActionableForAccessibility() {
+ public boolean isActionableForAccessibility() {
return (isClickable() || isLongClickable() || isFocusable());
}
@@ -6517,6 +6520,9 @@
* that is interesting for accessilility purposes.
*/
public void notifyAccessibilityStateChanged() {
+ if (!AccessibilityManager.getInstance(mContext).isEnabled()) {
+ return;
+ }
if ((mPrivateFlags2 & ACCESSIBILITY_STATE_CHANGED) == 0) {
mPrivateFlags2 |= ACCESSIBILITY_STATE_CHANGED;
if (mParent != null) {
@@ -7658,7 +7664,7 @@
&& pointInView(event.getX(), event.getY())) {
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
mSendingHoverAccessibilityEvents = true;
- requestAccessibilityFocusFromHover((int) event.getX(), (int) event.getY());
+ requestAccessibilityFocusFromHover();
}
} else {
if (action == MotionEvent.ACTION_HOVER_EXIT
@@ -15280,10 +15286,12 @@
/**
* Sets the next animation to play for this view.
* If you want the animation to play immediately, use
- * startAnimation. This method provides allows fine-grained
+ * {@link #startAnimation(android.view.animation.Animation)} instead.
+ * This method provides allows fine-grained
* control over the start time and invalidation, but you
* must make sure that 1) the animation has a start time set, and
- * 2) the view will be invalidated when the animation is supposed to
+ * 2) the view's parent (which controls animations on its children)
+ * will be invalidated when the animation is supposed to
* start.
*
* @param animation The next animation, or null.
@@ -17161,12 +17169,6 @@
boolean mUse32BitDrawingCache;
/**
- * Describes the parts of the window that are currently completely
- * obscured by system UI elements.
- */
- final Rect mSystemInsets = new Rect();
-
- /**
* For windows that are full-screen but using insets to layout inside
* of the screen decorations, these are the current insets for the
* content of the window.
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index b3c8895..b95ca5e 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -628,7 +628,11 @@
* FOCUS_RIGHT, or 0 for not applicable.
*/
public View focusSearch(View focused, int direction) {
- if (isRootNamespace()) {
+ // If we are moving accessibility focus we want to consider all
+ // views no matter if they are on the screen. It is responsibility
+ // of the accessibility service to check whether the result is in
+ // the screen.
+ if (isRootNamespace() && (direction & FOCUS_ACCESSIBILITY) == 0) {
// root namespace means we should consider ourselves the top of the
// tree for focus searching; otherwise we could be focus searching
// into other tabs. see LocalActivityManager and TabHost for more info
@@ -857,20 +861,13 @@
* {@inheritDoc}
*/
@Override
- public void addFocusables(ArrayList<View> views, int direction) {
- addFocusables(views, direction, FOCUSABLES_TOUCH_MODE);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {
final int focusableCount = views.size();
final int descendantFocusability = getDescendantFocusability();
- if (descendantFocusability != FOCUS_BLOCK_DESCENDANTS) {
+ if (descendantFocusability != FOCUS_BLOCK_DESCENDANTS
+ || (focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) {
final int count = mChildrenCount;
final View[] children = mChildren;
@@ -886,10 +883,11 @@
// FOCUS_AFTER_DESCENDANTS and there are some descendants focusable. this is
// to avoid the focus search finding layouts when a more precise search
// among the focusable children would be more interesting.
- if (
- descendantFocusability != FOCUS_AFTER_DESCENDANTS ||
+ if (descendantFocusability != FOCUS_AFTER_DESCENDANTS
// No focusable descendants
- (focusableCount == views.size())) {
+ || (focusableCount == views.size())
+ // We are collecting accessibility focusables.
+ || (focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) {
super.addFocusables(views, direction, focusableMode);
}
}
@@ -1635,8 +1633,7 @@
final int childrenCount = children.getChildCount();
for (int i = 0; i < childrenCount; i++) {
View child = children.getChildAt(i);
- if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE
- && (child.mPrivateFlags & IS_ROOT_NAMESPACE) == 0) {
+ if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
if (child.includeForAccessibility()) {
childrenForAccessibility.add(child);
} else {
@@ -1660,6 +1657,20 @@
}
/**
+ * @hide
+ */
+ @Override
+ public View findViewToTakeAccessibilityFocusFromHover(View child, View descendant) {
+ if (includeForAccessibility() && isActionableForAccessibility()) {
+ return this;
+ }
+ if (mParent != null) {
+ return mParent.findViewToTakeAccessibilityFocusFromHover(this, descendant);
+ }
+ return null;
+ }
+
+ /**
* Implement this method to intercept hover events before they are handled
* by child views.
* <p>
diff --git a/core/java/android/view/ViewParent.java b/core/java/android/view/ViewParent.java
index ddff91d..d93b996 100644
--- a/core/java/android/view/ViewParent.java
+++ b/core/java/android/view/ViewParent.java
@@ -295,4 +295,16 @@
* @hide
*/
public void childAccessibilityStateChanged(View child);
+
+ /**
+ * A descendant requests this view to find a candidate to take accessibility
+ * focus from hover.
+ *
+ * @param child The child making the call.
+ * @param descendant The descendant that made the initial request.
+ * @return A view to take accessibility focus.
+ *
+ * @hide
+ */
+ public View findViewToTakeAccessibilityFocusFromHover(View child, View descendant);
}
diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java
index 2012db2..ce6f4c5 100644
--- a/core/java/android/view/ViewPropertyAnimator.java
+++ b/core/java/android/view/ViewPropertyAnimator.java
@@ -342,6 +342,7 @@
* otherwise), then this method can be used.
*/
public void start() {
+ mView.removeCallbacks(mAnimationStarter);
startAnimation();
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 1fcb2c3..41cd887 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -262,8 +262,6 @@
final Rect mPendingVisibleInsets = new Rect();
final Rect mPendingContentInsets = new Rect();
- final Rect mPendingSystemInsets = new Rect();
- final Rect mActiveRect = new Rect();
final ViewTreeObserver.InternalInsetsInfo mLastGivenInsets
= new ViewTreeObserver.InternalInsetsInfo();
@@ -273,7 +271,6 @@
final Configuration mPendingConfiguration = new Configuration();
class ResizedInfo {
- Rect systemInsets;
Rect contentInsets;
Rect visibleInsets;
Configuration newConfig;
@@ -491,7 +488,9 @@
mFallbackEventHandler.setView(view);
mWindowAttributes.copyFrom(attrs);
attrs = mWindowAttributes;
-
+
+ setAccessibilityFocusedHost(null);
+
if (view instanceof RootViewSurfaceTaker) {
mSurfaceHolderCallback =
((RootViewSurfaceTaker)view).willYouTakeTheSurface();
@@ -559,6 +558,7 @@
mInputChannel = null;
mFallbackEventHandler.setView(null);
unscheduleTraversals();
+ setAccessibilityFocusedHost(null);
throw new RuntimeException("Adding window failed", e);
} finally {
if (restore) {
@@ -569,7 +569,6 @@
if (mTranslator != null) {
mTranslator.translateRectInScreenToAppWindow(mAttachInfo.mContentInsets);
}
- mPendingSystemInsets.set(0, 0, 0, 0);
mPendingContentInsets.set(mAttachInfo.mContentInsets);
mPendingVisibleInsets.set(0, 0, 0, 0);
if (DEBUG_LAYOUT) Log.v(TAG, "Added window " + mWindow);
@@ -579,6 +578,7 @@
mAdded = false;
mFallbackEventHandler.setView(null);
unscheduleTraversals();
+ setAccessibilityFocusedHost(null);
switch (res) {
case WindowManagerImpl.ADD_BAD_APP_TOKEN:
case WindowManagerImpl.ADD_BAD_SUBWINDOW_TOKEN:
@@ -639,8 +639,6 @@
if (view.getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
-
- setAccessibilityFocusedHost(null);
}
}
}
@@ -1236,7 +1234,6 @@
getRunQueue().executeActions(attachInfo.mHandler);
boolean insetsChanged = false;
- boolean activeRectChanged = false;
boolean layoutRequested = mLayoutRequested && !mStopped;
if (layoutRequested) {
@@ -1248,12 +1245,7 @@
// to opposite of the added touch mode.
mAttachInfo.mInTouchMode = !mAddedTouchMode;
ensureTouchModeLocally(mAddedTouchMode);
- activeRectChanged = true;
} else {
- if (!mPendingSystemInsets.equals(mAttachInfo.mSystemInsets)) {
- mAttachInfo.mSystemInsets.set(mPendingSystemInsets);
- activeRectChanged = true;
- }
if (!mPendingContentInsets.equals(mAttachInfo.mContentInsets)) {
insetsChanged = true;
}
@@ -1407,10 +1399,6 @@
mPendingConfiguration.seq = 0;
}
- if (!mPendingSystemInsets.equals(mAttachInfo.mSystemInsets)) {
- activeRectChanged = true;
- mAttachInfo.mSystemInsets.set(mPendingSystemInsets);
- }
contentInsetsChanged = !mPendingContentInsets.equals(
mAttachInfo.mContentInsets);
visibleInsetsChanged = !mPendingVisibleInsets.equals(
@@ -1513,7 +1501,6 @@
// before actually drawing them, so it can display then
// all at once.
newSurface = true;
- activeRectChanged = true;
mFullRedrawNeeded = true;
mPreviousTransparentRegion.setEmpty();
@@ -1579,7 +1566,6 @@
// window size we asked for. We should avoid this by getting a maximum size from
// the window session beforehand.
if (mWidth != frame.width() || mHeight != frame.height()) {
- activeRectChanged = true;
mWidth = frame.width();
mHeight = frame.height();
}
@@ -1698,14 +1684,6 @@
}
}
- if (activeRectChanged && mSurface.isValid()) {
- mActiveRect.set(attachInfo.mSystemInsets.left, attachInfo.mSystemInsets.top,
- mWidth - attachInfo.mSystemInsets.right,
- mHeight - attachInfo.mSystemInsets.bottom);
- //Log.i(TAG, "Active rect " + mWindowAttributes.getTitle() + ": " + mActiveRect);
- mSurface.setActiveRect(mActiveRect);
- }
-
final boolean didLayout = layoutRequested && !mStopped;
boolean triggerGlobalLayoutListener = didLayout
|| attachInfo.mRecomputeGlobalAttributes;
@@ -1877,18 +1855,15 @@
performDraw();
}
} else {
- // End any pending transitions on this non-visible window
- if (mPendingTransitions != null && mPendingTransitions.size() > 0) {
+ if (viewVisibility == View.VISIBLE) {
+ // Try again
+ scheduleTraversals();
+ } else if (mPendingTransitions != null && mPendingTransitions.size() > 0) {
for (int i = 0; i < mPendingTransitions.size(); ++i) {
mPendingTransitions.get(i).endChangingAnimations();
}
mPendingTransitions.clear();
}
-
- if (viewVisibility == View.VISIBLE) {
- // Try again
- scheduleTraversals();
- }
}
}
@@ -2349,6 +2324,14 @@
return true;
}
+ @Override
+ public View findViewToTakeAccessibilityFocusFromHover(View child, View descendant) {
+ if (descendant.includeForAccessibility()) {
+ return descendant;
+ }
+ return null;
+ }
+
/**
* We want to draw a highlight around the current accessibility focused.
* Since adding a style for all possible view is not a viable option we
@@ -2544,12 +2527,66 @@
return handled;
}
+ /**
+ * @hide
+ */
+ public View getAccessibilityFocusedHost() {
+ return mAccessibilityFocusedHost;
+ }
+
+ /**
+ * @hide
+ */
+ public AccessibilityNodeInfo getAccessibilityFocusedVirtualView() {
+ return mAccessibilityFocusedVirtualView;
+ }
+
void setAccessibilityFocusedHost(View host) {
- if (mAccessibilityFocusedHost != null && mAccessibilityFocusedVirtualView == null) {
+ // If we have a virtual view with accessibility focus we need
+ // to clear the focus and invalidate the virtual view bounds.
+ if (mAccessibilityFocusedVirtualView != null) {
+
+ AccessibilityNodeInfo focusNode = mAccessibilityFocusedVirtualView;
+ View focusHost = mAccessibilityFocusedHost;
+ focusHost.clearAccessibilityFocusNoCallbacks();
+
+ // Wipe the state of the current accessibility focus since
+ // the call into the provider to clear accessibility focus
+ // will fire an accessibility event which will end up calling
+ // this method and we want to have clean state when this
+ // invocation happens.
+ mAccessibilityFocusedHost = null;
+ mAccessibilityFocusedVirtualView = null;
+
+ AccessibilityNodeProvider provider = focusHost.getAccessibilityNodeProvider();
+ if (provider != null) {
+ // Invalidate the area of the cleared accessibility focus.
+ focusNode.getBoundsInParent(mTempRect);
+ focusHost.invalidate(mTempRect);
+ // Clear accessibility focus in the virtual node.
+ final int virtualNodeId = AccessibilityNodeInfo.getVirtualDescendantId(
+ focusNode.getSourceNodeId());
+ provider.performAction(virtualNodeId,
+ AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS, null);
+ }
+ }
+ if (mAccessibilityFocusedHost != null) {
+ // Clear accessibility focus in the view.
mAccessibilityFocusedHost.clearAccessibilityFocusNoCallbacks();
}
+
+ // Set the new focus host.
mAccessibilityFocusedHost = host;
- mAccessibilityFocusedVirtualView = null;
+
+ // If the host has a provide find the virtual descendant that has focus.
+ if (mAccessibilityFocusedHost != null) {
+ AccessibilityNodeProvider provider =
+ mAccessibilityFocusedHost.getAccessibilityNodeProvider();
+ if (provider != null) {
+ mAccessibilityFocusedVirtualView = provider.findAccessibilityFocus(View.NO_ID);
+ return;
+ }
+ }
}
public void requestChildFocus(View child, View focused) {
@@ -2635,6 +2672,8 @@
destroyHardwareRenderer();
+ setAccessibilityFocusedHost(null);
+
mView = null;
mAttachInfo.mRootView = null;
mAttachInfo.mSurface = null;
@@ -2696,7 +2735,7 @@
/**
* Return true if child is an ancestor of parent, (or equal to the parent).
*/
- static boolean isViewDescendantOf(View child, View parent) {
+ public static boolean isViewDescendantOf(View child, View parent) {
if (child == parent) {
return true;
}
@@ -2823,7 +2862,6 @@
ResizedInfo ri = (ResizedInfo)msg.obj;
if (mWinFrame.width() == msg.arg1 && mWinFrame.height() == msg.arg2
- && mPendingSystemInsets.equals(ri.systemInsets)
&& mPendingContentInsets.equals(ri.contentInsets)
&& mPendingVisibleInsets.equals(ri.visibleInsets)
&& ((ResizedInfo)msg.obj).newConfig == null) {
@@ -2840,7 +2878,6 @@
mWinFrame.right = msg.arg1;
mWinFrame.top = 0;
mWinFrame.bottom = msg.arg2;
- mPendingSystemInsets.set(((ResizedInfo)msg.obj).systemInsets);
mPendingContentInsets.set(((ResizedInfo)msg.obj).contentInsets);
mPendingVisibleInsets.set(((ResizedInfo)msg.obj).visibleInsets);
if (msg.what == MSG_RESIZED_REPORT) {
@@ -3875,7 +3912,7 @@
(int) (mView.getMeasuredWidth() * appScale + 0.5f),
(int) (mView.getMeasuredHeight() * appScale + 0.5f),
viewVisibility, insetsPending ? WindowManagerImpl.RELAYOUT_INSETS_PENDING : 0,
- mWinFrame, mPendingSystemInsets, mPendingContentInsets, mPendingVisibleInsets,
+ mWinFrame, mPendingContentInsets, mPendingVisibleInsets,
mPendingConfiguration, mSurface);
//Log.d(TAG, "<<<<<< BACK FROM relayout");
if (restore) {
@@ -4071,11 +4108,10 @@
mHandler.sendMessage(msg);
}
- public void dispatchResized(int w, int h, Rect systemInsets, Rect contentInsets,
+ public void dispatchResized(int w, int h, Rect contentInsets,
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
if (DEBUG_LAYOUT) Log.v(TAG, "Resizing " + this + ": w=" + w
- + " h=" + h + " systemInsets=" + systemInsets.toShortString()
- + " contentInsets=" + contentInsets.toShortString()
+ + " h=" + h + " contentInsets=" + contentInsets.toShortString()
+ " visibleInsets=" + visibleInsets.toShortString()
+ " reportDraw=" + reportDraw);
Message msg = mHandler.obtainMessage(reportDraw ? MSG_RESIZED_REPORT :MSG_RESIZED);
@@ -4088,7 +4124,6 @@
msg.arg1 = w;
msg.arg2 = h;
ResizedInfo ri = new ResizedInfo();
- ri.systemInsets = new Rect(systemInsets);
ri.contentInsets = new Rect(contentInsets);
ri.visibleInsets = new Rect(visibleInsets);
ri.newConfig = newConfig;
@@ -4614,6 +4649,31 @@
if (mView == null) {
return false;
}
+ // Watch for accessibility focus change events from virtual nodes
+ // to keep track of accessibility focus being on a virtual node.
+ final int eventType = event.getEventType();
+ switch (eventType) {
+ case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED: {
+ final long sourceId = event.getSourceNodeId();
+ // If the event is not from a virtual node we are not interested.
+ final int virtualViewId = AccessibilityNodeInfo.getVirtualDescendantId(sourceId);
+ if (virtualViewId == AccessibilityNodeInfo.UNDEFINED) {
+ break;
+ }
+ final int realViewId = AccessibilityNodeInfo.getAccessibilityViewId(sourceId);
+ View focusHost = mView.findViewByAccessibilityId(realViewId);
+ setAccessibilityFocusedHost(focusHost);
+ } break;
+ case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED: {
+ final long sourceId = event.getSourceNodeId();
+ // If the event is not from a virtual node we are not interested.
+ final int virtualViewId = AccessibilityNodeInfo.getVirtualDescendantId(sourceId);
+ if (virtualViewId == AccessibilityNodeInfo.UNDEFINED) {
+ break;
+ }
+ setAccessibilityFocusedHost(null);
+ } break;
+ }
mAccessibilityManager.sendAccessibilityEvent(event);
return true;
}
@@ -4744,11 +4804,11 @@
mViewAncestor = new WeakReference<ViewRootImpl>(viewAncestor);
}
- public void resized(int w, int h, Rect systemInsets, Rect contentInsets,
+ public void resized(int w, int h, Rect contentInsets,
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
final ViewRootImpl viewAncestor = mViewAncestor.get();
if (viewAncestor != null) {
- viewAncestor.dispatchResized(w, h, systemInsets, contentInsets,
+ viewAncestor.dispatchResized(w, h, contentInsets,
visibleInsets, reportDraw, newConfig);
}
}
diff --git a/core/java/android/view/VolumePanel.java b/core/java/android/view/VolumePanel.java
index 110c239..78984e0 100644
--- a/core/java/android/view/VolumePanel.java
+++ b/core/java/android/view/VolumePanel.java
@@ -296,41 +296,33 @@
private boolean isMuted(int streamType) {
if (streamType == STREAM_MASTER) {
- return mAudioService.isMasterMute();
+ return mAudioManager.isMasterMute();
} else {
- return mAudioService.isStreamMute(streamType);
+ return mAudioManager.isStreamMute(streamType);
}
}
private int getStreamMaxVolume(int streamType) {
if (streamType == STREAM_MASTER) {
- return mAudioService.getMasterMaxVolume();
+ return mAudioManager.getMasterMaxVolume();
} else {
- return mAudioService.getStreamMaxVolume(streamType);
+ return mAudioManager.getStreamMaxVolume(streamType);
}
}
private int getStreamVolume(int streamType) {
if (streamType == STREAM_MASTER) {
- return mAudioService.getMasterVolume();
+ return mAudioManager.getMasterVolume();
} else {
- return mAudioService.getStreamVolume(streamType);
+ return mAudioManager.getStreamVolume(streamType);
}
}
private void setStreamVolume(int streamType, int index, int flags) {
if (streamType == STREAM_MASTER) {
- mAudioService.setMasterVolume(index, flags);
+ mAudioManager.setMasterVolume(index, flags);
} else {
- mAudioService.setStreamVolume(streamType, index, flags);
- }
- }
-
- private int getLastAudibleStreamVolume(int streamType) {
- if (streamType == STREAM_MASTER) {
- return mAudioService.getLastAudibleMasterVolume();
- } else {
- return mAudioService.getLastAudibleStreamVolume(streamType);
+ mAudioManager.setStreamVolume(streamType, index, flags);
}
}
@@ -399,13 +391,18 @@
/** Update the mute and progress state of a slider */
private void updateSlider(StreamControl sc) {
- sc.seekbarView.setProgress(getLastAudibleStreamVolume(sc.streamType));
+ sc.seekbarView.setProgress(getStreamVolume(sc.streamType));
final boolean muted = isMuted(sc.streamType);
sc.icon.setImageResource(muted ? sc.iconMuteRes : sc.iconRes);
- if (sc.streamType == AudioManager.STREAM_RING && muted
- && mAudioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_RINGER)) {
+ if (sc.streamType == AudioManager.STREAM_RING &&
+ mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) {
sc.icon.setImageResource(R.drawable.ic_audio_ring_notif_vibrate);
}
+ if (sc.streamType != mAudioManager.getMasterStreamType() && muted) {
+ sc.seekbarView.setEnabled(false);
+ } else {
+ sc.seekbarView.setEnabled(true);
+ }
}
private boolean isExpanded() {
@@ -510,9 +507,7 @@
}
protected void onShowVolumeChanged(int streamType, int flags) {
- int index = isMuted(streamType) ?
- getLastAudibleStreamVolume(streamType)
- : getStreamVolume(streamType);
+ int index = getStreamVolume(streamType);
mRingIsSilent = false;
@@ -592,6 +587,11 @@
sc.seekbarView.setMax(max);
}
sc.seekbarView.setProgress(index);
+ if (streamType != mAudioManager.getMasterStreamType() && isMuted(streamType)) {
+ sc.seekbarView.setEnabled(false);
+ } else {
+ sc.seekbarView.setEnabled(true);
+ }
}
if (!mDialog.isShowing()) {
@@ -607,8 +607,7 @@
// Do a little vibrate if applicable (only when going into vibrate mode)
if ((flags & AudioManager.FLAG_VIBRATE) != 0 &&
mAudioService.isStreamAffectedByRingerMode(streamType) &&
- mAudioService.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE &&
- mAudioService.shouldVibrate(AudioManager.VIBRATE_TYPE_RINGER)) {
+ mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) {
sendMessageDelayed(obtainMessage(MSG_VIBRATE), VIBRATE_DELAY);
}
}
@@ -646,7 +645,7 @@
protected void onVibrate() {
// Make sure we ended up in vibrate ringer mode
- if (mAudioService.getRingerMode() != AudioManager.RINGER_MODE_VIBRATE) {
+ if (mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_VIBRATE) {
return;
}
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 388cfb3..0c5d6ea 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -145,10 +145,6 @@
* @param displayFrame The frame of the overall display in which this
* window can appear, used for constraining the overall dimensions
* of the window.
- * @param systemFrame The frame within the display that any system
- * elements are currently covering. These indicate which parts of
- * the window should be considered completely obscured by the screen
- * decorations.
* @param contentFrame The frame within the display in which we would
* like active content to appear. This will cause windows behind to
* be resized to match the given content frame.
@@ -160,7 +156,7 @@
* are visible.
*/
public void computeFrameLw(Rect parentFrame, Rect displayFrame,
- Rect systemFrame, Rect contentFrame, Rect visibleFrame);
+ Rect contentFrame, Rect visibleFrame);
/**
* Retrieve the current frame of the window that has been assigned by
@@ -188,14 +184,6 @@
public Rect getDisplayFrameLw();
/**
- * Retrieve the frame of the system elements that last covered the window.
- * Must be called with the window manager lock held.
- *
- * @return Rect The rectangle holding the system frame.
- */
- public Rect getSystemFrameLw();
-
- /**
* Retrieve the frame of the content area that this window was last
* laid out in. This is the area in which the content of the window
* should be placed. It will be smaller than the display frame to
@@ -397,6 +385,9 @@
* Creates an input channel that will receive all input from the input dispatcher.
*/
public InputChannel monitorInput(String name);
+
+ public void shutdown();
+ public void rebootSafeMode();
}
/**
@@ -770,6 +761,21 @@
public void beginLayoutLw(int displayWidth, int displayHeight, int displayRotation);
/**
+ * Return the rectangle of the screen currently covered by system decorations.
+ * This will be called immediately after {@link #layoutWindowLw}. It can
+ * fill in the rectangle to indicate any part of the screen that it knows
+ * for sure is covered by system decor such as the status bar. The rectangle
+ * is initially set to the actual size of the screen, indicating nothing is
+ * covered.
+ *
+ * @param systemRect The rectangle of the screen that is not covered by
+ * system decoration.
+ * @return Returns the layer above which the system rectangle should
+ * not be applied.
+ */
+ public int getSystemDecorRectLw(Rect systemRect);
+
+ /**
* Called for each window attached to the window manager as layout is
* proceeding. The implementation of this function must take care of
* setting the window's frame, either here or in finishLayout().
@@ -794,7 +800,7 @@
*
*/
public void getContentInsetHintLw(WindowManager.LayoutParams attrs, Rect contentInset);
-
+
/**
* Called when layout of the windows is finished. After this function has
* returned, all windows given to layoutWindow() <em>must</em> have had a
diff --git a/core/java/android/view/accessibility/AccessibilityInteractionClient.java b/core/java/android/view/accessibility/AccessibilityInteractionClient.java
index 24e90fd..bd341d0 100644
--- a/core/java/android/view/accessibility/AccessibilityInteractionClient.java
+++ b/core/java/android/view/accessibility/AccessibilityInteractionClient.java
@@ -441,10 +441,6 @@
sAccessibilityNodeInfoCache.clear();
}
- public void removeCachedNode(long accessibilityNodeId) {
- sAccessibilityNodeInfoCache.remove(accessibilityNodeId);
- }
-
public void onAccessibilityEvent(AccessibilityEvent event) {
sAccessibilityNodeInfoCache.onAccessibilityEvent(event);
}
@@ -630,7 +626,7 @@
applyCompatibilityScaleIfNeeded(info, windowScale);
info.setConnectionId(connectionId);
info.setSealed(true);
- sAccessibilityNodeInfoCache.put(info.getSourceNodeId(), info);
+ sAccessibilityNodeInfoCache.add(info);
}
}
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfoCache.java b/core/java/android/view/accessibility/AccessibilityNodeInfoCache.java
index d2609bb..52b7772 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfoCache.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfoCache.java
@@ -16,10 +16,15 @@
package android.view.accessibility;
+import android.os.Build;
import android.util.Log;
import android.util.LongSparseArray;
import android.util.SparseLongArray;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Queue;
+
/**
* Simple cache for AccessibilityNodeInfos. The cache is mapping an
* accessibility id to an info. The cache allows storing of
@@ -36,10 +41,14 @@
private static final boolean DEBUG = false;
+ private static final boolean CHECK_INTEGRITY = true;
+
private final Object mLock = new Object();
private final LongSparseArray<AccessibilityNodeInfo> mCacheImpl;
+ private int mWindowId;
+
public AccessibilityNodeInfoCache() {
if (ENABLED) {
mCacheImpl = new LongSparseArray<AccessibilityNodeInfo>();
@@ -59,21 +68,49 @@
final int eventType = event.getEventType();
switch (eventType) {
case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED: {
+ // New window so we clear the cache.
+ mWindowId = event.getWindowId();
clear();
} break;
+ case AccessibilityEvent.TYPE_VIEW_HOVER_ENTER:
+ case AccessibilityEvent.TYPE_VIEW_HOVER_EXIT: {
+ final int windowId = event.getWindowId();
+ if (mWindowId != windowId) {
+ // New window so we clear the cache.
+ mWindowId = windowId;
+ clear();
+ }
+ } break;
case AccessibilityEvent.TYPE_VIEW_FOCUSED:
+ case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED:
case AccessibilityEvent.TYPE_VIEW_SELECTED:
case AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED:
case AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED: {
- final long accessibilityNodeId = event.getSourceNodeId();
- remove(accessibilityNodeId);
+ // Since we prefetch the descendants of a node we
+ // just remove the entire subtree since when the node
+ // is fetched we will gets its descendant anyway.
+ synchronized (mLock) {
+ final long sourceId = event.getSourceNodeId();
+ clearSubTreeLocked(sourceId);
+ if (eventType == AccessibilityEvent.TYPE_VIEW_FOCUSED) {
+ clearSubtreeWithOldInputFocusLocked(sourceId);
+ }
+ if (eventType == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED) {
+ clearSubtreeWithOldAccessibilityFocusLocked(sourceId);
+ }
+ }
} break;
case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED:
case AccessibilityEvent.TYPE_VIEW_SCROLLED: {
- final long accessibilityNodeId = event.getSourceNodeId();
- clearSubTree(accessibilityNodeId);
+ synchronized (mLock) {
+ final long accessibilityNodeId = event.getSourceNodeId();
+ clearSubTreeLocked(accessibilityNodeId);
+ }
} break;
}
+ if (Build.IS_DEBUGGABLE && CHECK_INTEGRITY) {
+ checkIntegrity();
+ }
}
}
@@ -105,51 +142,45 @@
/**
* Caches an {@link AccessibilityNodeInfo} given its accessibility node id.
*
- * @param accessibilityNodeId The info accessibility node id.
* @param info The {@link AccessibilityNodeInfo} to cache.
*/
- public void put(long accessibilityNodeId, AccessibilityNodeInfo info) {
+ public void add(AccessibilityNodeInfo info) {
if (ENABLED) {
synchronized(mLock) {
if (DEBUG) {
- Log.i(LOG_TAG, "put(" + accessibilityNodeId + ", " + info + ")");
+ Log.i(LOG_TAG, "add(" + info + ")");
}
+
+ final long sourceId = info.getSourceNodeId();
+ AccessibilityNodeInfo oldInfo = mCacheImpl.get(sourceId);
+ if (oldInfo != null) {
+ // If the added node is in the cache we have to be careful if
+ // the new one represents a source state where some of the
+ // children have been removed to avoid having disconnected
+ // subtrees in the cache.
+ SparseLongArray oldChildrenIds = oldInfo.getChildNodeIds();
+ SparseLongArray newChildrenIds = info.getChildNodeIds();
+ final int oldChildCount = oldChildrenIds.size();
+ for (int i = 0; i < oldChildCount; i++) {
+ final long oldChildId = oldChildrenIds.valueAt(i);
+ if (newChildrenIds.indexOfValue(oldChildId) < 0) {
+ clearSubTreeLocked(oldChildId);
+ }
+ }
+
+ // Also be careful if the parent has changed since the new
+ // parent may be a predecessor of the old parent which will
+ // make the cached tree cyclic.
+ final long oldParentId = oldInfo.getParentNodeId();
+ if (info.getParentNodeId() != oldParentId) {
+ clearSubTreeLocked(oldParentId);
+ }
+ }
+
// Cache a copy since the client calls to AccessibilityNodeInfo#recycle()
// will wipe the data of the cached info.
AccessibilityNodeInfo clone = AccessibilityNodeInfo.obtain(info);
- mCacheImpl.put(accessibilityNodeId, clone);
- }
- }
- }
-
- /**
- * Returns whether the cache contains an accessibility node id key.
- *
- * @param accessibilityNodeId The key for which to check.
- * @return True if the key is in the cache.
- */
- public boolean containsKey(long accessibilityNodeId) {
- if (ENABLED) {
- synchronized(mLock) {
- return (mCacheImpl.indexOfKey(accessibilityNodeId) >= 0);
- }
- } else {
- return false;
- }
- }
-
- /**
- * Removes a cached {@link AccessibilityNodeInfo}.
- *
- * @param accessibilityNodeId The info accessibility node id.
- */
- public void remove(long accessibilityNodeId) {
- if (ENABLED) {
- synchronized(mLock) {
- if (DEBUG) {
- Log.i(LOG_TAG, "remove(" + accessibilityNodeId + ")");
- }
- mCacheImpl.remove(accessibilityNodeId);
+ mCacheImpl.put(sourceId, clone);
}
}
}
@@ -179,7 +210,7 @@
*
* @param rootNodeId The root id.
*/
- private void clearSubTree(long rootNodeId) {
+ private void clearSubTreeLocked(long rootNodeId) {
AccessibilityNodeInfo current = mCacheImpl.get(rootNodeId);
if (current == null) {
return;
@@ -189,7 +220,124 @@
final int childCount = childNodeIds.size();
for (int i = 0; i < childCount; i++) {
final long childNodeId = childNodeIds.valueAt(i);
- clearSubTree(childNodeId);
+ clearSubTreeLocked(childNodeId);
+ }
+ }
+
+ /**
+ * We are enforcing the invariant for a single input focus.
+ *
+ * @param currentInputFocusId The current input focused node.
+ */
+ private void clearSubtreeWithOldInputFocusLocked(long currentInputFocusId) {
+ final int cacheSize = mCacheImpl.size();
+ for (int i = 0; i < cacheSize; i++) {
+ AccessibilityNodeInfo info = mCacheImpl.valueAt(i);
+ final long infoSourceId = info.getSourceNodeId();
+ if (infoSourceId != currentInputFocusId && info.isFocused()) {
+ clearSubTreeLocked(infoSourceId);
+ return;
+ }
+ }
+ }
+
+ /**
+ * We are enforcing the invariant for a single accessibility focus.
+ *
+ * @param currentInputFocusId The current input focused node.
+ */
+ private void clearSubtreeWithOldAccessibilityFocusLocked(long currentAccessibilityFocusId) {
+ final int cacheSize = mCacheImpl.size();
+ for (int i = 0; i < cacheSize; i++) {
+ AccessibilityNodeInfo info = mCacheImpl.valueAt(i);
+ final long infoSourceId = info.getSourceNodeId();
+ if (infoSourceId != currentAccessibilityFocusId && info.isAccessibilityFocused()) {
+ clearSubTreeLocked(infoSourceId);
+ return;
+ }
+ }
+ }
+
+ /**
+ * Check the integrity of the cache which is it does not have nodes
+ * from more than one window, there are no duplicates, all nodes are
+ * connected, there is a single input focused node, and there is a
+ * single accessibility focused node.
+ */
+ private void checkIntegrity() {
+ synchronized (mLock) {
+ // Get the root.
+ if (mCacheImpl.size() <= 0) {
+ return;
+ }
+
+ // If the cache is a tree it does not matter from
+ // which node we start to search for the root.
+ AccessibilityNodeInfo root = mCacheImpl.valueAt(0);
+ AccessibilityNodeInfo parent = root;
+ while (parent != null) {
+ root = parent;
+ parent = mCacheImpl.get(parent.getParentNodeId());
+ }
+
+ // Traverse the tree and do some checks.
+ final int windowId = root.getWindowId();
+ AccessibilityNodeInfo accessFocus = null;
+ AccessibilityNodeInfo inputFocus = null;
+ HashSet<AccessibilityNodeInfo> seen = new HashSet<AccessibilityNodeInfo>();
+ Queue<AccessibilityNodeInfo> fringe = new LinkedList<AccessibilityNodeInfo>();
+ fringe.add(root);
+
+ while (!fringe.isEmpty()) {
+ AccessibilityNodeInfo current = fringe.poll();
+ // Check for duplicates
+ if (!seen.add(current)) {
+ Log.e(LOG_TAG, "Duplicate node: " + current);
+ return;
+ }
+
+ // Check for one accessibility focus.
+ if (current.isAccessibilityFocused()) {
+ if (accessFocus != null) {
+ Log.e(LOG_TAG, "Duplicate accessibility focus:" + current);
+ } else {
+ accessFocus = current;
+ }
+ }
+
+ // Check for one input focus.
+ if (current.isFocused()) {
+ if (inputFocus != null) {
+ Log.e(LOG_TAG, "Duplicate input focus: " + current);
+ } else {
+ inputFocus = current;
+ }
+ }
+
+ SparseLongArray childIds = current.getChildNodeIds();
+ final int childCount = childIds.size();
+ for (int i = 0; i < childCount; i++) {
+ final long childId = childIds.valueAt(i);
+ AccessibilityNodeInfo child = mCacheImpl.get(childId);
+ if (child != null) {
+ fringe.add(child);
+ }
+ }
+ }
+
+ // Check for disconnected nodes or ones from another window.
+ final int cacheSize = mCacheImpl.size();
+ for (int i = 0; i < cacheSize; i++) {
+ AccessibilityNodeInfo info = mCacheImpl.valueAt(i);
+ if (!seen.contains(info)) {
+ if (info.getWindowId() == windowId) {
+ Log.e(LOG_TAG, "Disconneced node: ");
+ } else {
+ Log.e(LOG_TAG, "Node from: " + info.getWindowId() + " not from:"
+ + windowId + " " + info);
+ }
+ }
+ }
}
}
}
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java
index 057c3d1..5d42da1 100644
--- a/core/java/android/webkit/WebViewClassic.java
+++ b/core/java/android/webkit/WebViewClassic.java
@@ -88,7 +88,6 @@
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewRootImpl;
-import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
@@ -888,20 +887,18 @@
private Point mSelectHandleLeftOffset;
private Point mSelectHandleRightOffset;
private Point mSelectHandleCenterOffset;
- private Point mSelectCursorBase = new Point();
- private int mSelectCursorBaseLayerId;
- private QuadF mSelectCursorBaseTextQuad = new QuadF();
- private Point mSelectCursorExtent = new Point();
- private int mSelectCursorExtentLayerId;
- private QuadF mSelectCursorExtentTextQuad = new QuadF();
+ private Point mSelectCursorLeft = new Point();
+ private int mSelectCursorLeftLayerId;
+ private QuadF mSelectCursorLeftTextQuad = new QuadF();
+ private Point mSelectCursorRight = new Point();
+ private int mSelectCursorRightLayerId;
+ private QuadF mSelectCursorRightTextQuad = new QuadF();
private Point mSelectDraggingCursor;
private Point mSelectDraggingOffset;
private QuadF mSelectDraggingTextQuad;
private boolean mIsCaretSelection;
- static final int HANDLE_ID_START = 0;
- static final int HANDLE_ID_END = 1;
- static final int HANDLE_ID_BASE = 2;
- static final int HANDLE_ID_EXTENT = 3;
+ static final int HANDLE_ID_LEFT = 0;
+ static final int HANDLE_ID_RIGHT = 1;
// the color used to highlight the touch rectangles
static final int HIGHLIGHT_COLOR = 0x6633b5e5;
@@ -3722,13 +3719,13 @@
return;
}
if (mSelectingText) {
- if (mSelectCursorBaseLayerId == mCurrentScrollingLayerId) {
- mSelectCursorBase.offset(dx, dy);
- mSelectCursorBaseTextQuad.offset(dx, dy);
+ if (mSelectCursorLeftLayerId == mCurrentScrollingLayerId) {
+ mSelectCursorLeft.offset(dx, dy);
+ mSelectCursorLeftTextQuad.offset(dx, dy);
}
- if (mSelectCursorExtentLayerId == mCurrentScrollingLayerId) {
- mSelectCursorExtent.offset(dx, dy);
- mSelectCursorExtentTextQuad.offset(dx, dy);
+ if (mSelectCursorRightLayerId == mCurrentScrollingLayerId) {
+ mSelectCursorRight.offset(dx, dy);
+ mSelectCursorRightTextQuad.offset(dx, dy);
}
} else if (mHandleAlpha.getAlpha() > 0) {
// stop fading as we're not going to move with the layer.
@@ -3829,6 +3826,9 @@
// reset the flag since we set to true in if need after
// loading is see onPageFinished(Url)
mAccessibilityScriptInjected = false;
+
+ // Don't start out editing.
+ mIsEditingText = false;
}
/**
@@ -4589,18 +4589,10 @@
* startX, startY, endX, endY
*/
private void getSelectionHandles(int[] handles) {
- handles[0] = mSelectCursorBase.x;
- handles[1] = mSelectCursorBase.y;
- handles[2] = mSelectCursorExtent.x;
- handles[3] = mSelectCursorExtent.y;
- if (!nativeIsBaseFirst(mNativeClass)) {
- int swap = handles[0];
- handles[0] = handles[2];
- handles[2] = swap;
- swap = handles[1];
- handles[1] = handles[3];
- handles[3] = swap;
- }
+ handles[0] = mSelectCursorLeft.x;
+ handles[1] = mSelectCursorLeft.y;
+ handles[2] = mSelectCursorRight.x;
+ handles[3] = mSelectCursorRight.y;
}
// draw history
@@ -5107,8 +5099,8 @@
ClipboardManager cm = (ClipboardManager)(mContext
.getSystemService(Context.CLIPBOARD_SERVICE));
if (cm.hasPrimaryClip()) {
- Point cursorPoint = new Point(contentToViewX(mSelectCursorBase.x),
- contentToViewY(mSelectCursorBase.y));
+ Point cursorPoint = new Point(contentToViewX(mSelectCursorLeft.x),
+ contentToViewY(mSelectCursorLeft.y));
Point cursorTop = calculateCaretTop();
cursorTop.set(contentToViewX(cursorTop.x),
contentToViewY(cursorTop.y));
@@ -5158,12 +5150,12 @@
* calculates the top of a caret.
*/
private Point calculateCaretTop() {
- float scale = scaleAlongSegment(mSelectCursorBase.x, mSelectCursorBase.y,
- mSelectCursorBaseTextQuad.p4, mSelectCursorBaseTextQuad.p3);
+ float scale = scaleAlongSegment(mSelectCursorLeft.x, mSelectCursorLeft.y,
+ mSelectCursorLeftTextQuad.p4, mSelectCursorLeftTextQuad.p3);
int x = Math.round(scaleCoordinate(scale,
- mSelectCursorBaseTextQuad.p1.x, mSelectCursorBaseTextQuad.p2.x));
+ mSelectCursorLeftTextQuad.p1.x, mSelectCursorLeftTextQuad.p2.x));
int y = Math.round(scaleCoordinate(scale,
- mSelectCursorBaseTextQuad.p1.y, mSelectCursorBaseTextQuad.p2.y));
+ mSelectCursorLeftTextQuad.p1.y, mSelectCursorLeftTextQuad.p2.y));
return new Point(x, y);
}
@@ -5174,46 +5166,40 @@
}
private void syncSelectionCursors() {
- mSelectCursorBaseLayerId =
- nativeGetHandleLayerId(mNativeClass, HANDLE_ID_BASE,
- mSelectCursorBase, mSelectCursorBaseTextQuad);
- mSelectCursorExtentLayerId =
- nativeGetHandleLayerId(mNativeClass, HANDLE_ID_EXTENT,
- mSelectCursorExtent, mSelectCursorExtentTextQuad);
+ mSelectCursorLeftLayerId =
+ nativeGetHandleLayerId(mNativeClass, HANDLE_ID_LEFT,
+ mSelectCursorLeft, mSelectCursorLeftTextQuad);
+ mSelectCursorRightLayerId =
+ nativeGetHandleLayerId(mNativeClass, HANDLE_ID_RIGHT,
+ mSelectCursorRight, mSelectCursorRightTextQuad);
}
private void adjustSelectionCursors() {
- boolean wasDraggingStart = (mSelectDraggingCursor == mSelectCursorBase);
+ if (mIsCaretSelection) {
+ return; // no need to swap left and right handles.
+ }
+
+ boolean wasDraggingLeft = (mSelectDraggingCursor == mSelectCursorLeft);
int oldX = mSelectDraggingCursor.x;
int oldY = mSelectDraggingCursor.y;
- int oldStartX = mSelectCursorBase.x;
- int oldStartY = mSelectCursorBase.y;
- int oldEndX = mSelectCursorExtent.x;
- int oldEndY = mSelectCursorExtent.y;
-
+ int oldLeftX = mSelectCursorLeft.x;
+ int oldLeftY = mSelectCursorLeft.y;
+ int oldRightX = mSelectCursorRight.x;
+ int oldRightY = mSelectCursorRight.y;
syncSelectionCursors();
- boolean dragChanged = oldX != mSelectDraggingCursor.x ||
- oldY != mSelectDraggingCursor.y;
- if (dragChanged && !mIsCaretSelection) {
- boolean draggingStart;
- if (wasDraggingStart) {
- float endStart = distanceSquared(oldEndX, oldEndY,
- mSelectCursorBase);
- float endEnd = distanceSquared(oldEndX, oldEndY,
- mSelectCursorExtent);
- draggingStart = endStart > endEnd;
- } else {
- float startStart = distanceSquared(oldStartX, oldStartY,
- mSelectCursorBase);
- float startEnd = distanceSquared(oldStartX, oldStartY,
- mSelectCursorExtent);
- draggingStart = startStart > startEnd;
- }
- mSelectDraggingCursor = (draggingStart
- ? mSelectCursorBase : mSelectCursorExtent);
- mSelectDraggingTextQuad = (draggingStart
- ? mSelectCursorBaseTextQuad : mSelectCursorExtentTextQuad);
- mSelectDraggingOffset = (draggingStart
+
+ boolean rightChanged = (oldRightX != mSelectCursorRight.x
+ || oldRightY != mSelectCursorRight.y);
+ boolean leftChanged = (oldLeftX != mSelectCursorLeft.x
+ || oldLeftY != mSelectCursorLeft.y);
+ if (leftChanged && rightChanged) {
+ // Left and right switched places, so swap dragging cursor
+ boolean draggingLeft = !wasDraggingLeft;
+ mSelectDraggingCursor = (draggingLeft
+ ? mSelectCursorLeft : mSelectCursorRight);
+ mSelectDraggingTextQuad = (draggingLeft
+ ? mSelectCursorLeftTextQuad : mSelectCursorRightTextQuad);
+ mSelectDraggingOffset = (draggingLeft
? mSelectHandleLeftOffset : mSelectHandleRightOffset);
}
mSelectDraggingCursor.set(oldX, oldY);
@@ -5239,14 +5225,11 @@
private void updateWebkitSelection() {
int[] handles = null;
if (mIsCaretSelection) {
- mSelectCursorExtent.set(mSelectCursorBase.x, mSelectCursorBase.y);
+ mSelectCursorRight.set(mSelectCursorLeft.x, mSelectCursorLeft.y);
}
if (mSelectingText) {
handles = new int[4];
- handles[0] = mSelectCursorBase.x;
- handles[1] = mSelectCursorBase.y;
- handles[2] = mSelectCursorExtent.x;
- handles[3] = mSelectCursorExtent.y;
+ getSelectionHandles(handles);
} else {
nativeSetTextSelection(mNativeClass, 0);
}
@@ -5610,21 +5593,21 @@
Point caretTop = calculateCaretTop();
if (visibleRect.width() < mEditTextContentBounds.width()) {
// The whole edit won't fit in the width, so use the caret rect
- if (mSelectCursorBase.x < caretTop.x) {
- showRect.left = Math.max(0, mSelectCursorBase.x - buffer);
+ if (mSelectCursorLeft.x < caretTop.x) {
+ showRect.left = Math.max(0, mSelectCursorLeft.x - buffer);
showRect.right = caretTop.x + buffer;
} else {
showRect.left = Math.max(0, caretTop.x - buffer);
- showRect.right = mSelectCursorBase.x + buffer;
+ showRect.right = mSelectCursorLeft.x + buffer;
}
}
if (visibleRect.height() < mEditTextContentBounds.height()) {
// The whole edit won't fit in the height, so use the caret rect
- if (mSelectCursorBase.y > caretTop.y) {
+ if (mSelectCursorLeft.y > caretTop.y) {
showRect.top = Math.max(0, caretTop.y - buffer);
- showRect.bottom = mSelectCursorBase.y + buffer;
+ showRect.bottom = mSelectCursorLeft.y + buffer;
} else {
- showRect.top = Math.max(0, mSelectCursorBase.y - buffer);
+ showRect.top = Math.max(0, mSelectCursorLeft.y - buffer);
showRect.bottom = caretTop.y + buffer;
}
}
@@ -5885,25 +5868,25 @@
if (mSelectHandleCenter != null && mSelectHandleCenter.getBounds()
.contains(shiftedX, shiftedY)) {
mSelectionStarted = true;
- mSelectDraggingCursor = mSelectCursorBase;
+ mSelectDraggingCursor = mSelectCursorLeft;
mSelectDraggingOffset = mSelectHandleCenterOffset;
- mSelectDraggingTextQuad = mSelectCursorBaseTextQuad;
+ mSelectDraggingTextQuad = mSelectCursorLeftTextQuad;
mPrivateHandler.removeMessages(CLEAR_CARET_HANDLE);
hidePasteButton();
} else if (mSelectHandleLeft != null
&& mSelectHandleLeft.getBounds()
.contains(shiftedX, shiftedY)) {
- mSelectionStarted = true;
- mSelectDraggingCursor = mSelectCursorBase;
- mSelectDraggingOffset = mSelectHandleLeftOffset;
- mSelectDraggingTextQuad = mSelectCursorBaseTextQuad;
+ mSelectionStarted = true;
+ mSelectDraggingOffset = mSelectHandleLeftOffset;
+ mSelectDraggingCursor = mSelectCursorLeft;
+ mSelectDraggingTextQuad = mSelectCursorLeftTextQuad;
} else if (mSelectHandleRight != null
&& mSelectHandleRight.getBounds()
.contains(shiftedX, shiftedY)) {
mSelectionStarted = true;
- mSelectDraggingCursor = mSelectCursorExtent;
mSelectDraggingOffset = mSelectHandleRightOffset;
- mSelectDraggingTextQuad = mSelectCursorExtentTextQuad;
+ mSelectDraggingCursor = mSelectCursorRight;
+ mSelectDraggingTextQuad = mSelectCursorRightTextQuad;
} else if (mIsCaretSelection) {
selectionDone();
}
@@ -7452,18 +7435,12 @@
case SHOW_RECT_MSG_ID: {
WebViewCore.ShowRectData data = (WebViewCore.ShowRectData) msg.obj;
- int x = getScrollX();
int left = contentToViewX(data.mLeft);
int width = contentToViewDimension(data.mWidth);
int maxWidth = contentToViewDimension(data.mContentWidth);
int viewWidth = getViewWidth();
- if (width < viewWidth) {
- // center align
- x += left + width / 2 - getScrollX() - viewWidth / 2;
- } else {
- x += (int) (left + data.mXPercentInDoc * width
- - getScrollX() - data.mXPercentInView * viewWidth);
- }
+ int x = (int) (left + data.mXPercentInDoc * width -
+ data.mXPercentInView * viewWidth);
if (DebugFlags.WEB_VIEW) {
Log.v(LOGTAG, "showRectMsg=(left=" + left + ",width=" +
width + ",maxWidth=" + maxWidth +
@@ -8009,7 +7986,9 @@
}
nativeSetTextSelection(mNativeClass, data.mSelectTextPtr);
- if (data.mSelectionReason == TextSelectionData.REASON_ACCESSIBILITY_INJECTOR) {
+ if ((data.mSelectionReason == TextSelectionData.REASON_ACCESSIBILITY_INJECTOR)
+ || (!mSelectingText
+ && data.mSelectionReason != TextSelectionData.REASON_SELECT_WORD)) {
selectionDone();
mShowTextSelectionExtra = true;
invalidate();
@@ -8654,7 +8633,6 @@
private native void nativeUpdateDrawGLFunction(int nativeInstance, Rect invScreenRect,
Rect screenRect, RectF visibleContentRect, float scale);
private native String nativeGetSelection();
- private native Rect nativeLayerBounds(int layer);
private native void nativeSetHeightCanMeasure(boolean measure);
private native boolean nativeSetBaseLayer(int nativeInstance,
int layer, boolean showVisualIndicator, boolean isPictureAfterFirstLayout);
@@ -8697,7 +8675,6 @@
private static native void nativeSetTextSelection(int instance, int selection);
private static native int nativeGetHandleLayerId(int instance, int handle,
Point cursorLocation, QuadF textQuad);
- private static native boolean nativeIsBaseFirst(int instance);
private static native void nativeMapLayerRect(int instance, int layerId,
Rect rect);
// Returns 1 if a layer sync is needed, else 0
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 4adfd6a..7aa9a0b 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -22,7 +22,6 @@
import android.database.Cursor;
import android.graphics.Point;
import android.graphics.Rect;
-import android.graphics.Region;
import android.media.MediaFile;
import android.net.ProxyProperties;
import android.net.Uri;
@@ -864,6 +863,7 @@
static class TextSelectionData {
static final int REASON_UNKNOWN = 0;
static final int REASON_ACCESSIBILITY_INJECTOR = 1;
+ static final int REASON_SELECT_WORD = 2;
public TextSelectionData(int start, int end, int selectTextPtr) {
mStart = start;
mEnd = end;
@@ -1718,12 +1718,16 @@
break;
}
case SELECT_WORD_AT: {
+ mTextSelectionChangeReason
+ = TextSelectionData.REASON_SELECT_WORD;
int x = msg.arg1;
int y = msg.arg2;
if (!nativeSelectWordAt(mNativeClass, x, y)) {
mWebViewClassic.mPrivateHandler.obtainMessage(WebViewClassic.SHOW_CARET_HANDLE)
.sendToTarget();
}
+ mTextSelectionChangeReason
+ = TextSelectionData.REASON_UNKNOWN;
break;
}
case SELECT_ALL:
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index c4e1bf5..04c8cdc 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -42,6 +42,7 @@
import android.util.StateSet;
import android.view.ActionMode;
import android.view.ContextMenu.ContextMenuInfo;
+import android.view.FocusFinder;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.InputDevice;
@@ -56,6 +57,7 @@
import android.view.ViewDebug;
import android.view.ViewGroup;
import android.view.ViewParent;
+import android.view.ViewRootImpl;
import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
@@ -1327,6 +1329,119 @@
}
@Override
+ public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {
+ if ((focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY
+ && (direction == ACCESSIBILITY_FOCUS_FORWARD
+ || direction == ACCESSIBILITY_FOCUS_BACKWARD)) {
+ if (canTakeAccessibilityFocusFromHover()) {
+ views.add(this);
+ }
+ } else {
+ super.addFocusables(views, direction, focusableMode);
+ }
+ }
+
+ @Override
+ public View focusSearch(int direction) {
+ return focusSearch(null, direction);
+ }
+
+ @Override
+ public View focusSearch(View focused, int direction) {
+ switch (direction) {
+ case ACCESSIBILITY_FOCUS_FORWARD: {
+ ViewRootImpl viewRootImpl = getViewRootImpl();
+ if (viewRootImpl == null) {
+ break;
+ }
+ View currentFocus = viewRootImpl.getAccessibilityFocusedHost();
+ if (currentFocus == null) {
+ break;
+ }
+ // If we have the focus try giving it to the first child.
+ if (currentFocus == this) {
+ final int firstVisiblePosition = getFirstVisiblePosition();
+ if (firstVisiblePosition >= 0) {
+ return getChildAt(0);
+ }
+ return null;
+ }
+ // Find the item that has accessibility focus.
+ final int currentPosition = getPositionForView(currentFocus);
+ if (currentPosition < 0 || currentPosition >= getCount()) {
+ break;
+ }
+ // Try to advance focus in the current item.
+ View currentItem = getChildAt(currentPosition - getFirstVisiblePosition());
+ if (currentItem instanceof ViewGroup) {
+ ViewGroup currentItemGroup = (ViewGroup) currentItem;
+ View nextFocus = FocusFinder.getInstance().findNextFocus(currentItemGroup,
+ currentFocus, direction);
+ if (nextFocus != null && nextFocus != currentItemGroup
+ && nextFocus != currentFocus) {
+ return nextFocus;
+ }
+ }
+ // Try to move focus to the next item.
+ final int nextPosition = currentPosition - getFirstVisiblePosition() + 1;
+ if (nextPosition < getChildCount()) {
+ return getChildAt(nextPosition);
+ }
+ } break;
+ case ACCESSIBILITY_FOCUS_BACKWARD: {
+ ViewRootImpl viewRootImpl = getViewRootImpl();
+ if (viewRootImpl == null) {
+ break;
+ }
+ View currentFocus = viewRootImpl.getAccessibilityFocusedHost();
+ if (currentFocus == null) {
+ break;
+ }
+ // If we have the focus do a generic search.
+ if (currentFocus == this) {
+ return super.focusSearch(this, direction);
+ }
+ // Find the item that has accessibility focus.
+ final int currentPosition = getPositionForView(currentFocus);
+ if (currentPosition < 0 || currentPosition >= getCount()) {
+ break;
+ }
+ // Try to advance focus in the current item.
+ View currentItem = getChildAt(currentPosition - getFirstVisiblePosition());
+ if (currentItem instanceof ViewGroup) {
+ ViewGroup currentItemGroup = (ViewGroup) currentItem;
+ View nextFocus = FocusFinder.getInstance().findNextFocus(currentItemGroup,
+ currentFocus, direction);
+ if (nextFocus != null && nextFocus != currentItemGroup
+ && nextFocus != currentFocus) {
+ return nextFocus;
+ }
+ }
+ // Try to move focus to the previous item.
+ final int nextPosition = currentPosition - getFirstVisiblePosition() - 1;
+ if (nextPosition >= 0) {
+ return getChildAt(nextPosition);
+ } else {
+ return this;
+ }
+ }
+ }
+ return super.focusSearch(focused, direction);
+ }
+
+ /**
+ * @hide
+ */
+ @Override
+ public View findViewToTakeAccessibilityFocusFromHover(View child, View descendant) {
+ final int position = getPositionForView(child);
+ if (position != INVALID_POSITION) {
+ return getChildAt(position - mFirstPosition);
+ }
+ return super.findViewToTakeAccessibilityFocusFromHover(child, descendant);
+ }
+
+ @Override
public void sendAccessibilityEvent(int eventType) {
// Since this class calls onScrollChanged even if the mFirstPosition and the
// child count have not changed we will avoid sending duplicate accessibility
@@ -1365,6 +1480,9 @@
@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
+ if (super.performAccessibilityAction(action, arguments)) {
+ return true;
+ }
switch (action) {
case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
if (getLastVisiblePosition() < getCount() - 1) {
@@ -1381,7 +1499,7 @@
}
} return false;
}
- return super.performAccessibilityAction(action, arguments);
+ return false;
}
/**
@@ -6317,6 +6435,7 @@
if (mTransientStateViews == null) {
mTransientStateViews = new SparseArray<View>();
}
+ scrap.dispatchStartTemporaryDetach();
mTransientStateViews.put(position, scrap);
}
return;
diff --git a/core/java/android/widget/ActivityChooserModel.java b/core/java/android/widget/ActivityChooserModel.java
index c6104bc..fe6c4f5 100644
--- a/core/java/android/widget/ActivityChooserModel.java
+++ b/core/java/android/widget/ActivityChooserModel.java
@@ -765,16 +765,6 @@
}
/**
- * Gets whether the given observer is already registered.
- *
- * @param observer The observer.
- * @return True if already registered.
- */
- public boolean isRegisteredObserver(DataSetObserver observer) {
- return mObservers.contains(observer);
- }
-
- /**
* Represents a record in the history.
*/
public final static class HistoricalRecord {
diff --git a/core/java/android/widget/ActivityChooserView.java b/core/java/android/widget/ActivityChooserView.java
index 0c0bb1e..be6b4e2 100644
--- a/core/java/android/widget/ActivityChooserView.java
+++ b/core/java/android/widget/ActivityChooserView.java
@@ -20,10 +20,8 @@
import android.content.Context;
import android.content.Intent;
-import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.DataSetObserver;
@@ -176,11 +174,6 @@
private int mDefaultActionButtonContentDescription;
/**
- * Whether this view has a default activity affordance.
- */
- private boolean mHasDefaultActivity;
-
- /**
* Create a new instance.
*
* @param context The application environment.
@@ -252,8 +245,6 @@
Resources resources = context.getResources();
mListPopupMaxWidth = Math.max(resources.getDisplayMetrics().widthPixels / 2,
resources.getDimensionPixelSize(com.android.internal.R.dimen.config_prefDialogWidth));
-
- updateHasDefaultActivity();
}
/**
@@ -267,21 +258,6 @@
}
}
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- Configuration oldConfig = mContext.getResources().getConfiguration();
- final int changed = oldConfig.diff(newConfig);
- if ((changed & ActivityInfo.CONFIG_SCREEN_SIZE) != 0
- || (changed & ActivityInfo.CONFIG_ORIENTATION) != 0) {
- updateHasDefaultActivity();
- }
- }
-
- private void updateHasDefaultActivity() {
- mHasDefaultActivity = mContext.getResources().getBoolean(
- R.bool.activity_chooser_view_has_default_activity);
- }
-
/**
* Sets the background for the button that expands the activity
* overflow list.
@@ -407,8 +383,7 @@
protected void onAttachedToWindow() {
super.onAttachedToWindow();
ActivityChooserModel dataModel = mAdapter.getDataModel();
- if (dataModel != null
- && !dataModel.isRegisteredObserver(mModelDataSetOberver)) {
+ if (dataModel != null) {
dataModel.registerObserver(mModelDataSetOberver);
}
mIsAttachedToWindow = true;
@@ -418,8 +393,7 @@
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
ActivityChooserModel dataModel = mAdapter.getDataModel();
- if (dataModel != null
- && dataModel.isRegisteredObserver(mModelDataSetOberver)) {
+ if (dataModel != null) {
dataModel.unregisterObserver(mModelDataSetOberver);
}
ViewTreeObserver viewTreeObserver = getViewTreeObserver();
@@ -522,7 +496,7 @@
// Default activity button.
final int activityCount = mAdapter.getActivityCount();
final int historySize = mAdapter.getHistorySize();
- if (mHasDefaultActivity && activityCount > 0 && historySize > 0) {
+ if (activityCount > 0 && historySize > 0) {
mDefaultActivityButton.setVisibility(VISIBLE);
ResolveInfo activity = mAdapter.getDefaultActivity();
PackageManager packageManager = mContext.getPackageManager();
@@ -538,9 +512,9 @@
}
// Activity chooser content.
if (mDefaultActivityButton.getVisibility() == VISIBLE) {
- mActivityChooserContent.setBackground(mActivityChooserContentBackground);
+ mActivityChooserContent.setBackgroundDrawable(mActivityChooserContentBackground);
} else {
- mActivityChooserContent.setBackground(null);
+ mActivityChooserContent.setBackgroundDrawable(null);
}
}
@@ -603,7 +577,7 @@
// OnLongClickListener#onLongClick
@Override
public boolean onLongClick(View view) {
- if (mHasDefaultActivity && view == mDefaultActivityButton) {
+ if (view == mDefaultActivityButton) {
if (mAdapter.getCount() > 0) {
mIsSelectingDefaultActivity = true;
showPopupUnchecked(mInitialActivityCount);
@@ -656,16 +630,14 @@
public void setDataModel(ActivityChooserModel dataModel) {
ActivityChooserModel oldDataModel = mAdapter.getDataModel();
- if (oldDataModel != null) {
+ if (oldDataModel != null && isShown()) {
oldDataModel.unregisterObserver(mModelDataSetOberver);
}
mDataModel = dataModel;
- if (dataModel != null) {
+ if (dataModel != null && isShown()) {
dataModel.registerObserver(mModelDataSetOberver);
- notifyDataSetChanged();
- } else {
- notifyDataSetInvalidated();
}
+ notifyDataSetChanged();
}
@Override
diff --git a/core/java/android/widget/AdapterView.java b/core/java/android/widget/AdapterView.java
index abfc577..502de31 100644
--- a/core/java/android/widget/AdapterView.java
+++ b/core/java/android/widget/AdapterView.java
@@ -24,7 +24,6 @@
import android.util.SparseArray;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
-import android.view.MotionEvent;
import android.view.SoundEffectConstants;
import android.view.View;
import android.view.ViewDebug;
@@ -32,6 +31,7 @@
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.accessibility.AccessibilityNodeProvider;
/**
* An AdapterView is a view whose children are determined by an {@link Adapter}.
@@ -957,24 +957,6 @@
event.setItemCount(getCount());
}
- /**
- * @hide
- */
- @Override
- public boolean onRequestAccessibilityFocusFromHover(float x, float y) {
- // We prefer to five focus to the child instead of this view.
- // Usually the children are not actionable for accessibility,
- // and they will not take accessibility focus, so we give it.
- final int childCount = getChildCount();
- for (int i = 0; i < childCount; i++) {
- View child = getChildAt(i);
- if (isTransformedTouchPointInView(x, y, child, null)) {
- return child.requestAccessibilityFocus();
- }
- }
- return super.onRequestAccessibilityFocusFromHover(x, y);
- }
-
private boolean isScrollableForAccessibility() {
T adapter = getAdapter();
if (adapter != null) {
diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java
index 278192c..61935c2 100644
--- a/core/java/android/widget/CheckedTextView.java
+++ b/core/java/android/widget/CheckedTextView.java
@@ -93,6 +93,7 @@
if (mChecked != checked) {
mChecked = checked;
refreshDrawableState();
+ notifyAccessibilityStateChanged();
}
}
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index 02c4c4f..0a71c5a 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -114,6 +114,7 @@
if (mChecked != checked) {
mChecked = checked;
refreshDrawableState();
+ notifyAccessibilityStateChanged();
// Avoid infinite recursions if setChecked() is called from a listener
if (mBroadcasting) {
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 4b7ec9a..16490e8 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -16,6 +16,9 @@
package android.widget;
+import com.android.internal.util.ArrayUtils;
+import com.android.internal.widget.EditableInputConnection;
+
import android.R;
import android.content.ClipData;
import android.content.ClipData.Item;
@@ -70,10 +73,10 @@
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
import android.view.View.DragShadowBuilder;
import android.view.View.OnClickListener;
+import android.view.ViewConfiguration;
+import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
@@ -85,12 +88,12 @@
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView.OnItemClickListener;
+import android.widget.Editor.InputContentType;
+import android.widget.Editor.InputMethodState;
+import android.widget.Editor.SelectionModifierCursorController;
import android.widget.TextView.Drawables;
import android.widget.TextView.OnEditorActionListener;
-import com.android.internal.util.ArrayUtils;
-import com.android.internal.widget.EditableInputConnection;
-
import java.text.BreakIterator;
import java.util.Arrays;
import java.util.Comparator;
@@ -102,6 +105,8 @@
* @hide
*/
public class Editor {
+ private static final String TAG = "Editor";
+
static final int BLINK = 500;
private static final float[] TEMP_POSITION = new float[2];
private static int DRAG_SHADOW_MAX_TEXT_LENGTH = 20;
@@ -151,6 +156,8 @@
boolean mInBatchEditControllers;
boolean mShowSoftInputOnFocus = true;
+ boolean mPreserveDetachedSelection;
+ boolean mTemporaryDetach;
SuggestionsPopupWindow mSuggestionsPopupWindow;
SuggestionRangeSpan mSuggestionRangeSpan;
@@ -190,6 +197,7 @@
showError();
mShowErrorAfterAttach = false;
}
+ mTemporaryDetach = false;
final ViewTreeObserver observer = mTextView.getViewTreeObserver();
// No need to create the controller.
@@ -198,10 +206,22 @@
observer.addOnTouchModeChangeListener(mInsertionPointCursorController);
}
if (mSelectionModifierCursorController != null) {
+ mSelectionModifierCursorController.resetTouchOffsets();
observer.addOnTouchModeChangeListener(mSelectionModifierCursorController);
}
updateSpellCheckSpans(0, mTextView.getText().length(),
true /* create the spell checker if needed */);
+
+ if (mTextView.hasTransientState() &&
+ mTextView.getSelectionStart() != mTextView.getSelectionEnd()) {
+ // Since transient state is reference counted make sure it stays matched
+ // with our own calls to it for managing selection.
+ // The action mode callback will set this back again when/if the action mode starts.
+ mTextView.setHasTransientState(false);
+
+ // We had an active selection from before, start the selection mode.
+ startSelectionActionMode();
+ }
}
void onDetachedFromWindow() {
@@ -234,7 +254,10 @@
mSpellChecker = null;
}
+ mPreserveDetachedSelection = true;
hideControllers();
+ mPreserveDetachedSelection = false;
+ mTemporaryDetach = false;
}
private void showError() {
@@ -877,7 +900,9 @@
hideControllers();
Selection.setSelection((Spannable) mTextView.getText(), selStart, selEnd);
} else {
+ if (mTemporaryDetach) mPreserveDetachedSelection = true;
hideControllers();
+ if (mTemporaryDetach) mPreserveDetachedSelection = false;
downgradeEasyCorrectionSpans();
}
@@ -2679,6 +2704,7 @@
if (menu.hasVisibleItems() || mode.getCustomView() != null) {
getSelectionController().show();
+ mTextView.setHasTransientState(true);
return true;
} else {
return false;
@@ -2707,7 +2733,17 @@
if (mCustomSelectionActionModeCallback != null) {
mCustomSelectionActionModeCallback.onDestroyActionMode(mode);
}
- Selection.setSelection((Spannable) mTextView.getText(), mTextView.getSelectionEnd());
+
+ /*
+ * If we're ending this mode because we're detaching from a window,
+ * we still have selection state to preserve. Don't clear it, we'll
+ * bring back the selection mode when (if) we get reattached.
+ */
+ if (!mPreserveDetachedSelection) {
+ Selection.setSelection((Spannable) mTextView.getText(),
+ mTextView.getSelectionEnd());
+ mTextView.setHasTransientState(false);
+ }
if (mSelectionModifierCursorController != null) {
mSelectionModifierCursorController.hide();
diff --git a/core/java/android/widget/Gallery.java b/core/java/android/widget/Gallery.java
index 03fdc39..b2c8164 100644
--- a/core/java/android/widget/Gallery.java
+++ b/core/java/android/widget/Gallery.java
@@ -20,6 +20,7 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
+import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import android.view.ContextMenu.ContextMenuInfo;
@@ -1367,6 +1368,35 @@
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName(Gallery.class.getName());
+ info.setScrollable(mItemCount > 1);
+ if (mItemCount > 0 && mSelectedPosition < mItemCount - 1) {
+ info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
+ }
+ if (mItemCount > 0 && mSelectedPosition > 0) {
+ info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
+ }
+ }
+
+ @Override
+ public boolean performAccessibilityAction(int action, Bundle arguments) {
+ if (super.performAccessibilityAction(action, arguments)) {
+ return true;
+ }
+ switch (action) {
+ case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
+ if (mItemCount > 0 && mSelectedPosition < mItemCount - 1) {
+ final int currentChildIndex = mSelectedPosition - mFirstPosition;
+ return scrollToChild(currentChildIndex + 1);
+ }
+ } return false;
+ case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
+ if (mItemCount > 0 && mSelectedPosition > 0) {
+ final int currentChildIndex = mSelectedPosition - mFirstPosition;
+ return scrollToChild(currentChildIndex - 1);
+ }
+ } return false;
+ }
+ return false;
}
/**
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java
index cb10d0a..60a1d15 100644
--- a/core/java/android/widget/GridLayout.java
+++ b/core/java/android/widget/GridLayout.java
@@ -581,7 +581,7 @@
}
private int getDefaultMargin(View c, boolean isAtEdge, boolean horizontal, boolean leading) {
- return /*isAtEdge ? DEFAULT_CONTAINER_MARGIN :*/ getDefaultMargin(c, horizontal, leading);
+ return isAtEdge ? DEFAULT_CONTAINER_MARGIN : getDefaultMargin(c, horizontal, leading);
}
private int getDefaultMargin(View c, LayoutParams p, boolean horizontal, boolean leading) {
@@ -733,6 +733,11 @@
@Override
protected void onSetLayoutParams(View child, ViewGroup.LayoutParams layoutParams) {
super.onSetLayoutParams(child, layoutParams);
+
+ if (!checkLayoutParams(layoutParams)) {
+ handleInvalidParams("supplied LayoutParams are of the wrong type");
+ }
+
invalidateStructure();
}
@@ -740,6 +745,43 @@
return (LayoutParams) c.getLayoutParams();
}
+ private static void handleInvalidParams(String msg) {
+ throw new IllegalArgumentException(msg + ". ");
+ }
+
+ private void checkLayoutParams(LayoutParams lp, boolean horizontal) {
+ String groupName = horizontal ? "column" : "row";
+ Spec spec = horizontal ? lp.columnSpec : lp.rowSpec;
+ Interval span = spec.span;
+ if (span.min != UNDEFINED && span.min < 0) {
+ handleInvalidParams(groupName + " indices must be positive");
+ }
+ Axis axis = horizontal ? horizontalAxis : verticalAxis;
+ int count = axis.definedCount;
+ if (count != UNDEFINED) {
+ if (span.max > count) {
+ handleInvalidParams(groupName +
+ " indices (start + span) mustn't exceed the " + groupName + " count");
+ }
+ if (span.size() > count) {
+ handleInvalidParams(groupName + " span mustn't exceed the " + groupName + " count");
+ }
+ }
+ }
+
+ @Override
+ protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
+ if (!(p instanceof LayoutParams)) {
+ return false;
+ }
+ LayoutParams lp = (LayoutParams) p;
+
+ checkLayoutParams(lp, true);
+ checkLayoutParams(lp, false);
+
+ return true;
+ }
+
@Override
protected LayoutParams generateDefaultLayoutParams() {
return new LayoutParams();
@@ -1143,6 +1185,7 @@
Interval span = spec.span;
result = max(result, span.min);
result = max(result, span.max);
+ result = max(result, span.size());
}
return result == -1 ? UNDEFINED : result;
}
@@ -1159,6 +1202,11 @@
}
public void setCount(int count) {
+ if (count != UNDEFINED && count < getMaxIndex()) {
+ handleInvalidParams((horizontal ? "column" : "row") +
+ "Count must be greater than or equal to the maximum of all grid indices " +
+ "(and spans) defined in the LayoutParams of each child");
+ }
this.definedCount = count;
}
@@ -1478,20 +1526,6 @@
This is a special case of the Linear Programming problem that is, in turn,
equivalent to the single-source shortest paths problem on a digraph, for
which the O(n^2) Bellman-Ford algorithm the most commonly used general solution.
-
- Other algorithms are faster in the case where no arcs have negative weights
- but allowing negative weights turns out to be the same as accommodating maximum
- size requirements as well as minimum ones.
-
- Bellman-Ford works by iteratively 'relaxing' constraints over all nodes (an O(N)
- process) and performing this step N times. Proof of correctness hinges on the
- fact that there can be no negative weight chains of length > N - unless a
- 'negative weight loop' exists. The algorithm catches this case in a final
- checking phase that reports failure.
-
- By topologically sorting the nodes and checking this condition at each step
- typical layout problems complete after the first iteration and the algorithm
- completes in O(N) steps with very low constants.
*/
private void solve(Arc[] arcs, int[] locations) {
String axisName = horizontal ? "horizontal" : "vertical";
diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java
index ffabd1d9..f889cb7 100644
--- a/core/java/android/widget/HorizontalScrollView.java
+++ b/core/java/android/widget/HorizontalScrollView.java
@@ -739,6 +739,9 @@
@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
+ if (super.performAccessibilityAction(action, arguments)) {
+ return true;
+ }
switch (action) {
case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
final int viewportWidth = getWidth() - mPaddingLeft - mPaddingRight;
@@ -757,7 +760,7 @@
}
} return false;
}
- return super.performAccessibilityAction(action, arguments);
+ return false;
}
@Override
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index 6ff924b..b825e1b 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -950,6 +950,8 @@
provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
mLastHoveredChildVirtualViewId = hoveredVirtualViewId;
+ provider.performAction(hoveredVirtualViewId,
+ AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
} break;
case MotionEvent.ACTION_HOVER_MOVE: {
if (mLastHoveredChildVirtualViewId != hoveredVirtualViewId
@@ -960,6 +962,8 @@
provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
mLastHoveredChildVirtualViewId = hoveredVirtualViewId;
+ provider.performAction(hoveredVirtualViewId,
+ AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
}
} break;
case MotionEvent.ACTION_HOVER_EXIT: {
@@ -1413,9 +1417,16 @@
}
@Override
- public void sendAccessibilityEvent(int eventType) {
- // Do not send accessibility events - we want the user to
- // perceive this widget as several controls rather as a whole.
+ public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {
+ // We do not want the real descendant to be considered focus search
+ // since it is managed by the accessibility node provider.
+ if ((focusableMode & FOCUSABLES_ACCESSIBILITY) == FOCUSABLES_ACCESSIBILITY) {
+ if (canTakeAccessibilityFocusFromHover() || getAccessibilityNodeProvider() != null) {
+ views.add(this);
+ return;
+ }
+ }
+ super.addFocusables(views, direction, focusableMode);
}
@Override
@@ -2072,7 +2083,12 @@
}
}
+ /**
+ * Class for managing virtual view tree rooted at this picker.
+ */
class AccessibilityNodeProviderImpl extends AccessibilityNodeProvider {
+ private static final int UNDEFINED = Integer.MIN_VALUE;
+
private static final int VIRTUAL_VIEW_ID_INCREMENT = 1;
private static final int VIRTUAL_VIEW_ID_INPUT = 2;
@@ -2083,6 +2099,8 @@
private final int[] mTempArray = new int[2];
+ private int mAccessibilityFocusedView = UNDEFINED;
+
@Override
public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
switch (virtualViewId) {
@@ -2137,6 +2155,37 @@
@Override
public boolean performAction(int virtualViewId, int action, Bundle arguments) {
switch (virtualViewId) {
+ case View.NO_ID: {
+ switch (action) {
+ case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: {
+ if (mAccessibilityFocusedView != virtualViewId) {
+ mAccessibilityFocusedView = virtualViewId;
+ requestAccessibilityFocus();
+ return true;
+ }
+ } return false;
+ case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: {
+ if (mAccessibilityFocusedView == virtualViewId) {
+ mAccessibilityFocusedView = UNDEFINED;
+ clearAccessibilityFocus();
+ return true;
+ }
+ return false;
+ }
+ case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
+ if (getWrapSelectorWheel() || getValue() < getMaxValue()) {
+ changeValueByOne(true);
+ return true;
+ }
+ } return false;
+ case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
+ if (getWrapSelectorWheel() || getValue() > getMinValue()) {
+ changeValueByOne(false);
+ return true;
+ }
+ } return false;
+ }
+ } break;
case VIRTUAL_VIEW_ID_INPUT: {
switch (action) {
case AccessibilityNodeInfo.ACTION_FOCUS: {
@@ -2149,25 +2198,182 @@
mInputText.clearFocus();
return true;
}
- } break;
+ return false;
+ }
+ case AccessibilityNodeInfo.ACTION_CLICK: {
+ showSoftInput();
+ return true;
+ }
+ case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: {
+ if (mAccessibilityFocusedView != virtualViewId) {
+ mAccessibilityFocusedView = virtualViewId;
+ sendAccessibilityEventForVirtualView(virtualViewId,
+ AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED);
+ mInputText.invalidate();
+ return true;
+ }
+ } return false;
+ case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: {
+ if (mAccessibilityFocusedView == virtualViewId) {
+ mAccessibilityFocusedView = UNDEFINED;
+ sendAccessibilityEventForVirtualView(virtualViewId,
+ AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
+ mInputText.invalidate();
+ return true;
+ }
+ } return false;
+ default: {
+ return mInputText.performAccessibilityAction(action, arguments);
+ }
+ }
+ } return false;
+ case VIRTUAL_VIEW_ID_INCREMENT: {
+ switch (action) {
+ case AccessibilityNodeInfo.ACTION_CLICK: {
+ NumberPicker.this.changeValueByOne(true);
+ sendAccessibilityEventForVirtualView(virtualViewId,
+ AccessibilityEvent.TYPE_VIEW_CLICKED);
+ } return true;
+ case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: {
+ if (mAccessibilityFocusedView != virtualViewId) {
+ mAccessibilityFocusedView = virtualViewId;
+ sendAccessibilityEventForVirtualView(virtualViewId,
+ AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED);
+ invalidate(0, mBottomSelectionDividerBottom, mRight, mBottom);
+ return true;
+ }
+ } return false;
+ case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: {
+ if (mAccessibilityFocusedView == virtualViewId) {
+ mAccessibilityFocusedView = UNDEFINED;
+ sendAccessibilityEventForVirtualView(virtualViewId,
+ AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
+ invalidate(0, mBottomSelectionDividerBottom, mRight, mBottom);
+ return true;
+ }
+ } return false;
+ }
+ } return false;
+ case VIRTUAL_VIEW_ID_DECREMENT: {
+ switch (action) {
+ case AccessibilityNodeInfo.ACTION_CLICK: {
+ final boolean increment = (virtualViewId == VIRTUAL_VIEW_ID_INCREMENT);
+ NumberPicker.this.changeValueByOne(increment);
+ sendAccessibilityEventForVirtualView(virtualViewId,
+ AccessibilityEvent.TYPE_VIEW_CLICKED);
+ } return true;
+ case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: {
+ if (mAccessibilityFocusedView != virtualViewId) {
+ mAccessibilityFocusedView = virtualViewId;
+ sendAccessibilityEventForVirtualView(virtualViewId,
+ AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED);
+ invalidate(0, 0, mRight, mTopSelectionDividerTop);
+ return true;
+ }
+ } return false;
+ case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: {
+ if (mAccessibilityFocusedView == virtualViewId) {
+ mAccessibilityFocusedView = UNDEFINED;
+ sendAccessibilityEventForVirtualView(virtualViewId,
+ AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
+ invalidate(0, 0, mRight, mTopSelectionDividerTop);
+ return true;
+ }
+ } return false;
+ }
+ } return false;
+ }
+ return super.performAction(virtualViewId, action, arguments);
+ }
+
+ @Override
+ public AccessibilityNodeInfo findAccessibilityFocus(int virtualViewId) {
+ return createAccessibilityNodeInfo(mAccessibilityFocusedView);
+ }
+
+ @Override
+ public AccessibilityNodeInfo accessibilityFocusSearch(int direction, int virtualViewId) {
+ switch (direction) {
+ case View.ACCESSIBILITY_FOCUS_DOWN:
+ case View.ACCESSIBILITY_FOCUS_FORWARD: {
+ switch (mAccessibilityFocusedView) {
+ case UNDEFINED: {
+ return createAccessibilityNodeInfo(View.NO_ID);
+ }
+ case View.NO_ID: {
+ if (hasVirtualDecrementButton()) {
+ return createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_DECREMENT);
+ }
+ }
+ //$FALL-THROUGH$
+ case VIRTUAL_VIEW_ID_DECREMENT: {
+ return createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INPUT);
+ }
+ case VIRTUAL_VIEW_ID_INPUT: {
+ if (hasVirtualIncrementButton()) {
+ return createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INCREMENT);
+ }
+ }
+ //$FALL-THROUGH$
+ case VIRTUAL_VIEW_ID_INCREMENT: {
+ View nextFocus = NumberPicker.this.focusSearch(direction);
+ if (nextFocus != null) {
+ return nextFocus.createAccessibilityNodeInfo();
+ }
+ return null;
+ }
+ }
+ } break;
+ case View.ACCESSIBILITY_FOCUS_UP:
+ case View.ACCESSIBILITY_FOCUS_BACKWARD: {
+ switch (mAccessibilityFocusedView) {
+ case UNDEFINED: {
+ return createAccessibilityNodeInfo(View.NO_ID);
+ }
+ case View.NO_ID: {
+ if (hasVirtualIncrementButton()) {
+ return createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INCREMENT);
+ }
+ }
+ //$FALL-THROUGH$
+ case VIRTUAL_VIEW_ID_INCREMENT: {
+ return createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INPUT);
+ }
+ case VIRTUAL_VIEW_ID_INPUT: {
+ if (hasVirtualDecrementButton()) {
+ return createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_DECREMENT);
+ }
+ }
+ //$FALL-THROUGH$
+ case VIRTUAL_VIEW_ID_DECREMENT: {
+ View nextFocus = NumberPicker.this.focusSearch(direction);
+ if (nextFocus != null) {
+ return nextFocus.createAccessibilityNodeInfo();
+ }
+ return null;
+ }
}
} break;
}
- return super.performAction(virtualViewId, action, arguments);
+ return null;
}
public void sendAccessibilityEventForVirtualView(int virtualViewId, int eventType) {
switch (virtualViewId) {
case VIRTUAL_VIEW_ID_DECREMENT: {
- sendAccessibilityEventForVirtualButton(virtualViewId, eventType,
- getVirtualDecrementButtonText());
+ if (hasVirtualDecrementButton()) {
+ sendAccessibilityEventForVirtualButton(virtualViewId, eventType,
+ getVirtualDecrementButtonText());
+ }
} break;
case VIRTUAL_VIEW_ID_INPUT: {
sendAccessibilityEventForVirtualText(eventType);
} break;
case VIRTUAL_VIEW_ID_INCREMENT: {
- sendAccessibilityEventForVirtualButton(virtualViewId, eventType,
- getVirtualIncrementButtonText());
+ if (hasVirtualIncrementButton()) {
+ sendAccessibilityEventForVirtualButton(virtualViewId, eventType,
+ getVirtualIncrementButtonText());
+ }
} break;
}
}
@@ -2227,8 +2433,13 @@
private AccessibilityNodeInfo createAccessibiltyNodeInfoForInputText() {
AccessibilityNodeInfo info = mInputText.createAccessibilityNodeInfo();
- info.setLongClickable(true);
info.setSource(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT);
+ if (mAccessibilityFocusedView != VIRTUAL_VIEW_ID_INPUT) {
+ info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS);
+ }
+ if (mAccessibilityFocusedView == VIRTUAL_VIEW_ID_INPUT) {
+ info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
+ }
return info;
}
@@ -2239,46 +2450,83 @@
info.setPackageName(mContext.getPackageName());
info.setSource(NumberPicker.this, virtualViewId);
info.setParent(NumberPicker.this);
- info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_DECREMENT);
- info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT);
- info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_INCREMENT);
info.setText(text);
info.setClickable(true);
info.setLongClickable(true);
info.setEnabled(NumberPicker.this.isEnabled());
Rect boundsInParent = mTempRect;
boundsInParent.set(left, top, right, bottom);
+ info.setVisibleToUser(isVisibleToUser(boundsInParent));
info.setBoundsInParent(boundsInParent);
Rect boundsInScreen = boundsInParent;
int[] locationOnScreen = mTempArray;
getLocationOnScreen(locationOnScreen);
- boundsInScreen.offsetTo(0, 0);
boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]);
info.setBoundsInScreen(boundsInScreen);
+
+ if (mAccessibilityFocusedView != virtualViewId) {
+ info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS);
+ }
+ if (mAccessibilityFocusedView == virtualViewId) {
+ info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
+ }
+ info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
+
return info;
}
private AccessibilityNodeInfo createAccessibilityNodeInfoForNumberPicker(int left, int top,
int right, int bottom) {
AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain();
- info.setClassName(Button.class.getName());
+ info.setClassName(NumberPicker.class.getName());
info.setPackageName(mContext.getPackageName());
info.setSource(NumberPicker.this);
+
+ if (hasVirtualDecrementButton()) {
+ info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_DECREMENT);
+ }
+ info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT);
+ if (hasVirtualIncrementButton()) {
+ info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_INCREMENT);
+ }
+
info.setParent((View) getParent());
info.setEnabled(NumberPicker.this.isEnabled());
info.setScrollable(true);
Rect boundsInParent = mTempRect;
boundsInParent.set(left, top, right, bottom);
info.setBoundsInParent(boundsInParent);
+ info.setVisibleToUser(isVisibleToUser());
Rect boundsInScreen = boundsInParent;
int[] locationOnScreen = mTempArray;
getLocationOnScreen(locationOnScreen);
- boundsInScreen.offsetTo(0, 0);
boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]);
info.setBoundsInScreen(boundsInScreen);
+
+ if (mAccessibilityFocusedView != View.NO_ID) {
+ info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS);
+ }
+ if (mAccessibilityFocusedView == View.NO_ID) {
+ info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
+ }
+ if (getWrapSelectorWheel() || getValue() < getMaxValue()) {
+ info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
+ }
+ if (getWrapSelectorWheel() || getValue() > getMinValue()) {
+ info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
+ }
+
return info;
}
+ private boolean hasVirtualDecrementButton() {
+ return getWrapSelectorWheel() || getValue() > getMinValue();
+ }
+
+ private boolean hasVirtualIncrementButton() {
+ return getWrapSelectorWheel() || getValue() < getMaxValue();
+ }
+
private String getVirtualDecrementButtonText() {
int value = mValue - 1;
if (mWrapSelectorWheel) {
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index b398ce4..a499743 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -742,6 +742,9 @@
@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
+ if (super.performAccessibilityAction(action, arguments)) {
+ return true;
+ }
switch (action) {
case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
final int viewportHeight = getHeight() - mPaddingBottom - mPaddingTop;
@@ -760,7 +763,7 @@
}
} return false;
}
- return super.performAccessibilityAction(action, arguments);
+ return false;
}
@Override
diff --git a/core/java/android/widget/ShareActionProvider.java b/core/java/android/widget/ShareActionProvider.java
index 21840ca..4045497 100644
--- a/core/java/android/widget/ShareActionProvider.java
+++ b/core/java/android/widget/ShareActionProvider.java
@@ -44,7 +44,6 @@
* <code>
* // In Activity#onCreateOptionsMenu
* public boolean onCreateOptionsMenu(Menu menu) {
- * getManuInflater().inflate(R.menu.my_menu, menu);
* // Get the menu item.
* MenuItem menuItem = menu.findItem(R.id.my_menu_item);
* // Get the provider and hold onto it to set/change the share intent.
@@ -246,7 +245,7 @@
* call {@link android.app.Activity#invalidateOptionsMenu()} to recreate the
* action view. You should <strong>not</strong> call
* {@link android.app.Activity#invalidateOptionsMenu()} from
- * {@link android.app.Activity#onCreateOptionsMenu(Menu)}.
+ * {@link android.app.Activity#onCreateOptionsMenu(Menu)}."
* <p>
* <code>
* private void doShare(Intent intent) {
diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java
index 7ca02e1..74ea038 100644
--- a/core/java/android/widget/SpellChecker.java
+++ b/core/java/android/widget/SpellChecker.java
@@ -132,8 +132,6 @@
// Restore SpellCheckSpans in pool
for (int i = 0; i < mLength; i++) {
- // Resets id and progress to invalidate spell check span
- mSpellCheckSpans[i].setSpellCheckInProgress(false);
mIds[i] = -1;
}
mLength = 0;
@@ -200,15 +198,16 @@
private void addSpellCheckSpan(Editable editable, int start, int end) {
final int index = nextSpellCheckSpanIndex();
- editable.setSpan(mSpellCheckSpans[index], start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+ SpellCheckSpan spellCheckSpan = mSpellCheckSpans[index];
+ editable.setSpan(spellCheckSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+ spellCheckSpan.setSpellCheckInProgress(false);
mIds[index] = mSpanSequenceCounter++;
}
- public void removeSpellCheckSpan(SpellCheckSpan spellCheckSpan) {
+ public void onSpellCheckSpanRemoved(SpellCheckSpan spellCheckSpan) {
+ // Recycle any removed SpellCheckSpan (from this code or during text edition)
for (int i = 0; i < mLength; i++) {
if (mSpellCheckSpans[i] == spellCheckSpan) {
- // Resets id and progress to invalidate spell check span
- mSpellCheckSpans[i].setSpellCheckInProgress(false);
mIds[i] = -1;
return;
}
@@ -387,6 +386,7 @@
final SpellCheckSpan spellCheckSpan =
onGetSuggestionsInternal(results[i], USE_SPAN_RANGE, USE_SPAN_RANGE);
if (spellCheckSpan != null) {
+ // onSpellCheckSpanRemoved will recycle this span in the pool
editable.removeSpan(spellCheckSpan);
}
}
@@ -414,11 +414,12 @@
suggestionsInfo, offset, length);
if (spellCheckSpan == null && scs != null) {
// the spellCheckSpan is shared by all the "SuggestionsInfo"s in the same
- // SentenceSuggestionsInfo
+ // SentenceSuggestionsInfo. Removal is deferred after this loop.
spellCheckSpan = scs;
}
}
if (spellCheckSpan != null) {
+ // onSpellCheckSpanRemoved will recycle this span in the pool
editable.removeSpan(spellCheckSpan);
}
}
@@ -633,7 +634,8 @@
}
break;
}
- removeSpellCheckSpan(spellCheckSpan);
+ // This spellCheckSpan is replaced by the one we are creating
+ editable.removeSpan(spellCheckSpan);
spellCheckStart = Math.min(spanStart, spellCheckStart);
spellCheckEnd = Math.max(spanEnd, spellCheckEnd);
}
diff --git a/core/java/android/widget/StackView.java b/core/java/android/widget/StackView.java
index 22df3bc..dd0915b 100644
--- a/core/java/android/widget/StackView.java
+++ b/core/java/android/widget/StackView.java
@@ -32,6 +32,7 @@
import android.graphics.RectF;
import android.graphics.Region;
import android.graphics.TableMaskFilter;
+import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import android.view.InputDevice;
@@ -1228,6 +1229,35 @@
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName(StackView.class.getName());
+ info.setScrollable(getChildCount() > 1);
+ if (getDisplayedChild() < getChildCount() - 1) {
+ info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
+ }
+ if (getDisplayedChild() > 0) {
+ info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
+ }
+ }
+
+ @Override
+ public boolean performAccessibilityAction(int action, Bundle arguments) {
+ if (super.performAccessibilityAction(action, arguments)) {
+ return true;
+ }
+ switch (action) {
+ case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
+ if (getDisplayedChild() < getChildCount() - 1) {
+ showNext();
+ return true;
+ }
+ } return false;
+ case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
+ if (getDisplayedChild() > 0) {
+ showPrevious();
+ return true;
+ }
+ } return false;
+ }
+ return false;
}
class LayoutParams extends ViewGroup.LayoutParams {
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 098a034..fc56e11 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -1472,6 +1472,10 @@
}
setText(mText);
+
+ if (hasPasswordTransformationMethod()) {
+ notifyAccessibilityStateChanged();
+ }
}
/**
@@ -7236,7 +7240,7 @@
if (mEditor != null && mEditor.mSpellChecker != null && newStart < 0 &&
what instanceof SpellCheckSpan) {
- mEditor.mSpellChecker.removeSpellCheckSpan((SpellCheckSpan) what);
+ mEditor.mSpellChecker.onSpellCheckSpanRemoved((SpellCheckSpan) what);
}
}
@@ -7257,10 +7261,9 @@
// usually because this instance is an editable field in a list
if (!mDispatchTemporaryDetach) mTemporaryDetach = true;
- // Because of View recycling in ListView, there is no easy way to know when a TextView with
- // selection becomes visible again. Until a better solution is found, stop text selection
- // mode (if any) as soon as this TextView is recycled.
- if (mEditor != null) mEditor.hideControllers();
+ // Tell the editor that we are temporarily detached. It can use this to preserve
+ // selection state as needed.
+ if (mEditor != null) mEditor.mTemporaryDetach = true;
}
@Override
@@ -7269,6 +7272,7 @@
// Only track when onStartTemporaryDetach() is called directly,
// usually because this instance is an editable field in a list
if (!mDispatchTemporaryDetach) mTemporaryDetach = false;
+ if (mEditor != null) mEditor.mTemporaryDetach = false;
}
@Override
diff --git a/core/java/com/android/internal/app/PlatLogoActivity.java b/core/java/com/android/internal/app/PlatLogoActivity.java
index 89f2187..e9db9d9 100644
--- a/core/java/com/android/internal/app/PlatLogoActivity.java
+++ b/core/java/com/android/internal/app/PlatLogoActivity.java
@@ -19,13 +19,17 @@
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
+import android.graphics.Typeface;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.os.Vibrator;
-import android.view.MotionEvent;
+import android.util.DisplayMetrics;
+import android.view.Gravity;
import android.view.View;
-import android.view.ViewConfiguration;
+import android.view.ViewGroup;
import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
import android.widget.Toast;
public class PlatLogoActivity extends Activity {
@@ -34,15 +38,65 @@
int mCount;
final Handler mHandler = new Handler();
+ private View makeView() {
+ DisplayMetrics metrics = new DisplayMetrics();
+ getWindowManager().getDefaultDisplay().getMetrics(metrics);
+
+ LinearLayout view = new LinearLayout(this);
+ view.setOrientation(LinearLayout.VERTICAL);
+ view.setLayoutParams(
+ new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.WRAP_CONTENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT
+ ));
+ final int p = (int)(8 * metrics.density);
+ view.setPadding(p, p, p, p);
+
+ Typeface light = Typeface.create("sans-serif-light", Typeface.NORMAL);
+ Typeface normal = Typeface.create("sans-serif", Typeface.BOLD);
+
+ final float size = 14 * metrics.density;
+ final LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.WRAP_CONTENT,
+ LinearLayout.LayoutParams.WRAP_CONTENT);
+ lp.gravity = Gravity.CENTER_HORIZONTAL;
+ lp.bottomMargin = (int) (-4*metrics.density);
+
+ TextView tv = new TextView(this);
+ if (light != null) tv.setTypeface(light);
+ tv.setTextSize(1.25f*size);
+ tv.setTextColor(0xFFFFFFFF);
+ tv.setShadowLayer(4*metrics.density, 0, 2*metrics.density, 0x66000000);
+ tv.setText("Android " + Build.VERSION.RELEASE);
+ view.addView(tv, lp);
+
+ tv = new TextView(this);
+ if (normal != null) tv.setTypeface(normal);
+ tv.setTextSize(size);
+ tv.setTextColor(0xFFFFFFFF);
+ tv.setShadowLayer(4*metrics.density, 0, 2*metrics.density, 0x66000000);
+ tv.setText("JELLY BEAN");
+ view.addView(tv, lp);
+
+ return view;
+ }
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mToast = Toast.makeText(this, "Android X.X: Jelly Bean", Toast.LENGTH_SHORT);
+ mToast = Toast.makeText(this, "", Toast.LENGTH_LONG);
+ mToast.setView(makeView());
+
+ DisplayMetrics metrics = new DisplayMetrics();
+ getWindowManager().getDefaultDisplay().getMetrics(metrics);
mContent = new ImageView(this);
mContent.setImageResource(com.android.internal.R.drawable.platlogo);
mContent.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
+
+ final int p = (int)(32 * metrics.density);
+ mContent.setPadding(p, p, p, p);
mContent.setOnClickListener(new View.OnClickListener() {
@Override
diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java
index fbed4859..4c34d73 100644
--- a/core/java/com/android/internal/view/BaseIWindow.java
+++ b/core/java/com/android/internal/view/BaseIWindow.java
@@ -33,7 +33,7 @@
mSession = session;
}
- public void resized(int w, int h, Rect systemInsets, Rect contentInsets,
+ public void resized(int w, int h, Rect contentInsets,
Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
if (reportDraw) {
try {
diff --git a/core/java/com/android/internal/view/menu/MenuBuilder.java b/core/java/com/android/internal/view/menu/MenuBuilder.java
index 9fbca82..458ea2f 100644
--- a/core/java/com/android/internal/view/menu/MenuBuilder.java
+++ b/core/java/com/android/internal/view/menu/MenuBuilder.java
@@ -873,15 +873,20 @@
boolean invoked = itemImpl.invoke();
+ final ActionProvider provider = item.getActionProvider();
+ final boolean providerHasSubMenu = provider != null && provider.hasSubMenu();
if (itemImpl.hasCollapsibleActionView()) {
invoked |= itemImpl.expandActionView();
if (invoked) close(true);
- } else if (item.hasSubMenu()) {
+ } else if (itemImpl.hasSubMenu() || providerHasSubMenu) {
close(false);
- final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
- final ActionProvider provider = item.getActionProvider();
- if (provider != null && provider.hasSubMenu()) {
+ if (!itemImpl.hasSubMenu()) {
+ itemImpl.setSubMenu(new SubMenuBuilder(getContext(), this, itemImpl));
+ }
+
+ final SubMenuBuilder subMenu = (SubMenuBuilder) itemImpl.getSubMenu();
+ if (providerHasSubMenu) {
provider.onPrepareSubMenu(subMenu);
}
invoked |= dispatchSubMenuSelected(subMenu);
diff --git a/core/java/com/android/internal/widget/PointerLocationView.java b/core/java/com/android/internal/widget/PointerLocationView.java
index 1d6af90..85e6c16 100644
--- a/core/java/com/android/internal/widget/PointerLocationView.java
+++ b/core/java/com/android/internal/widget/PointerLocationView.java
@@ -527,7 +527,7 @@
ps.addTrace(coords.x, coords.y);
ps.mXVelocity = mVelocity.getXVelocity(id);
ps.mYVelocity = mVelocity.getYVelocity(id);
- mVelocity.getEstimator(id, -1, -1, ps.mEstimator);
+ mVelocity.getEstimator(id, ps.mEstimator);
ps.mToolType = event.getToolType(i);
}
}
diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
index d6ffba2..60cd895 100644
--- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
@@ -258,14 +258,14 @@
protected int getSuggestedMinimumWidth() {
// View should be large enough to contain the background + handle and
// target drawable on either edge.
- return mOuterRing.getWidth() + mMaxTargetWidth;
+ return (int) (Math.max(mOuterRing.getWidth(), 2 * mOuterRadius) + mMaxTargetWidth);
}
@Override
protected int getSuggestedMinimumHeight() {
// View should be large enough to contain the unlock ring + target and
// target drawable on either edge
- return mOuterRing.getHeight() + mMaxTargetHeight;
+ return (int) (Math.max(mOuterRing.getHeight(), 2 * mOuterRadius) + mMaxTargetHeight);
}
private int resolveMeasured(int measureSpec, int desired)
@@ -941,10 +941,14 @@
super.onLayout(changed, left, top, right, bottom);
final int width = right - left;
final int height = bottom - top;
+ // Target placement width/height. This puts the targets on the greater of the ring
+ // width or the specified outer radius.
+ final float placementWidth = Math.max(mOuterRing.getWidth(), 2 * mOuterRadius);
+ final float placementHeight = Math.max(mOuterRing.getHeight(), 2 * mOuterRadius);
float newWaveCenterX = mHorizontalOffset + mHorizontalInset
- + Math.max(width, mMaxTargetWidth + mOuterRing.getWidth()) / 2;
+ + Math.max(width, mMaxTargetWidth + placementWidth) / 2;
float newWaveCenterY = mVerticalOffset + mVerticalInset
- + Math.max(height, + mMaxTargetHeight + mOuterRing.getHeight()) / 2;
+ + Math.max(height, + mMaxTargetHeight + placementHeight) / 2;
assignDefaultsIfNeeded(newWaveCenterX, newWaveCenterY);
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index cd0959b..c24f6c6 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -66,7 +66,6 @@
android_os_MessageQueue.cpp \
android_os_ParcelFileDescriptor.cpp \
android_os_Parcel.cpp \
- android_os_Power.cpp \
android_os_StatFs.cpp \
android_os_SystemClock.cpp \
android_os_SystemProperties.cpp \
@@ -217,8 +216,7 @@
libjpeg \
libusbhost \
libharfbuzz \
- libz \
- libsuspend \
+ libz
ifeq ($(USE_OPENGL_RENDERER),true)
LOCAL_SHARED_LIBRARIES += libhwui
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index b877071..241a905 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -133,7 +133,6 @@
extern int register_android_os_MessageQueue(JNIEnv* env);
extern int register_android_os_Parcel(JNIEnv* env);
extern int register_android_os_ParcelFileDescriptor(JNIEnv *env);
-extern int register_android_os_Power(JNIEnv *env);
extern int register_android_os_StatFs(JNIEnv *env);
extern int register_android_os_SystemProperties(JNIEnv *env);
extern int register_android_os_SystemClock(JNIEnv* env);
@@ -1147,7 +1146,6 @@
REG_JNI(register_android_os_FileUtils),
REG_JNI(register_android_os_MessageQueue),
REG_JNI(register_android_os_ParcelFileDescriptor),
- REG_JNI(register_android_os_Power),
REG_JNI(register_android_os_StatFs),
REG_JNI(register_android_os_Trace),
REG_JNI(register_android_os_UEventObserver),
diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp
index 3dfaac3..858ec79 100644
--- a/core/jni/android_os_Parcel.cpp
+++ b/core/jni/android_os_Parcel.cpp
@@ -61,7 +61,10 @@
static struct parcel_offsets_t
{
+ jclass clazz;
jfieldID mNativePtr;
+ jmethodID obtain;
+ jmethodID recycle;
} gParcelOffsets;
Parcel* parcelForJavaObject(JNIEnv* env, jobject obj)
@@ -76,6 +79,16 @@
return NULL;
}
+jobject createJavaParcelObject(JNIEnv* env)
+{
+ return env->CallStaticObjectMethod(gParcelOffsets.clazz, gParcelOffsets.obtain);
+}
+
+void recycleJavaParcelObject(JNIEnv* env, jobject parcelObj)
+{
+ env->CallVoidMethod(parcelObj, gParcelOffsets.recycle);
+}
+
static jint android_os_Parcel_dataSize(JNIEnv* env, jclass clazz, jint nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
@@ -665,8 +678,11 @@
clazz = env->FindClass(kParcelPathName);
LOG_FATAL_IF(clazz == NULL, "Unable to find class android.os.Parcel");
- gParcelOffsets.mNativePtr
- = env->GetFieldID(clazz, "mNativePtr", "I");
+ gParcelOffsets.clazz = (jclass) env->NewGlobalRef(clazz);
+ gParcelOffsets.mNativePtr = env->GetFieldID(clazz, "mNativePtr", "I");
+ gParcelOffsets.obtain = env->GetStaticMethodID(clazz, "obtain",
+ "()Landroid/os/Parcel;");
+ gParcelOffsets.recycle = env->GetMethodID(clazz, "recycle", "()V");
return AndroidRuntime::registerNativeMethods(
env, kParcelPathName,
diff --git a/core/jni/android_os_Parcel.h b/core/jni/android_os_Parcel.h
index 65f3819e..1db523a 100644
--- a/core/jni/android_os_Parcel.h
+++ b/core/jni/android_os_Parcel.h
@@ -23,5 +23,7 @@
// Conversion from Java Parcel Object to C++ Parcel instance.
// Note: does not type checking; must guarantee jobject is a Java Parcel
extern Parcel* parcelForJavaObject(JNIEnv* env, jobject obj);
+extern jobject createJavaParcelObject(JNIEnv* env);
+extern void recycleJavaParcelObject(JNIEnv* env, jobject object);
}
diff --git a/core/jni/android_os_Power.cpp b/core/jni/android_os_Power.cpp
deleted file mode 100644
index 373abd4..0000000
--- a/core/jni/android_os_Power.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/* //device/libs/android_runtime/android_os_Power.cpp
-**
-** Copyright 2006, 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.
-*/
-
-#define LOG_TAG "Power-JNI"
-
-#include "JNIHelp.h"
-#include "jni.h"
-#include "android_runtime/AndroidRuntime.h"
-#include <utils/misc.h>
-#include <hardware/power.h>
-#include <hardware_legacy/power.h>
-#include <cutils/android_reboot.h>
-#include <suspend/autosuspend.h>
-
-static struct power_module *sPowerModule;
-
-namespace android
-{
-
-static void
-acquireWakeLock(JNIEnv *env, jobject clazz, jint lock, jstring idObj)
-{
- if (idObj == NULL) {
- jniThrowNullPointerException(env, "id is null");
- return ;
- }
-
- const char *id = env->GetStringUTFChars(idObj, NULL);
-
- acquire_wake_lock(lock, id);
-
- env->ReleaseStringUTFChars(idObj, id);
-}
-
-static void
-releaseWakeLock(JNIEnv *env, jobject clazz, jstring idObj)
-{
- if (idObj == NULL) {
- jniThrowNullPointerException(env, "id is null");
- return ;
- }
-
- const char *id = env->GetStringUTFChars(idObj, NULL);
-
- release_wake_lock(id);
-
- env->ReleaseStringUTFChars(idObj, id);
-
-}
-
-static int
-setLastUserActivityTimeout(JNIEnv *env, jobject clazz, jlong timeMS)
-{
- return set_last_user_activity_timeout(timeMS/1000);
-}
-
-static int
-setScreenState(JNIEnv *env, jobject clazz, jboolean on)
-{
- if (on) {
- autosuspend_disable();
- if (sPowerModule) {
- sPowerModule->setInteractive(sPowerModule, true);
- }
- } else {
- if (sPowerModule) {
- sPowerModule->setInteractive(sPowerModule, false);
- }
- autosuspend_enable();
- }
-
- return 0;
-}
-
-static void android_os_Power_shutdown(JNIEnv *env, jobject clazz)
-{
- android_reboot(ANDROID_RB_POWEROFF, 0, 0);
-}
-
-static void android_os_Power_reboot(JNIEnv *env, jobject clazz, jstring reason)
-{
- if (reason == NULL) {
- android_reboot(ANDROID_RB_RESTART, 0, 0);
- } else {
- const char *chars = env->GetStringUTFChars(reason, NULL);
- android_reboot(ANDROID_RB_RESTART2, 0, (char *) chars);
- env->ReleaseStringUTFChars(reason, chars); // In case it fails.
- }
- jniThrowIOException(env, errno);
-}
-
-static int android_os_Power_init(JNIEnv *env, jobject clazz)
-{
- status_t err = hw_get_module(POWER_HARDWARE_MODULE_ID,
- (hw_module_t const**)&sPowerModule);
- ALOGE_IF(err, "couldn't load %s module (%s)",
- POWER_HARDWARE_MODULE_ID, strerror(-err));
-
- if (!err)
- sPowerModule->init(sPowerModule);
-
- return err;
-}
-
-static JNINativeMethod method_table[] = {
- { "acquireWakeLock", "(ILjava/lang/String;)V", (void*)acquireWakeLock },
- { "releaseWakeLock", "(Ljava/lang/String;)V", (void*)releaseWakeLock },
- { "setLastUserActivityTimeout", "(J)I", (void*)setLastUserActivityTimeout },
- { "setScreenState", "(Z)I", (void*)setScreenState },
- { "shutdown", "()V", (void*)android_os_Power_shutdown },
- { "powerInitNative", "()I", (void*)android_os_Power_init },
- { "rebootNative", "(Ljava/lang/String;)V", (void*)android_os_Power_reboot },
-};
-
-int register_android_os_Power(JNIEnv *env)
-{
- return AndroidRuntime::registerNativeMethods(
- env, "android/os/Power",
- method_table, NELEM(method_table));
-}
-
-};
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 60929ac..e3d11f2 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -326,8 +326,8 @@
// ----------------------------------------------------------------------------
static void android_view_GLES20Canvas_drawBitmap(JNIEnv* env, jobject clazz,
- OpenGLRenderer* renderer, SkBitmap* bitmap, jbyteArray buffer, float left,
- float top, SkPaint* paint) {
+ OpenGLRenderer* renderer, SkBitmap* bitmap, jbyteArray buffer,
+ jfloat left, jfloat top, SkPaint* paint) {
// This object allows the renderer to allocate a global JNI ref to the buffer object.
JavaHeapBitmapRef bitmapRef(env, bitmap, buffer);
@@ -354,6 +354,31 @@
renderer->drawBitmap(bitmap, matrix, paint);
}
+static void android_view_GLES20Canvas_drawBitmapData(JNIEnv* env, jobject clazz,
+ OpenGLRenderer* renderer, jintArray colors, jint offset, jint stride,
+ jfloat left, jfloat top, jint width, jint height, jboolean hasAlpha, SkPaint* paint) {
+ SkBitmap* bitmap = new SkBitmap;
+ bitmap->setConfig(hasAlpha ? SkBitmap::kARGB_8888_Config : SkBitmap::kRGB_565_Config,
+ width, height);
+
+ if (!bitmap->allocPixels()) {
+ delete bitmap;
+ return;
+ }
+
+ if (!GraphicsJNI::SetPixels(env, colors, offset, stride, 0, 0, width, height, *bitmap)) {
+ delete bitmap;
+ return;
+ }
+
+ renderer->drawBitmapData(bitmap, left, top, paint);
+
+ // If the renderer is a deferred renderer it will own the bitmap
+ if (!renderer->isDeferred()) {
+ delete bitmap;
+ }
+}
+
static void android_view_GLES20Canvas_drawBitmapMesh(JNIEnv* env, jobject clazz,
OpenGLRenderer* renderer, SkBitmap* bitmap, jbyteArray buffer,
jint meshWidth, jint meshHeight, jfloatArray vertices, jint offset,
@@ -880,6 +905,7 @@
{ "nDrawBitmap", "(II[BFFI)V", (void*) android_view_GLES20Canvas_drawBitmap },
{ "nDrawBitmap", "(II[BFFFFFFFFI)V",(void*) android_view_GLES20Canvas_drawBitmapRect },
{ "nDrawBitmap", "(II[BII)V", (void*) android_view_GLES20Canvas_drawBitmapMatrix },
+ { "nDrawBitmap", "(I[IIIFFIIZI)V", (void*) android_view_GLES20Canvas_drawBitmapData },
{ "nDrawBitmapMesh", "(II[BII[FI[III)V",(void*) android_view_GLES20Canvas_drawBitmapMesh },
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 8c4c42ab..5739cbe 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -345,32 +345,6 @@
}
}
-static void Surface_setActiveRect(JNIEnv* env, jobject thiz, jobject activeRect)
-{
- const sp<Surface>& surface(getSurface(env, thiz));
- if (!Surface::isValid(surface)) {
- doThrowIAE(env);
- return;
- }
-
- android_native_rect_t nativeRect;
- if (activeRect) {
- nativeRect.left = env->GetIntField(activeRect, ro.l);
- nativeRect.top = env->GetIntField(activeRect, ro.t);
- nativeRect.right = env->GetIntField(activeRect, ro.r);
- nativeRect.bottom= env->GetIntField(activeRect, ro.b);
- } else {
- doThrowIAE(env, "activeRect may not be null");
- return;
- }
-
- int err = native_window_set_active_rect(surface.get(), &nativeRect);
- if (err != NO_ERROR) {
- doThrowRE(env, String8::format(
- "Surface::setActiveRect returned an error: %d", err).string());
- }
-}
-
static jobject Surface_lockCanvas(JNIEnv* env, jobject clazz, jobject dirtyRect)
{
const sp<Surface>& surface(getSurface(env, clazz));
@@ -773,6 +747,28 @@
}
}
+static void Surface_setWindowCrop(JNIEnv* env, jobject thiz, jobject crop)
+{
+ const sp<SurfaceControl>& surface(getSurfaceControl(env, thiz));
+ if (surface == 0) return;
+
+ Rect nativeCrop;
+ if (crop) {
+ nativeCrop.left = env->GetIntField(crop, ro.l);
+ nativeCrop.top = env->GetIntField(crop, ro.t);
+ nativeCrop.right = env->GetIntField(crop, ro.r);
+ nativeCrop.bottom= env->GetIntField(crop, ro.b);
+ } else {
+ nativeCrop.left = nativeCrop.top = nativeCrop.right =
+ nativeCrop.bottom = 0;
+ }
+
+ status_t err = surface->setCrop(nativeCrop);
+ if (err<0 && err!=NO_INIT) {
+ doThrowIAE(env);
+ }
+}
+
// ----------------------------------------------------------------------------
static void Surface_copyFrom(
@@ -915,7 +911,7 @@
{"readFromParcel", "(Landroid/os/Parcel;)V", (void*)Surface_readFromParcel },
{"writeToParcel", "(Landroid/os/Parcel;I)V", (void*)Surface_writeToParcel },
{"isConsumerRunningBehind", "()Z", (void*)Surface_isConsumerRunningBehind },
- {"setActiveRect", "(Landroid/graphics/Rect;)V", (void*)Surface_setActiveRect },
+ {"setWindowCrop", "(Landroid/graphics/Rect;)V", (void*)Surface_setWindowCrop },
};
void nativeClassInit(JNIEnv* env, jclass clazz)
diff --git a/core/jni/android_view_VelocityTracker.cpp b/core/jni/android_view_VelocityTracker.cpp
index 04d1056..0180e0a 100644
--- a/core/jni/android_view_VelocityTracker.cpp
+++ b/core/jni/android_view_VelocityTracker.cpp
@@ -48,8 +48,7 @@
void addMovement(const MotionEvent* event);
void computeCurrentVelocity(int32_t units, float maxVelocity);
void getVelocity(int32_t id, float* outVx, float* outVy);
- bool getEstimator(int32_t id, uint32_t degree, nsecs_t horizon,
- VelocityTracker::Estimator* outEstimator);
+ bool getEstimator(int32_t id, VelocityTracker::Estimator* outEstimator);
private:
struct Velocity {
@@ -129,9 +128,8 @@
}
}
-bool VelocityTrackerState::getEstimator(int32_t id, uint32_t degree, nsecs_t horizon,
- VelocityTracker::Estimator* outEstimator) {
- return mVelocityTracker.getEstimator(id, degree, horizon, outEstimator);
+bool VelocityTrackerState::getEstimator(int32_t id, VelocityTracker::Estimator* outEstimator) {
+ return mVelocityTracker.getEstimator(id, outEstimator);
}
@@ -186,14 +184,10 @@
}
static jboolean android_view_VelocityTracker_nativeGetEstimator(JNIEnv* env, jclass clazz,
- jint ptr, jint id, jint degree, jint horizonMillis, jobject outEstimatorObj) {
+ jint ptr, jint id, jobject outEstimatorObj) {
VelocityTrackerState* state = reinterpret_cast<VelocityTrackerState*>(ptr);
VelocityTracker::Estimator estimator;
- bool result = state->getEstimator(id,
- degree < 0 ? VelocityTracker::DEFAULT_DEGREE : uint32_t(degree),
- horizonMillis < 0 ? VelocityTracker::DEFAULT_HORIZON :
- nsecs_t(horizonMillis) * 1000000L,
- &estimator);
+ bool result = state->getEstimator(id, &estimator);
jfloatArray xCoeffObj = jfloatArray(env->GetObjectField(outEstimatorObj,
gEstimatorClassInfo.xCoeff));
@@ -236,7 +230,7 @@
"(II)F",
(void*)android_view_VelocityTracker_nativeGetYVelocity },
{ "nativeGetEstimator",
- "(IIIILandroid/view/VelocityTracker$Estimator;)Z",
+ "(IILandroid/view/VelocityTracker$Estimator;)Z",
(void*)android_view_VelocityTracker_nativeGetEstimator },
};
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_answer_active.png b/core/res/res/drawable-hdpi/ic_lockscreen_answer_active.png
deleted file mode 100644
index d201bfb7..0000000
--- a/core/res/res/drawable-hdpi/ic_lockscreen_answer_active.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_answer_focused.png b/core/res/res/drawable-hdpi/ic_lockscreen_answer_focused.png
deleted file mode 100644
index efb29f1..0000000
--- a/core/res/res/drawable-hdpi/ic_lockscreen_answer_focused.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_answer_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_answer_normal.png
deleted file mode 100644
index 176d448..0000000
--- a/core/res/res/drawable-hdpi/ic_lockscreen_answer_normal.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_decline_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_decline_activated.png
deleted file mode 100644
index 9866769..0000000
--- a/core/res/res/drawable-hdpi/ic_lockscreen_decline_activated.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_decline_focused.png b/core/res/res/drawable-hdpi/ic_lockscreen_decline_focused.png
deleted file mode 100644
index f37b16a..0000000
--- a/core/res/res/drawable-hdpi/ic_lockscreen_decline_focused.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_decline_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_decline_normal.png
deleted file mode 100644
index d88087b..0000000
--- a/core/res/res/drawable-hdpi/ic_lockscreen_decline_normal.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_text_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_text_activated.png
deleted file mode 100644
index 0ebff0b..0000000
--- a/core/res/res/drawable-hdpi/ic_lockscreen_text_activated.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_text_focusde.png b/core/res/res/drawable-hdpi/ic_lockscreen_text_focusde.png
deleted file mode 100644
index 5f1b881..0000000
--- a/core/res/res/drawable-hdpi/ic_lockscreen_text_focusde.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_text_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_text_normal.png
deleted file mode 100644
index bf73a26..0000000
--- a/core/res/res/drawable-hdpi/ic_lockscreen_text_normal.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_bg_holo_dark.9.png b/core/res/res/drawable-hdpi/progress_bg_holo_dark.9.png
index 310c368..877fd2b 100644
--- a/core/res/res/drawable-hdpi/progress_bg_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/progress_bg_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_bg_holo_light.9.png b/core/res/res/drawable-hdpi/progress_bg_holo_light.9.png
index 70cb7fc..3f12166 100644
--- a/core/res/res/drawable-hdpi/progress_bg_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/progress_bg_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png
index 1c26920..b73abba 100644
--- a/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png
index 1c26920..2f76a22 100644
--- a/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_secondary_holo_dark.9.png b/core/res/res/drawable-hdpi/progress_secondary_holo_dark.9.png
index 40d0d16..a75d0dd 100644
--- a/core/res/res/drawable-hdpi/progress_secondary_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/progress_secondary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_secondary_holo_light.9.png b/core/res/res/drawable-hdpi/progress_secondary_holo_light.9.png
index 40d0d16..955b708 100644
--- a/core/res/res/drawable-hdpi/progress_secondary_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/progress_secondary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_control_disabled_holo.png b/core/res/res/drawable-hdpi/scrubber_control_disabled_holo.png
index 167d7d3..370242a 100644
--- a/core/res/res/drawable-hdpi/scrubber_control_disabled_holo.png
+++ b/core/res/res/drawable-hdpi/scrubber_control_disabled_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_control_focused_holo.png b/core/res/res/drawable-hdpi/scrubber_control_focused_holo.png
index 4048260..eea2c3e 100644
--- a/core/res/res/drawable-hdpi/scrubber_control_focused_holo.png
+++ b/core/res/res/drawable-hdpi/scrubber_control_focused_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_control_normal_holo.png b/core/res/res/drawable-hdpi/scrubber_control_normal_holo.png
index 90e9c9c..3c98ee9 100644
--- a/core/res/res/drawable-hdpi/scrubber_control_normal_holo.png
+++ b/core/res/res/drawable-hdpi/scrubber_control_normal_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_control_pressed_holo.png b/core/res/res/drawable-hdpi/scrubber_control_pressed_holo.png
index 4a3e57c..4dc8999 100644
--- a/core/res/res/drawable-hdpi/scrubber_control_pressed_holo.png
+++ b/core/res/res/drawable-hdpi/scrubber_control_pressed_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_primary_holo.9.png b/core/res/res/drawable-hdpi/scrubber_primary_holo.9.png
index 0d13f71..260a0a5 100644
--- a/core/res/res/drawable-hdpi/scrubber_primary_holo.9.png
+++ b/core/res/res/drawable-hdpi/scrubber_primary_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_secondary_holo.9.png b/core/res/res/drawable-hdpi/scrubber_secondary_holo.9.png
index b39d831..09f2d58 100644
--- a/core/res/res/drawable-hdpi/scrubber_secondary_holo.9.png
+++ b/core/res/res/drawable-hdpi/scrubber_secondary_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_track_holo_dark.9.png b/core/res/res/drawable-hdpi/scrubber_track_holo_dark.9.png
index c997bf0..0c0ccda 100644
--- a/core/res/res/drawable-hdpi/scrubber_track_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/scrubber_track_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_track_holo_light.9.png b/core/res/res/drawable-hdpi/scrubber_track_holo_light.9.png
index b2a22dc..90528b1 100644
--- a/core/res/res/drawable-hdpi/scrubber_track_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/scrubber_track_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_answer_active.png b/core/res/res/drawable-mdpi/ic_lockscreen_answer_active.png
deleted file mode 100644
index 0ad03c0..0000000
--- a/core/res/res/drawable-mdpi/ic_lockscreen_answer_active.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_answer_focused.png b/core/res/res/drawable-mdpi/ic_lockscreen_answer_focused.png
deleted file mode 100644
index f46e8bd..0000000
--- a/core/res/res/drawable-mdpi/ic_lockscreen_answer_focused.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_answer_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_answer_normal.png
deleted file mode 100644
index ddeeb18..0000000
--- a/core/res/res/drawable-mdpi/ic_lockscreen_answer_normal.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_decline_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_decline_activated.png
deleted file mode 100644
index d1aae18..0000000
--- a/core/res/res/drawable-mdpi/ic_lockscreen_decline_activated.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_decline_focused.png b/core/res/res/drawable-mdpi/ic_lockscreen_decline_focused.png
deleted file mode 100644
index b52c844..0000000
--- a/core/res/res/drawable-mdpi/ic_lockscreen_decline_focused.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_decline_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_decline_normal.png
deleted file mode 100644
index 722027e..0000000
--- a/core/res/res/drawable-mdpi/ic_lockscreen_decline_normal.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_text_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_text_activated.png
deleted file mode 100644
index 878ff1f..0000000
--- a/core/res/res/drawable-mdpi/ic_lockscreen_text_activated.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_text_focusde.png b/core/res/res/drawable-mdpi/ic_lockscreen_text_focusde.png
deleted file mode 100644
index 1de7586..0000000
--- a/core/res/res/drawable-mdpi/ic_lockscreen_text_focusde.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_text_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_text_normal.png
deleted file mode 100644
index e007322..0000000
--- a/core/res/res/drawable-mdpi/ic_lockscreen_text_normal.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_bg_holo_dark.9.png b/core/res/res/drawable-mdpi/progress_bg_holo_dark.9.png
index 3d946e5..155e546 100644
--- a/core/res/res/drawable-mdpi/progress_bg_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/progress_bg_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_bg_holo_light.9.png b/core/res/res/drawable-mdpi/progress_bg_holo_light.9.png
index 4bb22f0..780b4b2 100644
--- a/core/res/res/drawable-mdpi/progress_bg_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/progress_bg_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png
index ab8ec69..b86f4b5 100644
--- a/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png
index ab8ec69..6fb9445 100644
--- a/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_secondary_holo_dark.9.png b/core/res/res/drawable-mdpi/progress_secondary_holo_dark.9.png
index 7274274..5651a7a 100644
--- a/core/res/res/drawable-mdpi/progress_secondary_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/progress_secondary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_secondary_holo_light.9.png b/core/res/res/drawable-mdpi/progress_secondary_holo_light.9.png
index 7274274..9104cf9 100644
--- a/core/res/res/drawable-mdpi/progress_secondary_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/progress_secondary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_control_disabled_holo.png b/core/res/res/drawable-mdpi/scrubber_control_disabled_holo.png
index 351d539..630a450 100644
--- a/core/res/res/drawable-mdpi/scrubber_control_disabled_holo.png
+++ b/core/res/res/drawable-mdpi/scrubber_control_disabled_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_control_focused_holo.png b/core/res/res/drawable-mdpi/scrubber_control_focused_holo.png
index e6072ee..c9e4796 100644
--- a/core/res/res/drawable-mdpi/scrubber_control_focused_holo.png
+++ b/core/res/res/drawable-mdpi/scrubber_control_focused_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_control_normal_holo.png b/core/res/res/drawable-mdpi/scrubber_control_normal_holo.png
index 79682c1..fb96f4b 100644
--- a/core/res/res/drawable-mdpi/scrubber_control_normal_holo.png
+++ b/core/res/res/drawable-mdpi/scrubber_control_normal_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_control_pressed_holo.png b/core/res/res/drawable-mdpi/scrubber_control_pressed_holo.png
index ba53c0b..30e18cd 100644
--- a/core/res/res/drawable-mdpi/scrubber_control_pressed_holo.png
+++ b/core/res/res/drawable-mdpi/scrubber_control_pressed_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_primary_holo.9.png b/core/res/res/drawable-mdpi/scrubber_primary_holo.9.png
index 7cbf2f2..a7910d6 100644
--- a/core/res/res/drawable-mdpi/scrubber_primary_holo.9.png
+++ b/core/res/res/drawable-mdpi/scrubber_primary_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_secondary_holo.9.png b/core/res/res/drawable-mdpi/scrubber_secondary_holo.9.png
index 81772a8..985b62e 100644
--- a/core/res/res/drawable-mdpi/scrubber_secondary_holo.9.png
+++ b/core/res/res/drawable-mdpi/scrubber_secondary_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_track_holo_dark.9.png b/core/res/res/drawable-mdpi/scrubber_track_holo_dark.9.png
index b8037a3..b91a4ee 100644
--- a/core/res/res/drawable-mdpi/scrubber_track_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/scrubber_track_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_track_holo_light.9.png b/core/res/res/drawable-mdpi/scrubber_track_holo_light.9.png
index 76df16f..359ae4a 100644
--- a/core/res/res/drawable-mdpi/scrubber_track_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/scrubber_track_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_answer_active.png b/core/res/res/drawable-xhdpi/ic_lockscreen_answer_active.png
deleted file mode 100644
index 8edf62d..0000000
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_answer_active.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_answer_focused.png b/core/res/res/drawable-xhdpi/ic_lockscreen_answer_focused.png
deleted file mode 100644
index 2a47e9b..0000000
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_answer_focused.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_answer_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_answer_normal.png
deleted file mode 100644
index f049dc9..0000000
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_answer_normal.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_decline_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_decline_activated.png
deleted file mode 100644
index 4244ca0..0000000
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_decline_activated.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_decline_focused.png b/core/res/res/drawable-xhdpi/ic_lockscreen_decline_focused.png
deleted file mode 100644
index a98a379..0000000
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_decline_focused.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_decline_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_decline_normal.png
deleted file mode 100644
index fa2a0f4..0000000
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_decline_normal.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_text_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_text_activated.png
deleted file mode 100644
index ddebe3e..0000000
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_text_activated.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_text_focusde.png b/core/res/res/drawable-xhdpi/ic_lockscreen_text_focusde.png
deleted file mode 100644
index 42c8ad2..0000000
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_text_focusde.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_text_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_text_normal.png
deleted file mode 100644
index ff65f20..0000000
--- a/core/res/res/drawable-xhdpi/ic_lockscreen_text_normal.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progress_bg_holo_dark.9.png b/core/res/res/drawable-xhdpi/progress_bg_holo_dark.9.png
index 345f5d3..c8b87d7 100644
--- a/core/res/res/drawable-xhdpi/progress_bg_holo_dark.9.png
+++ b/core/res/res/drawable-xhdpi/progress_bg_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progress_bg_holo_light.9.png b/core/res/res/drawable-xhdpi/progress_bg_holo_light.9.png
index c843ef3..cbd19ac 100644
--- a/core/res/res/drawable-xhdpi/progress_bg_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/progress_bg_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-xhdpi/progress_primary_holo_dark.9.png
index c6c3f1e..f1069fd 100644
--- a/core/res/res/drawable-xhdpi/progress_primary_holo_dark.9.png
+++ b/core/res/res/drawable-xhdpi/progress_primary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-xhdpi/progress_primary_holo_light.9.png
index c6c3f1e..e62123c 100644
--- a/core/res/res/drawable-xhdpi/progress_primary_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/progress_primary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progress_secondary_holo_dark.9.png b/core/res/res/drawable-xhdpi/progress_secondary_holo_dark.9.png
index 205b66e..06ae19c 100644
--- a/core/res/res/drawable-xhdpi/progress_secondary_holo_dark.9.png
+++ b/core/res/res/drawable-xhdpi/progress_secondary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progress_secondary_holo_light.9.png b/core/res/res/drawable-xhdpi/progress_secondary_holo_light.9.png
index 205b66e..37c6d5f 100644
--- a/core/res/res/drawable-xhdpi/progress_secondary_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/progress_secondary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_control_disabled_holo.png b/core/res/res/drawable-xhdpi/scrubber_control_disabled_holo.png
index 8cf3868..62be77c 100644
--- a/core/res/res/drawable-xhdpi/scrubber_control_disabled_holo.png
+++ b/core/res/res/drawable-xhdpi/scrubber_control_disabled_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_control_focused_holo.png b/core/res/res/drawable-xhdpi/scrubber_control_focused_holo.png
index 417b35a..754dd2f 100644
--- a/core/res/res/drawable-xhdpi/scrubber_control_focused_holo.png
+++ b/core/res/res/drawable-xhdpi/scrubber_control_focused_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_control_normal_holo.png b/core/res/res/drawable-xhdpi/scrubber_control_normal_holo.png
index 8053d88..d546a73 100644
--- a/core/res/res/drawable-xhdpi/scrubber_control_normal_holo.png
+++ b/core/res/res/drawable-xhdpi/scrubber_control_normal_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_control_pressed_holo.png b/core/res/res/drawable-xhdpi/scrubber_control_pressed_holo.png
index d17fa7d..0b62072 100644
--- a/core/res/res/drawable-xhdpi/scrubber_control_pressed_holo.png
+++ b/core/res/res/drawable-xhdpi/scrubber_control_pressed_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_primary_holo.9.png b/core/res/res/drawable-xhdpi/scrubber_primary_holo.9.png
index 073ff4c..3b0b241 100644
--- a/core/res/res/drawable-xhdpi/scrubber_primary_holo.9.png
+++ b/core/res/res/drawable-xhdpi/scrubber_primary_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_secondary_holo.9.png b/core/res/res/drawable-xhdpi/scrubber_secondary_holo.9.png
index 4c7b0aac..9099034 100644
--- a/core/res/res/drawable-xhdpi/scrubber_secondary_holo.9.png
+++ b/core/res/res/drawable-xhdpi/scrubber_secondary_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_track_holo_dark.9.png b/core/res/res/drawable-xhdpi/scrubber_track_holo_dark.9.png
index a217a90..bfb2048 100644
--- a/core/res/res/drawable-xhdpi/scrubber_track_holo_dark.9.png
+++ b/core/res/res/drawable-xhdpi/scrubber_track_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_track_holo_light.9.png b/core/res/res/drawable-xhdpi/scrubber_track_holo_light.9.png
index 551fb0a..a7d396de2 100644
--- a/core/res/res/drawable-xhdpi/scrubber_track_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/scrubber_track_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable/ic_lockscreen_answer.xml b/core/res/res/drawable/ic_lockscreen_answer.xml
deleted file mode 100644
index dd50930..0000000
--- a/core/res/res/drawable/ic_lockscreen_answer.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_answer_normal" />
-
- <item
- android:state_enabled="true"
- android:state_active="true"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_answer_active" />
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="true"
- android:drawable="@drawable/ic_lockscreen_answer_active" />
-
-</selector>
diff --git a/core/res/res/drawable/ic_lockscreen_decline.xml b/core/res/res/drawable/ic_lockscreen_decline.xml
deleted file mode 100644
index 58e9d38..0000000
--- a/core/res/res/drawable/ic_lockscreen_decline.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_decline_normal" />
-
- <item
- android:state_enabled="true"
- android:state_active="true"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_decline_activated" />
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="true"
- android:drawable="@drawable/ic_lockscreen_decline_activated" />
-
-</selector>
diff --git a/core/res/res/drawable/ic_lockscreen_send_sms.xml b/core/res/res/drawable/ic_lockscreen_send_sms.xml
deleted file mode 100644
index 0d09297..0000000
--- a/core/res/res/drawable/ic_lockscreen_send_sms.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_text_normal" />
-
- <item
- android:state_enabled="true"
- android:state_active="true"
- android:state_focused="false"
- android:drawable="@drawable/ic_lockscreen_text_activated" />
-
- <item
- android:state_enabled="true"
- android:state_active="false"
- android:state_focused="true"
- android:drawable="@drawable/ic_lockscreen_text_activated" />
-
-</selector>
diff --git a/core/res/res/layout-large/action_mode_close_item.xml b/core/res/res/layout-large/action_mode_close_item.xml
index 96aa451..f8b397a 100644
--- a/core/res/res/layout-large/action_mode_close_item.xml
+++ b/core/res/res/layout-large/action_mode_close_item.xml
@@ -34,6 +34,7 @@
android:layout_marginLeft="4dip"
android:layout_marginRight="16dip"
android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="?android:attr/actionMenuTextColor"
android:textSize="12sp"
android:textAllCaps="true"
android:text="@string/action_mode_done" />
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml
index 055955e..efd406d 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock.xml
@@ -31,7 +31,7 @@
<!-- top: status -->
<RelativeLayout
android:layout_height="0dip"
- android:layout_weight="1"
+ android:layout_weight="0.42"
android:layout_width="match_parent"
android:gravity="center">
@@ -69,8 +69,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
- android:layout_weight="1"
- android:orientation="vertical">
+ android:layout_weight="0.58"
+ android:orientation="vertical"
+ android:gravity="bottom">
<TextView
android:id="@+id/screenLocked"
@@ -87,7 +88,7 @@
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center"
+ android:layout_gravity="center_horizontal"
android:gravity="center"
android:targetDrawables="@array/lockscreen_targets_with_camera"
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml
index e68a0c1..de64a51 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_tab_unlock_land.xml
@@ -30,7 +30,7 @@
<!-- left side: status and music -->
<RelativeLayout
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_weight="0.42"
android:layout_width="0dip"
android:gravity="center">
@@ -67,7 +67,7 @@
<!-- right side -->
<RelativeLayout
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_weight="0.58"
android:layout_width="0dip"
android:gravity="center_horizontal|center_vertical">
@@ -87,7 +87,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_rowSpan="7"
- android:layout_gravity="center_vertical|center_horizontal"
+ android:layout_gravity="center_vertical|right"
android:gravity="center"
android:targetDrawables="@array/lockscreen_targets_with_camera"
diff --git a/core/res/res/layout/time_picker_holo.xml b/core/res/res/layout/time_picker_holo.xml
index 91e66bc..7b91022 100644
--- a/core/res/res/layout/time_picker_holo.xml
+++ b/core/res/res/layout/time_picker_holo.xml
@@ -44,6 +44,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
+ android:importantForAccessibility="no"
/>
<!-- minute -->
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index d31afa1..25cfb7f 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -796,7 +796,7 @@
<string name="js_dialog_title_default" msgid="6961903213729667573">"Javascript"</string>
<string name="js_dialog_before_unload" msgid="730366588032430474">"Vil du gå væk fra denne side?"\n\n"<xliff:g id="MESSAGE">%s</xliff:g>"\n\n"Tryk på OK for at fortsætte eller Annuller for at blive på den aktuelle side."</string>
<string name="save_password_label" msgid="6860261758665825069">"Bekræft"</string>
- <string name="double_tap_toast" msgid="4595046515400268881">"Tip: Dobbeltklik for at zoome ind eller ud."</string>
+ <string name="double_tap_toast" msgid="4595046515400268881">"Tip! Dobbeltklik for at zoome ind eller ud."</string>
<string name="autofill_this_form" msgid="4616758841157816676">"Autofyld"</string>
<string name="setup_autofill" msgid="7103495070180590814">"Konfigurer Autofyld"</string>
<string name="autofill_address_name_separator" msgid="6350145154779706772">" "</string>
@@ -997,7 +997,7 @@
<string name="launch_warning_original" msgid="188102023021668683">"<xliff:g id="APP_NAME">%1$s</xliff:g> blev oprindeligt åbnet."</string>
<string name="screen_compat_mode_scale" msgid="3202955667675944499">"Skaler"</string>
<string name="screen_compat_mode_show" msgid="4013878876486655892">"Vis altid"</string>
- <string name="screen_compat_mode_hint" msgid="1064524084543304459">"Aktiver dette igen i Systemindstillinger > Apps > Downloadet."</string>
+ <string name="screen_compat_mode_hint" msgid="1064524084543304459">"Aktivér dette igen i Systemindstillinger > Apps > Downloadet."</string>
<string name="smv_application" msgid="3307209192155442829">"Appen <xliff:g id="APPLICATION">%1$s</xliff:g> (proces <xliff:g id="PROCESS">%2$s</xliff:g>) har overtrådt sin egen StrictMode-politik."</string>
<string name="smv_process" msgid="5120397012047462446">"Processen <xliff:g id="PROCESS">%1$s</xliff:g> har overtrådt sin egen StrictMode-politik."</string>
<string name="android_upgrading_title" msgid="1584192285441405746">"Android opgraderes..."</string>
diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml
index 225f8e6..3d51570 100644
--- a/core/res/res/values-de/strings.xml
+++ b/core/res/res/values-de/strings.xml
@@ -1107,7 +1107,7 @@
<string name="usb_ptp_notification_title" msgid="1960817192216064833">"Als Kamera angeschlossen"</string>
<string name="usb_cd_installer_notification_title" msgid="6774712827892090754">"Als Installationsprogramm angeschlossen"</string>
<string name="usb_accessory_notification_title" msgid="7848236974087653666">"Mit USB-Zubehör verbunden"</string>
- <string name="usb_notification_message" msgid="2290859399983720271">"Zum Anzeigen weiterer USB-Optionen berühren"</string>
+ <string name="usb_notification_message" msgid="2290859399983720271">"Für mehr USB-Optionen berühren"</string>
<string name="extmedia_format_title" product="nosdcard" msgid="9020092196061007262">"USB-Speicher formatieren?"</string>
<string name="extmedia_format_title" product="default" msgid="3648415921526526069">"SD-Karte formatieren?"</string>
<string name="extmedia_format_message" product="nosdcard" msgid="3934016853425761078">"Alle in Ihrem USB-Speicher abgelegten Dateien werden gelöscht. Diese Aktion kann nicht rückgängig gemacht werden!"</string>
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index 800f503..7e3e95b 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -175,28 +175,20 @@
<string name="permgroupdesc_location" msgid="5704679763124170100">"現在地を追跡します。"</string>
<string name="permgrouplab_network" msgid="5808983377727109831">"ネットワーク通信"</string>
<string name="permgroupdesc_network" msgid="4478299413241861987">"さまざまなネットワーク機能にアクセスします。"</string>
- <!-- no translation found for permgrouplab_bluetoothNetwork (1585403544162128109) -->
- <skip />
- <!-- no translation found for permgroupdesc_bluetoothNetwork (5625288577164282391) -->
- <skip />
- <!-- no translation found for permgrouplab_shortrangeNetwork (130808676377486118) -->
- <skip />
- <!-- no translation found for permgroupdesc_shortrangeNetwork (1884069062653436007) -->
- <skip />
+ <string name="permgrouplab_bluetoothNetwork" msgid="1585403544162128109">"Bluetooth"</string>
+ <string name="permgroupdesc_bluetoothNetwork" msgid="5625288577164282391">"Bluetooth経由でデバイスやネットワークにアクセスします。"</string>
+ <string name="permgrouplab_shortrangeNetwork" msgid="130808676377486118">"短距離ネットワーク"</string>
+ <string name="permgroupdesc_shortrangeNetwork" msgid="1884069062653436007">"NFCなどの近距離ネットワーク経由でデバイスにアクセスします。"</string>
<string name="permgrouplab_audioSettings" msgid="8329261670151871235">"音声設定"</string>
<string name="permgroupdesc_audioSettings" msgid="2641515403347568130">"音声設定を変更します。"</string>
<string name="permgrouplab_affectsBattery" msgid="6209246653424798033">"電池への影響"</string>
<string name="permgroupdesc_affectsBattery" msgid="6441275320638916947">"短時間で電池を消費する機能を使用します。"</string>
<string name="permgrouplab_calendar" msgid="5863508437783683902">"カレンダー"</string>
<string name="permgroupdesc_calendar" msgid="5777534316982184416">"カレンダーと予定に直接アクセスします。"</string>
- <!-- no translation found for permgrouplab_dictionary (4148597128843641379) -->
- <skip />
- <!-- no translation found for permgroupdesc_dictionary (7921166355964764490) -->
- <skip />
- <!-- no translation found for permgrouplab_writeDictionary (8090237702432576788) -->
- <skip />
- <!-- no translation found for permgroupdesc_writeDictionary (2711561994497361646) -->
- <skip />
+ <string name="permgrouplab_dictionary" msgid="4148597128843641379">"単語リストの読み取り"</string>
+ <string name="permgroupdesc_dictionary" msgid="7921166355964764490">"単語リストから語句を読み取ります。"</string>
+ <string name="permgrouplab_writeDictionary" msgid="8090237702432576788">"単語リストへの書き込み"</string>
+ <string name="permgroupdesc_writeDictionary" msgid="2711561994497361646">"単語リストに語句を追加します。"</string>
<string name="permgrouplab_bookmarks" msgid="1949519673103968229">"ブックマークと履歴"</string>
<string name="permgroupdesc_bookmarks" msgid="4169771606257963028">"ブックマークとブラウザの履歴に直接アクセスします。"</string>
<string name="permgrouplab_deviceAlarms" msgid="6117704629728824101">"アラーム"</string>
@@ -569,8 +561,7 @@
<string name="permdesc_sdcardRead" product="nosdcard" msgid="3530894470637667917">"USBストレージ(写真やメディアなど)の読み取りをアプリに許可します。"</string>
<string name="permdesc_sdcardRead" product="default" msgid="2555811422562526606">"SDカードのコンテンツ(写真やメディアなど)の読み取りをアプリに許可します。"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="8485979062254666748">"USBストレージのコンテンツの変更または削除"</string>
- <!-- no translation found for permlab_sdcardWrite (8805693630050458763) -->
- <skip />
+ <string name="permlab_sdcardWrite" product="default" msgid="8805693630050458763">"SDカードのコンテンツの変更または削除"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"USBストレージへの書き込みをアプリに許可します。"</string>
<string name="permdesc_sdcardWrite" product="default" msgid="4337417790936632090">"SDカードへの書き込みをアプリに許可します。"</string>
<string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"内部メディアストレージの内容の変更/削除"</string>
@@ -1090,8 +1081,7 @@
<string name="date_time_set" msgid="5777075614321087758">"設定"</string>
<string name="date_time_done" msgid="2507683751759308828">"完了"</string>
<string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ff900000">"NEW: "</font></string>
- <!-- no translation found for perms_description_app (5139836143293299417) -->
- <skip />
+ <string name="perms_description_app" msgid="5139836143293299417">"<xliff:g id="APP_NAME">%1$s</xliff:g>で提供されます。"</string>
<string name="no_permissions" msgid="7283357728219338112">"権限の許可は必要ありません"</string>
<string name="usb_storage_activity_title" msgid="4465055157209648641">"USBマスストレージ"</string>
<string name="usb_storage_title" msgid="5901459041398751495">"USB接続"</string>
@@ -1322,6 +1312,5 @@
<string name="launchBrowserDefault" msgid="2057951947297614725">"ブラウザを起動しますか?"</string>
<string name="SetupCallDefault" msgid="5834948469253758575">"通話を受けますか?"</string>
<string name="activity_resolver_use_always" msgid="8017770747801494933">"常時"</string>
- <!-- no translation found for activity_resolver_use_once (405646673463328329) -->
- <skip />
+ <string name="activity_resolver_use_once" msgid="405646673463328329">"今回のみ"</string>
</resources>
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index d39c75c..a0e00eb 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -175,28 +175,20 @@
<string name="permgroupdesc_location" msgid="5704679763124170100">"Overvåking av telefonens fysiske posisjon."</string>
<string name="permgrouplab_network" msgid="5808983377727109831">"Nettverkstilgang"</string>
<string name="permgroupdesc_network" msgid="4478299413241861987">"Tilgang til ulike nettverksfunksjoner."</string>
- <!-- no translation found for permgrouplab_bluetoothNetwork (1585403544162128109) -->
- <skip />
- <!-- no translation found for permgroupdesc_bluetoothNetwork (5625288577164282391) -->
- <skip />
- <!-- no translation found for permgrouplab_shortrangeNetwork (130808676377486118) -->
- <skip />
- <!-- no translation found for permgroupdesc_shortrangeNetwork (1884069062653436007) -->
- <skip />
+ <string name="permgrouplab_bluetoothNetwork" msgid="1585403544162128109">"Bluetooth"</string>
+ <string name="permgroupdesc_bluetoothNetwork" msgid="5625288577164282391">"Bruke enheter og nettverk gjennom Bluetooth"</string>
+ <string name="permgrouplab_shortrangeNetwork" msgid="130808676377486118">"Nettverk med kort rekkevidde"</string>
+ <string name="permgroupdesc_shortrangeNetwork" msgid="1884069062653436007">"Bruke enheter via nettverk med kort rekkevidde, som NFC."</string>
<string name="permgrouplab_audioSettings" msgid="8329261670151871235">"Lydinnstillingene"</string>
<string name="permgroupdesc_audioSettings" msgid="2641515403347568130">"Endre lydinnstillingene."</string>
<string name="permgrouplab_affectsBattery" msgid="6209246653424798033">"Påvirker batteriet"</string>
<string name="permgroupdesc_affectsBattery" msgid="6441275320638916947">"Bruke funksjoner som kan tappe batteriet fortere."</string>
<string name="permgrouplab_calendar" msgid="5863508437783683902">"Kalenderen"</string>
<string name="permgroupdesc_calendar" msgid="5777534316982184416">"Direkte tilgang til kalenderen og aktiviteter."</string>
- <!-- no translation found for permgrouplab_dictionary (4148597128843641379) -->
- <skip />
- <!-- no translation found for permgroupdesc_dictionary (7921166355964764490) -->
- <skip />
- <!-- no translation found for permgrouplab_writeDictionary (8090237702432576788) -->
- <skip />
- <!-- no translation found for permgroupdesc_writeDictionary (2711561994497361646) -->
- <skip />
+ <string name="permgrouplab_dictionary" msgid="4148597128843641379">"Lese brukerordlisten"</string>
+ <string name="permgroupdesc_dictionary" msgid="7921166355964764490">"Lese ord i brukerordlisten."</string>
+ <string name="permgrouplab_writeDictionary" msgid="8090237702432576788">"Skrive i brukerordlisten"</string>
+ <string name="permgroupdesc_writeDictionary" msgid="2711561994497361646">"Legge til ord i brukerordlisten."</string>
<string name="permgrouplab_bookmarks" msgid="1949519673103968229">"Bokmerkene og loggen"</string>
<string name="permgroupdesc_bookmarks" msgid="4169771606257963028">"Direkte tilgang til bokmerker og nettleserloggen."</string>
<string name="permgrouplab_deviceAlarms" msgid="6117704629728824101">"Alarmen"</string>
@@ -569,8 +561,7 @@
<string name="permdesc_sdcardRead" product="nosdcard" msgid="3530894470637667917">"Tillater at appen leser innholdet i USB-lagring, som kan inneholde bilder og medier."</string>
<string name="permdesc_sdcardRead" product="default" msgid="2555811422562526606">"Tillater at appen leser innholdet i SD-kort, som kan inneholde bilder og medier."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="8485979062254666748">"endrer eller sletter innholdet i USB-lagringen"</string>
- <!-- no translation found for permlab_sdcardWrite (8805693630050458763) -->
- <skip />
+ <string name="permlab_sdcardWrite" product="default" msgid="8805693630050458763">"endre eller slette innhold i SD-kortet"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Gir appen tillatelse til å skrive til USB-lagringen."</string>
<string name="permdesc_sdcardWrite" product="default" msgid="4337417790936632090">"Lar appen skrive til SD-kortet."</string>
<string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"endre eller slette innhold på interne medier"</string>
@@ -1090,8 +1081,7 @@
<string name="date_time_set" msgid="5777075614321087758">"Lagre"</string>
<string name="date_time_done" msgid="2507683751759308828">"Ferdig"</string>
<string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ff900000">"NYTT: "</font></string>
- <!-- no translation found for perms_description_app (5139836143293299417) -->
- <skip />
+ <string name="perms_description_app" msgid="5139836143293299417">"Levert av <xliff:g id="APP_NAME">%1$s</xliff:g>."</string>
<string name="no_permissions" msgid="7283357728219338112">"Trenger ingen rettigheter"</string>
<string name="usb_storage_activity_title" msgid="4465055157209648641">"USB-masselagring"</string>
<string name="usb_storage_title" msgid="5901459041398751495">"USB koblet til"</string>
@@ -1322,6 +1312,5 @@
<string name="launchBrowserDefault" msgid="2057951947297614725">"Vil du starte nettleseren?"</string>
<string name="SetupCallDefault" msgid="5834948469253758575">"Vil du besvare anropet?"</string>
<string name="activity_resolver_use_always" msgid="8017770747801494933">"Alltid"</string>
- <!-- no translation found for activity_resolver_use_once (405646673463328329) -->
- <skip />
+ <string name="activity_resolver_use_once" msgid="405646673463328329">"Bare én gang"</string>
</resources>
diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml
index 60ea8e8..10effa3 100644
--- a/core/res/res/values-pl/strings.xml
+++ b/core/res/res/values-pl/strings.xml
@@ -175,28 +175,20 @@
<string name="permgroupdesc_location" msgid="5704679763124170100">"Monitorowanie fizycznej lokalizacji"</string>
<string name="permgrouplab_network" msgid="5808983377727109831">"Połączenia sieciowe"</string>
<string name="permgroupdesc_network" msgid="4478299413241861987">"Uzyskiwanie dostępu do różnych funkcji sieciowych"</string>
- <!-- no translation found for permgrouplab_bluetoothNetwork (1585403544162128109) -->
- <skip />
- <!-- no translation found for permgroupdesc_bluetoothNetwork (5625288577164282391) -->
- <skip />
- <!-- no translation found for permgrouplab_shortrangeNetwork (130808676377486118) -->
- <skip />
- <!-- no translation found for permgroupdesc_shortrangeNetwork (1884069062653436007) -->
- <skip />
+ <string name="permgrouplab_bluetoothNetwork" msgid="1585403544162128109">"Bluetooth"</string>
+ <string name="permgroupdesc_bluetoothNetwork" msgid="5625288577164282391">"Urządzenia dostępowe i sieci przez Bluetooth."</string>
+ <string name="permgrouplab_shortrangeNetwork" msgid="130808676377486118">"Sieci krótkiego zasięgu"</string>
+ <string name="permgroupdesc_shortrangeNetwork" msgid="1884069062653436007">"Dostęp do urządzeń przez sieci krótkiego zasięgu, takie jak NFC."</string>
<string name="permgrouplab_audioSettings" msgid="8329261670151871235">"Ustawienia dźwięku"</string>
<string name="permgroupdesc_audioSettings" msgid="2641515403347568130">"Zmiana ustawień dźwięku."</string>
<string name="permgrouplab_affectsBattery" msgid="6209246653424798033">"Użycie baterii"</string>
<string name="permgroupdesc_affectsBattery" msgid="6441275320638916947">"Korzystanie z funkcji, które mogą szybko rozładować baterię."</string>
<string name="permgrouplab_calendar" msgid="5863508437783683902">"Kalendarz"</string>
<string name="permgroupdesc_calendar" msgid="5777534316982184416">"Bezpośredni dostęp do kalendarza i wydarzeń."</string>
- <!-- no translation found for permgrouplab_dictionary (4148597128843641379) -->
- <skip />
- <!-- no translation found for permgroupdesc_dictionary (7921166355964764490) -->
- <skip />
- <!-- no translation found for permgrouplab_writeDictionary (8090237702432576788) -->
- <skip />
- <!-- no translation found for permgroupdesc_writeDictionary (2711561994497361646) -->
- <skip />
+ <string name="permgrouplab_dictionary" msgid="4148597128843641379">"Czytanie słownika użytkownika"</string>
+ <string name="permgroupdesc_dictionary" msgid="7921166355964764490">"Czytanie wyrazów ze słownika użytkownika."</string>
+ <string name="permgrouplab_writeDictionary" msgid="8090237702432576788">"Zapisywanie w słowniku użytkownika"</string>
+ <string name="permgroupdesc_writeDictionary" msgid="2711561994497361646">"Dodawanie wyrazów do słownika użytkownika."</string>
<string name="permgrouplab_bookmarks" msgid="1949519673103968229">"Zakładki i historia"</string>
<string name="permgroupdesc_bookmarks" msgid="4169771606257963028">"Bezpośredni dostęp do zakładek i historii przeglądarki."</string>
<string name="permgrouplab_deviceAlarms" msgid="6117704629728824101">"Alarm"</string>
@@ -569,8 +561,7 @@
<string name="permdesc_sdcardRead" product="nosdcard" msgid="3530894470637667917">"Zezwala aplikacji na odczytywanie zawartości pamięci USB, która może obejmować zdjęcia i multimedia."</string>
<string name="permdesc_sdcardRead" product="default" msgid="2555811422562526606">"Zezwala aplikacji na odczytywanie zawartości karty SD, która może obejmować zdjęcia i multimedia."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="8485979062254666748">"modyfikowanie i usuwanie zawartości pamięci USB"</string>
- <!-- no translation found for permlab_sdcardWrite (8805693630050458763) -->
- <skip />
+ <string name="permlab_sdcardWrite" product="default" msgid="8805693630050458763">"modyfikowanie i usuwanie zawartości karty SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Pozwala aplikacji na zapis w pamięci USB."</string>
<string name="permdesc_sdcardWrite" product="default" msgid="4337417790936632090">"Pozwala aplikacji na zapis na karcie SD."</string>
<string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"modyfikowanie/usuwanie zawartości pamięci wew."</string>
@@ -1090,8 +1081,7 @@
<string name="date_time_set" msgid="5777075614321087758">"Ustaw"</string>
<string name="date_time_done" msgid="2507683751759308828">"Gotowe"</string>
<string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ff900000">"NOWE: "</font></string>
- <!-- no translation found for perms_description_app (5139836143293299417) -->
- <skip />
+ <string name="perms_description_app" msgid="5139836143293299417">"Dostarczane przez <xliff:g id="APP_NAME">%1$s</xliff:g>."</string>
<string name="no_permissions" msgid="7283357728219338112">"Nie są wymagane żadne uprawnienia"</string>
<string name="usb_storage_activity_title" msgid="4465055157209648641">"Pamięć masowa USB"</string>
<string name="usb_storage_title" msgid="5901459041398751495">"Połączenie przez USB"</string>
@@ -1322,6 +1312,5 @@
<string name="launchBrowserDefault" msgid="2057951947297614725">"Uruchomić przeglądarkę?"</string>
<string name="SetupCallDefault" msgid="5834948469253758575">"Odebrać połączenie?"</string>
<string name="activity_resolver_use_always" msgid="8017770747801494933">"Zawsze"</string>
- <!-- no translation found for activity_resolver_use_once (405646673463328329) -->
- <skip />
+ <string name="activity_resolver_use_once" msgid="405646673463328329">"Tylko raz"</string>
</resources>
diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml
index ba10acd..4236d50 100644
--- a/core/res/res/values-pt/strings.xml
+++ b/core/res/res/values-pt/strings.xml
@@ -176,9 +176,9 @@
<string name="permgrouplab_network" msgid="5808983377727109831">"Comunicação da rede"</string>
<string name="permgroupdesc_network" msgid="4478299413241861987">"Acesse diversos recursos de rede."</string>
<string name="permgrouplab_bluetoothNetwork" msgid="1585403544162128109">"Bluetooth"</string>
- <string name="permgroupdesc_bluetoothNetwork" msgid="5625288577164282391">"Acessar dispositivos e redes através do Bluetooth."</string>
+ <string name="permgroupdesc_bluetoothNetwork" msgid="5625288577164282391">"Acessar dispositivos e redes por meio do Bluetooth."</string>
<string name="permgrouplab_shortrangeNetwork" msgid="130808676377486118">"Redes de curto alcance"</string>
- <string name="permgroupdesc_shortrangeNetwork" msgid="1884069062653436007">"Acessar dispositivos através de redes de curto alcance de redes como a NFC."</string>
+ <string name="permgroupdesc_shortrangeNetwork" msgid="1884069062653436007">"Acessar dispositivos por meio de redes de curto alcance de redes como a NFC."</string>
<string name="permgrouplab_audioSettings" msgid="8329261670151871235">"Configurações de áudio"</string>
<string name="permgroupdesc_audioSettings" msgid="2641515403347568130">"Alterar as configurações de áudio."</string>
<string name="permgrouplab_affectsBattery" msgid="6209246653424798033">"Afeta a bateria"</string>
diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml
index 45783d1..dd639858 100644
--- a/core/res/res/values-ro/strings.xml
+++ b/core/res/res/values-ro/strings.xml
@@ -175,28 +175,20 @@
<string name="permgroupdesc_location" msgid="5704679763124170100">"Monitorizează locaţia dvs. fizică."</string>
<string name="permgrouplab_network" msgid="5808983377727109831">"Comunicare în reţea"</string>
<string name="permgroupdesc_network" msgid="4478299413241861987">"Accesează diferite funcţii ale reţelei."</string>
- <!-- no translation found for permgrouplab_bluetoothNetwork (1585403544162128109) -->
- <skip />
- <!-- no translation found for permgroupdesc_bluetoothNetwork (5625288577164282391) -->
- <skip />
- <!-- no translation found for permgrouplab_shortrangeNetwork (130808676377486118) -->
- <skip />
- <!-- no translation found for permgroupdesc_shortrangeNetwork (1884069062653436007) -->
- <skip />
+ <string name="permgrouplab_bluetoothNetwork" msgid="1585403544162128109">"Bluetooth"</string>
+ <string name="permgroupdesc_bluetoothNetwork" msgid="5625288577164282391">"Accesează dispozitive şi reţele prin intermediul Bluetooth."</string>
+ <string name="permgrouplab_shortrangeNetwork" msgid="130808676377486118">"Reţele cu distanţă scurtă"</string>
+ <string name="permgroupdesc_shortrangeNetwork" msgid="1884069062653436007">"Accesează dispozitive prin intermediul reţelelor cu distanţă scurtă, cum ar fi NFC."</string>
<string name="permgrouplab_audioSettings" msgid="8329261670151871235">"Setările audio"</string>
<string name="permgroupdesc_audioSettings" msgid="2641515403347568130">"Modifică setările audio."</string>
<string name="permgrouplab_affectsBattery" msgid="6209246653424798033">"Capacitatea de a afecta bateria"</string>
<string name="permgroupdesc_affectsBattery" msgid="6441275320638916947">"Utilizează funcţii care pot consuma rapid bateria."</string>
<string name="permgrouplab_calendar" msgid="5863508437783683902">"Calendarul"</string>
<string name="permgroupdesc_calendar" msgid="5777534316982184416">"Acces direct la calendar şi la evenimente."</string>
- <!-- no translation found for permgrouplab_dictionary (4148597128843641379) -->
- <skip />
- <!-- no translation found for permgroupdesc_dictionary (7921166355964764490) -->
- <skip />
- <!-- no translation found for permgrouplab_writeDictionary (8090237702432576788) -->
- <skip />
- <!-- no translation found for permgroupdesc_writeDictionary (2711561994497361646) -->
- <skip />
+ <string name="permgrouplab_dictionary" msgid="4148597128843641379">"Citeşte dicţionarul utilizatorului"</string>
+ <string name="permgroupdesc_dictionary" msgid="7921166355964764490">"Citeşte cuvinte din dicţionarul utilizatorului."</string>
+ <string name="permgrouplab_writeDictionary" msgid="8090237702432576788">"Scrie în dicţionarul utilizatorului"</string>
+ <string name="permgroupdesc_writeDictionary" msgid="2711561994497361646">"Adaugă cuvinte în dicţionarul utilizatorului."</string>
<string name="permgrouplab_bookmarks" msgid="1949519673103968229">"Marcajele şi Istoricul"</string>
<string name="permgroupdesc_bookmarks" msgid="4169771606257963028">"Acces direct la marcaje şi la istoricul navigării."</string>
<string name="permgrouplab_deviceAlarms" msgid="6117704629728824101">"Alarma"</string>
@@ -569,8 +561,7 @@
<string name="permdesc_sdcardRead" product="nosdcard" msgid="3530894470637667917">"Permite aplic. să citească conţin. stoc. USB, care poate include fotogr. şi media."</string>
<string name="permdesc_sdcardRead" product="default" msgid="2555811422562526606">"Permite aplicaţiei să citească conţinutul cardului SD, care poate include fotografii şi conţinut media."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="8485979062254666748">"modifică sau şterge conţinutul stocării USB"</string>
- <!-- no translation found for permlab_sdcardWrite (8805693630050458763) -->
- <skip />
+ <string name="permlab_sdcardWrite" product="default" msgid="8805693630050458763">"modifică sau şterge conţinutul cardului SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permite scriere în stoc. USB."</string>
<string name="permdesc_sdcardWrite" product="default" msgid="4337417790936632090">"Permite aplicaţiei să scrie pe cardul SD."</string>
<string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"modif./şterg. conţinutul media stocat intern"</string>
@@ -1090,8 +1081,7 @@
<string name="date_time_set" msgid="5777075614321087758">"Setaţi"</string>
<string name="date_time_done" msgid="2507683751759308828">"Terminat"</string>
<string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ff900000">"NOU: "</font></string>
- <!-- no translation found for perms_description_app (5139836143293299417) -->
- <skip />
+ <string name="perms_description_app" msgid="5139836143293299417">"Furnizată de <xliff:g id="APP_NAME">%1$s</xliff:g>."</string>
<string name="no_permissions" msgid="7283357728219338112">"Nu se solicită nicio permisiune"</string>
<string name="usb_storage_activity_title" msgid="4465055157209648641">"Stocare masivă USB"</string>
<string name="usb_storage_title" msgid="5901459041398751495">"USB conectat"</string>
@@ -1322,6 +1312,5 @@
<string name="launchBrowserDefault" msgid="2057951947297614725">"Lansaţi browserul?"</string>
<string name="SetupCallDefault" msgid="5834948469253758575">"Acceptaţi apelul?"</string>
<string name="activity_resolver_use_always" msgid="8017770747801494933">"Întotdeauna"</string>
- <!-- no translation found for activity_resolver_use_once (405646673463328329) -->
- <skip />
+ <string name="activity_resolver_use_once" msgid="405646673463328329">"Doar o singură dată"</string>
</resources>
diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml
index 251d487..f91db69 100644
--- a/core/res/res/values-sv/strings.xml
+++ b/core/res/res/values-sv/strings.xml
@@ -175,28 +175,20 @@
<string name="permgroupdesc_location" msgid="5704679763124170100">"Övervaka din fysiska plats."</string>
<string name="permgrouplab_network" msgid="5808983377727109831">"Nätverkskommunikation"</string>
<string name="permgroupdesc_network" msgid="4478299413241861987">"Åtkomst till olika nätverksfunktioner."</string>
- <!-- no translation found for permgrouplab_bluetoothNetwork (1585403544162128109) -->
- <skip />
- <!-- no translation found for permgroupdesc_bluetoothNetwork (5625288577164282391) -->
- <skip />
- <!-- no translation found for permgrouplab_shortrangeNetwork (130808676377486118) -->
- <skip />
- <!-- no translation found for permgroupdesc_shortrangeNetwork (1884069062653436007) -->
- <skip />
+ <string name="permgrouplab_bluetoothNetwork" msgid="1585403544162128109">"Bluetooth"</string>
+ <string name="permgroupdesc_bluetoothNetwork" msgid="5625288577164282391">"Få åtkomst till enheter och nätverk via Bluetooth."</string>
+ <string name="permgrouplab_shortrangeNetwork" msgid="130808676377486118">"Nätverk för kommunikation på nära håll"</string>
+ <string name="permgroupdesc_shortrangeNetwork" msgid="1884069062653436007">"Få åtkomst till enheter via nätverk för kommunikation på nära håll, som NFC."</string>
<string name="permgrouplab_audioSettings" msgid="8329261670151871235">"Ljudinställningar"</string>
<string name="permgroupdesc_audioSettings" msgid="2641515403347568130">"Ändra ljudinställningar."</string>
<string name="permgrouplab_affectsBattery" msgid="6209246653424798033">"Påverkar batteriet"</string>
<string name="permgroupdesc_affectsBattery" msgid="6441275320638916947">"Använda funktioner som gör att batteriet tar slut snabbt."</string>
<string name="permgrouplab_calendar" msgid="5863508437783683902">"Kalender"</string>
<string name="permgroupdesc_calendar" msgid="5777534316982184416">"Direktåtkomst till kalender och händelser."</string>
- <!-- no translation found for permgrouplab_dictionary (4148597128843641379) -->
- <skip />
- <!-- no translation found for permgroupdesc_dictionary (7921166355964764490) -->
- <skip />
- <!-- no translation found for permgrouplab_writeDictionary (8090237702432576788) -->
- <skip />
- <!-- no translation found for permgroupdesc_writeDictionary (2711561994497361646) -->
- <skip />
+ <string name="permgrouplab_dictionary" msgid="4148597128843641379">"Läsa den egna ordlistan"</string>
+ <string name="permgroupdesc_dictionary" msgid="7921166355964764490">"Läsa ord i den egna ordlistan."</string>
+ <string name="permgrouplab_writeDictionary" msgid="8090237702432576788">"Skriva i den egna ordlistan"</string>
+ <string name="permgroupdesc_writeDictionary" msgid="2711561994497361646">"Lägga till ord i den egna ordlistan."</string>
<string name="permgrouplab_bookmarks" msgid="1949519673103968229">"Bokmärken och historik"</string>
<string name="permgroupdesc_bookmarks" msgid="4169771606257963028">"Direktåtkomst till bokmärken och webbläsarhistorik."</string>
<string name="permgrouplab_deviceAlarms" msgid="6117704629728824101">"Larm"</string>
@@ -569,8 +561,7 @@
<string name="permdesc_sdcardRead" product="nosdcard" msgid="3530894470637667917">"Tillåter att innehållet läses."</string>
<string name="permdesc_sdcardRead" product="default" msgid="2555811422562526606">"Tillåter att appen läser SD-kortets innehåll, inklusive eventuella bilder och media."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="8485979062254666748">"ändra eller ta bort innehållet"</string>
- <!-- no translation found for permlab_sdcardWrite (8805693630050458763) -->
- <skip />
+ <string name="permlab_sdcardWrite" product="default" msgid="8805693630050458763">"ändra eller ta bort innehåll på SD-kortet"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Gör att app skriver till USB."</string>
<string name="permdesc_sdcardWrite" product="default" msgid="4337417790936632090">"Tillåter att appen skriver till SD-kortet."</string>
<string name="permlab_mediaStorageWrite" product="default" msgid="6859839199706879015">"ändra/ta bort innehåll"</string>
@@ -1090,8 +1081,7 @@
<string name="date_time_set" msgid="5777075614321087758">"Ställ in"</string>
<string name="date_time_done" msgid="2507683751759308828">"Klar"</string>
<string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ff900000">"NY: "</font></string>
- <!-- no translation found for perms_description_app (5139836143293299417) -->
- <skip />
+ <string name="perms_description_app" msgid="5139836143293299417">"Tillhandahålls av <xliff:g id="APP_NAME">%1$s</xliff:g>."</string>
<string name="no_permissions" msgid="7283357728219338112">"Inga behörigheter krävs"</string>
<string name="usb_storage_activity_title" msgid="4465055157209648641">"USB-masslagring"</string>
<string name="usb_storage_title" msgid="5901459041398751495">"USB-ansluten"</string>
@@ -1322,6 +1312,5 @@
<string name="launchBrowserDefault" msgid="2057951947297614725">"Vill du öppna webbläsaren?"</string>
<string name="SetupCallDefault" msgid="5834948469253758575">"Vill du ta emot samtal?"</string>
<string name="activity_resolver_use_always" msgid="8017770747801494933">"Alltid"</string>
- <!-- no translation found for activity_resolver_use_once (405646673463328329) -->
- <skip />
+ <string name="activity_resolver_use_once" msgid="405646673463328329">"Bara den här gången"</string>
</resources>
diff --git a/core/res/res/values-sw600dp/dimens.xml b/core/res/res/values-sw600dp/dimens.xml
index c5727ea..d26666e 100644
--- a/core/res/res/values-sw600dp/dimens.xml
+++ b/core/res/res/values-sw600dp/dimens.xml
@@ -51,12 +51,6 @@
<!-- Size of status line font in LockScreen. -->
<dimen name="keyguard_pattern_unlock_status_line_font_size">14sp</dimen>
- <!-- Default padding to apply to AppWidgetHostViews containing widgets targeting API level 14 and up. -->
- <dimen name="default_app_widget_padding_left">12dp</dimen>
- <dimen name="default_app_widget_padding_top">4dp</dimen>
- <dimen name="default_app_widget_padding_right">12dp</dimen>
- <dimen name="default_app_widget_padding_bottom">20dp</dimen>
-
<!-- Minimum width for an action button in the menu area of an action bar -->
<dimen name="action_button_min_width">64dip</dimen>
diff --git a/core/res/res/values-sw720dp/dimens.xml b/core/res/res/values-sw720dp/dimens.xml
index 34c7ea3..fc336ae 100644
--- a/core/res/res/values-sw720dp/dimens.xml
+++ b/core/res/res/values-sw720dp/dimens.xml
@@ -50,6 +50,12 @@
<dimen name="preference_screen_header_padding_side">0dip</dimen>
<integer name="preference_screen_header_scrollbarStyle">0x0</integer> <!-- insideOverlay -->
+ <!-- Default padding to apply to AppWidgetHostViews containing widgets targeting API level 14 and up. -->
+ <dimen name="default_app_widget_padding_left">12dp</dimen>
+ <dimen name="default_app_widget_padding_top">4dp</dimen>
+ <dimen name="default_app_widget_padding_right">12dp</dimen>
+ <dimen name="default_app_widget_padding_bottom">20dp</dimen>
+
<!-- Preference fragment padding, sides -->
<dimen name="preference_fragment_padding_side">32dp</dimen>
<!-- Padding to the left of the preference panel breadcrumb -->
diff --git a/core/res/res/values-w500dp/bools.xml b/core/res/res/values-w500dp/bools.xml
deleted file mode 100644
index f53fd39..0000000
--- a/core/res/res/values-w500dp/bools.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-
-<resources>
- <bool name="activity_chooser_view_has_default_activity">true</bool>
-</resources>
\ No newline at end of file
diff --git a/core/res/res/values/bools.xml b/core/res/res/values/bools.xml
index 6910ebe..f9762b1 100644
--- a/core/res/res/values/bools.xml
+++ b/core/res/res/values/bools.xml
@@ -22,5 +22,4 @@
<bool name="show_ongoing_ime_switcher">true</bool>
<bool name="action_bar_expanded_action_views_exclusive">true</bool>
<bool name="target_honeycomb_needs_options_menu">true</bool>
- <bool name="activity_chooser_view_has_default_activity">false</bool>
</resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 48038dd..a24e345c 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1380,7 +1380,6 @@
<java-symbol type="bool" name="config_wifi_dual_band_support" />
<java-symbol type="bool" name="config_wimaxEnabled" />
<java-symbol type="bool" name="show_ongoing_ime_switcher" />
- <java-symbol type="bool" name="activity_chooser_view_has_default_activity" />
<java-symbol type="color" name="config_defaultNotificationColor" />
<java-symbol type="drawable" name="ic_notification_ime_default" />
<java-symbol type="drawable" name="stat_notify_car_mode" />
diff --git a/core/tests/utillib/src/android/test/BandwidthTestCase.java b/core/tests/utillib/src/android/test/BandwidthTestCase.java
index 4f95f77..c03d9b3 100644
--- a/core/tests/utillib/src/android/test/BandwidthTestCase.java
+++ b/core/tests/utillib/src/android/test/BandwidthTestCase.java
@@ -18,6 +18,7 @@
import android.net.NetworkStats;
import android.net.TrafficStats;
import android.os.Bundle;
+import android.util.Log;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -29,6 +30,7 @@
* as an {@link InstrumentationTestCase}
*/
public class BandwidthTestCase extends InstrumentationTestCase {
+ private static final String TAG = "BandwidthTestCase";
private static final String REPORT_KEY_PACKETS_SENT = "txPackets";
private static final String REPORT_KEY_PACKETS_RECEIVED = "rxPackets";
private static final String REPORT_KEY_BYTES_SENT = "txBytes";
@@ -86,11 +88,26 @@
}
} else if (method.isAnnotationPresent(BandwidthTest.class) ||
testClass.isAnnotationPresent(BandwidthTest.class)) {
- TrafficStats.startDataProfiling(null);
+ /**
+ * If bandwidth profiling fails for whatever reason the test
+ * should be allow to execute to its completion.
+ * Typically bandwidth profiling would fail when a lower level
+ * component is missing, such as the kernel module, for a newly
+ * introduced hardware.
+ */
+ try{
+ TrafficStats.startDataProfiling(null);
+ } catch(IllegalStateException isx){
+ Log.w(TAG, "Failed to start bandwidth profiling");
+ }
runMethod(method, 1, false);
- NetworkStats stats = TrafficStats.stopDataProfiling(null);
- NetworkStats.Entry entry = stats.getTotal(null);
- getInstrumentation().sendStatus(2, getBandwidthStats(entry));
+ try{
+ NetworkStats stats = TrafficStats.stopDataProfiling(null);
+ NetworkStats.Entry entry = stats.getTotal(null);
+ getInstrumentation().sendStatus(2, getBandwidthStats(entry));
+ } catch (IllegalStateException isx){
+ Log.w(TAG, "Failed to collect bandwidth stats");
+ }
} else {
runMethod(method, runCount, isRepetitive);
}
diff --git a/data/fonts/fallback_fonts-ja.xml b/data/fonts/fallback_fonts-ja.xml
index be53d1d..5f9b5ed 100644
--- a/data/fonts/fallback_fonts-ja.xml
+++ b/data/fonts/fallback_fonts-ja.xml
@@ -70,13 +70,28 @@
</family>
<family>
<fileset>
+ <file>DroidSansTamil-Regular.ttf</file>
+ <file>DroidSansTamil-Bold.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>AnjaliNewLipi-light.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
<file>Lohit-Bengali.ttf</file>
</fileset>
</family>
<family>
<fileset>
- <file>DroidSansTamil-Regular.ttf</file>
- <file>DroidSansTamil-Bold.ttf</file>
+ <file>Lohit-Kannada.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>Lohit-Telugu.ttf</file>
</fileset>
</family>
<family>
diff --git a/data/fonts/fallback_fonts.xml b/data/fonts/fallback_fonts.xml
index 80fffa9..5f7017e 100644
--- a/data/fonts/fallback_fonts.xml
+++ b/data/fonts/fallback_fonts.xml
@@ -70,13 +70,28 @@
</family>
<family>
<fileset>
+ <file>DroidSansTamil-Regular.ttf</file>
+ <file>DroidSansTamil-Bold.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>AnjaliNewLipi-light.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
<file>Lohit-Bengali.ttf</file>
</fileset>
</family>
<family>
<fileset>
- <file>DroidSansTamil-Regular.ttf</file>
- <file>DroidSansTamil-Bold.ttf</file>
+ <file>Lohit-Kannada.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>Lohit-Telugu.ttf</file>
</fileset>
</family>
<family>
diff --git a/graphics/java/android/graphics/Rect.java b/graphics/java/android/graphics/Rect.java
index ec911b0..6c204ab 100644
--- a/graphics/java/android/graphics/Rect.java
+++ b/graphics/java/android/graphics/Rect.java
@@ -49,9 +49,9 @@
* checking is performed, so the caller must ensure that left <= right and
* top <= bottom.
*
- * @param left The X coordinate of the left side of the rectagle
+ * @param left The X coordinate of the left side of the rectangle
* @param top The Y coordinate of the top of the rectangle
- * @param right The X coordinate of the right side of the rectagle
+ * @param right The X coordinate of the right side of the rectangle
* @param bottom The Y coordinate of the bottom of the rectangle
*/
public Rect(int left, int top, int right, int bottom) {
@@ -235,9 +235,9 @@
* checking is performed, so it is up to the caller to ensure that
* left <= right and top <= bottom.
*
- * @param left The X coordinate of the left side of the rectagle
+ * @param left The X coordinate of the left side of the rectangle
* @param top The Y coordinate of the top of the rectangle
- * @param right The X coordinate of the right side of the rectagle
+ * @param right The X coordinate of the right side of the rectangle
* @param bottom The Y coordinate of the bottom of the rectangle
*/
public void set(int left, int top, int right, int bottom) {
diff --git a/graphics/java/android/graphics/RectF.java b/graphics/java/android/graphics/RectF.java
index c633d84..108b7f9 100644
--- a/graphics/java/android/graphics/RectF.java
+++ b/graphics/java/android/graphics/RectF.java
@@ -46,9 +46,9 @@
* checking is performed, so the caller must ensure that left <= right and
* top <= bottom.
*
- * @param left The X coordinate of the left side of the rectagle
+ * @param left The X coordinate of the left side of the rectangle
* @param top The Y coordinate of the top of the rectangle
- * @param right The X coordinate of the right side of the rectagle
+ * @param right The X coordinate of the right side of the rectangle
* @param bottom The Y coordinate of the bottom of the rectangle
*/
public RectF(float left, float top, float right, float bottom) {
@@ -182,9 +182,9 @@
* checking is performed, so it is up to the caller to ensure that
* left <= right and top <= bottom.
*
- * @param left The X coordinate of the left side of the rectagle
+ * @param left The X coordinate of the left side of the rectangle
* @param top The Y coordinate of the top of the rectangle
- * @param right The X coordinate of the right side of the rectagle
+ * @param right The X coordinate of the right side of the rectangle
* @param bottom The Y coordinate of the bottom of the rectangle
*/
public void set(float left, float top, float right, float bottom) {
diff --git a/include/androidfw/Input.h b/include/androidfw/Input.h
index aa8b824..2c91fab 100644
--- a/include/androidfw/Input.h
+++ b/include/androidfw/Input.h
@@ -176,7 +176,6 @@
status_t setAxisValue(int32_t axis, float value);
void scale(float scale);
- void lerp(const PointerCoords& a, const PointerCoords& b, float alpha);
inline float getX() const {
return getAxisValue(AMOTION_EVENT_AXIS_X);
diff --git a/include/androidfw/InputTransport.h b/include/androidfw/InputTransport.h
index 2924505..5706bce 100644
--- a/include/androidfw/InputTransport.h
+++ b/include/androidfw/InputTransport.h
@@ -92,6 +92,12 @@
PointerCoords coords;
} pointers[MAX_POINTERS];
+ int32_t getActionId() const {
+ uint32_t index = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK)
+ >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
+ return pointers[index].properties.id;
+ }
+
inline size_t size() const {
return sizeof(Motion) - sizeof(Pointer) * MAX_POINTERS
+ sizeof(Pointer) * pointerCount;
@@ -322,6 +328,10 @@
bool hasPendingBatch() const;
private:
+ // True if touch resampling is enabled.
+ const bool mResampleTouch;
+
+ // The input channel.
sp<InputChannel> mChannel;
// The current input message.
@@ -341,6 +351,7 @@
struct History {
nsecs_t eventTime;
BitSet32 idBits;
+ int32_t idToIndex[MAX_POINTER_ID + 1];
PointerCoords pointers[MAX_POINTERS];
void initializeFrom(const InputMessage* msg) {
@@ -349,10 +360,14 @@
for (size_t i = 0; i < msg->body.motion.pointerCount; i++) {
uint32_t id = msg->body.motion.pointers[i].properties.id;
idBits.markBit(id);
- size_t index = idBits.getIndexOfBit(id);
- pointers[index].copyFrom(msg->body.motion.pointers[i].coords);
+ idToIndex[id] = i;
+ pointers[i].copyFrom(msg->body.motion.pointers[i].coords);
}
}
+
+ const PointerCoords& getPointerById(uint32_t id) const {
+ return pointers[idToIndex[id]];
+ }
};
struct TouchState {
int32_t deviceId;
@@ -360,12 +375,15 @@
size_t historyCurrent;
size_t historySize;
History history[2];
+ History lastResample;
void initialize(int32_t deviceId, int32_t source) {
this->deviceId = deviceId;
this->source = source;
historyCurrent = 0;
historySize = 0;
+ lastResample.eventTime = 0;
+ lastResample.idBits.clear();
}
void addHistory(const InputMessage* msg) {
@@ -398,6 +416,7 @@
Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent);
void updateTouchState(InputMessage* msg);
+ void rewriteMessage(const TouchState& state, InputMessage* msg);
void resampleTouchState(nsecs_t frameTime, MotionEvent* event,
const InputMessage *next);
@@ -412,6 +431,8 @@
static bool canAddSample(const Batch& batch, const InputMessage* msg);
static ssize_t findSampleNoLaterThan(const Batch& batch, nsecs_t time);
static bool shouldResampleTool(int32_t toolType);
+
+ static bool isTouchResamplingEnabled();
};
} // namespace android
diff --git a/include/androidfw/VelocityTracker.h b/include/androidfw/VelocityTracker.h
index 6d17e1f..cbb07829 100644
--- a/include/androidfw/VelocityTracker.h
+++ b/include/androidfw/VelocityTracker.h
@@ -23,19 +23,13 @@
namespace android {
+class VelocityTrackerStrategy;
+
/*
* Calculates the velocity of pointer movements over time.
*/
class VelocityTracker {
public:
- // Default polynomial degree. (used by getVelocity)
- static const uint32_t DEFAULT_DEGREE = 2;
-
- // Default sample horizon. (used by getVelocity)
- // We don't use too much history by default since we want to react to quick
- // changes in direction.
- static const nsecs_t DEFAULT_HORIZON = 100 * 1000000; // 100 ms
-
struct Position {
float x, y;
};
@@ -43,6 +37,9 @@
struct Estimator {
static const size_t MAX_DEGREE = 2;
+ // Estimator time base.
+ nsecs_t time;
+
// Polynomial coefficients describing motion in X and Y.
float xCoeff[MAX_DEGREE + 1], yCoeff[MAX_DEGREE + 1];
@@ -54,6 +51,7 @@
float confidence;
inline void clear() {
+ time = 0;
degree = 0;
confidence = 0;
for (size_t i = 0; i <= MAX_DEGREE; i++) {
@@ -64,6 +62,7 @@
};
VelocityTracker();
+ ~VelocityTracker();
// Resets the velocity tracker state.
void clear();
@@ -88,35 +87,81 @@
// insufficient movement information for the pointer.
bool getVelocity(uint32_t id, float* outVx, float* outVy) const;
- // Gets a quadratic estimator for the movements of the specified pointer id.
+ // Gets an estimator for the recent movements of the specified pointer id.
// Returns false and clears the estimator if there is no information available
// about the pointer.
- bool getEstimator(uint32_t id, uint32_t degree, nsecs_t horizon,
- Estimator* outEstimator) const;
+ bool getEstimator(uint32_t id, Estimator* outEstimator) const;
// Gets the active pointer id, or -1 if none.
inline int32_t getActivePointerId() const { return mActivePointerId; }
// Gets a bitset containing all pointer ids from the most recent movement.
- inline BitSet32 getCurrentPointerIdBits() const { return mMovements[mIndex].idBits; }
+ inline BitSet32 getCurrentPointerIdBits() const { return mCurrentPointerIdBits; }
private:
+ nsecs_t mLastEventTime;
+ BitSet32 mCurrentPointerIdBits;
+ int32_t mActivePointerId;
+ VelocityTrackerStrategy* mStrategy;
+};
+
+
+/*
+ * Implements a particular velocity tracker algorithm.
+ */
+class VelocityTrackerStrategy {
+protected:
+ VelocityTrackerStrategy() { }
+
+public:
+ virtual ~VelocityTrackerStrategy() { }
+
+ virtual void clear() = 0;
+ virtual void clearPointers(BitSet32 idBits) = 0;
+ virtual void addMovement(nsecs_t eventTime, BitSet32 idBits,
+ const VelocityTracker::Position* positions) = 0;
+ virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const = 0;
+};
+
+
+/*
+ * Velocity tracker algorithm based on least-squares linear regression.
+ */
+class LeastSquaresVelocityTrackerStrategy : public VelocityTrackerStrategy {
+public:
+ LeastSquaresVelocityTrackerStrategy();
+ virtual ~LeastSquaresVelocityTrackerStrategy();
+
+ virtual void clear();
+ virtual void clearPointers(BitSet32 idBits);
+ virtual void addMovement(nsecs_t eventTime, BitSet32 idBits,
+ const VelocityTracker::Position* positions);
+ virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const;
+
+private:
+ // Polynomial degree. Must be less than or equal to Estimator::MAX_DEGREE.
+ static const uint32_t DEGREE = 2;
+
+ // Sample horizon.
+ // We don't use too much history by default since we want to react to quick
+ // changes in direction.
+ static const nsecs_t HORIZON = 100 * 1000000; // 100 ms
+
// Number of samples to keep.
static const uint32_t HISTORY_SIZE = 20;
struct Movement {
nsecs_t eventTime;
BitSet32 idBits;
- Position positions[MAX_POINTERS];
+ VelocityTracker::Position positions[MAX_POINTERS];
- inline const Position& getPosition(uint32_t id) const {
+ inline const VelocityTracker::Position& getPosition(uint32_t id) const {
return positions[idBits.getIndexOfBit(id)];
}
};
uint32_t mIndex;
Movement mMovements[HISTORY_SIZE];
- int32_t mActivePointerId;
};
} // namespace android
diff --git a/libs/androidfw/Input.cpp b/libs/androidfw/Input.cpp
index 40a6c47..97b0ec1 100644
--- a/libs/androidfw/Input.cpp
+++ b/libs/androidfw/Input.cpp
@@ -211,26 +211,6 @@
scaleAxisValue(*this, AMOTION_EVENT_AXIS_TOOL_MINOR, scaleFactor);
}
-void PointerCoords::lerp(const PointerCoords& a, const PointerCoords& b, float alpha) {
- bits = 0;
- for (uint64_t bitsRemaining = a.bits | b.bits; bitsRemaining; ) {
- int32_t axis = __builtin_ctz(bitsRemaining);
- uint64_t axisBit = 1LL << axis;
- bitsRemaining &= ~axisBit;
- if (a.bits & axisBit) {
- if (b.bits & axisBit) {
- float aval = a.getAxisValue(axis);
- float bval = b.getAxisValue(axis);
- setAxisValue(axis, aval + alpha * (bval - aval));
- } else {
- setAxisValue(axis, a.getAxisValue(axis));
- }
- } else {
- setAxisValue(axis, b.getAxisValue(axis));
- }
- }
-}
-
#ifdef HAVE_ANDROID_OS
status_t PointerCoords::readFromParcel(Parcel* parcel) {
bits = parcel->readInt64();
diff --git a/libs/androidfw/InputTransport.cpp b/libs/androidfw/InputTransport.cpp
index 9a4182c..351c666 100644
--- a/libs/androidfw/InputTransport.cpp
+++ b/libs/androidfw/InputTransport.cpp
@@ -21,6 +21,7 @@
#include <cutils/log.h>
+#include <cutils/properties.h>
#include <errno.h>
#include <fcntl.h>
#include <androidfw/InputTransport.h>
@@ -43,15 +44,23 @@
// Latency added during resampling. A few milliseconds doesn't hurt much but
// reduces the impact of mispredicted touch positions.
-static const nsecs_t RESAMPLE_LATENCY = 4 * NANOS_PER_MS;
+static const nsecs_t RESAMPLE_LATENCY = 5 * NANOS_PER_MS;
// Minimum time difference between consecutive samples before attempting to resample.
-static const nsecs_t RESAMPLE_MIN_DELTA = 1 * NANOS_PER_MS;
+static const nsecs_t RESAMPLE_MIN_DELTA = 2 * NANOS_PER_MS;
-// Maximum linear interpolation scale value. The larger this is, the more error may
-// potentially be introduced.
-static const float RESAMPLE_MAX_ALPHA = 2.0f;
+// Maximum time to predict forward from the last known state, to avoid predicting too
+// far into the future. This time is further bounded by 50% of the last time delta.
+static const nsecs_t RESAMPLE_MAX_PREDICTION = 8 * NANOS_PER_MS;
+template<typename T>
+inline static T min(const T& a, const T& b) {
+ return a < b ? a : b;
+}
+
+inline static float lerp(float a, float b, float alpha) {
+ return a + alpha * (b - a);
+}
// --- InputMessage ---
@@ -352,12 +361,28 @@
// --- InputConsumer ---
InputConsumer::InputConsumer(const sp<InputChannel>& channel) :
+ mResampleTouch(isTouchResamplingEnabled()),
mChannel(channel), mMsgDeferred(false) {
}
InputConsumer::~InputConsumer() {
}
+bool InputConsumer::isTouchResamplingEnabled() {
+ char value[PROPERTY_VALUE_MAX];
+ int length = property_get("debug.inputconsumer.resample", value, NULL);
+ if (length > 0) {
+ if (!strcmp("0", value)) {
+ return false;
+ }
+ if (strcmp("1", value)) {
+ ALOGD("Unrecognized property value for 'debug.inputconsumer.resample'. "
+ "Use '1' or '0'.");
+ }
+ }
+ return true;
+}
+
status_t InputConsumer::consume(InputEventFactoryInterface* factory,
bool consumeBatches, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent) {
#if DEBUG_TRANSPORT_ACTIONS
@@ -538,18 +563,19 @@
}
void InputConsumer::updateTouchState(InputMessage* msg) {
- if (!(msg->body.motion.source & AINPUT_SOURCE_CLASS_POINTER)) {
+ if (!mResampleTouch ||
+ !(msg->body.motion.source & AINPUT_SOURCE_CLASS_POINTER)) {
return;
}
int32_t deviceId = msg->body.motion.deviceId;
int32_t source = msg->body.motion.source;
+ nsecs_t eventTime = msg->body.motion.eventTime;
- // TODO: Filter the incoming touch event so that it aligns better
- // with prior predictions. Turning RESAMPLE_LATENCY offsets the need
- // for filtering but it would be nice to reduce the latency further.
-
- switch (msg->body.motion.action) {
+ // Update the touch state history to incorporate the new input message.
+ // If the message is in the past relative to the most recently produced resampled
+ // touch, then use the resampled time and coordinates instead.
+ switch (msg->body.motion.action & AMOTION_EVENT_ACTION_MASK) {
case AMOTION_EVENT_ACTION_DOWN: {
ssize_t index = findTouchState(deviceId, source);
if (index < 0) {
@@ -567,6 +593,40 @@
if (index >= 0) {
TouchState& touchState = mTouchStates.editItemAt(index);
touchState.addHistory(msg);
+ if (eventTime < touchState.lastResample.eventTime) {
+ rewriteMessage(touchState, msg);
+ } else {
+ touchState.lastResample.idBits.clear();
+ }
+ }
+ break;
+ }
+
+ case AMOTION_EVENT_ACTION_POINTER_DOWN: {
+ ssize_t index = findTouchState(deviceId, source);
+ if (index >= 0) {
+ TouchState& touchState = mTouchStates.editItemAt(index);
+ touchState.lastResample.idBits.clearBit(msg->body.motion.getActionId());
+ rewriteMessage(touchState, msg);
+ }
+ break;
+ }
+
+ case AMOTION_EVENT_ACTION_POINTER_UP: {
+ ssize_t index = findTouchState(deviceId, source);
+ if (index >= 0) {
+ TouchState& touchState = mTouchStates.editItemAt(index);
+ rewriteMessage(touchState, msg);
+ touchState.lastResample.idBits.clearBit(msg->body.motion.getActionId());
+ }
+ break;
+ }
+
+ case AMOTION_EVENT_ACTION_SCROLL: {
+ ssize_t index = findTouchState(deviceId, source);
+ if (index >= 0) {
+ const TouchState& touchState = mTouchStates.itemAt(index);
+ rewriteMessage(touchState, msg);
}
break;
}
@@ -575,6 +635,8 @@
case AMOTION_EVENT_ACTION_CANCEL: {
ssize_t index = findTouchState(deviceId, source);
if (index >= 0) {
+ const TouchState& touchState = mTouchStates.itemAt(index);
+ rewriteMessage(touchState, msg);
mTouchStates.removeAt(index);
}
break;
@@ -582,13 +644,30 @@
}
}
+void InputConsumer::rewriteMessage(const TouchState& state, InputMessage* msg) {
+ for (size_t i = 0; i < msg->body.motion.pointerCount; i++) {
+ uint32_t id = msg->body.motion.pointers[i].properties.id;
+ if (state.lastResample.idBits.hasBit(id)) {
+ PointerCoords& msgCoords = msg->body.motion.pointers[i].coords;
+ const PointerCoords& resampleCoords = state.lastResample.getPointerById(id);
+#if DEBUG_RESAMPLING
+ ALOGD("[%d] - rewrite (%0.3f, %0.3f), old (%0.3f, %0.3f)", id,
+ resampleCoords.getAxisValue(AMOTION_EVENT_AXIS_X),
+ resampleCoords.getAxisValue(AMOTION_EVENT_AXIS_Y),
+ msgCoords.getAxisValue(AMOTION_EVENT_AXIS_X),
+ msgCoords.getAxisValue(AMOTION_EVENT_AXIS_Y));
+#endif
+ msgCoords.setAxisValue(AMOTION_EVENT_AXIS_X, resampleCoords.getX());
+ msgCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, resampleCoords.getY());
+ }
+ }
+}
+
void InputConsumer::resampleTouchState(nsecs_t sampleTime, MotionEvent* event,
const InputMessage* next) {
- if (event->getAction() != AMOTION_EVENT_ACTION_MOVE
- || !(event->getSource() & AINPUT_SOURCE_CLASS_POINTER)) {
-#if DEBUG_RESAMPLING
- ALOGD("Not resampled, not a move.");
-#endif
+ if (!mResampleTouch
+ || !(event->getSource() & AINPUT_SOURCE_CLASS_POINTER)
+ || event->getAction() != AMOTION_EVENT_ACTION_MOVE) {
return;
}
@@ -608,39 +687,9 @@
return;
}
+ // Ensure that the current sample has all of the pointers that need to be reported.
const History* current = touchState.getHistory(0);
- const History* other;
- History future;
- if (next) {
- future.initializeFrom(next);
- other = &future;
- } else if (touchState.historySize >= 2) {
- other = touchState.getHistory(1);
- } else {
-#if DEBUG_RESAMPLING
- ALOGD("Not resampled, insufficient data.");
-#endif
- return;
- }
-
- nsecs_t delta = current->eventTime - other->eventTime;
- if (delta > -RESAMPLE_MIN_DELTA && delta < RESAMPLE_MIN_DELTA) {
-#if DEBUG_RESAMPLING
- ALOGD("Not resampled, delta time is %lld", delta);
-#endif
- return;
- }
-
- float alpha = float(current->eventTime - sampleTime) / delta;
- if (fabs(alpha) > RESAMPLE_MAX_ALPHA) {
-#if DEBUG_RESAMPLING
- ALOGD("Not resampled, alpha is %f", alpha);
-#endif
- return;
- }
-
size_t pointerCount = event->getPointerCount();
- PointerCoords resampledCoords[MAX_POINTERS];
for (size_t i = 0; i < pointerCount; i++) {
uint32_t id = event->getPointerId(i);
if (!current->idBits.hasBit(id)) {
@@ -649,32 +698,89 @@
#endif
return;
}
- const PointerCoords& currentCoords =
- current->pointers[current->idBits.getIndexOfBit(id)];
+ }
+
+ // Find the data to use for resampling.
+ const History* other;
+ History future;
+ float alpha;
+ if (next) {
+ // Interpolate between current sample and future sample.
+ // So current->eventTime <= sampleTime <= future.eventTime.
+ future.initializeFrom(next);
+ other = &future;
+ nsecs_t delta = future.eventTime - current->eventTime;
+ if (delta < RESAMPLE_MIN_DELTA) {
+#if DEBUG_RESAMPLING
+ ALOGD("Not resampled, delta time is %lld ns.", delta);
+#endif
+ return;
+ }
+ alpha = float(sampleTime - current->eventTime) / delta;
+ } else if (touchState.historySize >= 2) {
+ // Extrapolate future sample using current sample and past sample.
+ // So other->eventTime <= current->eventTime <= sampleTime.
+ other = touchState.getHistory(1);
+ nsecs_t delta = current->eventTime - other->eventTime;
+ if (delta < RESAMPLE_MIN_DELTA) {
+#if DEBUG_RESAMPLING
+ ALOGD("Not resampled, delta time is %lld ns.", delta);
+#endif
+ return;
+ }
+ nsecs_t maxPredict = current->eventTime + min(delta / 2, RESAMPLE_MAX_PREDICTION);
+ if (sampleTime > maxPredict) {
+#if DEBUG_RESAMPLING
+ ALOGD("Sample time is too far in the future, adjusting prediction "
+ "from %lld to %lld ns.",
+ sampleTime - current->eventTime, maxPredict - current->eventTime);
+#endif
+ sampleTime = maxPredict;
+ }
+ alpha = float(current->eventTime - sampleTime) / delta;
+ } else {
+#if DEBUG_RESAMPLING
+ ALOGD("Not resampled, insufficient data.");
+#endif
+ return;
+ }
+
+ // Resample touch coordinates.
+ touchState.lastResample.eventTime = sampleTime;
+ touchState.lastResample.idBits.clear();
+ for (size_t i = 0; i < pointerCount; i++) {
+ uint32_t id = event->getPointerId(i);
+ touchState.lastResample.idToIndex[id] = i;
+ touchState.lastResample.idBits.markBit(id);
+ PointerCoords& resampledCoords = touchState.lastResample.pointers[i];
+ const PointerCoords& currentCoords = current->getPointerById(id);
if (other->idBits.hasBit(id)
&& shouldResampleTool(event->getToolType(i))) {
- const PointerCoords& otherCoords =
- other->pointers[other->idBits.getIndexOfBit(id)];
- resampledCoords[i].lerp(currentCoords, otherCoords, alpha);
+ const PointerCoords& otherCoords = other->getPointerById(id);
+ resampledCoords.copyFrom(currentCoords);
+ resampledCoords.setAxisValue(AMOTION_EVENT_AXIS_X,
+ lerp(currentCoords.getX(), otherCoords.getX(), alpha));
+ resampledCoords.setAxisValue(AMOTION_EVENT_AXIS_Y,
+ lerp(currentCoords.getY(), otherCoords.getY(), alpha));
#if DEBUG_RESAMPLING
ALOGD("[%d] - out (%0.3f, %0.3f), cur (%0.3f, %0.3f), "
"other (%0.3f, %0.3f), alpha %0.3f",
- i, resampledCoords[i].getX(), resampledCoords[i].getY(),
+ id, resampledCoords.getX(), resampledCoords.getY(),
currentCoords.getX(), currentCoords.getY(),
otherCoords.getX(), otherCoords.getY(),
alpha);
#endif
} else {
- resampledCoords[i].copyFrom(currentCoords);
+ resampledCoords.copyFrom(currentCoords);
#if DEBUG_RESAMPLING
ALOGD("[%d] - out (%0.3f, %0.3f), cur (%0.3f, %0.3f)",
- i, resampledCoords[i].getX(), resampledCoords[i].getY(),
+ id, resampledCoords.getX(), resampledCoords.getY(),
currentCoords.getX(), currentCoords.getY());
#endif
}
}
- event->addSample(sampleTime, resampledCoords);
+ event->addSample(sampleTime, touchState.lastResample.pointers);
}
bool InputConsumer::shouldResampleTool(int32_t toolType) {
diff --git a/libs/androidfw/VelocityTracker.cpp b/libs/androidfw/VelocityTracker.cpp
index 2fb094e..5dbafd8 100644
--- a/libs/androidfw/VelocityTracker.cpp
+++ b/libs/androidfw/VelocityTracker.cpp
@@ -33,13 +33,17 @@
namespace android {
-// --- VelocityTracker ---
+// Nanoseconds per milliseconds.
+static const nsecs_t NANOS_PER_MS = 1000000;
-const uint32_t VelocityTracker::DEFAULT_DEGREE;
-const nsecs_t VelocityTracker::DEFAULT_HORIZON;
-const uint32_t VelocityTracker::HISTORY_SIZE;
+// Threshold for determining that a pointer has stopped moving.
+// Some input devices do not send ACTION_MOVE events in the case where a pointer has
+// stopped. We need to detect this case so that we can accurately predict the
+// velocity after the pointer starts moving again.
+static const nsecs_t ASSUME_POINTER_STOPPED_TIME = 40 * NANOS_PER_MS;
-static inline float vectorDot(const float* a, const float* b, uint32_t m) {
+
+static float vectorDot(const float* a, const float* b, uint32_t m) {
float r = 0;
while (m--) {
r += *(a++) * *(b++);
@@ -47,7 +51,7 @@
return r;
}
-static inline float vectorNorm(const float* a, uint32_t m) {
+static float vectorNorm(const float* a, uint32_t m) {
float r = 0;
while (m--) {
float t = *(a++);
@@ -91,45 +95,59 @@
}
#endif
-VelocityTracker::VelocityTracker() {
- clear();
+
+// --- VelocityTracker ---
+
+VelocityTracker::VelocityTracker() :
+ mLastEventTime(0), mCurrentPointerIdBits(0), mActivePointerId(-1),
+ mStrategy(new LeastSquaresVelocityTrackerStrategy()) {
+}
+
+VelocityTracker::~VelocityTracker() {
+ delete mStrategy;
}
void VelocityTracker::clear() {
- mIndex = 0;
- mMovements[0].idBits.clear();
+ mCurrentPointerIdBits.clear();
mActivePointerId = -1;
+
+ mStrategy->clear();
}
void VelocityTracker::clearPointers(BitSet32 idBits) {
- BitSet32 remainingIdBits(mMovements[mIndex].idBits.value & ~idBits.value);
- mMovements[mIndex].idBits = remainingIdBits;
+ BitSet32 remainingIdBits(mCurrentPointerIdBits.value & ~idBits.value);
+ mCurrentPointerIdBits = remainingIdBits;
if (mActivePointerId >= 0 && idBits.hasBit(mActivePointerId)) {
mActivePointerId = !remainingIdBits.isEmpty() ? remainingIdBits.firstMarkedBit() : -1;
}
+
+ mStrategy->clearPointers(idBits);
}
void VelocityTracker::addMovement(nsecs_t eventTime, BitSet32 idBits, const Position* positions) {
- if (++mIndex == HISTORY_SIZE) {
- mIndex = 0;
- }
-
while (idBits.count() > MAX_POINTERS) {
idBits.clearLastMarkedBit();
}
- Movement& movement = mMovements[mIndex];
- movement.eventTime = eventTime;
- movement.idBits = idBits;
- uint32_t count = idBits.count();
- for (uint32_t i = 0; i < count; i++) {
- movement.positions[i] = positions[i];
+ if ((mCurrentPointerIdBits.value & idBits.value)
+ && eventTime >= mLastEventTime + ASSUME_POINTER_STOPPED_TIME) {
+#if DEBUG_VELOCITY
+ ALOGD("VelocityTracker: stopped for %0.3f ms, clearing state.",
+ (eventTime - mLastEventTime) * 0.000001f);
+#endif
+ // We have not received any movements for too long. Assume that all pointers
+ // have stopped.
+ mStrategy->clear();
+ }
+ mLastEventTime = eventTime;
+
+ mCurrentPointerIdBits = idBits;
+ if (mActivePointerId < 0 || !idBits.hasBit(mActivePointerId)) {
+ mActivePointerId = idBits.isEmpty() ? -1 : idBits.firstMarkedBit();
}
- if (mActivePointerId < 0 || !idBits.hasBit(mActivePointerId)) {
- mActivePointerId = count != 0 ? idBits.firstMarkedBit() : -1;
- }
+ mStrategy->addMovement(eventTime, idBits, positions);
#if DEBUG_VELOCITY
ALOGD("VelocityTracker: addMovement eventTime=%lld, idBits=0x%08x, activePointerId=%d",
@@ -139,13 +157,13 @@
uint32_t index = idBits.getIndexOfBit(id);
iterBits.clearBit(id);
Estimator estimator;
- getEstimator(id, DEFAULT_DEGREE, DEFAULT_HORIZON, &estimator);
+ getEstimator(id, &estimator);
ALOGD(" %d: position (%0.3f, %0.3f), "
"estimator (degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f)",
id, positions[index].x, positions[index].y,
int(estimator.degree),
- vectorToString(estimator.xCoeff, estimator.degree).string(),
- vectorToString(estimator.yCoeff, estimator.degree).string(),
+ vectorToString(estimator.xCoeff, estimator.degree + 1).string(),
+ vectorToString(estimator.yCoeff, estimator.degree + 1).string(),
estimator.confidence);
}
#endif
@@ -194,6 +212,11 @@
idBits.markBit(event->getPointerId(i));
}
+ uint32_t pointerIndex[MAX_POINTERS];
+ for (size_t i = 0; i < pointerCount; i++) {
+ pointerIndex[i] = idBits.getIndexOfBit(event->getPointerId(i));
+ }
+
nsecs_t eventTime;
Position positions[pointerCount];
@@ -201,20 +224,77 @@
for (size_t h = 0; h < historySize; h++) {
eventTime = event->getHistoricalEventTime(h);
for (size_t i = 0; i < pointerCount; i++) {
- positions[i].x = event->getHistoricalX(i, h);
- positions[i].y = event->getHistoricalY(i, h);
+ uint32_t index = pointerIndex[i];
+ positions[index].x = event->getHistoricalX(i, h);
+ positions[index].y = event->getHistoricalY(i, h);
}
addMovement(eventTime, idBits, positions);
}
eventTime = event->getEventTime();
for (size_t i = 0; i < pointerCount; i++) {
- positions[i].x = event->getX(i);
- positions[i].y = event->getY(i);
+ uint32_t index = pointerIndex[i];
+ positions[index].x = event->getX(i);
+ positions[index].y = event->getY(i);
}
addMovement(eventTime, idBits, positions);
}
+bool VelocityTracker::getVelocity(uint32_t id, float* outVx, float* outVy) const {
+ Estimator estimator;
+ if (getEstimator(id, &estimator) && estimator.degree >= 1) {
+ *outVx = estimator.xCoeff[1];
+ *outVy = estimator.yCoeff[1];
+ return true;
+ }
+ *outVx = 0;
+ *outVy = 0;
+ return false;
+}
+
+bool VelocityTracker::getEstimator(uint32_t id, Estimator* outEstimator) const {
+ return mStrategy->getEstimator(id, outEstimator);
+}
+
+
+// --- LeastSquaresVelocityTrackerStrategy ---
+
+const uint32_t LeastSquaresVelocityTrackerStrategy::DEGREE;
+const nsecs_t LeastSquaresVelocityTrackerStrategy::HORIZON;
+const uint32_t LeastSquaresVelocityTrackerStrategy::HISTORY_SIZE;
+
+LeastSquaresVelocityTrackerStrategy::LeastSquaresVelocityTrackerStrategy() {
+ clear();
+}
+
+LeastSquaresVelocityTrackerStrategy::~LeastSquaresVelocityTrackerStrategy() {
+}
+
+void LeastSquaresVelocityTrackerStrategy::clear() {
+ mIndex = 0;
+ mMovements[0].idBits.clear();
+}
+
+void LeastSquaresVelocityTrackerStrategy::clearPointers(BitSet32 idBits) {
+ BitSet32 remainingIdBits(mMovements[mIndex].idBits.value & ~idBits.value);
+ mMovements[mIndex].idBits = remainingIdBits;
+}
+
+void LeastSquaresVelocityTrackerStrategy::addMovement(nsecs_t eventTime, BitSet32 idBits,
+ const VelocityTracker::Position* positions) {
+ if (++mIndex == HISTORY_SIZE) {
+ mIndex = 0;
+ }
+
+ Movement& movement = mMovements[mIndex];
+ movement.eventTime = eventTime;
+ movement.idBits = idBits;
+ uint32_t count = idBits.count();
+ for (uint32_t i = 0; i < count; i++) {
+ movement.positions[i] = positions[i];
+ }
+}
+
/**
* Solves a linear least squares problem to obtain a N degree polynomial that fits
* the specified input data as nearly as possible.
@@ -361,22 +441,8 @@
return true;
}
-bool VelocityTracker::getVelocity(uint32_t id, float* outVx, float* outVy) const {
- Estimator estimator;
- if (getEstimator(id, DEFAULT_DEGREE, DEFAULT_HORIZON, &estimator)) {
- if (estimator.degree >= 1) {
- *outVx = estimator.xCoeff[1];
- *outVy = estimator.yCoeff[1];
- return true;
- }
- }
- *outVx = 0;
- *outVy = 0;
- return false;
-}
-
-bool VelocityTracker::getEstimator(uint32_t id, uint32_t degree, nsecs_t horizon,
- Estimator* outEstimator) const {
+bool LeastSquaresVelocityTrackerStrategy::getEstimator(uint32_t id,
+ VelocityTracker::Estimator* outEstimator) const {
outEstimator->clear();
// Iterate over movement samples in reverse time order and collect samples.
@@ -393,11 +459,11 @@
}
nsecs_t age = newestMovement.eventTime - movement.eventTime;
- if (age > horizon) {
+ if (age > HORIZON) {
break;
}
- const Position& position = movement.getPosition(id);
+ const VelocityTracker::Position& position = movement.getPosition(id);
x[m] = position.x;
y[m] = position.y;
time[m] = -age * 0.000000001f;
@@ -409,9 +475,7 @@
}
// Calculate a least squares polynomial fit.
- if (degree > Estimator::MAX_DEGREE) {
- degree = Estimator::MAX_DEGREE;
- }
+ uint32_t degree = DEGREE;
if (degree > m - 1) {
degree = m - 1;
}
@@ -420,6 +484,7 @@
uint32_t n = degree + 1;
if (solveLeastSquares(time, x, m, n, outEstimator->xCoeff, &xdet)
&& solveLeastSquares(time, y, m, n, outEstimator->yCoeff, &ydet)) {
+ outEstimator->time = newestMovement.eventTime;
outEstimator->degree = degree;
outEstimator->confidence = xdet * ydet;
#if DEBUG_LEAST_SQUARES
@@ -436,6 +501,7 @@
// No velocity data available for this pointer, but we do have its current position.
outEstimator->xCoeff[0] = x[0];
outEstimator->yCoeff[0] = y[0];
+ outEstimator->time = newestMovement.eventTime;
outEstimator->degree = 0;
outEstimator->confidence = 1;
return true;
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index 123695a..f210820 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -48,25 +48,9 @@
///////////////////////////////////////////////////////////////////////////////
Caches::Caches(): Singleton<Caches>(), mInitialized(false) {
- GLint maxTextureUnits;
- glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
- if (maxTextureUnits < REQUIRED_TEXTURE_UNITS_COUNT) {
- ALOGW("At least %d texture units are required!", REQUIRED_TEXTURE_UNITS_COUNT);
- }
-
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
-
- if (extensions.hasDebugMarker()) {
- eventMark = glInsertEventMarkerEXT;
- startMark = glPushGroupMarkerEXT;
- endMark = glPopGroupMarkerEXT;
- } else {
- eventMark = eventMarkNull;
- startMark = startMarkNull;
- endMark = endMarkNull;
- }
-
init();
+ initExtensions();
+ initConstraints();
mDebugLevel = readDebugLevel();
ALOGD("Enabling debug mode %d", mDebugLevel);
@@ -105,6 +89,36 @@
mInitialized = true;
}
+void Caches::initExtensions() {
+ if (extensions.hasDebugMarker()) {
+ eventMark = glInsertEventMarkerEXT;
+ startMark = glPushGroupMarkerEXT;
+ endMark = glPopGroupMarkerEXT;
+ } else {
+ eventMark = eventMarkNull;
+ startMark = startMarkNull;
+ endMark = endMarkNull;
+ }
+
+ if (extensions.hasDebugLabel()) {
+ setLabel = glLabelObjectEXT;
+ getLabel = glGetObjectLabelEXT;
+ } else {
+ setLabel = setLabelNull;
+ getLabel = getLabelNull;
+ }
+}
+
+void Caches::initConstraints() {
+ GLint maxTextureUnits;
+ glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
+ if (maxTextureUnits < REQUIRED_TEXTURE_UNITS_COUNT) {
+ ALOGW("At least %d texture units are required!", REQUIRED_TEXTURE_UNITS_COUNT);
+ }
+
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
+}
+
void Caches::terminate() {
if (!mInitialized) return;
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h
index 65ff9ad..58361c9 100644
--- a/libs/hwui/Caches.h
+++ b/libs/hwui/Caches.h
@@ -107,7 +107,7 @@
};
/**
- * Initializes the cache.
+ * Initialize caches.
*/
void init();
@@ -247,15 +247,30 @@
GammaFontRenderer fontRenderer;
ResourceCache resourceCache;
+ // Debug methods
PFNGLINSERTEVENTMARKEREXTPROC eventMark;
PFNGLPUSHGROUPMARKEREXTPROC startMark;
PFNGLPOPGROUPMARKEREXTPROC endMark;
+ PFNGLLABELOBJECTEXTPROC setLabel;
+ PFNGLGETOBJECTLABELEXTPROC getLabel;
+
private:
- static void eventMarkNull(GLsizei length, const GLchar *marker) { }
- static void startMarkNull(GLsizei length, const GLchar *marker) { }
+ void initExtensions();
+ void initConstraints();
+
+ static void eventMarkNull(GLsizei length, const GLchar* marker) { }
+ static void startMarkNull(GLsizei length, const GLchar* marker) { }
static void endMarkNull() { }
+ static void setLabelNull(GLenum type, uint object, GLsizei length,
+ const char* label) { }
+ static void getLabelNull(GLenum type, uint object, GLsizei bufferSize,
+ GLsizei* length, char* label) {
+ if (length) *length = 0;
+ if (label) *label = '\0';
+ }
+
GLuint mCurrentBuffer;
GLuint mCurrentIndicesBuffer;
void* mCurrentPositionPointer;
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index f6ca77c..a5f653a 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -49,6 +49,7 @@
"DrawBitmap",
"DrawBitmapMatrix",
"DrawBitmapRect",
+ "DrawBitmapData",
"DrawBitmapMesh",
"DrawPatch",
"DrawColor",
@@ -161,6 +162,13 @@
}
mBitmapResources.clear();
+ for (size_t i = 0; i < mOwnedBitmapResources.size(); i++) {
+ SkBitmap* bitmap = mOwnedBitmapResources.itemAt(i);
+ caches.resourceCache.decrementRefcount(bitmap);
+ caches.resourceCache.destructor(bitmap);
+ }
+ mOwnedBitmapResources.clear();
+
for (size_t i = 0; i < mFilterResources.size(); i++) {
caches.resourceCache.decrementRefcount(mFilterResources.itemAt(i));
}
@@ -216,44 +224,51 @@
Caches& caches = Caches::getInstance();
- const Vector<SkBitmap*> &bitmapResources = recorder.getBitmapResources();
+ const Vector<SkBitmap*>& bitmapResources = recorder.getBitmapResources();
for (size_t i = 0; i < bitmapResources.size(); i++) {
SkBitmap* resource = bitmapResources.itemAt(i);
mBitmapResources.add(resource);
caches.resourceCache.incrementRefcount(resource);
}
- const Vector<SkiaColorFilter*> &filterResources = recorder.getFilterResources();
+ const Vector<SkBitmap*> &ownedBitmapResources = recorder.getOwnedBitmapResources();
+ for (size_t i = 0; i < ownedBitmapResources.size(); i++) {
+ SkBitmap* resource = ownedBitmapResources.itemAt(i);
+ mOwnedBitmapResources.add(resource);
+ caches.resourceCache.incrementRefcount(resource);
+ }
+
+ const Vector<SkiaColorFilter*>& filterResources = recorder.getFilterResources();
for (size_t i = 0; i < filterResources.size(); i++) {
SkiaColorFilter* resource = filterResources.itemAt(i);
mFilterResources.add(resource);
caches.resourceCache.incrementRefcount(resource);
}
- const Vector<SkiaShader*> &shaders = recorder.getShaders();
+ const Vector<SkiaShader*>& shaders = recorder.getShaders();
for (size_t i = 0; i < shaders.size(); i++) {
SkiaShader* resource = shaders.itemAt(i);
mShaders.add(resource);
caches.resourceCache.incrementRefcount(resource);
}
- const Vector<SkPaint*> &paints = recorder.getPaints();
+ const Vector<SkPaint*>& paints = recorder.getPaints();
for (size_t i = 0; i < paints.size(); i++) {
mPaints.add(paints.itemAt(i));
}
- const Vector<SkPath*> &paths = recorder.getPaths();
+ const Vector<SkPath*>& paths = recorder.getPaths();
for (size_t i = 0; i < paths.size(); i++) {
mPaths.add(paths.itemAt(i));
}
- const SortedVector<SkPath*> &sourcePaths = recorder.getSourcePaths();
+ const SortedVector<SkPath*>& sourcePaths = recorder.getSourcePaths();
for (size_t i = 0; i < sourcePaths.size(); i++) {
mSourcePaths.add(sourcePaths.itemAt(i));
caches.resourceCache.incrementRefcount(sourcePaths.itemAt(i));
}
- const Vector<SkMatrix*> &matrices = recorder.getMatrices();
+ const Vector<SkMatrix*>& matrices = recorder.getMatrices();
for (size_t i = 0; i < matrices.size(); i++) {
mMatrices.add(matrices.itemAt(i));
}
@@ -434,6 +449,14 @@
(char*) indent, OP_NAMES[op], bitmap, f1, f2, f3, f4, f5, f6, f7, f8, paint);
}
break;
+ case DrawBitmapData: {
+ SkBitmap* bitmap = getBitmapData();
+ float x = getFloat();
+ float y = getFloat();
+ SkPaint* paint = getPaint(renderer);
+ ALOGD("%s%s %.2f, %.2f, %p", (char*) indent, OP_NAMES[op], x, y, paint);
+ }
+ break;
case DrawBitmapMesh: {
int verticesCount = 0;
uint32_t colorsCount = 0;
@@ -1020,6 +1043,16 @@
renderer.drawBitmap(bitmap, f1, f2, f3, f4, f5, f6, f7, f8, paint);
}
break;
+ case DrawBitmapData: {
+ SkBitmap* bitmap = getBitmapData();
+ float x = getFloat();
+ float y = getFloat();
+ SkPaint* paint = getPaint(renderer);
+ DISPLAY_LIST_LOGD("%s%s %p, %.2f, %.2f, %p", (char*) indent, OP_NAMES[op],
+ bitmap, x, y, paint);
+ renderer.drawBitmap(bitmap, x, y, paint);
+ }
+ break;
case DrawBitmapMesh: {
int32_t verticesCount = 0;
uint32_t colorsCount = 0;
@@ -1273,6 +1306,12 @@
}
mBitmapResources.clear();
+ for (size_t i = 0; i < mOwnedBitmapResources.size(); i++) {
+ SkBitmap* bitmap = mOwnedBitmapResources.itemAt(i);
+ caches.resourceCache.decrementRefcount(bitmap);
+ }
+ mOwnedBitmapResources.clear();
+
for (size_t i = 0; i < mFilterResources.size(); i++) {
caches.resourceCache.decrementRefcount(mFilterResources.itemAt(i));
}
@@ -1314,6 +1353,10 @@
return displayList;
}
+bool DisplayListRenderer::isDeferred() {
+ return true;
+}
+
void DisplayListRenderer::setViewport(int width, int height) {
mOrthoMatrix.loadOrtho(0, width, height, 0, -1, 1);
@@ -1487,6 +1530,15 @@
addSkip(location);
}
+void DisplayListRenderer::drawBitmapData(SkBitmap* bitmap, float left, float top, SkPaint* paint) {
+ const bool reject = quickReject(left, top, left + bitmap->width(), bitmap->height());
+ uint32_t* location = addOp(DisplayList::DrawBitmapData, reject);
+ addBitmapData(bitmap);
+ addPoint(left, top);
+ addPaint(paint);
+ addSkip(location);
+}
+
void DisplayListRenderer::drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int meshHeight,
float* vertices, int* colors, SkPaint* paint) {
addOp(DisplayList::DrawBitmapMesh);
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 5ce770d..93b065d 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -91,6 +91,7 @@
DrawBitmap,
DrawBitmapMatrix,
DrawBitmapRect,
+ DrawBitmapData,
DrawBitmapMesh,
DrawPatch,
DrawColor,
@@ -397,7 +398,6 @@
private:
void init();
-
void initProperties();
void clearResources();
@@ -422,6 +422,10 @@
return (SkBitmap*) getInt();
}
+ SkBitmap* getBitmapData() {
+ return (SkBitmap*) getInt();
+ }
+
SkiaShader* getShader() {
return (SkiaShader*) getInt();
}
@@ -483,6 +487,7 @@
}
Vector<SkBitmap*> mBitmapResources;
+ Vector<SkBitmap*> mOwnedBitmapResources;
Vector<SkiaColorFilter*> mFilterResources;
Vector<SkPaint*> mPaints;
@@ -538,6 +543,8 @@
ANDROID_API DisplayList* getDisplayList(DisplayList* displayList);
+ virtual bool isDeferred();
+
virtual void setViewport(int width, int height);
virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque);
virtual void finish();
@@ -574,6 +581,7 @@
virtual void drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
float srcRight, float srcBottom, float dstLeft, float dstTop,
float dstRight, float dstBottom, SkPaint* paint);
+ virtual void drawBitmapData(SkBitmap* bitmap, float left, float top, SkPaint* paint);
virtual void drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int meshHeight,
float* vertices, int* colors, SkPaint* paint);
virtual void drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs,
@@ -619,6 +627,10 @@
return mBitmapResources;
}
+ const Vector<SkBitmap*>& getOwnedBitmapResources() const {
+ return mOwnedBitmapResources;
+ }
+
const Vector<SkiaColorFilter*>& getFilterResources() const {
return mFilterResources;
}
@@ -701,16 +713,12 @@
void addInts(const int32_t* values, uint32_t count) {
mWriter.writeInt(count);
- for (uint32_t i = 0; i < count; i++) {
- mWriter.writeInt(values[i]);
- }
+ mWriter.write(values, count * sizeof(int32_t));
}
void addUInts(const uint32_t* values, int8_t count) {
mWriter.writeInt(count);
- for (int8_t i = 0; i < count; i++) {
- mWriter.writeInt(values[i]);
- }
+ mWriter.write(values, count * sizeof(uint32_t));
}
inline void addFloat(float value) {
@@ -719,9 +727,7 @@
void addFloats(const float* values, int32_t count) {
mWriter.writeInt(count);
- for (int32_t i = 0; i < count; i++) {
- mWriter.writeScalar(values[i]);
- }
+ mWriter.write(values, count * sizeof(float));
}
inline void addPoint(float x, float y) {
@@ -805,6 +811,12 @@
Caches::getInstance().resourceCache.incrementRefcount(bitmap);
}
+ void addBitmapData(SkBitmap* bitmap) {
+ addInt((int) bitmap);
+ mOwnedBitmapResources.add(bitmap);
+ Caches::getInstance().resourceCache.incrementRefcount(bitmap);
+ }
+
inline void addShader(SkiaShader* shader) {
if (!shader) {
addInt((int) NULL);
@@ -831,6 +843,7 @@
}
Vector<SkBitmap*> mBitmapResources;
+ Vector<SkBitmap*> mOwnedBitmapResources;
Vector<SkiaColorFilter*> mFilterResources;
Vector<SkPaint*> mPaints;
diff --git a/libs/hwui/Extensions.h b/libs/hwui/Extensions.h
index f11fecc..6b174d6 100644
--- a/libs/hwui/Extensions.h
+++ b/libs/hwui/Extensions.h
@@ -40,7 +40,6 @@
#endif
// Vendor strings
-
#define VENDOR_IMG "Imagination Technologies"
///////////////////////////////////////////////////////////////////////////////
@@ -68,6 +67,7 @@
mHasFramebufferFetch = hasExtension("GL_NV_shader_framebuffer_fetch");
mHasDiscardFramebuffer = hasExtension("GL_EXT_discard_framebuffer");
mHasDebugMarker = hasExtension("GL_EXT_debug_marker");
+ mHasDebugLabel = hasExtension("GL_EXT_debug_label");
const char* vendor = (const char*) glGetString(GL_VENDOR);
EXT_LOGD("Vendor: %s", vendor);
@@ -84,6 +84,7 @@
inline bool needsHighpTexCoords() const { return mNeedsHighpTexCoords; }
inline bool hasDiscardFramebuffer() const { return mHasDiscardFramebuffer; }
inline bool hasDebugMarker() const { return mHasDebugMarker; }
+ inline bool hasDebugLabel() const { return mHasDebugLabel; }
bool hasExtension(const char* extension) const {
const String8 s(extension);
@@ -104,6 +105,7 @@
bool mHasFramebufferFetch;
bool mHasDiscardFramebuffer;
bool mHasDebugMarker;
+ bool mHasDebugLabel;
}; // class Extensions
}; // namespace uirenderer
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index 9e7fbb5..a0bf8e3 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -540,9 +540,11 @@
issueDrawCommand();
mCurrentQuadIndex = 0;
}
+
for (uint32_t i = 0; i < mActiveFonts.size(); i++) {
mActiveFonts[i]->invalidateTextureCache();
}
+
for (uint32_t i = 0; i < mCacheLines.size(); i++) {
mCacheLines[i]->mCurrentCol = 0;
}
@@ -551,8 +553,9 @@
void FontRenderer::deallocateTextureMemory(CacheTexture *cacheTexture) {
if (cacheTexture && cacheTexture->mTexture) {
glDeleteTextures(1, &cacheTexture->mTextureId);
- delete cacheTexture->mTexture;
+ delete[] cacheTexture->mTexture;
cacheTexture->mTexture = NULL;
+ cacheTexture->mTextureId = 0;
}
}
@@ -582,11 +585,19 @@
deallocateTextureMemory(mCacheTexture512);
}
-void FontRenderer::allocateTextureMemory(CacheTexture *cacheTexture) {
+void FontRenderer::allocateTextureMemory(CacheTexture* cacheTexture) {
int width = cacheTexture->mWidth;
int height = cacheTexture->mHeight;
+
cacheTexture->mTexture = new uint8_t[width * height];
+#if DEBUG_FONT_RENDERER
memset(cacheTexture->mTexture, 0, width * height * sizeof(uint8_t));
+#endif
+
+ if (!cacheTexture->mTextureId) {
+ glGenTextures(1, &cacheTexture->mTextureId);
+ }
+
glBindTexture(GL_TEXTURE_2D, cacheTexture->mTextureId);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
// Initialize texture dimensions
@@ -654,11 +665,12 @@
uint32_t cacheWidth = cacheLine->mMaxWidth;
- CacheTexture *cacheTexture = cacheLine->mCacheTexture;
- if (cacheTexture->mTexture == NULL) {
+ CacheTexture* cacheTexture = cacheLine->mCacheTexture;
+ if (!cacheTexture->mTexture) {
// Large-glyph texture memory is allocated only as needed
allocateTextureMemory(cacheTexture);
}
+
uint8_t* cacheBuffer = cacheTexture->mTexture;
uint8_t* bitmapBuffer = (uint8_t*) glyph.fImage;
unsigned int stride = glyph.rowBytes();
@@ -675,34 +687,39 @@
}
CacheTexture* FontRenderer::createCacheTexture(int width, int height, bool allocate) {
- GLuint textureId;
- glGenTextures(1, &textureId);
uint8_t* textureMemory = NULL;
+ CacheTexture* cacheTexture = new CacheTexture(textureMemory, width, height);
- CacheTexture* cacheTexture = new CacheTexture(textureMemory, textureId, width, height);
if (allocate) {
allocateTextureMemory(cacheTexture);
}
+
return cacheTexture;
}
void FontRenderer::initTextTexture() {
+ for (uint32_t i = 0; i < mCacheLines.size(); i++) {
+ delete mCacheLines[i];
+ }
mCacheLines.clear();
+ if (mCacheTextureSmall) {
+ delete mCacheTextureSmall;
+ delete mCacheTexture128;
+ delete mCacheTexture256;
+ delete mCacheTexture512;
+ }
+
// Next, use other, separate caches for large glyphs.
uint16_t maxWidth = 0;
if (Caches::hasInstance()) {
maxWidth = Caches::getInstance().maxTextureSize;
}
+
if (maxWidth > MAX_TEXT_CACHE_WIDTH || maxWidth == 0) {
maxWidth = MAX_TEXT_CACHE_WIDTH;
}
- if (mCacheTextureSmall != NULL) {
- delete mCacheTextureSmall;
- delete mCacheTexture128;
- delete mCacheTexture256;
- delete mCacheTexture512;
- }
+
mCacheTextureSmall = createCacheTexture(mSmallCacheWidth, mSmallCacheHeight, true);
mCacheTexture128 = createCacheTexture(maxWidth, 256, false);
mCacheTexture256 = createCacheTexture(maxWidth, 256, false);
@@ -776,12 +793,6 @@
initTextTexture();
initVertexArrayBuffers();
- // We store a string with letters in a rough frequency of occurrence
- mLatinPrecache = String16("eisarntolcdugpmhbyfvkwzxjq ");
- mLatinPrecache += String16("EISARNTOLCDUGPMHBYFVKWZXJQ");
- mLatinPrecache += String16(",.?!()-+@;:'");
- mLatinPrecache += String16("0123456789");
-
mInitialized = true;
}
@@ -944,11 +955,19 @@
void FontRenderer::precacheLatin(SkPaint* paint) {
// Remaining capacity is measured in %
uint32_t remainingCapacity = getRemainingCacheCapacity();
- uint32_t precacheIdx = 0;
- while (remainingCapacity > 25 && precacheIdx < mLatinPrecache.size()) {
- mCurrentFont->getCachedGlyph(paint, (int32_t) mLatinPrecache[precacheIdx]);
+ uint32_t precacheIndex = 0;
+
+ // We store a string with letters in a rough frequency of occurrence
+ String16 l("eisarntolcdugpmhbyfvkwzxjq EISARNTOLCDUGPMHBYFVKWZXJQ,.?!()-+@;:'0123456789");
+
+ size_t size = l.size();
+ uint16_t latin[size];
+ paint->utfToGlyphs(l.string(), SkPaint::kUTF16_TextEncoding, size * sizeof(char16_t), latin);
+
+ while (remainingCapacity > 25 && precacheIndex < size) {
+ mCurrentFont->getCachedGlyph(paint, TO_GLYPH(latin[precacheIndex]));
remainingCapacity = getRemainingCacheCapacity();
- precacheIdx ++;
+ precacheIndex++;
}
}
diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h
index 4fc5862..2ab680e 100644
--- a/libs/hwui/FontRenderer.h
+++ b/libs/hwui/FontRenderer.h
@@ -41,11 +41,13 @@
#if RENDER_TEXT_AS_GLYPHS
typedef uint16_t glyph_t;
+ #define TO_GLYPH(g) g
#define GET_METRICS(paint, glyph) paint->getGlyphMetrics(glyph)
#define GET_GLYPH(text) nextGlyph((const uint16_t**) &text)
#define IS_END_OF_STRING(glyph) false
#else
typedef SkUnichar glyph_t;
+ #define TO_GLYPH(g) ((SkUnichar) g)
#define GET_METRICS(paint, glyph) paint->getUnicharMetrics(glyph)
#define GET_GLYPH(text) SkUTF16_NextUnichar((const uint16_t**) &text)
#define IS_END_OF_STRING(glyph) glyph < 0
@@ -59,15 +61,15 @@
class CacheTexture {
public:
- CacheTexture(){}
- CacheTexture(uint8_t* texture, GLuint textureId, uint16_t width, uint16_t height) :
- mTexture(texture), mTextureId(textureId), mWidth(width), mHeight(height),
- mLinearFiltering(false) {}
+ CacheTexture() { }
+ CacheTexture(uint8_t* texture, uint16_t width, uint16_t height) :
+ mTexture(texture), mTextureId(0), mWidth(width), mHeight(height),
+ mLinearFiltering(false) { }
~CacheTexture() {
- if (mTexture != NULL) {
+ if (mTexture) {
delete[] mTexture;
}
- if (mTextureId != 0) {
+ if (mTextureId) {
glDeleteTextures(1, &mTextureId);
}
}
@@ -88,7 +90,7 @@
mCurrentRow(currentRow),
mCurrentCol(currentCol),
mDirty(false),
- mCacheTexture(cacheTexture){
+ mCacheTexture(cacheTexture) {
}
bool fitBitmap(const SkGlyph& glyph, uint32_t *retOriginX, uint32_t *retOriginY);
@@ -98,7 +100,7 @@
uint32_t mCurrentRow;
uint32_t mCurrentCol;
bool mDirty;
- CacheTexture *mCacheTexture;
+ CacheTexture* mCacheTexture;
};
struct CachedGlyphInfo {
@@ -236,8 +238,6 @@
FontRenderer();
~FontRenderer();
- void init();
- void deinit();
void flushLargeCaches();
void setGammaTable(const uint8_t* gammaTable) {
@@ -278,6 +278,7 @@
GLuint getTexture(bool linearFiltering = false) {
checkInit();
+
if (linearFiltering != mCurrentCacheTexture->mLinearFiltering) {
mCurrentCacheTexture->mLinearFiltering = linearFiltering;
mLinearFiltering = linearFiltering;
@@ -287,6 +288,7 @@
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
}
+
return mCurrentCacheTexture->mTextureId;
}
@@ -326,7 +328,6 @@
void initRender(const Rect* clip, Rect* bounds);
void finishRender();
- String16 mLatinPrecache;
void precacheLatin(SkPaint* paint);
void issueDrawCommand();
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index da2192f..50f5d57 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -144,6 +144,10 @@
return STENCIL_BUFFER_SIZE;
}
+bool OpenGLRenderer::isDeferred() {
+ return false;
+}
+
void OpenGLRenderer::setViewport(int width, int height) {
mOrthoMatrix.loadOrtho(0, width, height, 0, -1, 1);
@@ -1502,6 +1506,21 @@
restore();
}
+void OpenGLRenderer::drawBitmapData(SkBitmap* bitmap, float left, float top, SkPaint* paint) {
+ const float right = left + bitmap->width();
+ const float bottom = top + bitmap->height();
+
+ if (quickReject(left, top, right, bottom)) {
+ return;
+ }
+
+ mCaches.activeTexture(0);
+ Texture* texture = mCaches.textureCache.getTransient(bitmap);
+ const AutoTexture autoCleanup(texture);
+
+ drawTextureRect(left, top, right, bottom, texture, paint);
+}
+
void OpenGLRenderer::drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int meshHeight,
float* vertices, int* colors, SkPaint* paint) {
// TODO: Do a quickReject
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 18a6923..ab324ff 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -63,6 +63,8 @@
ANDROID_API OpenGLRenderer();
virtual ~OpenGLRenderer();
+ virtual bool isDeferred();
+
virtual void setViewport(int width, int height);
ANDROID_API void prepare(bool opaque);
@@ -115,6 +117,7 @@
virtual void drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
float srcRight, float srcBottom, float dstLeft, float dstTop,
float dstRight, float dstBottom, SkPaint* paint);
+ virtual void drawBitmapData(SkBitmap* bitmap, float left, float top, SkPaint* paint);
virtual void drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int meshHeight,
float* vertices, int* colors, SkPaint* paint);
virtual void drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs,
diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp
index 9ffad88..cf5f822 100644
--- a/libs/hwui/ResourceCache.cpp
+++ b/libs/hwui/ResourceCache.cpp
@@ -59,11 +59,11 @@
void ResourceCache::incrementRefcount(SkBitmap* bitmapResource) {
SkSafeRef(bitmapResource->pixelRef());
SkSafeRef(bitmapResource->getColorTable());
- incrementRefcount((void*)bitmapResource, kBitmap);
+ incrementRefcount((void*) bitmapResource, kBitmap);
}
void ResourceCache::incrementRefcount(SkPath* pathResource) {
- incrementRefcount((void*)pathResource, kPath);
+ incrementRefcount((void*) pathResource, kPath);
}
void ResourceCache::incrementRefcount(SkiaShader* shaderResource) {
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp
index cc09aae..9fb61e4 100644
--- a/libs/hwui/TextureCache.cpp
+++ b/libs/hwui/TextureCache.cpp
@@ -160,6 +160,16 @@
return texture;
}
+Texture* TextureCache::getTransient(SkBitmap* bitmap) {
+ Texture* texture = new Texture;
+ texture->bitmapSize = bitmap->rowBytes() * bitmap->height();
+ texture->cleanup = true;
+
+ generateTexture(bitmap, texture, false);
+
+ return texture;
+}
+
void TextureCache::remove(SkBitmap* bitmap) {
mCache.remove(bitmap);
}
diff --git a/libs/hwui/TextureCache.h b/libs/hwui/TextureCache.h
index 10a05e0..31a2e3d 100644
--- a/libs/hwui/TextureCache.h
+++ b/libs/hwui/TextureCache.h
@@ -67,6 +67,11 @@
*/
Texture* get(SkBitmap* bitmap);
/**
+ * Returns the texture associated with the specified bitmap. The generated
+ * texture is not kept in the cache. The caller must destroy the texture.
+ */
+ Texture* getTransient(SkBitmap* bitmap);
+ /**
* Removes the texture associated with the specified bitmap.
* Upon remove the texture is freed.
*/
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index f412b9b..8da7d0f 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -33,6 +33,7 @@
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothHeadset;
import android.bluetooth.BluetoothProfile;
+import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -700,6 +701,10 @@
// Check if the ringer mode changes with this volume adjustment. If
// it does, it will handle adjusting the volume, so we won't below
adjustVolume = checkForRingerModeChange(aliasIndex, direction, step);
+ if ((streamTypeAlias == getMasterStreamType()) &&
+ (mRingerMode == AudioManager.RINGER_MODE_SILENT)) {
+ streamState.setLastAudibleIndex(0, device);
+ }
}
// If stream is muted, adjust last audible index only
@@ -3607,24 +3612,20 @@
// RemoteControl
//==========================================================================================
public void dispatchMediaKeyEvent(KeyEvent keyEvent) {
- dispatchMediaKeyEvent(keyEvent, false /*needWakeLock*/);
+ filterMediaKeyEvent(keyEvent, false /*needWakeLock*/);
}
public void dispatchMediaKeyEventUnderWakelock(KeyEvent keyEvent) {
- dispatchMediaKeyEvent(keyEvent, true /*needWakeLock*/);
+ filterMediaKeyEvent(keyEvent, true /*needWakeLock*/);
}
- /**
- * Handles the dispatching of the media button events to one of the registered listeners,
- * or if there was none, broadcast a ACTION_MEDIA_BUTTON intent to the rest of the system.
- */
- private void dispatchMediaKeyEvent(KeyEvent keyEvent, boolean needWakeLock) {
+ private void filterMediaKeyEvent(KeyEvent keyEvent, boolean needWakeLock) {
// sanity check on the incoming key event
if (!isValidMediaKeyEvent(keyEvent)) {
Log.e(TAG, "not dispatching invalid media key event " + keyEvent);
return;
}
- // event filtering
+ // event filtering based on audio mode
synchronized(mRingingLock) {
if (mIsRinging || (getMode() == AudioSystem.MODE_IN_CALL) ||
(getMode() == AudioSystem.MODE_IN_COMMUNICATION) ||
@@ -3632,6 +3633,22 @@
return;
}
}
+ // event filtering based on voice-based interactions
+ if (isValidVoiceInputKeyCode(keyEvent.getKeyCode())) {
+ filterVoiceInputKeyEvent(keyEvent, needWakeLock);
+ } else {
+ dispatchMediaKeyEvent(keyEvent, needWakeLock);
+ }
+ }
+
+ /**
+ * Handles the dispatching of the media button events to one of the registered listeners,
+ * or if there was none, broadcast an ACTION_MEDIA_BUTTON intent to the rest of the system.
+ * @param keyEvent a non-null KeyEvent whose key code is one of the supported media buttons
+ * @param needWakeLock true if a PARTIAL_WAKE_LOCK needs to be held while this key event
+ * is dispatched.
+ */
+ private void dispatchMediaKeyEvent(KeyEvent keyEvent, boolean needWakeLock) {
if (needWakeLock) {
mMediaEventWakeLock.acquire();
}
@@ -3660,6 +3677,140 @@
}
}
+ /**
+ * The minimum duration during which a user must press to trigger voice-based interactions
+ */
+ private final static int MEDIABUTTON_LONG_PRESS_DURATION_MS = 300;
+ /**
+ * The different states of the state machine to handle the launch of voice-based interactions,
+ * stored in mVoiceButtonState.
+ */
+ private final static int VOICEBUTTON_STATE_IDLE = 0;
+ private final static int VOICEBUTTON_STATE_DOWN = 1;
+ private final static int VOICEBUTTON_STATE_DOWN_IGNORE_NEW = 2;
+ /**
+ * The different actions after state transitions on mVoiceButtonState.
+ */
+ private final static int VOICEBUTTON_ACTION_DISCARD_CURRENT_KEY_PRESS = 1;
+ private final static int VOICEBUTTON_ACTION_START_VOICE_INPUT = 2;
+ private final static int VOICEBUTTON_ACTION_SIMULATE_KEY_PRESS = 3;
+
+ private final Object mVoiceEventLock = new Object();
+ private int mVoiceButtonState = VOICEBUTTON_STATE_IDLE;
+ private long mVoiceButtonDownTime = 0;
+
+ /**
+ * Log an error when an unexpected action is encountered in the state machine to filter
+ * key events.
+ * @param keyAction the unexpected action of the key event being filtered
+ * @param stateName the string corresponding to the state in which the error occurred
+ */
+ private static void logErrorForKeyAction(int keyAction, String stateName) {
+ Log.e(TAG, "unexpected action "
+ + KeyEvent.actionToString(keyAction)
+ + " in " + stateName + " state");
+ }
+
+ /**
+ * Filter key events that may be used for voice-based interactions
+ * @param keyEvent a non-null KeyEvent whose key code is that of one of the supported
+ * media buttons that can be used to trigger voice-based interactions.
+ * @param needWakeLock true if a PARTIAL_WAKE_LOCK needs to be held while this key event
+ * is dispatched.
+ */
+ private void filterVoiceInputKeyEvent(KeyEvent keyEvent, boolean needWakeLock) {
+ int voiceButtonAction = VOICEBUTTON_ACTION_DISCARD_CURRENT_KEY_PRESS;
+ int keyAction = keyEvent.getAction();
+ synchronized (mVoiceEventLock) {
+ // state machine on mVoiceButtonState
+ switch (mVoiceButtonState) {
+
+ case VOICEBUTTON_STATE_IDLE:
+ if (keyAction == KeyEvent.ACTION_DOWN) {
+ mVoiceButtonDownTime = keyEvent.getDownTime();
+ // valid state transition
+ mVoiceButtonState = VOICEBUTTON_STATE_DOWN;
+ } else if (keyAction == KeyEvent.ACTION_UP) {
+ // no state transition
+ // action is still VOICEBUTTON_ACTION_DISCARD_CURRENT_KEY_PRESS
+ } else {
+ logErrorForKeyAction(keyAction, "VOICEBUTTON_STATE_IDLE");
+ }
+ break;
+
+ case VOICEBUTTON_STATE_DOWN:
+ if ((keyEvent.getEventTime() - mVoiceButtonDownTime)
+ >= MEDIABUTTON_LONG_PRESS_DURATION_MS) {
+ // press was long enough, start voice-based interactions, regardless of
+ // whether this was a DOWN or UP key event
+ voiceButtonAction = VOICEBUTTON_ACTION_START_VOICE_INPUT;
+ if (keyAction == KeyEvent.ACTION_UP) {
+ // done tracking the key press, so transition back to idle state
+ mVoiceButtonState = VOICEBUTTON_STATE_IDLE;
+ } else if (keyAction == KeyEvent.ACTION_DOWN) {
+ // no need to observe the upcoming key events
+ mVoiceButtonState = VOICEBUTTON_STATE_DOWN_IGNORE_NEW;
+ } else {
+ logErrorForKeyAction(keyAction, "VOICEBUTTON_STATE_DOWN");
+ }
+ } else {
+ if (keyAction == KeyEvent.ACTION_UP) {
+ // press wasn't long enough, simulate complete key press
+ voiceButtonAction = VOICEBUTTON_ACTION_SIMULATE_KEY_PRESS;
+ // not tracking the key press anymore, so transition back to idle state
+ mVoiceButtonState = VOICEBUTTON_STATE_IDLE;
+ } else if (keyAction == KeyEvent.ACTION_DOWN) {
+ // no state transition
+ // action is still VOICEBUTTON_ACTION_DISCARD_CURRENT_KEY_PRESS
+ } else {
+ logErrorForKeyAction(keyAction, "VOICEBUTTON_STATE_DOWN");
+ }
+ }
+ break;
+
+ case VOICEBUTTON_STATE_DOWN_IGNORE_NEW:
+ if (keyAction == KeyEvent.ACTION_UP) {
+ // done tracking the key press, so transition back to idle state
+ mVoiceButtonState = VOICEBUTTON_STATE_IDLE;
+ // action is still VOICEBUTTON_ACTION_DISCARD_CURRENT_KEY_PRESS
+ } else if (keyAction == KeyEvent.ACTION_DOWN) {
+ // no state transition: we've already launched voice-based interactions
+ // action is still VOICEBUTTON_ACTION_DISCARD_CURRENT_KEY_PRESS
+ } else {
+ logErrorForKeyAction(keyAction, "VOICEBUTTON_STATE_DOWN_IGNORE_NEW");
+ }
+ break;
+ }
+ }//synchronized (mVoiceEventLock)
+
+ // take action after media button event filtering for voice-based interactions
+ switch (voiceButtonAction) {
+ case VOICEBUTTON_ACTION_DISCARD_CURRENT_KEY_PRESS:
+ if (DEBUG_RC) Log.v(TAG, " ignore key event");
+ break;
+ case VOICEBUTTON_ACTION_START_VOICE_INPUT:
+ if (DEBUG_RC) Log.v(TAG, " start voice-based interactions");
+ // then start the voice-based interactions
+ startVoiceBasedInteractions(needWakeLock);
+ break;
+ case VOICEBUTTON_ACTION_SIMULATE_KEY_PRESS:
+ if (DEBUG_RC) Log.v(TAG, " send simulated key event");
+ sendSimulatedMediaButtonEvent(keyEvent, needWakeLock);
+ break;
+ }
+ }
+
+ private void sendSimulatedMediaButtonEvent(KeyEvent originalKeyEvent, boolean needWakeLock) {
+ // send DOWN event
+ KeyEvent keyEvent = KeyEvent.changeAction(originalKeyEvent, KeyEvent.ACTION_DOWN);
+ dispatchMediaKeyEvent(keyEvent, needWakeLock);
+ // send UP event
+ keyEvent = KeyEvent.changeAction(originalKeyEvent, KeyEvent.ACTION_UP);
+ dispatchMediaKeyEvent(keyEvent, needWakeLock);
+
+ }
+
+
private static boolean isValidMediaKeyEvent(KeyEvent keyEvent) {
if (keyEvent == null) {
return false;
@@ -3686,6 +3837,63 @@
return true;
}
+ /**
+ * Checks whether the given key code is one that can trigger the launch of voice-based
+ * interactions.
+ * @param keyCode the key code associated with the key event
+ * @return true if the key is one of the supported voice-based interaction triggers
+ */
+ private static boolean isValidVoiceInputKeyCode(int keyCode) {
+ if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Tell the system to start voice-based interactions / voice commands
+ */
+ private void startVoiceBasedInteractions(boolean needWakeLock) {
+ Intent voiceIntent = new Intent(android.speech.RecognizerIntent.ACTION_WEB_SEARCH);
+ if (needWakeLock) {
+ mMediaEventWakeLock.acquire();
+ }
+ voiceIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ try {
+ if (mKeyguardManager != null) {
+ // it's ok to start voice-based interactions when:
+ // - the device is locked but doesn't require a password to be unlocked
+ // - the device is not locked
+ if ((mKeyguardManager.isKeyguardLocked() && !mKeyguardManager.isKeyguardSecure())
+ || !mKeyguardManager.isKeyguardLocked()) {
+ mContext.startActivity(voiceIntent);
+ }
+ }
+ } catch (ActivityNotFoundException e) {
+ Log.e(TAG, "Error launching activity for ACTION_WEB_SEARCH: " + e);
+ } finally {
+ if (needWakeLock) {
+ mMediaEventWakeLock.release();
+ }
+ }
+ }
+
+ /**
+ * Verify whether it is safe to start voice-based interactions given the state of the system
+ * @return false is the Keyguard is locked and secure, true otherwise
+ */
+ private boolean safeToStartVoiceBasedInteractions() {
+ KeyguardManager keyguard =
+ (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
+ if (keyguard == null) {
+ return false;
+ }
+
+ return true;
+ }
+
private PowerManager.WakeLock mMediaEventWakeLock;
private static final int WAKELOCK_RELEASE_ON_FINISHED = 1980; //magic number
@@ -3703,7 +3911,14 @@
BroadcastReceiver mKeyEventDone = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
- if (intent.getExtras().containsKey(EXTRA_WAKELOCK_ACQUIRED)) {
+ if (intent == null) {
+ return;
+ }
+ Bundle extras = intent.getExtras();
+ if (extras == null) {
+ return;
+ }
+ if (extras.containsKey(EXTRA_WAKELOCK_ACQUIRED)) {
mMediaEventWakeLock.release();
}
}
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index f51a24a..96f01db 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -401,7 +401,7 @@
mChannels = AudioFormat.CHANNEL_OUT_STEREO;
break;
default:
- if ((channelConfig & SUPPORTED_OUT_CHANNELS) != channelConfig) {
+ if (!isMultichannelConfigSupported(channelConfig)) {
// input channel configuration features unsupported channels
mChannelCount = 0;
mChannels = AudioFormat.CHANNEL_INVALID;
@@ -438,6 +438,37 @@
}
}
+ /**
+ * Convenience method to check that the channel configuration (a.k.a channel mask) is supported
+ * @param channelConfig the mask to validate
+ * @return false if the AudioTrack can't be used with such a mask
+ */
+ private static boolean isMultichannelConfigSupported(int channelConfig) {
+ // check for unsupported channels
+ if ((channelConfig & SUPPORTED_OUT_CHANNELS) != channelConfig) {
+ Log.e(TAG, "Channel configuration features unsupported channels");
+ return false;
+ }
+ // check for unsupported multichannel combinations:
+ // - FL/FR must be present
+ // - L/R channels must be paired (e.g. no single L channel)
+ final int frontPair =
+ AudioFormat.CHANNEL_OUT_FRONT_LEFT | AudioFormat.CHANNEL_OUT_FRONT_RIGHT;
+ if ((channelConfig & frontPair) != frontPair) {
+ Log.e(TAG, "Front channels must be present in multichannel configurations");
+ return false;
+ }
+ final int backPair =
+ AudioFormat.CHANNEL_OUT_BACK_LEFT | AudioFormat.CHANNEL_OUT_BACK_RIGHT;
+ if ((channelConfig & backPair) != 0) {
+ if ((channelConfig & backPair) != backPair) {
+ Log.e(TAG, "Rear channels can't be used independently");
+ return false;
+ }
+ }
+ return true;
+ }
+
// Convenience method for the contructor's audio buffer size check.
// preconditions:
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 9f0fd48..aa4cdbe 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -2020,8 +2020,9 @@
if (msg.obj == null) {
mOnTimedTextListener.onTimedText(mMediaPlayer, null);
} else {
- if (msg.obj instanceof byte[]) {
- TimedText text = new TimedText((byte[])(msg.obj));
+ if (msg.obj instanceof Parcel) {
+ Parcel parcel = (Parcel)msg.obj;
+ TimedText text = new TimedText(parcel);
mOnTimedTextListener.onTimedText(mMediaPlayer, text);
}
}
diff --git a/media/java/android/media/TimedText.java b/media/java/android/media/TimedText.java
index 1d7c9682..e6a7e13 100644
--- a/media/java/android/media/TimedText.java
+++ b/media/java/android/media/TimedText.java
@@ -28,7 +28,7 @@
* Class to hold the timed text's metadata, including:
* <ul>
* <li> The characters for rendering</li>
- * <li> The rendering postion for the timed text</li>
+ * <li> The rendering position for the timed text</li>
* </ul>
*
* <p> To render the timed text, applications need to do the following:
@@ -86,7 +86,6 @@
private static final String TAG = "TimedText";
- private Parcel mParcel = Parcel.obtain();
private final HashMap<Integer, Object> mKeyObjectMap =
new HashMap<Integer, Object>();
@@ -356,10 +355,8 @@
* @throws IllegalArgumentExcept if parseParcel() fails.
* {@hide}
*/
- public TimedText(byte[] obj) {
- mParcel.unmarshall(obj, 0, obj.length);
-
- if (!parseParcel()) {
+ public TimedText(Parcel parcel) {
+ if (!parseParcel(parcel)) {
mKeyObjectMap.clear();
throw new IllegalArgumentException("parseParcel() fails");
}
@@ -393,28 +390,28 @@
* Parcel. These are stored in mKeyObjectMap for application to retrieve.
* @return false if an error occurred during parsing. Otherwise, true.
*/
- private boolean parseParcel() {
- mParcel.setDataPosition(0);
- if (mParcel.dataAvail() == 0) {
+ private boolean parseParcel(Parcel parcel) {
+ parcel.setDataPosition(0);
+ if (parcel.dataAvail() == 0) {
return false;
}
- int type = mParcel.readInt();
+ int type = parcel.readInt();
if (type == KEY_LOCAL_SETTING) {
- type = mParcel.readInt();
+ type = parcel.readInt();
if (type != KEY_START_TIME) {
return false;
}
- int mStartTimeMs = mParcel.readInt();
+ int mStartTimeMs = parcel.readInt();
mKeyObjectMap.put(type, mStartTimeMs);
- type = mParcel.readInt();
+ type = parcel.readInt();
if (type != KEY_STRUCT_TEXT) {
return false;
}
- int textLen = mParcel.readInt();
- byte[] text = mParcel.createByteArray();
+ int textLen = parcel.readInt();
+ byte[] text = parcel.createByteArray();
if (text == null || text.length == 0) {
mTextChars = null;
} else {
@@ -426,8 +423,8 @@
return false;
}
- while (mParcel.dataAvail() > 0) {
- int key = mParcel.readInt();
+ while (parcel.dataAvail() > 0) {
+ int key = parcel.readInt();
if (!isValidKey(key)) {
Log.w(TAG, "Invalid timed text key found: " + key);
return false;
@@ -437,77 +434,77 @@
switch (key) {
case KEY_STRUCT_STYLE_LIST: {
- readStyle();
+ readStyle(parcel);
object = mStyleList;
break;
}
case KEY_STRUCT_FONT_LIST: {
- readFont();
+ readFont(parcel);
object = mFontList;
break;
}
case KEY_STRUCT_HIGHLIGHT_LIST: {
- readHighlight();
+ readHighlight(parcel);
object = mHighlightPosList;
break;
}
case KEY_STRUCT_KARAOKE_LIST: {
- readKaraoke();
+ readKaraoke(parcel);
object = mKaraokeList;
break;
}
case KEY_STRUCT_HYPER_TEXT_LIST: {
- readHyperText();
+ readHyperText(parcel);
object = mHyperTextList;
break;
}
case KEY_STRUCT_BLINKING_TEXT_LIST: {
- readBlinkingText();
+ readBlinkingText(parcel);
object = mBlinkingPosList;
break;
}
case KEY_WRAP_TEXT: {
- mWrapText = mParcel.readInt();
+ mWrapText = parcel.readInt();
object = mWrapText;
break;
}
case KEY_HIGHLIGHT_COLOR_RGBA: {
- mHighlightColorRGBA = mParcel.readInt();
+ mHighlightColorRGBA = parcel.readInt();
object = mHighlightColorRGBA;
break;
}
case KEY_DISPLAY_FLAGS: {
- mDisplayFlags = mParcel.readInt();
+ mDisplayFlags = parcel.readInt();
object = mDisplayFlags;
break;
}
case KEY_STRUCT_JUSTIFICATION: {
- int horizontal = mParcel.readInt();
- int vertical = mParcel.readInt();
+ int horizontal = parcel.readInt();
+ int vertical = parcel.readInt();
mJustification = new Justification(horizontal, vertical);
object = mJustification;
break;
}
case KEY_BACKGROUND_COLOR_RGBA: {
- mBackgroundColorRGBA = mParcel.readInt();
+ mBackgroundColorRGBA = parcel.readInt();
object = mBackgroundColorRGBA;
break;
}
case KEY_STRUCT_TEXT_POS: {
- int top = mParcel.readInt();
- int left = mParcel.readInt();
- int bottom = mParcel.readInt();
- int right = mParcel.readInt();
+ int top = parcel.readInt();
+ int left = parcel.readInt();
+ int bottom = parcel.readInt();
+ int right = parcel.readInt();
mTextBounds = new Rect(left, top, right, bottom);
break;
}
case KEY_SCROLL_DELAY: {
- mScrollDelay = mParcel.readInt();
+ mScrollDelay = parcel.readInt();
object = mScrollDelay;
break;
}
@@ -520,18 +517,18 @@
if (mKeyObjectMap.containsKey(key)) {
mKeyObjectMap.remove(key);
}
+ // Previous mapping will be replaced with the new object, if there was one.
mKeyObjectMap.put(key, object);
}
}
- mParcel.recycle();
return true;
}
/*
* To parse and store the Style list.
*/
- private void readStyle() {
+ private void readStyle(Parcel parcel) {
boolean endOfStyle = false;
int startChar = -1;
int endChar = -1;
@@ -541,23 +538,23 @@
boolean isUnderlined = false;
int fontSize = -1;
int colorRGBA = -1;
- while (!endOfStyle && (mParcel.dataAvail() > 0)) {
- int key = mParcel.readInt();
+ while (!endOfStyle && (parcel.dataAvail() > 0)) {
+ int key = parcel.readInt();
switch (key) {
case KEY_START_CHAR: {
- startChar = mParcel.readInt();
+ startChar = parcel.readInt();
break;
}
case KEY_END_CHAR: {
- endChar = mParcel.readInt();
+ endChar = parcel.readInt();
break;
}
case KEY_FONT_ID: {
- fontId = mParcel.readInt();
+ fontId = parcel.readInt();
break;
}
case KEY_STYLE_FLAGS: {
- int flags = mParcel.readInt();
+ int flags = parcel.readInt();
// In the absence of any bits set in flags, the text
// is plain. Otherwise, 1: bold, 2: italic, 4: underline
isBold = ((flags % 2) == 1);
@@ -566,17 +563,17 @@
break;
}
case KEY_FONT_SIZE: {
- fontSize = mParcel.readInt();
+ fontSize = parcel.readInt();
break;
}
case KEY_TEXT_COLOR_RGBA: {
- colorRGBA = mParcel.readInt();
+ colorRGBA = parcel.readInt();
break;
}
default: {
// End of the Style parsing. Reset the data position back
- // to the position before the last mParcel.readInt() call.
- mParcel.setDataPosition(mParcel.dataPosition() - 4);
+ // to the position before the last parcel.readInt() call.
+ parcel.setDataPosition(parcel.dataPosition() - 4);
endOfStyle = true;
break;
}
@@ -594,14 +591,14 @@
/*
* To parse and store the Font list
*/
- private void readFont() {
- int entryCount = mParcel.readInt();
+ private void readFont(Parcel parcel) {
+ int entryCount = parcel.readInt();
for (int i = 0; i < entryCount; i++) {
- int id = mParcel.readInt();
- int nameLen = mParcel.readInt();
+ int id = parcel.readInt();
+ int nameLen = parcel.readInt();
- byte[] text = mParcel.createByteArray();
+ byte[] text = parcel.createByteArray();
final String name = new String(text, 0, nameLen);
Font font = new Font(id, name);
@@ -616,9 +613,9 @@
/*
* To parse and store the Highlight list
*/
- private void readHighlight() {
- int startChar = mParcel.readInt();
- int endChar = mParcel.readInt();
+ private void readHighlight(Parcel parcel) {
+ int startChar = parcel.readInt();
+ int endChar = parcel.readInt();
CharPos pos = new CharPos(startChar, endChar);
if (mHighlightPosList == null) {
@@ -630,14 +627,14 @@
/*
* To parse and store the Karaoke list
*/
- private void readKaraoke() {
- int entryCount = mParcel.readInt();
+ private void readKaraoke(Parcel parcel) {
+ int entryCount = parcel.readInt();
for (int i = 0; i < entryCount; i++) {
- int startTimeMs = mParcel.readInt();
- int endTimeMs = mParcel.readInt();
- int startChar = mParcel.readInt();
- int endChar = mParcel.readInt();
+ int startTimeMs = parcel.readInt();
+ int endTimeMs = parcel.readInt();
+ int startChar = parcel.readInt();
+ int endChar = parcel.readInt();
Karaoke kara = new Karaoke(startTimeMs, endTimeMs,
startChar, endChar);
@@ -651,16 +648,16 @@
/*
* To parse and store HyperText list
*/
- private void readHyperText() {
- int startChar = mParcel.readInt();
- int endChar = mParcel.readInt();
+ private void readHyperText(Parcel parcel) {
+ int startChar = parcel.readInt();
+ int endChar = parcel.readInt();
- int len = mParcel.readInt();
- byte[] url = mParcel.createByteArray();
+ int len = parcel.readInt();
+ byte[] url = parcel.createByteArray();
final String urlString = new String(url, 0, len);
- len = mParcel.readInt();
- byte[] alt = mParcel.createByteArray();
+ len = parcel.readInt();
+ byte[] alt = parcel.createByteArray();
final String altString = new String(alt, 0, len);
HyperText hyperText = new HyperText(startChar, endChar, urlString, altString);
@@ -674,9 +671,9 @@
/*
* To parse and store blinking text list
*/
- private void readBlinkingText() {
- int startChar = mParcel.readInt();
- int endChar = mParcel.readInt();
+ private void readBlinkingText(Parcel parcel) {
+ int startChar = parcel.readInt();
+ int endChar = parcel.readInt();
CharPos blinkingPos = new CharPos(startChar, endChar);
if (mBlinkingPosList == null) {
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 5eadb3a..de22e09 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -72,6 +72,7 @@
JNIMediaPlayerListener();
jclass mClass; // Reference to MediaPlayer class
jobject mObject; // Weak ref to MediaPlayer Java object to call on
+ jobject mParcel;
};
JNIMediaPlayerListener::JNIMediaPlayerListener(JNIEnv* env, jobject thiz, jobject weak_thiz)
@@ -90,6 +91,7 @@
// We use a weak reference so the MediaPlayer object can be garbage collected.
// The reference is only used as a proxy for callbacks.
mObject = env->NewGlobalRef(weak_thiz);
+ mParcel = env->NewGlobalRef(createJavaParcelObject(env));
}
JNIMediaPlayerListener::~JNIMediaPlayerListener()
@@ -98,25 +100,30 @@
JNIEnv *env = AndroidRuntime::getJNIEnv();
env->DeleteGlobalRef(mObject);
env->DeleteGlobalRef(mClass);
+
+ recycleJavaParcelObject(env, mParcel);
+ env->DeleteGlobalRef(mParcel);
}
void JNIMediaPlayerListener::notify(int msg, int ext1, int ext2, const Parcel *obj)
{
JNIEnv *env = AndroidRuntime::getJNIEnv();
if (obj && obj->dataSize() > 0) {
- jbyteArray jArray = env->NewByteArray(obj->dataSize());
- if (jArray != NULL) {
- jbyte *nArray = env->GetByteArrayElements(jArray, NULL);
- memcpy(nArray, obj->data(), obj->dataSize());
- env->ReleaseByteArrayElements(jArray, nArray, 0);
+ if (mParcel != NULL) {
+ Parcel* nativeParcel = parcelForJavaObject(env, mParcel);
+ nativeParcel->setData(obj->data(), obj->dataSize());
env->CallStaticVoidMethod(mClass, fields.post_event, mObject,
- msg, ext1, ext2, jArray);
- env->DeleteLocalRef(jArray);
+ msg, ext1, ext2, mParcel);
}
} else {
env->CallStaticVoidMethod(mClass, fields.post_event, mObject,
msg, ext1, ext2, NULL);
}
+ if (env->ExceptionCheck()) {
+ ALOGW("An exception occurred while notifying an event.");
+ LOGW_EX(env);
+ env->ExceptionClear();
+ }
}
// ----------------------------------------------------------------------------
@@ -533,7 +540,6 @@
return UNKNOWN_ERROR;
}
-
Parcel *request = parcelForJavaObject(env, java_request);
Parcel *reply = parcelForJavaObject(env, java_reply);
diff --git a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
index 3b87b96..f09c010 100644
--- a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
+++ b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java
@@ -223,6 +223,8 @@
@Override
public long calculateDirectorySize(String path) throws RemoteException {
+ Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
+
final File directory = new File(path);
if (directory.exists() && directory.isDirectory()) {
return MeasurementUtils.measureDirectory(path);
@@ -233,6 +235,8 @@
@Override
public long[] getFileSystemStats(String path) {
+ Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
+
try {
final StructStatFs stat = Libcore.os.statfs(path);
final long totalSize = stat.f_blocks * stat.f_bsize;
diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
index 869b164..8a21117 100644
--- a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
@@ -27,12 +27,6 @@
systemui:recentItemLayout="@layout/status_bar_recent_item"
>
- <ImageView
- android:id="@+id/recents_transition_placeholder_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:visibility="invisible" />
-
<FrameLayout
android:id="@+id/recents_bg_protect"
android:background="@drawable/status_bar_recents_background"
@@ -42,6 +36,12 @@
android:clipToPadding="false"
android:clipChildren="false">
+ <ImageView
+ android:id="@+id/recents_transition_placeholder_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="invisible" />
+
<com.android.systemui.recent.RecentsHorizontalScrollView android:id="@+id/recents_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
diff --git a/packages/SystemUI/res/layout-land/status_bar_search_panel.xml b/packages/SystemUI/res/layout-land/status_bar_search_panel.xml
index 5d4d989..392a8b5 100644
--- a/packages/SystemUI/res/layout-land/status_bar_search_panel.xml
+++ b/packages/SystemUI/res/layout-land/status_bar_search_panel.xml
@@ -52,7 +52,6 @@
prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions"
prvandroid:handleDrawable="@drawable/navbar_search_handle"
prvandroid:waveDrawable="@drawable/navbar_search_outerring"
- prvandroid:outerRadius="@dimen/navbar_search_target_placement_radius"
prvandroid:snapMargin="@dimen/navbar_search_snap_margin"
prvandroid:hitRadius="@dimen/navbar_search_hit_radius"
prvandroid:feedbackCount="0"
diff --git a/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
index fc9fcf4..1d29c5a 100644
--- a/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
@@ -27,12 +27,6 @@
systemui:recentItemLayout="@layout/status_bar_recent_item"
>
- <ImageView
- android:id="@+id/recents_transition_placeholder_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:visibility="invisible" />
-
<FrameLayout
android:id="@+id/recents_bg_protect"
android:background="@drawable/status_bar_recents_background"
@@ -40,6 +34,12 @@
android:layout_height="match_parent"
android:layout_alignParentBottom="true">
+ <ImageView
+ android:id="@+id/recents_transition_placeholder_icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="invisible" />
+
<com.android.systemui.recent.RecentsVerticalScrollView
android:id="@+id/recents_container"
android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/layout-port/status_bar_search_panel.xml b/packages/SystemUI/res/layout-port/status_bar_search_panel.xml
index 2486b75..371c575 100644
--- a/packages/SystemUI/res/layout-port/status_bar_search_panel.xml
+++ b/packages/SystemUI/res/layout-port/status_bar_search_panel.xml
@@ -52,7 +52,6 @@
prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions"
prvandroid:handleDrawable="@drawable/navbar_search_handle"
prvandroid:waveDrawable="@drawable/navbar_search_outerring"
- prvandroid:outerRadius="@dimen/navbar_search_target_placement_radius"
prvandroid:snapMargin="@dimen/navbar_search_snap_margin"
prvandroid:hitRadius="@dimen/navbar_search_hit_radius"
prvandroid:feedbackCount="0"
diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml
index 4b2fbc7..0ccfe95 100644
--- a/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml
+++ b/packages/SystemUI/res/layout-sw600dp/status_bar_search_panel.xml
@@ -61,7 +61,6 @@
prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions"
prvandroid:handleDrawable="@drawable/navbar_search_handle"
prvandroid:waveDrawable="@drawable/navbar_search_outerring"
- prvandroid:outerRadius="@dimen/navbar_search_target_placement_radius"
prvandroid:snapMargin="@dimen/navbar_search_snap_margin"
prvandroid:hitRadius="@dimen/navbar_search_hit_radius"
prvandroid:feedbackCount="0"
diff --git a/packages/SystemUI/res/layout-sw720dp/status_bar_search_panel.xml b/packages/SystemUI/res/layout-sw720dp/status_bar_search_panel.xml
index ac2472c..0a5390a 100644
--- a/packages/SystemUI/res/layout-sw720dp/status_bar_search_panel.xml
+++ b/packages/SystemUI/res/layout-sw720dp/status_bar_search_panel.xml
@@ -61,7 +61,6 @@
prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions"
prvandroid:handleDrawable="@drawable/navbar_search_handle"
prvandroid:waveDrawable="@drawable/navbar_search_outerring"
- prvandroid:outerRadius="@dimen/navbar_search_target_placement_radius"
prvandroid:snapMargin="@dimen/navbar_search_snap_margin"
prvandroid:hitRadius="@dimen/navbar_search_hit_radius"
prvandroid:feedbackCount="0"
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml
index bc144bb..4cff67b 100644
--- a/packages/SystemUI/res/layout/status_bar_expanded.xml
+++ b/packages/SystemUI/res/layout/status_bar_expanded.xml
@@ -48,7 +48,7 @@
android:id="@+id/latestItems"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- systemui:rowHeight="@dimen/notification_height"
+ systemui:rowHeight="@dimen/notification_row_min_height"
/>
</ScrollView>
@@ -68,4 +68,4 @@
</com.android.systemui.statusbar.phone.CloseDragHandle>
-</FrameLayout><!-- end of sliding panel -->
\ No newline at end of file
+</FrameLayout><!-- end of sliding panel -->
diff --git a/packages/SystemUI/res/layout/system_bar_notification_panel.xml b/packages/SystemUI/res/layout/system_bar_notification_panel.xml
index 42af147..5579505 100644
--- a/packages/SystemUI/res/layout/system_bar_notification_panel.xml
+++ b/packages/SystemUI/res/layout/system_bar_notification_panel.xml
@@ -77,7 +77,7 @@
android:clickable="true"
android:focusable="true"
android:descendantFocusability="afterDescendants"
- systemui:rowHeight="@dimen/notification_height"
+ systemui:rowHeight="@dimen/notification_row_min_height"
/>
</ScrollView>
</LinearLayout>
diff --git a/packages/SystemUI/res/values-da/strings.xml b/packages/SystemUI/res/values-da/strings.xml
index 612ab6a..01068ec 100644
--- a/packages/SystemUI/res/values-da/strings.xml
+++ b/packages/SystemUI/res/values-da/strings.xml
@@ -138,7 +138,7 @@
<string name="gps_notification_searching_text" msgid="8574247005642736060">"Søger efter GPS"</string>
<string name="gps_notification_found_text" msgid="4619274244146446464">"Placeringen er angivet ved hjælp af GPS"</string>
<string name="accessibility_clear_all" msgid="5235938559247164925">"Ryd alle meddelelser."</string>
- <string name="dreams_dock_launcher" msgid="3541196417659166245">"Aktiver pauseskærm"</string>
+ <string name="dreams_dock_launcher" msgid="3541196417659166245">"Aktivér pauseskærm"</string>
<string name="status_bar_notification_inspect_item_title" msgid="1163547729015390250">"Oplysninger om appen"</string>
<string name="notifications_off_title" msgid="8936620513608443224">"Underretninger slået fra"</string>
<string name="notifications_off_text" msgid="2529001315769385273">"Tryk her for at slå underretninger til igen."</string>
diff --git a/packages/SystemUI/res/values-de/strings.xml b/packages/SystemUI/res/values-de/strings.xml
index b7dcb14..c15a2fa 100644
--- a/packages/SystemUI/res/values-de/strings.xml
+++ b/packages/SystemUI/res/values-de/strings.xml
@@ -66,7 +66,7 @@
<string name="screenshot_saving_title" msgid="8242282144535555697">"Screenshot wird gespeichert..."</string>
<string name="screenshot_saving_text" msgid="2419718443411738818">"Screenshot wird gespeichert..."</string>
<string name="screenshot_saved_title" msgid="6461865960961414961">"Screenshot aufgenommen"</string>
- <string name="screenshot_saved_text" msgid="1152839647677558815">"Zum Anzeigen des Screenshots berühren"</string>
+ <string name="screenshot_saved_text" msgid="1152839647677558815">"Zum Ansehen berühren"</string>
<string name="screenshot_failed_title" msgid="705781116746922771">"Screenshot konnte nicht aufgenommen werden."</string>
<string name="screenshot_failed_text" msgid="8134011269572415402">"Screenshot konnte nicht gespeichert werden. Eventuell wird der Speicher gerade verwendet."</string>
<string name="usb_preference_title" msgid="6551050377388882787">"USB-Dateiübertragungsoptionen"</string>
diff --git a/packages/SystemUI/res/values-ja/strings.xml b/packages/SystemUI/res/values-ja/strings.xml
index eb493b2..70ba034 100644
--- a/packages/SystemUI/res/values-ja/strings.xml
+++ b/packages/SystemUI/res/values-ja/strings.xml
@@ -142,10 +142,8 @@
<string name="accessibility_clear_all" msgid="5235938559247164925">"通知をすべて消去。"</string>
<string name="dreams_dock_launcher" msgid="3541196417659166245">"スクリーンセーバーを有効にする"</string>
<string name="status_bar_notification_inspect_item_title" msgid="1163547729015390250">"アプリ情報"</string>
- <!-- no translation found for notifications_off_title (8936620513608443224) -->
- <skip />
- <!-- no translation found for notifications_off_text (2529001315769385273) -->
- <skip />
+ <string name="notifications_off_title" msgid="8936620513608443224">"通知OFF"</string>
+ <string name="notifications_off_text" msgid="2529001315769385273">"通知を再度ONにするにはここをタップします。"</string>
<string name="accessibility_rotation_lock_off" msgid="4062780228931590069">"画面は自動的に回転します。"</string>
<string name="accessibility_rotation_lock_on_landscape" msgid="6731197337665366273">"画面は横向きにロックされています。"</string>
<string name="accessibility_rotation_lock_on_portrait" msgid="5809367521644012115">"画面は縦向きにロックされています。"</string>
diff --git a/packages/SystemUI/res/values-nb/strings.xml b/packages/SystemUI/res/values-nb/strings.xml
index 2a9c1c8..a1ee469 100644
--- a/packages/SystemUI/res/values-nb/strings.xml
+++ b/packages/SystemUI/res/values-nb/strings.xml
@@ -140,10 +140,8 @@
<string name="accessibility_clear_all" msgid="5235938559247164925">"Fjern alle varslinger."</string>
<string name="dreams_dock_launcher" msgid="3541196417659166245">"Aktiver skjermbeskytter"</string>
<string name="status_bar_notification_inspect_item_title" msgid="1163547729015390250">"Info om app"</string>
- <!-- no translation found for notifications_off_title (8936620513608443224) -->
- <skip />
- <!-- no translation found for notifications_off_text (2529001315769385273) -->
- <skip />
+ <string name="notifications_off_title" msgid="8936620513608443224">"Varsler er deaktivert"</string>
+ <string name="notifications_off_text" msgid="2529001315769385273">"Trykk her for å aktivere varsler på nytt."</string>
<string name="accessibility_rotation_lock_off" msgid="4062780228931590069">"Skjermen roterer automatisk."</string>
<string name="accessibility_rotation_lock_on_landscape" msgid="6731197337665366273">"Skjermen er låst i liggende retning."</string>
<string name="accessibility_rotation_lock_on_portrait" msgid="5809367521644012115">"Skjermen er låst i stående retning."</string>
diff --git a/packages/SystemUI/res/values-pl/strings.xml b/packages/SystemUI/res/values-pl/strings.xml
index b01345e..b4a77a2 100644
--- a/packages/SystemUI/res/values-pl/strings.xml
+++ b/packages/SystemUI/res/values-pl/strings.xml
@@ -140,10 +140,8 @@
<string name="accessibility_clear_all" msgid="5235938559247164925">"Usuń wszystkie powiadomienia."</string>
<string name="dreams_dock_launcher" msgid="3541196417659166245">"Włącz wygaszacz ekranu."</string>
<string name="status_bar_notification_inspect_item_title" msgid="1163547729015390250">"O aplikacji"</string>
- <!-- no translation found for notifications_off_title (8936620513608443224) -->
- <skip />
- <!-- no translation found for notifications_off_text (2529001315769385273) -->
- <skip />
+ <string name="notifications_off_title" msgid="8936620513608443224">"Powiadomienia wyłączone"</string>
+ <string name="notifications_off_text" msgid="2529001315769385273">"Kliknij tutaj, by przywrócić powiadomienia."</string>
<string name="accessibility_rotation_lock_off" msgid="4062780228931590069">"Ekran zostanie obrócony automatycznie."</string>
<string name="accessibility_rotation_lock_on_landscape" msgid="6731197337665366273">"Ekran jest zablokowany w orientacji poziomej."</string>
<string name="accessibility_rotation_lock_on_portrait" msgid="5809367521644012115">"Ekran jest zablokowany w orientacji pionowej."</string>
diff --git a/packages/SystemUI/res/values-pt/strings.xml b/packages/SystemUI/res/values-pt/strings.xml
index f074d22..596ceec 100644
--- a/packages/SystemUI/res/values-pt/strings.xml
+++ b/packages/SystemUI/res/values-pt/strings.xml
@@ -62,8 +62,8 @@
<string name="compat_mode_off" msgid="4434467572461327898">"Ampliar p/ preencher tela"</string>
<string name="compat_mode_help_header" msgid="7969493989397529910">"Zoom em modo de compatibilidade"</string>
<string name="compat_mode_help_body" msgid="4946726776359270040">"Quando um aplicativo é desenvolvido para uma tela menor, um controle de zoom é exibido perto do relógio."</string>
- <string name="screenshot_saving_ticker" msgid="7403652894056693515">"Salvar captura de tela..."</string>
- <string name="screenshot_saving_title" msgid="8242282144535555697">"Salvar captura de tela..."</string>
+ <string name="screenshot_saving_ticker" msgid="7403652894056693515">"Salvando captura de tela..."</string>
+ <string name="screenshot_saving_title" msgid="8242282144535555697">"Salvando captura de tela..."</string>
<string name="screenshot_saving_text" msgid="2419718443411738818">"A captura de tela está sendo salva."</string>
<string name="screenshot_saved_title" msgid="6461865960961414961">"Captura de tela obtida."</string>
<string name="screenshot_saved_text" msgid="1152839647677558815">"Toque para visualizar a captura de tela."</string>
diff --git a/packages/SystemUI/res/values-ro/strings.xml b/packages/SystemUI/res/values-ro/strings.xml
index 4750ac5..87eec9f 100644
--- a/packages/SystemUI/res/values-ro/strings.xml
+++ b/packages/SystemUI/res/values-ro/strings.xml
@@ -140,10 +140,8 @@
<string name="accessibility_clear_all" msgid="5235938559247164925">"Ştergeţi toate notificările."</string>
<string name="dreams_dock_launcher" msgid="3541196417659166245">"Activaţi screensaverul"</string>
<string name="status_bar_notification_inspect_item_title" msgid="1163547729015390250">"Informaţii despre aplicaţie"</string>
- <!-- no translation found for notifications_off_title (8936620513608443224) -->
- <skip />
- <!-- no translation found for notifications_off_text (2529001315769385273) -->
- <skip />
+ <string name="notifications_off_title" msgid="8936620513608443224">"Notificările sunt dezactivate"</string>
+ <string name="notifications_off_text" msgid="2529001315769385273">"Apăsaţi aici pentru a reactiva notificările."</string>
<string name="accessibility_rotation_lock_off" msgid="4062780228931590069">"Ecranul se va roti în mod automat."</string>
<string name="accessibility_rotation_lock_on_landscape" msgid="6731197337665366273">"Ecranul este blocat în orientarea de tip peisaj."</string>
<string name="accessibility_rotation_lock_on_portrait" msgid="5809367521644012115">"Ecranul este blocat în orientarea de tip portret."</string>
diff --git a/packages/SystemUI/res/values-ru/strings.xml b/packages/SystemUI/res/values-ru/strings.xml
index 7ca04e6..3277fb6 100644
--- a/packages/SystemUI/res/values-ru/strings.xml
+++ b/packages/SystemUI/res/values-ru/strings.xml
@@ -65,7 +65,7 @@
<string name="screenshot_saving_ticker" msgid="7403652894056693515">"Сохранение..."</string>
<string name="screenshot_saving_title" msgid="8242282144535555697">"Сохранение..."</string>
<string name="screenshot_saving_text" msgid="2419718443411738818">"Сохранение..."</string>
- <string name="screenshot_saved_title" msgid="6461865960961414961">"Скриншот сохранен."</string>
+ <string name="screenshot_saved_title" msgid="6461865960961414961">"Скриншот сохранен"</string>
<string name="screenshot_saved_text" msgid="1152839647677558815">"Нажмите, чтобы просмотреть"</string>
<string name="screenshot_failed_title" msgid="705781116746922771">"Не удалось сохранить скриншот."</string>
<string name="screenshot_failed_text" msgid="8134011269572415402">"Не удалось сохранить скриншот. Возможно, накопители заняты."</string>
diff --git a/packages/SystemUI/res/values-sv/strings.xml b/packages/SystemUI/res/values-sv/strings.xml
index 36950dc..afbe0fb 100644
--- a/packages/SystemUI/res/values-sv/strings.xml
+++ b/packages/SystemUI/res/values-sv/strings.xml
@@ -140,10 +140,8 @@
<string name="accessibility_clear_all" msgid="5235938559247164925">"Ta bort alla meddelanden."</string>
<string name="dreams_dock_launcher" msgid="3541196417659166245">"Aktivera skärmsläckare"</string>
<string name="status_bar_notification_inspect_item_title" msgid="1163547729015390250">"Info om appen"</string>
- <!-- no translation found for notifications_off_title (8936620513608443224) -->
- <skip />
- <!-- no translation found for notifications_off_text (2529001315769385273) -->
- <skip />
+ <string name="notifications_off_title" msgid="8936620513608443224">"Meddelanden inaktiverade"</string>
+ <string name="notifications_off_text" msgid="2529001315769385273">"Knacka lätt här om du vill aktivera meddelanden igen."</string>
<string name="accessibility_rotation_lock_off" msgid="4062780228931590069">"Skärmen roteras automatiskt."</string>
<string name="accessibility_rotation_lock_on_landscape" msgid="6731197337665366273">"Bildskärmens riktning är nu låst i liggande format."</string>
<string name="accessibility_rotation_lock_on_portrait" msgid="5809367521644012115">"Bildskärmens riktning är nu låst i stående format."</string>
diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml
index 2cb99ff..07d55f1 100644
--- a/packages/SystemUI/res/values-sw600dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp/dimens.xml
@@ -27,9 +27,6 @@
<!-- 0x33 = center_horizontal|top -->
<integer name="notification_panel_layout_gravity">0x31</integer>
- <!-- Default target placement radius for navigation bar search target -->
- <dimen name="navbar_search_target_placement_radius">182dip</dimen>
-
<!-- Diameter of outer shape drawable shown in navbar search-->
<dimen name="navbar_search_outerring_diameter">364dp</dimen>
diff --git a/packages/SystemUI/res/values-xhdpi/dimens.xml b/packages/SystemUI/res/values-xhdpi/dimens.xml
deleted file mode 100644
index 303841a..0000000
--- a/packages/SystemUI/res/values-xhdpi/dimens.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (c) 2011, 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.
-*/
--->
-<resources>
- <!-- thickness (height) of each notification row, including any separators or padding -->
- <!-- note: this is the same value as in values/dimens.xml; the value is overridden in
- values-hdpi/dimens.xml and so we need to re-assert the general value here -->
- <dimen name="notification_height">68dp</dimen>
-
- <!-- thickness (height) of dividers between each notification row -->
- <!-- same as in values/dimens.xml; see note at notification_height -->
- <dimen name="notification_divider_height">2dp</dimen>
-</resources>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 21e5fd7..9042045 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -49,18 +49,21 @@
reducing false presses on navbar buttons; approx 2mm -->
<dimen name="navigation_bar_deadzone_size">12dp</dimen>
- <!-- thickness (height) of each 1U notification row plus glow, padding, etc -->
- <dimen name="notification_height">72dp</dimen>
-
<!-- Height of notification icons in the status bar -->
<dimen name="status_bar_icon_size">@*android:dimen/status_bar_icon_size</dimen>
- <!-- Height of a small notification in the status bar plus glow, padding, etc -->
- <dimen name="notification_min_height">72dp</dimen>
+ <!-- Height of a small notification in the status bar -->
+ <dimen name="notification_min_height">64dp</dimen>
<!-- Height of a large notification in the status bar -->
<dimen name="notification_max_height">256dp</dimen>
+ <!-- Height of a small notification in the status bar plus glow, padding, etc -->
+ <dimen name="notification_row_min_height">72dp</dimen>
+
+ <!-- Height of a large notification in the status bar plus glow, padding, etc -->
+ <dimen name="notification_row_max_height">260dp</dimen>
+
<!-- size at which Notification icons will be drawn in the status bar -->
<dimen name="status_bar_icon_drawing_size">18dip</dimen>
@@ -105,9 +108,6 @@
<!-- The width of the view containing the menu status bar icon -->
<dimen name="navigation_menu_key_width">40dip</dimen>
- <!-- Default target placement radius for navigation bar search target -->
- <dimen name="navbar_search_target_placement_radius">150dip</dimen>
-
<!-- Default distance beyond which snaps to the target radius -->
<dimen name="navbar_search_snap_margin">20dip</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java b/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java
index 9e273d4..3502b62 100644
--- a/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java
+++ b/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java
@@ -41,7 +41,7 @@
*/
public class RingtonePlayer extends SystemUI {
private static final String TAG = "RingtonePlayer";
- private static final boolean LOGD = true;
+ private static final boolean LOGD = false;
// TODO: support Uri switching under same IBinder
diff --git a/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java b/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
index a8c2020..ccdf038 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
@@ -102,12 +102,14 @@
builder.with(noRecentAppsFadeAnim);
}
- Drawable background = mScrimView.getBackground();
- if (background != null) {
- Animator bgAnim = ObjectAnimator.ofInt(background,
- "alpha", appearing ? 0 : 255, appearing ? 255 : 0);
- bgAnim.setDuration(appearing ? SCRIM_DURATION : CLOSE_DURATION);
- builder.with(bgAnim);
+ if (appearing) {
+ Drawable background = mScrimView.getBackground();
+ if (background != null) {
+ Animator bgAnim = ObjectAnimator.ofInt(background,
+ "alpha", appearing ? 0 : 255, appearing ? 255 : 0);
+ bgAnim.setDuration(appearing ? SCRIM_DURATION : CLOSE_DURATION);
+ builder.with(bgAnim);
+ }
}
mContentAnim.addListener(this);
if (mListener != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index feb1ac8..39d686f 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -19,6 +19,7 @@
import android.animation.Animator;
import android.animation.LayoutTransition;
import android.app.ActivityManager;
+import android.app.ActivityManagerNative;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
@@ -26,13 +27,13 @@
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
-import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
+import android.os.RemoteException;
import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Log;
@@ -283,8 +284,19 @@
}
}
+ static void sendCloseSystemWindows(Context context, String reason) {
+ if (ActivityManagerNative.isSystemReady()) {
+ try {
+ ActivityManagerNative.getDefault().closeSystemDialogs(reason);
+ } catch (RemoteException e) {
+ }
+ }
+ }
+
public void show(boolean show, boolean animate,
ArrayList<TaskDescription> recentTaskDescriptions, boolean firstScreenful) {
+ sendCloseSystemWindows(mContext, BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS);
+
// For now, disable animations. We may want to re-enable in the future
if (show) {
animate = false;
@@ -469,7 +481,7 @@
Display d = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
if (!ActivityManager.isHighEndGfx(d)) {
- mRecentsScrim.setBackgroundDrawable(null);
+ mRecentsScrim.setBackground(null);
} else if (mRecentsScrim.getBackground() instanceof BitmapDrawable) {
// In order to save space, we make the background texture repeat in the Y direction
((BitmapDrawable) mRecentsScrim.getBackground()).setTileModeY(TileMode.REPEAT);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index a310b1d..4b223dd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -85,6 +85,9 @@
protected static final boolean ENABLE_INTRUDERS = false;
+ // Should match the value in PhoneWindowManager
+ public static final String SYSTEM_DIALOG_REASON_RECENT_APPS = "recentapps";
+
public static final int EXPANDED_LEAVE_ALONE = -10000;
public static final int EXPANDED_FULL_OPEN = -10001;
@@ -400,6 +403,15 @@
return new H();
}
+ static void sendCloseSystemWindows(Context context, String reason) {
+ if (ActivityManagerNative.isSystemReady()) {
+ try {
+ ActivityManagerNative.getDefault().closeSystemDialogs(reason);
+ } catch (RemoteException e) {
+ }
+ }
+ }
+
protected class H extends Handler {
public void handleMessage(Message m) {
switch (m.what) {
@@ -466,7 +478,7 @@
protected boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) {
int rowHeight =
- mContext.getResources().getDimensionPixelSize(R.dimen.notification_height);
+ mContext.getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
int minHeight =
mContext.getResources().getDimensionPixelSize(R.dimen.notification_min_height);
int maxHeight =
@@ -486,7 +498,6 @@
// for blaming (see SwipeHelper.setLongPressListener)
row.setTag(sbn.pkg);
- ViewGroup.LayoutParams lp = row.getLayoutParams();
workAroundBadLayerDrawableOpacity(row);
View vetoButton = updateNotificationVetoButton(row, sbn);
vetoButton.setContentDescription(mContext.getString(
@@ -498,13 +509,6 @@
ViewGroup content = (ViewGroup)row.findViewById(R.id.content);
ViewGroup adaptive = (ViewGroup)row.findViewById(R.id.adaptive);
- // Ensure that R.id.content is properly set to 64dp high if 1U
- lp = content.getLayoutParams();
- if (large == null) {
- lp.height = minHeight;
- }
- content.setLayoutParams(lp);
-
content.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
PendingIntent contentIntent = sbn.notification.contentIntent;
@@ -516,6 +520,7 @@
content.setOnClickListener(null);
}
+ // TODO(cwren) normalize variable names with those in updateNotification
View expandedOneU = null;
View expandedLarge = null;
Exception exception = null;
@@ -544,7 +549,7 @@
SizeAdaptiveLayout.LayoutParams params =
new SizeAdaptiveLayout.LayoutParams(expandedLarge.getLayoutParams());
params.minHeight = minHeight+1;
- params.maxHeight = SizeAdaptiveLayout.LayoutParams.UNBOUNDED;
+ params.maxHeight = maxHeight;
adaptive.addView(expandedLarge, params);
}
row.setDrawingCacheEnabled(true);
@@ -711,20 +716,18 @@
}
protected boolean expandView(NotificationData.Entry entry, boolean expand) {
- if (entry.expandable()) {
- int rowHeight =
- mContext.getResources().getDimensionPixelSize(R.dimen.notification_height);
- ViewGroup.LayoutParams lp = entry.row.getLayoutParams();
- if (expand) {
- lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
- } else {
- lp.height = rowHeight;
- }
- entry.row.setLayoutParams(lp);
- return expand;
+ int rowHeight =
+ mContext.getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
+ ViewGroup.LayoutParams lp = entry.row.getLayoutParams();
+ if (entry.expandable() && expand) {
+ if (DEBUG) Slog.d(TAG, "setting expanded row height to WRAP_CONTENT");
+ lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
} else {
- return false;
+ if (DEBUG) Slog.d(TAG, "setting collapsed row height to " + rowHeight);
+ lp.height = rowHeight;
}
+ entry.row.setLayoutParams(lp);
+ return expand;
}
protected void updateExpansionStates() {
@@ -751,6 +754,7 @@
protected abstract void tick(IBinder key, StatusBarNotification n, boolean firstTime);
protected abstract void updateExpandedViewPos(int expandedPosition);
protected abstract int getExpandedViewMaxHeight();
+ protected abstract boolean shouldDisableNavbarGestures();
protected boolean isTopNotification(ViewGroup parent, NotificationData.Entry entry) {
return parent.indexOfChild(entry.row) == 0;
@@ -768,32 +772,41 @@
final StatusBarNotification oldNotification = oldEntry.notification;
// XXX: modify when we do something more intelligent with the two content views
- final RemoteViews oldContentView = (oldNotification.notification.bigContentView != null)
- ? oldNotification.notification.bigContentView
- : oldNotification.notification.contentView;
- final RemoteViews contentView = (notification.notification.bigContentView != null)
- ? notification.notification.bigContentView
- : notification.notification.contentView;
+ final RemoteViews oldContentView = oldNotification.notification.contentView;
+ final RemoteViews contentView = notification.notification.contentView;
+ final RemoteViews oldBigContentView = oldNotification.notification.bigContentView;
+ final RemoteViews bigContentView = notification.notification.bigContentView;
if (DEBUG) {
Slog.d(TAG, "old notification: when=" + oldNotification.notification.when
+ " ongoing=" + oldNotification.isOngoing()
+ " expanded=" + oldEntry.expanded
+ " contentView=" + oldContentView
+ + " bigContentView=" + oldBigContentView
+ " rowParent=" + oldEntry.row.getParent());
Slog.d(TAG, "new notification: when=" + notification.notification.when
+ " ongoing=" + oldNotification.isOngoing()
- + " contentView=" + contentView);
+ + " contentView=" + contentView
+ + " bigContentView=" + bigContentView);
}
// Can we just reapply the RemoteViews in place? If when didn't change, the order
// didn't change.
+
+ // 1U is never null
boolean contentsUnchanged = oldEntry.expanded != null
- && contentView != null && oldContentView != null
&& contentView.getPackage() != null
&& oldContentView.getPackage() != null
&& oldContentView.getPackage().equals(contentView.getPackage())
&& oldContentView.getLayoutId() == contentView.getLayoutId();
+ // large view may be null
+ boolean bigContentsUnchanged =
+ (oldEntry.getLargeView() == null && bigContentView == null)
+ || ((oldEntry.getLargeView() != null && bigContentView != null)
+ && bigContentView.getPackage() != null
+ && oldBigContentView.getPackage() != null
+ && oldBigContentView.getPackage().equals(bigContentView.getPackage())
+ && oldBigContentView.getLayoutId() == bigContentView.getLayoutId());
ViewGroup rowParent = (ViewGroup) oldEntry.row.getParent();
boolean orderUnchanged = notification.notification.when==oldNotification.notification.when
&& notification.score == oldNotification.score;
@@ -803,12 +816,15 @@
&& !TextUtils.equals(notification.notification.tickerText,
oldEntry.notification.notification.tickerText);
boolean isTopAnyway = isTopNotification(rowParent, oldEntry);
- if (contentsUnchanged && (orderUnchanged || isTopAnyway)) {
+ if (contentsUnchanged && bigContentsUnchanged && (orderUnchanged || isTopAnyway)) {
if (DEBUG) Slog.d(TAG, "reusing notification for key: " + key);
oldEntry.notification = notification;
try {
// Reapply the RemoteViews
- contentView.reapply(mContext, oldEntry.content);
+ contentView.reapply(mContext, oldEntry.expanded);
+ if (bigContentView != null && oldEntry.getLargeView() != null) {
+ bigContentView.reapply(mContext, oldEntry.getLargeView());
+ }
// update the contentIntent
final PendingIntent contentIntent = notification.notification.contentIntent;
if (contentIntent != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java
index e074a80..0e6dfd5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/DelegateViewHelper.java
@@ -53,6 +53,9 @@
}
public boolean onInterceptTouchEvent(MotionEvent event) {
+ if (mBar.shouldDisableNavbarGestures()) {
+ return false;
+ }
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mDownPoint[0] = event.getX();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index d3fbdab..287c2922 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1977,7 +1977,7 @@
if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) {
String reason = intent.getStringExtra("reason");
if (reason != null) {
- excludeRecents = reason.equals("recentapps");
+ excludeRecents = reason.equals(SYSTEM_DIALOG_REASON_RECENT_APPS);
}
}
animateCollapse(excludeRecents);
@@ -2109,5 +2109,10 @@
protected void haltTicker() {
mTicker.halt();
}
+
+ @Override
+ protected boolean shouldDisableNavbarGestures() {
+ return mExpanded || (mDisabled & StatusBarManager.DISABLE_HOME) != 0;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
index 72fdfad..3ba36af 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
@@ -31,8 +31,8 @@
public class BrightnessController implements ToggleSlider.Listener {
private static final String TAG = "StatusBar.BrightnessController";
- private static final int MINIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_DIM;
- private static final int MAXIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_ON;
+ private static final int MINIMUM_BACKLIGHT = android.os.PowerManager.BRIGHTNESS_DIM;
+ private static final int MAXIMUM_BACKLIGHT = android.os.PowerManager.BRIGHTNESS_ON;
private Context mContext;
private ToggleSlider mControl;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
index 0fe7a0a..f41d99c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
@@ -101,8 +101,8 @@
float densityScale = getResources().getDisplayMetrics().density;
float pagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop);
- int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
- int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_max_height);
+ int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
+ int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height);
mExpandHelper = new ExpandHelper(mContext, this, minHeight, maxHeight);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 906d1aa..dba1606 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -1582,7 +1582,7 @@
if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) {
String reason = intent.getStringExtra("reason");
if (reason != null) {
- excludeRecents = reason.equals("recentapps");
+ excludeRecents = reason.equals(SYSTEM_DIALOG_REASON_RECENT_APPS);
}
}
if (Intent.ACTION_SCREEN_OFF.equals(action)) {
@@ -1618,6 +1618,12 @@
@Override
protected void updateExpandedViewPos(int expandedPosition) {
}
+
+ @Override
+ protected boolean shouldDisableNavbarGestures() {
+ return mNotificationPanel.getVisibility() == View.VISIBLE
+ || (mDisabled & StatusBarManager.DISABLE_HOME) != 0;
+ }
}
diff --git a/policy/src/com/android/internal/policy/impl/BiometricSensorUnlock.java b/policy/src/com/android/internal/policy/impl/BiometricSensorUnlock.java
index a13ccc2..f476f82 100644
--- a/policy/src/com/android/internal/policy/impl/BiometricSensorUnlock.java
+++ b/policy/src/com/android/internal/policy/impl/BiometricSensorUnlock.java
@@ -21,8 +21,7 @@
interface BiometricSensorUnlock {
/**
* Initializes the view provided for the biometric unlock UI to work within. The provided area
- * completely covers the backup unlock mechanism. The view is then displayed in the same manner
- * as if {@link BiometricSensorUnlock#show(long)} was called with a timeout of 0.
+ * completely covers the backup unlock mechanism.
* @param biometricUnlockView View provided for the biometric unlock UI.
*/
public void initializeView(View biometricUnlockView);
diff --git a/policy/src/com/android/internal/policy/impl/FaceUnlock.java b/policy/src/com/android/internal/policy/impl/FaceUnlock.java
index ffdeeb1..c46b94a 100644
--- a/policy/src/com/android/internal/policy/impl/FaceUnlock.java
+++ b/policy/src/com/android/internal/policy/impl/FaceUnlock.java
@@ -101,7 +101,6 @@
public void initializeView(View biometricUnlockView) {
Log.d(TAG, "initializeView()");
mFaceUnlockView = biometricUnlockView;
- show(0);
}
/**
@@ -469,10 +468,8 @@
if (mLockPatternUtils == null) {
Log.d(TAG, "mLockPatternUtils is null");
}
- Log.d(TAG, "x,y,w,h,live: " + x + "," + y + "," + w + "," + h + "," +
- (mLockPatternUtils.isBiometricWeakLivelinessEnabled()?"yes":"no"));
- mService.startUi(windowToken, x, y, w, h,
- mLockPatternUtils.isBiometricWeakLivelinessEnabled());
+ Log.d(TAG, "x,y,w,h,live: " + x + "," + y + "," + w + "," + h + ", no");
+ mService.startUi(windowToken, x, y, w, h, false);
Log.d(TAG, "mService.startUi() called");
} catch (RemoteException e) {
Log.e(TAG, "Caught exception starting Face Unlock: " + e.toString());
diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java
index 3fa79b6..aa73de4 100644
--- a/policy/src/com/android/internal/policy/impl/GlobalActions.java
+++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java
@@ -16,14 +16,12 @@
package com.android.internal.policy.impl;
-import com.android.internal.app.ShutdownThread;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.R;
import android.app.ActivityManagerNative;
import android.app.AlertDialog;
-import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
@@ -48,6 +46,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
+import android.view.WindowManagerPolicy.WindowManagerFuncs;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
@@ -68,6 +67,7 @@
private static final boolean SHOW_SILENT_TOGGLE = true;
private final Context mContext;
+ private final WindowManagerFuncs mWindowManagerFuncs;
private final AudioManager mAudioManager;
private ArrayList<Action> mItems;
@@ -88,8 +88,9 @@
/**
* @param context everything needs a context :(
*/
- public GlobalActions(Context context) {
+ public GlobalActions(Context context, WindowManagerFuncs windowManagerFuncs) {
mContext = context;
+ mWindowManagerFuncs = windowManagerFuncs;
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
// receive broadcasts
@@ -186,11 +187,11 @@
public void onPress() {
// shutdown by making sure radio and power are handled accordingly.
- ShutdownThread.shutdown(mContext, true);
+ mWindowManagerFuncs.shutdown();
}
public boolean onLongPress() {
- ShutdownThread.rebootSafeMode(mContext, true);
+ mWindowManagerFuncs.rebootSafeMode();
return true;
}
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index 7238fdf..18b8042 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -81,7 +81,7 @@
private int mFailedAttempts = 0;
private int mFailedBiometricUnlockAttempts = 0;
- private static final int FAILED_BIOMETRIC_UNLOCK_ATTEMPTS_BEFORE_BACKUP = 15;
+ private static final int FAILED_BIOMETRIC_UNLOCK_ATTEMPTS_BEFORE_BACKUP = 5;
private boolean mClockVisible;
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 8320b1d..049e6ac 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -414,12 +414,6 @@
}
};
- // Indicates whether a biometric unlock method is in use
- private boolean isBiometricUnlockInstalledAndSelected() {
- return (mLockPatternUtils.usingBiometricWeak() &&
- mLockPatternUtils.isBiometricWeakInstalled());
- }
-
/**
* @param context Used to inflate, and create views.
* @param callback Keyguard callback object for pokewakelock(), etc.
@@ -443,14 +437,6 @@
sIsFirstAppearanceAfterBoot = false;
mPluggedIn = mUpdateMonitor.isDevicePluggedIn();
mScreenOn = ((PowerManager)context.getSystemService(Context.POWER_SERVICE)).isScreenOn();
-
- // If the biometric unlock is not being used, we don't bother constructing it. Then we can
- // simply check if it is null when deciding whether we should make calls to it.
- if (isBiometricUnlockInstalledAndSelected()) {
- mBiometricUnlock = new FaceUnlock(context, updateMonitor, lockPatternUtils,
- mKeyguardScreenCallback);
- }
-
mUpdateMonitor.registerInfoCallback(mInfoCallback);
/**
@@ -848,19 +834,11 @@
}
}
- // Re-create the unlock screen if necessary. This is primarily required to properly handle
- // SIM state changes. This typically happens when this method is called by reset()
+ // Re-create the unlock screen if necessary.
final UnlockMode unlockMode = getUnlockMode();
if (mode == Mode.UnlockScreen && unlockMode != UnlockMode.Unknown) {
if (force || mUnlockScreen == null || unlockMode != mUnlockScreenMode) {
- boolean restartBiometricUnlock = false;
- if (mBiometricUnlock != null) {
- restartBiometricUnlock = mBiometricUnlock.stop();
- }
recreateUnlockScreen(unlockMode);
- if (mBiometricUnlock != null && restartBiometricUnlock) {
- maybeStartBiometricUnlock();
- }
}
}
@@ -973,13 +951,7 @@
throw new IllegalArgumentException("unknown unlock mode " + unlockMode);
}
initializeTransportControlView(unlockView);
-
- if (mBiometricUnlock != null) {
- // TODO: make faceLockAreaView a more general biometricUnlockView
- // We will need to add our Face Unlock specific child views programmatically in
- // initializeView rather than having them in the XML files.
- mBiometricUnlock.initializeView(unlockView.findViewById(R.id.faceLockAreaView));
- }
+ initializeBiometricUnlockView(unlockView);
mUnlockScreenMode = unlockMode;
return unlockView;
@@ -997,6 +969,55 @@
}
/**
+ * This returns false if there is any condition that indicates that the biometric unlock should
+ * not be used before the next time the unlock screen is recreated. In other words, if this
+ * returns false there is no need to even construct the biometric unlock.
+ */
+ private boolean useBiometricUnlock() {
+ final UnlockMode unlockMode = getUnlockMode();
+ final boolean backupIsTimedOut = (mUpdateMonitor.getFailedAttempts() >=
+ LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT);
+ return (mLockPatternUtils.usingBiometricWeak() &&
+ mLockPatternUtils.isBiometricWeakInstalled() &&
+ !mUpdateMonitor.getMaxBiometricUnlockAttemptsReached() &&
+ !backupIsTimedOut &&
+ (unlockMode == UnlockMode.Pattern || unlockMode == UnlockMode.Password));
+ }
+
+ private void initializeBiometricUnlockView(View view) {
+ boolean restartBiometricUnlock = false;
+
+ if (mBiometricUnlock != null) {
+ restartBiometricUnlock = mBiometricUnlock.stop();
+ }
+
+ // If the biometric unlock is not being used, we don't bother constructing it. Then we can
+ // simply check if it is null when deciding whether we should make calls to it.
+ mBiometricUnlock = null;
+ if (useBiometricUnlock()) {
+ // TODO: make faceLockAreaView a more general biometricUnlockView
+ // We will need to add our Face Unlock specific child views programmatically in
+ // initializeView rather than having them in the XML files.
+ View biometricUnlockView = view.findViewById(R.id.faceLockAreaView);
+ if (biometricUnlockView != null) {
+ mBiometricUnlock = new FaceUnlock(mContext, mUpdateMonitor, mLockPatternUtils,
+ mKeyguardScreenCallback);
+ mBiometricUnlock.initializeView(biometricUnlockView);
+
+ // If this is being called because the screen turned off, we want to cover the
+ // backup lock so it is covered when the screen turns back on.
+ if (!mScreenOn) mBiometricUnlock.show(0);
+ } else {
+ Log.w(TAG, "Couldn't find biometric unlock view");
+ }
+ }
+
+ if (mBiometricUnlock != null && restartBiometricUnlock) {
+ maybeStartBiometricUnlock();
+ }
+ }
+
+ /**
* Given the current state of things, what should be the initial mode of
* the lock screen (lock or unlock).
*/
diff --git a/policy/src/com/android/internal/policy/impl/LockScreen.java b/policy/src/com/android/internal/policy/impl/LockScreen.java
index f34f9a9..8ea334e 100644
--- a/policy/src/com/android/internal/policy/impl/LockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/LockScreen.java
@@ -129,6 +129,9 @@
// Get the target position for the given resource. Returns -1 if not found.
public int getTargetPosition(int resourceId);
+
+ // Clean up when this widget is going away
+ public void cleanUp();
}
class SlidingTabMethods implements SlidingTab.OnTriggerListener, UnlockWidgetCommonMethods {
@@ -197,6 +200,10 @@
public int getTargetPosition(int resourceId) {
return -1; // Not supported
}
+
+ public void cleanUp() {
+ mSlidingTab.setOnTriggerListener(null);
+ }
}
class WaveViewMethods implements WaveView.OnTriggerListener, UnlockWidgetCommonMethods {
@@ -240,6 +247,9 @@
public int getTargetPosition(int resourceId) {
return -1; // Not supported
}
+ public void cleanUp() {
+ mWaveView.setOnTriggerListener(null);
+ }
}
private Intent getAssistIntent() {
@@ -374,6 +384,10 @@
public int getTargetPosition(int resourceId) {
return mMultiWaveView.getTargetPosition(resourceId);
}
+
+ public void cleanUp() {
+ mMultiWaveView.setOnTriggerListener(null);
+ }
}
private void requestUnlockScreen() {
@@ -592,6 +606,7 @@
public void cleanUp() {
mUpdateMonitor.removeCallback(mInfoCallback); // this must be first
mUpdateMonitor.removeCallback(mSimStateCallback);
+ mUnlockWidgetMethods.cleanUp();
mLockPatternUtils = null;
mUpdateMonitor = null;
mCallback = null;
diff --git a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
index 06cd69e..203f9db 100644
--- a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
@@ -113,10 +113,7 @@
mPasswordEntry.setOnEditorActionListener(this);
mKeyboardHelper = new PasswordEntryKeyboardHelper(context, mKeyboardView, this, false);
- mKeyboardHelper.setEnableHaptics(
- Settings.Secure.getInt(mContext.getContentResolver(),
- Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, 0)
- != 0);
+ mKeyboardHelper.setEnableHaptics(mLockPatternUtils.isTactileFeedbackEnabled());
boolean imeOrDeleteButtonVisible = false;
if (mIsAlpha) {
// We always use the system IME for alpha keyboard, so hide lockscreen's soft keyboard
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index cc7050a..9629f0a 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -79,6 +79,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewManager;
+import android.view.ViewParent;
import android.view.ViewStub;
import android.view.Window;
import android.view.WindowManager;
@@ -582,7 +583,10 @@
st.decorView.setWindowBackground(getContext().getResources().getDrawable(
backgroundResId));
-
+ ViewParent shownPanelParent = st.shownPanelView.getParent();
+ if (shownPanelParent != null && shownPanelParent instanceof ViewGroup) {
+ ((ViewGroup) shownPanelParent).removeView(st.shownPanelView);
+ }
st.decorView.addView(st.shownPanelView, lp);
/*
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 794ed15..3147ba7 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -15,7 +15,6 @@
package com.android.internal.policy.impl;
-import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManagerNative;
import android.app.IUiModeManager;
@@ -37,8 +36,6 @@
import android.database.ContentObserver;
import android.graphics.PixelFormat;
import android.graphics.Rect;
-import android.graphics.RectF;
-import android.hardware.input.InputManager;
import android.media.AudioManager;
import android.media.IAudioService;
import android.os.BatteryManager;
@@ -60,7 +57,6 @@
import android.provider.Settings;
import com.android.internal.R;
-import com.android.internal.app.ShutdownThread;
import com.android.internal.policy.PolicyManager;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.telephony.ITelephony;
@@ -149,7 +145,6 @@
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
-import java.util.ArrayList;
/**
* WindowManagerPolicy implementation for the Android phone UI. This
@@ -248,8 +243,6 @@
static final int SYSTEM_UI_CHANGING_LAYOUT =
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
- private static final int BTN_MOUSE = 0x110;
-
/* Table of Application Launch keys. Maps from key codes to intent categories.
*
* These are special keys that are used to launch particular kinds of applications,
@@ -448,7 +441,6 @@
static final Rect mTmpParentFrame = new Rect();
static final Rect mTmpDisplayFrame = new Rect();
- static final Rect mTmpSystemFrame = new Rect();
static final Rect mTmpContentFrame = new Rect();
static final Rect mTmpVisibleFrame = new Rect();
static final Rect mTmpNavigationFrame = new Rect();
@@ -727,7 +719,7 @@
mPowerKeyHandled = true;
performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
sendCloseSystemWindows(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS);
- ShutdownThread.shutdown(mContext, true);
+ mWindowManagerFuncs.shutdown();
break;
}
}
@@ -741,7 +733,7 @@
void showGlobalActionsDialog() {
if (mGlobalActions == null) {
- mGlobalActions = new GlobalActions(mContext);
+ mGlobalActions = new GlobalActions(mContext, mWindowManagerFuncs);
}
final boolean keyguardShowing = keyguardIsShowingTq();
mGlobalActions.showDialog(keyguardShowing, isDeviceProvisioned());
@@ -2302,7 +2294,7 @@
mStatusBarLayer = mNavigationBar.getSurfaceLayer();
// And compute the final frame.
mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame,
- mTmpNavigationFrame, mTmpNavigationFrame, mTmpNavigationFrame);
+ mTmpNavigationFrame, mTmpNavigationFrame);
if (DEBUG_LAYOUT) Log.i(TAG, "mNavigationBar frame: " + mTmpNavigationFrame);
}
if (DEBUG_LAYOUT) Log.i(TAG, String.format("mDock rect: (%d,%d - %d,%d)",
@@ -2323,7 +2315,7 @@
mStatusBarLayer = mStatusBar.getSurfaceLayer();
// Let the status bar determine its size.
- mStatusBar.computeFrameLw(pf, df, df, vf, vf);
+ mStatusBar.computeFrameLw(pf, df, vf, vf);
// For layout, the status bar is always at the top with our fixed height.
mStableTop = mUnrestrictedScreenTop + mStatusBarHeight;
@@ -2357,6 +2349,17 @@
}
}
+ /** {@inheritDoc} */
+ public int getSystemDecorRectLw(Rect systemRect) {
+ systemRect.left = mSystemLeft;
+ systemRect.top = mSystemTop;
+ systemRect.right = mSystemRight;
+ systemRect.bottom = mSystemBottom;
+ if (mStatusBar != null) return mStatusBar.getSurfaceLayer();
+ if (mNavigationBar != null) return mNavigationBar.getSurfaceLayer();
+ return 0;
+ }
+
void setAttachedWindowFrames(WindowState win, int fl, int adjust,
WindowState attached, boolean insetDecors, Rect pf, Rect df, Rect cf, Rect vf) {
if (win.getSurfaceLayer() > mDockLayer && attached.getSurfaceLayer() < mDockLayer) {
@@ -2427,7 +2430,6 @@
final Rect pf = mTmpParentFrame;
final Rect df = mTmpDisplayFrame;
- final Rect sf = mTmpSystemFrame;
final Rect cf = mTmpContentFrame;
final Rect vf = mTmpVisibleFrame;
@@ -2671,20 +2673,6 @@
df.right = df.bottom = cf.right = cf.bottom = vf.right = vf.bottom = 10000;
}
- // Compute the system frame. This is easy: for things behind the
- // status bar, it is any application windows; otherwise it is not set.
- int parentType = attached != null ? attached.getAttrs().type : attrs.type;
- if (win.getSurfaceLayer() < mStatusBarLayer
- && parentType < WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW) {
- sf.left = mSystemLeft;
- sf.top = mSystemTop;
- sf.right = mSystemRight;
- sf.bottom = mSystemBottom;
- } else {
- sf.left = sf.top = -10000;
- sf.right = sf.bottom = 10000;
- }
-
if (DEBUG_LAYOUT) Log.v(TAG, "Compute frame " + attrs.getTitle()
+ ": sim=#" + Integer.toHexString(sim)
+ " attach=" + attached + " type=" + attrs.type
@@ -2692,7 +2680,7 @@
+ " pf=" + pf.toShortString() + " df=" + df.toShortString()
+ " cf=" + cf.toShortString() + " vf=" + vf.toShortString());
- win.computeFrameLw(pf, df, sf, cf, vf);
+ win.computeFrameLw(pf, df, cf, vf);
// Dock windows carve out the bottom of the screen, so normal windows
// can't appear underneath them.
diff --git a/services/java/com/android/server/CertBlacklister.java b/services/java/com/android/server/CertBlacklister.java
new file mode 100644
index 0000000..8b167d7
--- /dev/null
+++ b/services/java/com/android/server/CertBlacklister.java
@@ -0,0 +1,142 @@
+/*
+ * 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 com.android.server;
+
+import android.content.Context;
+import android.content.ContentResolver;
+import android.database.ContentObserver;
+import android.os.Binder;
+import android.os.FileUtils;
+import android.provider.Settings;
+import android.util.Slog;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import libcore.io.IoUtils;
+
+/**
+ * <p>CertBlacklister provides a simple mechanism for updating the platform blacklists for SSL
+ * certificate public keys and serial numbers.
+ */
+public class CertBlacklister extends Binder {
+
+ private static final String TAG = "CertBlacklister";
+
+ private static final String BLACKLIST_ROOT = System.getenv("ANDROID_DATA") + "/misc/keychain/";
+
+ public static final String PUBKEY_PATH = BLACKLIST_ROOT + "pubkey_blacklist.txt";
+ public static final String SERIAL_PATH = BLACKLIST_ROOT + "serial_blacklist.txt";
+
+ public static final String PUBKEY_BLACKLIST_KEY = "pubkey_blacklist";
+ public static final String SERIAL_BLACKLIST_KEY = "serial_blacklist";
+
+ private static class BlacklistObserver extends ContentObserver {
+
+ private final String mKey;
+ private final String mName;
+ private final String mPath;
+ private final File mTmpDir;
+ private final ContentResolver mContentResolver;
+
+ public BlacklistObserver(String key, String name, String path, ContentResolver cr) {
+ super(null);
+ mKey = key;
+ mName = name;
+ mPath = path;
+ mTmpDir = new File(mPath).getParentFile();
+ mContentResolver = cr;
+ }
+
+ @Override
+ public void onChange(boolean selfChange) {
+ super.onChange(selfChange);
+ writeBlacklist();
+ }
+
+ public String getValue() {
+ return Settings.Secure.getString(mContentResolver, mKey);
+ }
+
+ private void writeBlacklist() {
+ new Thread("BlacklistUpdater") {
+ public void run() {
+ synchronized(mTmpDir) {
+ String blacklist = getValue();
+ if (blacklist != null) {
+ Slog.i(TAG, "Certificate blacklist changed, updating...");
+ FileOutputStream out = null;
+ try {
+ // create a temporary file
+ File tmp = File.createTempFile("journal", "", mTmpDir);
+ // mark it -rw-r--r--
+ tmp.setReadable(true, false);
+ // write to it
+ out = new FileOutputStream(tmp);
+ out.write(blacklist.getBytes());
+ // sync to disk
+ FileUtils.sync(out);
+ // atomic rename
+ tmp.renameTo(new File(mPath));
+ Slog.i(TAG, "Certificate blacklist updated");
+ } catch (IOException e) {
+ Slog.e(TAG, "Failed to write blacklist", e);
+ } finally {
+ IoUtils.closeQuietly(out);
+ }
+ }
+ }
+ }
+ }.start();
+ }
+ }
+
+ public CertBlacklister(Context context) {
+ registerObservers(context.getContentResolver());
+ }
+
+ private BlacklistObserver buildPubkeyObserver(ContentResolver cr) {
+ return new BlacklistObserver(PUBKEY_BLACKLIST_KEY,
+ "pubkey",
+ PUBKEY_PATH,
+ cr);
+ }
+
+ private BlacklistObserver buildSerialObserver(ContentResolver cr) {
+ return new BlacklistObserver(SERIAL_BLACKLIST_KEY,
+ "serial",
+ SERIAL_PATH,
+ cr);
+ }
+
+ private void registerObservers(ContentResolver cr) {
+ // set up the public key blacklist observer
+ cr.registerContentObserver(
+ Settings.Secure.getUriFor(PUBKEY_BLACKLIST_KEY),
+ true,
+ buildPubkeyObserver(cr)
+ );
+
+ // set up the serial number blacklist observer
+ cr.registerContentObserver(
+ Settings.Secure.getUriFor(SERIAL_BLACKLIST_KEY),
+ true,
+ buildSerialObserver(cr)
+ );
+ }
+}
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 289ab2a..2cc2704 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -17,8 +17,8 @@
package com.android.server;
import com.android.internal.app.IBatteryStats;
-import com.android.internal.app.ShutdownThread;
import com.android.server.am.BatteryStatsService;
+import com.android.server.pm.ShutdownThread;
import android.app.ActivityManagerNative;
import android.app.IActivityManager;
@@ -47,7 +47,6 @@
import android.os.IPowerManager;
import android.os.LocalPowerManager;
import android.os.Message;
-import android.os.Power;
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
@@ -71,6 +70,7 @@
import static android.provider.Settings.System.TRANSITION_ANIMATION_SCALE;
import java.io.FileDescriptor;
+import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
@@ -84,6 +84,12 @@
private static final String TAG = "PowerManagerService";
static final String PARTIAL_NAME = "PowerManagerService";
+ // Wake lock that ensures that the CPU is running. The screen might not be on.
+ private static final int PARTIAL_WAKE_LOCK_ID = 1;
+
+ // Wake lock that ensures that the screen is on.
+ private static final int FULL_WAKE_LOCK_ID = 2;
+
static final boolean DEBUG_SCREEN_ON = false;
private static final boolean LOG_PARTIAL_WL = false;
@@ -134,6 +140,10 @@
// Screen brightness should always have a value, but just in case...
private static final int DEFAULT_SCREEN_BRIGHTNESS = 192;
+ // Threshold for BRIGHTNESS_LOW_BATTERY (percentage)
+ // Screen will stay dim if battery level is <= LOW_BATTERY_THRESHOLD
+ private static final int LOW_BATTERY_THRESHOLD = 10;
+
// flags for setPowerState
private static final int ALL_LIGHTS_OFF = 0x00000000;
private static final int SCREEN_ON_BIT = 0x00000001;
@@ -175,8 +185,8 @@
// we should read them from the driver, but our current hardware returns 0
// for the initial value. Oops!
static final int INITIAL_SCREEN_BRIGHTNESS = 255;
- static final int INITIAL_BUTTON_BRIGHTNESS = Power.BRIGHTNESS_OFF;
- static final int INITIAL_KEYBOARD_BRIGHTNESS = Power.BRIGHTNESS_OFF;
+ static final int INITIAL_BUTTON_BRIGHTNESS = PowerManager.BRIGHTNESS_OFF;
+ static final int INITIAL_KEYBOARD_BRIGHTNESS = PowerManager.BRIGHTNESS_OFF;
private final int MY_UID;
private final int MY_PID;
@@ -296,6 +306,11 @@
private native void nativeInit();
private native void nativeSetPowerState(boolean screenOn, boolean screenBright);
private native void nativeStartSurfaceFlingerAnimation(int mode);
+ private static native void nativeAcquireWakeLock(int lock, String id);
+ private static native void nativeReleaseWakeLock(String id);
+ private static native int nativeSetScreenState(boolean on);
+ private static native void nativeShutdown();
+ private static native void nativeReboot(String reason) throws IOException;
/*
static PrintStream mLog;
@@ -515,14 +530,13 @@
MY_PID = Process.myPid();
Binder.restoreCallingIdentity(token);
- // XXX remove this when the kernel doesn't timeout wake locks
- Power.setLastUserActivityTimeout(7*24*3600*1000); // one week
-
// assume nothing is on yet
mUserState = mPowerState = 0;
// Add ourself to the Watchdog monitors.
Watchdog.getInstance().addMonitor(this);
+
+ nativeInit();
}
private ContentQueryMap mSettings;
@@ -541,11 +555,6 @@
mAttentionLight = lights.getLight(LightsService.LIGHT_ID_ATTENTION);
mHeadless = "1".equals(SystemProperties.get("ro.config.headless", "0"));
- nativeInit();
- synchronized (mLocks) {
- updateNativePowerStateLocked();
- }
-
mInitComplete = false;
mScreenBrightnessAnimator = new ScreenBrightnessAnimator("mScreenBrightnessUpdaterThread",
Process.THREAD_PRIORITY_DISPLAY);
@@ -581,8 +590,6 @@
}
}
- nativeInit();
- Power.powerInitNative();
synchronized (mLocks) {
updateNativePowerStateLocked();
// We make sure to start out with the screen on due to user activity.
@@ -686,6 +693,26 @@
}
}
+ /**
+ * Low-level function turn the device off immediately, without trying
+ * to be clean. Most people should use
+ * {@link com.android.server.pm.internal.app.ShutdownThread} for a clean shutdown.
+ */
+ public static void lowLevelShutdown() {
+ nativeShutdown();
+ }
+
+ /**
+ * Low-level function to reboot the device.
+ *
+ * @param reason code to pass to the kernel (e.g. "recovery"), or null.
+ * @throws IOException if reboot fails for some reason (eg, lack of
+ * permission)
+ */
+ public static void lowLevelReboot(String reason) throws IOException {
+ nativeReboot(reason);
+ }
+
private class WakeLock implements IBinder.DeathRecipient
{
WakeLock(int f, IBinder b, String t, int u, int p) {
@@ -926,7 +953,7 @@
if (LOG_PARTIAL_WL) EventLog.writeEvent(EventLogTags.POWER_PARTIAL_WAKE_STATE, 1, tag);
}
}
- Power.acquireWakeLock(Power.PARTIAL_WAKE_LOCK,PARTIAL_NAME);
+ nativeAcquireWakeLock(PARTIAL_WAKE_LOCK_ID, PARTIAL_NAME);
}
if (diffsource) {
@@ -1010,7 +1037,7 @@
mPartialCount--;
if (mPartialCount == 0) {
if (LOG_PARTIAL_WL) EventLog.writeEvent(EventLogTags.POWER_PARTIAL_WAKE_STATE, 0, wl.tag);
- Power.releaseWakeLock(PARTIAL_NAME);
+ nativeReleaseWakeLock(PARTIAL_NAME);
}
}
// Unlink the lock from the binder.
@@ -1719,10 +1746,10 @@
+ " mSkippedScreenOn=" + mSkippedScreenOn);
}
mScreenBrightnessHandler.removeMessages(ScreenBrightnessAnimator.ANIMATE_LIGHTS);
- mScreenBrightnessAnimator.animateTo(Power.BRIGHTNESS_OFF, SCREEN_BRIGHT_BIT, 0);
+ mScreenBrightnessAnimator.animateTo(PowerManager.BRIGHTNESS_OFF, SCREEN_BRIGHT_BIT, 0);
}
}
- int err = Power.setScreenState(on);
+ int err = nativeSetScreenState(on);
if (err == 0) {
mLastScreenOnTime = (on ? SystemClock.elapsedRealtime() : 0);
if (mUseSoftwareAutoBrightness) {
@@ -1934,7 +1961,7 @@
private boolean batteryIsLow() {
return (!mIsPowered &&
- mBatteryService.getBatteryLevel() <= Power.LOW_BATTERY_THRESHOLD);
+ mBatteryService.getBatteryLevel() <= LOW_BATTERY_THRESHOLD);
}
private boolean shouldDeferScreenOnLocked() {
@@ -2024,7 +2051,7 @@
nominalCurrentValue = mScreenBrightnessDim;
break;
case 0:
- nominalCurrentValue = Power.BRIGHTNESS_OFF;
+ nominalCurrentValue = PowerManager.BRIGHTNESS_OFF;
break;
case SCREEN_BRIGHT_BIT:
default:
@@ -2050,7 +2077,7 @@
// was dim
steps = (int)(ANIM_STEPS*ratio*scale);
}
- brightness = Power.BRIGHTNESS_OFF;
+ brightness = PowerManager.BRIGHTNESS_OFF;
} else {
if ((oldState & SCREEN_ON_BIT) != 0) {
// was bright
@@ -2101,13 +2128,13 @@
if (offMask != 0) {
if (mSpew) Slog.i(TAG, "Setting brightess off: " + offMask);
- setLightBrightness(offMask, Power.BRIGHTNESS_OFF);
+ setLightBrightness(offMask, PowerManager.BRIGHTNESS_OFF);
}
if (dimMask != 0) {
int brightness = mScreenBrightnessDim;
if ((newState & BATTERY_LOW_BIT) != 0 &&
- brightness > Power.BRIGHTNESS_LOW_BATTERY) {
- brightness = Power.BRIGHTNESS_LOW_BATTERY;
+ brightness > PowerManager.BRIGHTNESS_LOW_BATTERY) {
+ brightness = PowerManager.BRIGHTNESS_LOW_BATTERY;
}
if (mSpew) Slog.i(TAG, "Setting brightess dim " + brightness + ": " + dimMask);
setLightBrightness(dimMask, brightness);
@@ -2115,8 +2142,8 @@
if (onMask != 0) {
int brightness = getPreferredBrightness();
if ((newState & BATTERY_LOW_BIT) != 0 &&
- brightness > Power.BRIGHTNESS_LOW_BATTERY) {
- brightness = Power.BRIGHTNESS_LOW_BATTERY;
+ brightness > PowerManager.BRIGHTNESS_LOW_BATTERY) {
+ brightness = PowerManager.BRIGHTNESS_LOW_BATTERY;
}
if (mSpew) Slog.i(TAG, "Setting brightess on " + brightness + ": " + onMask);
setLightBrightness(onMask, brightness);
@@ -2198,8 +2225,8 @@
if (elapsed < duration) {
int delta = endValue - startValue;
newValue = startValue + delta * elapsed / duration;
- newValue = Math.max(Power.BRIGHTNESS_OFF, newValue);
- newValue = Math.min(Power.BRIGHTNESS_ON, newValue);
+ newValue = Math.max(PowerManager.BRIGHTNESS_OFF, newValue);
+ newValue = Math.min(PowerManager.BRIGHTNESS_ON, newValue);
} else {
newValue = endValue;
mInitialAnimation = false;
@@ -2249,7 +2276,7 @@
if (target != currentValue) {
final boolean doScreenAnim = (mask & (SCREEN_BRIGHT_BIT | SCREEN_ON_BIT)) != 0;
- final boolean turningOff = endValue == Power.BRIGHTNESS_OFF;
+ final boolean turningOff = endValue == PowerManager.BRIGHTNESS_OFF;
if (turningOff && doScreenAnim) {
// Cancel all pending animations since we're turning off
mScreenBrightnessHandler.removeCallbacksAndMessages(null);
@@ -2353,7 +2380,7 @@
private boolean isScreenTurningOffLocked() {
return (mScreenBrightnessAnimator.isAnimating()
- && mScreenBrightnessAnimator.endValue == Power.BRIGHTNESS_OFF);
+ && mScreenBrightnessAnimator.endValue == PowerManager.BRIGHTNESS_OFF);
}
private boolean shouldLog(long time) {
diff --git a/services/java/com/android/server/ShutdownActivity.java b/services/java/com/android/server/ShutdownActivity.java
index c9d4d01..d85abe6 100644
--- a/services/java/com/android/server/ShutdownActivity.java
+++ b/services/java/com/android/server/ShutdownActivity.java
@@ -22,7 +22,8 @@
import android.os.Bundle;
import android.os.Handler;
import android.util.Slog;
-import com.android.internal.app.ShutdownThread;
+
+import com.android.server.pm.ShutdownThread;
public class ShutdownActivity extends Activity {
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 849281d..bb103580 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -46,7 +46,6 @@
import android.util.Slog;
import android.view.WindowManager;
-import com.android.internal.app.ShutdownThread;
import com.android.internal.os.BinderInternal;
import com.android.internal.os.SamplingProfilerIntegration;
import com.android.internal.widget.LockSettingsService;
@@ -56,6 +55,7 @@
import com.android.server.net.NetworkPolicyManagerService;
import com.android.server.net.NetworkStatsService;
import com.android.server.pm.PackageManagerService;
+import com.android.server.pm.ShutdownThread;
import com.android.server.usb.UsbService;
import com.android.server.wm.WindowManagerService;
@@ -623,6 +623,13 @@
} catch (Throwable e) {
reportWtf("starting CommonTimeManagementService service", e);
}
+
+ try {
+ Slog.i(TAG, "CertBlacklister");
+ CertBlacklister blacklister = new CertBlacklister(context);
+ } catch (Throwable e) {
+ reportWtf("starting CertBlacklister", e);
+ }
if (context.getResources().getBoolean(
com.android.internal.R.bool.config_enableDreams)) {
diff --git a/services/java/com/android/server/accessibility/AccessibilityInputFilter.java b/services/java/com/android/server/accessibility/AccessibilityInputFilter.java
index 889fbe4..3fbac38 100644
--- a/services/java/com/android/server/accessibility/AccessibilityInputFilter.java
+++ b/services/java/com/android/server/accessibility/AccessibilityInputFilter.java
@@ -20,6 +20,7 @@
import com.android.server.input.InputFilter;
import android.content.Context;
+import android.os.PowerManager;
import android.util.Slog;
import android.view.InputDevice;
import android.view.InputEvent;
@@ -37,6 +38,8 @@
private final Context mContext;
+ private final PowerManager mPm;
+
private final GestureListener mGestureListener;
/**
@@ -74,6 +77,7 @@
super(context.getMainLooper());
mContext = context;
mGestureListener = gestureListener;
+ mPm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
}
@Override
@@ -108,6 +112,7 @@
mTouchExplorer.clear(motionEvent, policyFlags);
}
if ((policyFlags & WindowManagerPolicy.FLAG_PASS_TO_USER) != 0) {
+ mPm.userActivity(event.getEventTime(), false);
mTouchExplorer.onMotionEvent(motionEvent, policyFlags);
} else {
mTouchExplorer.clear(motionEvent, policyFlags);
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index 0c6d85d..1937bad 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -23,9 +23,9 @@
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.accessibilityservice.IAccessibilityServiceClient;
-import android.accessibilityservice.IAccessibilityServiceClientCallback;
import android.accessibilityservice.IAccessibilityServiceConnection;
import android.app.PendingIntent;
+import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -44,7 +44,6 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
-import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -58,9 +57,7 @@
import android.view.InputDevice;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
-import android.view.View;
import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityInteractionClient;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.IAccessibilityInteractionConnection;
@@ -69,8 +66,6 @@
import android.view.accessibility.IAccessibilityManagerClient;
import com.android.internal.content.PackageMonitor;
-import com.android.internal.os.HandlerCaller;
-import com.android.internal.os.HandlerCaller.Callback;
import com.android.server.accessibility.TouchExplorer.GestureListener;
import com.android.server.wm.WindowManagerService;
@@ -85,7 +80,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
/**
* This class is instantiated by the system as a system level service and can be
@@ -107,8 +101,6 @@
private static final int OWN_PROCESS_ID = android.os.Process.myPid();
- private static final int UNDEFINED = -1;
-
private static int sIdCounter = 0;
private static int sNextWindowId;
@@ -155,10 +147,6 @@
private Service mUiAutomationService;
- private GestureHandler mGestureHandler;
-
- private int mDefaultGestureHandlingHelperServiceId = UNDEFINED;
-
/**
* Handler for delayed event dispatch.
*/
@@ -416,7 +404,6 @@
IAccessibilityInteractionConnection connection) throws RemoteException {
synchronized (mLock) {
final IWindow addedWindowToken = windowToken;
- final IAccessibilityInteractionConnection addedConnection = connection;
final int windowId = sNextWindowId++;
AccessibilityConnectionWrapper wrapper = new AccessibilityConnectionWrapper(windowId,
connection);
@@ -486,44 +473,15 @@
@Override
public boolean onGesture(int gestureId) {
- // Lazily instantiate the gesture handler.
- if (mGestureHandler == null) {
- mGestureHandler = new GestureHandler();
- }
synchronized (mLock) {
boolean handled = notifyGestureLocked(gestureId, false);
if (!handled) {
handled = notifyGestureLocked(gestureId, true);
}
- if (!handled) {
- mGestureHandler.scheduleHandleGestureDefault(gestureId);
- }
return handled;
}
}
- private Service getDefaultGestureHandlingHelperService() {
- // Since querying of screen content is done through the
- // AccessibilityInteractionClient which talks to an
- // IAccessibilityServiceConnection implementation we create a proxy
- // Service when necessary to enable interaction with the remote
- // view tree. Note that this service is just a stateless proxy
- // that does not get any events or interrupts.
- if (mDefaultGestureHandlingHelperServiceId == UNDEFINED) {
- ComponentName name = new ComponentName("android",
- "DefaultGestureHandlingHelperService");
- AccessibilityServiceInfo info = new AccessibilityServiceInfo();
- Service service = new Service(name, info, true);
- mDefaultGestureHandlingHelperServiceId = service.mId;
- AccessibilityInteractionClient.getInstance().addConnection(
- mDefaultGestureHandlingHelperServiceId, service);
- return service;
- } else {
- return (Service) AccessibilityInteractionClient.getInstance()
- .getConnection(mDefaultGestureHandlingHelperServiceId);
- }
- }
-
private boolean notifyGestureLocked(int gestureId, boolean isDefault) {
// TODO: Now we are giving the gestures to the last enabled
// service that can handle them which is the last one
@@ -537,7 +495,12 @@
for (int i = mServices.size() - 1; i >= 0; i--) {
Service service = mServices.get(i);
if (service.mReqeustTouchExplorationMode && service.mIsDefault == isDefault) {
- mGestureHandler.scheduleHandleGesture(gestureId, service.mServiceInterface);
+ try {
+ service.mServiceInterface.onGesture(gestureId);
+ } catch (RemoteException re) {
+ Slog.e(LOG_TAG, "Error during sending gesture " + gestureId
+ + " to " + service.mService, re);
+ }
return true;
}
}
@@ -983,212 +946,6 @@
}
}
- class GestureHandler extends IAccessibilityServiceClientCallback.Stub
- implements Runnable, Callback {
-
- private static final String THREAD_NAME = "AccessibilityGestureHandler";
-
- private static final long TIMEOUT_INTERACTION_MILLIS = 5000;
-
- private static final int MSG_HANDLE_GESTURE = 1;
-
- private static final int MSG_HANDLE_GESTURE_DEFAULT = 2;
-
- private final AtomicInteger mInteractionCounter = new AtomicInteger();
-
- private final Object mGestureLock = new Object();
-
- private HandlerCaller mHandlerCaller;
-
- private volatile int mInteractionId = -1;
-
- private volatile boolean mGestureResult;
-
- public GestureHandler() {
- synchronized (mGestureLock) {
- Thread worker = new Thread(this, THREAD_NAME);
- worker.start();
- while (mHandlerCaller == null) {
- try {
- mGestureLock.wait();
- } catch (InterruptedException ie) {
- /* ignore */
- }
- }
- }
- }
-
- @Override
- public void run() {
- Looper.prepare();
- synchronized (mGestureLock) {
- mHandlerCaller = new HandlerCaller(mContext, Looper.myLooper(), this);
- mGestureLock.notifyAll();
- }
- Looper.loop();
- }
-
- @Override
- public void setGestureResult(int gestureId, boolean handled, int interactionId) {
- synchronized (mGestureLock) {
- if (interactionId > mInteractionId) {
- mGestureResult = handled;
- mInteractionId = interactionId;
- }
- mGestureLock.notifyAll();
- }
- }
-
- @Override
- public void executeMessage(Message message) {
- final int type = message.what;
- switch (type) {
- case MSG_HANDLE_GESTURE: {
- IAccessibilityServiceClient service =
- (IAccessibilityServiceClient) message.obj;
- final int gestureId = message.arg1;
- final int interactionId = message.arg2;
-
- try {
- service.onGesture(gestureId, this, interactionId);
- } catch (RemoteException re) {
- Slog.e(LOG_TAG, "Error dispatching a gesture to a client.", re);
- return;
- }
-
- long waitTimeMillis = 0;
- final long startTimeMillis = SystemClock.uptimeMillis();
- synchronized (mGestureLock) {
- while (true) {
- try {
- // Did we get the expected callback?
- if (mInteractionId == interactionId) {
- break;
- }
- // Did we get an obsolete callback?
- if (mInteractionId > interactionId) {
- break;
- }
- // Did we time out?
- final long elapsedTimeMillis =
- SystemClock.uptimeMillis() - startTimeMillis;
- waitTimeMillis = TIMEOUT_INTERACTION_MILLIS - elapsedTimeMillis;
- if (waitTimeMillis <= 0) {
- break;
- }
- mGestureLock.wait(waitTimeMillis);
- } catch (InterruptedException ie) {
- /* ignore */
- }
- }
- handleGestureIfNeededAndResetLocked(gestureId);
- }
- } break;
- case MSG_HANDLE_GESTURE_DEFAULT: {
- final int gestureId = message.arg1;
- handleGestureDefault(gestureId);
- } break;
- default: {
- throw new IllegalArgumentException("Unknown message type: " + type);
- }
- }
- }
-
- private void handleGestureIfNeededAndResetLocked(int gestureId) {
- if (!mGestureResult) {
- handleGestureDefault(gestureId);
- }
- mGestureResult = false;
- mInteractionId = -1;
- }
-
- public void scheduleHandleGesture(int gestureId, IAccessibilityServiceClient service) {
- final int interactionId = mInteractionCounter.incrementAndGet();
- mHandlerCaller.obtainMessageIIO(MSG_HANDLE_GESTURE, gestureId, interactionId,
- service).sendToTarget();
- }
-
- public void scheduleHandleGestureDefault(int gestureId) {
- final int interactionId = mInteractionCounter.incrementAndGet();
- mHandlerCaller.obtainMessageI(MSG_HANDLE_GESTURE_DEFAULT, gestureId).sendToTarget();
- }
-
- private void handleGestureDefault(int gestureId) {
- Service service = getDefaultGestureHandlingHelperService();
-
- // Global actions.
- switch (gestureId) {
- case AccessibilityService.GESTURE_SWIPE_DOWN_AND_LEFT: {
- service.performGlobalAction(AccessibilityService.GLOBAL_ACTION_BACK);
- } return;
- case AccessibilityService.GESTURE_SWIPE_DOWN_AND_RIGHT: {
- service.performGlobalAction(AccessibilityService.GLOBAL_ACTION_HOME);
- } return;
- case AccessibilityService.GESTURE_SWIPE_UP_AND_LEFT: {
- service.performGlobalAction(AccessibilityService.GLOBAL_ACTION_RECENTS);
- } return;
- case AccessibilityService.GESTURE_SWIPE_UP_AND_RIGHT: {
- service.performGlobalAction(AccessibilityService.GLOBAL_ACTION_NOTIFICATIONS);
- } return;
- }
-
- AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance();
-
- AccessibilityNodeInfo root = client.getRootInActiveWindow(service.mId);
- if (root == null) {
- return;
- }
-
- AccessibilityNodeInfo current = root.findFocus(
- AccessibilityNodeInfo.FOCUS_ACCESSIBILITY);
- if (current == null) {
- current = root;
- }
-
- // Local actions.
- AccessibilityNodeInfo next = null;
- switch (gestureId) {
- case AccessibilityService.GESTURE_SWIPE_UP: {
- // TODO:
- } break;
- case AccessibilityService.GESTURE_SWIPE_DOWN: {
- // TODO:
- } break;
- case AccessibilityService.GESTURE_SWIPE_LEFT: {
- // TODO: Implement the RTL support.
-// if (mLayoutDirection == View.LAYOUT_DIRECTION_LTR) {
- next = current.focusSearch(View.ACCESSIBILITY_FOCUS_BACKWARD);
-// } else { // LAYOUT_DIRECTION_RTL
-// next = current.focusSearch(View.ACCESSIBILITY_FOCUS_FORWARD);
-// }
- } break;
- case AccessibilityService.GESTURE_SWIPE_RIGHT: {
- // TODO: Implement the RTL support.
-// if (mLayoutDirection == View.LAYOUT_DIRECTION_LTR) {
- next = current.focusSearch(View.ACCESSIBILITY_FOCUS_FORWARD);
-// } else { // LAYOUT_DIRECTION_RTL
-// next = current.focusSearch(View.ACCESSIBILITY_FOCUS_BACKWARD);
-// }
- } break;
- case AccessibilityService.GESTURE_SWIPE_UP_AND_DOWN: {
- next = current.focusSearch(View.ACCESSIBILITY_FOCUS_UP);
- } break;
- case AccessibilityService.GESTURE_SWIPE_DOWN_AND_UP: {
- next = current.focusSearch(View.ACCESSIBILITY_FOCUS_DOWN);
- } break;
- case AccessibilityService.GESTURE_SWIPE_LEFT_AND_RIGHT: {
- next = current.focusSearch(View.ACCESSIBILITY_FOCUS_LEFT);
- } break;
- case AccessibilityService.GESTURE_SWIPE_RIGHT_AND_LEFT: {
- next = current.focusSearch(View.ACCESSIBILITY_FOCUS_RIGHT);
- } break;
- }
- if (next != null && !next.equals(current)) {
- next.performAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS);
- }
- }
- }
-
/**
* This class represents an accessibility service. It stores all per service
* data required for the service management, provides API for starting/stopping the
@@ -1268,10 +1025,7 @@
mIsDefault = (info.flags & DEFAULT) != 0;
if (mIsAutomation || info.getResolveInfo().serviceInfo.applicationInfo.targetSdkVersion
- // TODO: Uncomment this line and remove the line below when JellyBean
- // SDK version is finalized.
- // >= Build.VERSION_CODES.JELLY_BEAN) {
- > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
+ >= Build.VERSION_CODES.JELLY_BEAN) {
mIncludeNotImportantViews =
(info.flags & FLAG_INCLUDE_NOT_IMPORTANT_VIEWS) != 0;
}
@@ -1590,7 +1344,7 @@
sendDownAndUpKeyEvents(KeyEvent.KEYCODE_APP_SWITCH);
} return true;
case AccessibilityService.GLOBAL_ACTION_NOTIFICATIONS: {
- // TODO: Implement when 6346026 is fixed.
+ expandStatusBar();
} return true;
}
return false;
@@ -1660,6 +1414,16 @@
Binder.restoreCallingIdentity(token);
}
+ private void expandStatusBar() {
+ final long token = Binder.clearCallingIdentity();
+
+ StatusBarManager statusBarManager = (StatusBarManager) mContext.getSystemService(
+ android.app.Service.STATUS_BAR_SERVICE);
+ statusBarManager.expand();
+
+ Binder.restoreCallingIdentity(token);
+ }
+
private IAccessibilityInteractionConnection getConnectionLocked(int windowId) {
if (DEBUG) {
Slog.i(LOG_TAG, "Trying to get interaction connection to windowId: " + windowId);
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index c300411..e6f4d918 100755
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -1036,6 +1036,11 @@
final void activityStoppedLocked(ActivityRecord r, Bundle icicle, Bitmap thumbnail,
CharSequence description) {
+ if (r.state != ActivityState.STOPPING) {
+ Slog.i(TAG, "Activity reported stop, but no longer stopping: " + r);
+ mHandler.removeMessages(STOP_TIMEOUT_MSG, r);
+ return;
+ }
if (DEBUG_SAVED_STATE) Slog.i(TAG, "Saving icicle of " + r + ": " + icicle);
if (icicle != null) {
// If icicle is null, this is happening due to a timeout, so we
@@ -2614,6 +2619,7 @@
}
boolean addingToTask = false;
+ boolean movedHome = false;
TaskRecord reuseTask = null;
if (((launchFlags&Intent.FLAG_ACTIVITY_NEW_TASK) != 0 &&
(launchFlags&Intent.FLAG_ACTIVITY_MULTIPLE_TASK) == 0)
@@ -2652,6 +2658,7 @@
if (callerAtFront) {
// We really do want to push this one into the
// user's face, right now.
+ movedHome = true;
moveHomeToFrontFromLaunchLocked(launchFlags);
moveTaskToFrontLocked(taskTop.task, r, options);
}
@@ -2830,7 +2837,9 @@
r.setTask(reuseTask, reuseTask, true);
}
newTask = true;
- moveHomeToFrontFromLaunchLocked(launchFlags);
+ if (!movedHome) {
+ moveHomeToFrontFromLaunchLocked(launchFlags);
+ }
} else if (sourceRecord != null) {
if (!addingToTask &&
@@ -3538,7 +3547,7 @@
}
ActivityRecord r = mHistory.get(index);
- while (index > 0) {
+ while (index >= 0) {
ActivityRecord cur = mHistory.get(index);
if (cur.task != r.task) {
break;
@@ -4394,14 +4403,14 @@
r.forceNewConfig = false;
if (r.app == null || r.app.thread == null) {
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
- "Switch is destroying non-running " + r);
+ "Config is destroying non-running " + r);
destroyActivityLocked(r, true, false, "config");
} else if (r.state == ActivityState.PAUSING) {
// A little annoying: we are waiting for this activity to
// finish pausing. Let's not do anything now, but just
// flag that it needs to be restarted when done pausing.
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
- "Switch is skipping already pausing " + r);
+ "Config is skipping already pausing " + r);
r.configDestroy = true;
return true;
} else if (r.state == ActivityState.RESUMED) {
@@ -4410,12 +4419,12 @@
// Instead of doing the normal handshaking, just say
// "restart!".
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
- "Switch is restarting resumed " + r);
+ "Config is relaunching resumed " + r);
relaunchActivityLocked(r, r.configChangeFlags, true);
r.configChangeFlags = 0;
} else {
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
- "Switch is restarting non-resumed " + r);
+ "Config is relaunching non-resumed " + r);
relaunchActivityLocked(r, r.configChangeFlags, false);
r.configChangeFlags = 0;
}
@@ -4461,7 +4470,9 @@
r.startFreezingScreenLocked(r.app, 0);
try {
- if (DEBUG_SWITCH) Slog.i(TAG, "Switch is restarting resumed " + r);
+ if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG,
+ (andResume ? "Relaunching to RESUMED " : "Relaunching to PAUSED ")
+ + r);
r.forceNewConfig = false;
r.app.thread.scheduleRelaunchActivity(r.appToken, results, newIntents,
changes, !andResume, new Configuration(mService.mConfiguration));
@@ -4469,7 +4480,7 @@
// the caller will only pass in 'andResume' if this activity is
// currently resumed, which implies we aren't sleeping.
} catch (RemoteException e) {
- return false;
+ if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG, "Relaunch failed", e);
}
if (andResume) {
@@ -4478,6 +4489,10 @@
if (mMainStack) {
mService.reportResumedActivityLocked(r);
}
+ r.state = ActivityState.RESUMED;
+ } else {
+ mHandler.removeMessages(PAUSE_TIMEOUT_MSG, r);
+ r.state = ActivityState.PAUSED;
}
return true;
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index d7c5eea..497ee4b 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -5600,16 +5600,18 @@
private final IPackageStatsObserver mObserver;
- public MeasureParams(PackageStats stats, boolean success, IPackageStatsObserver observer) {
+ public MeasureParams(PackageStats stats, IPackageStatsObserver observer) {
mObserver = observer;
mStats = stats;
- mSuccess = success;
}
@Override
void handleStartCopy() throws RemoteException {
- final boolean mounted;
+ synchronized (mInstallLock) {
+ mSuccess = getPackageSizeInfoLI(mStats.packageName, mStats);
+ }
+ final boolean mounted;
if (Environment.isExternalStorageEmulated()) {
mounted = true;
} else {
@@ -7781,22 +7783,16 @@
final IPackageStatsObserver observer) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.GET_PACKAGE_SIZE, null);
- // Queue up an async operation since the package deletion may take a little while.
- mHandler.post(new Runnable() {
- public void run() {
- mHandler.removeCallbacks(this);
- PackageStats stats = new PackageStats(packageName);
- final boolean success;
- synchronized (mInstallLock) {
- success = getPackageSizeInfoLI(packageName, stats);
- }
+ PackageStats stats = new PackageStats(packageName);
- Message msg = mHandler.obtainMessage(INIT_COPY);
- msg.obj = new MeasureParams(stats, success, observer);
- mHandler.sendMessage(msg);
- } //end run
- });
+ /*
+ * Queue up an async operation since the package measurement may take a
+ * little while.
+ */
+ Message msg = mHandler.obtainMessage(INIT_COPY);
+ msg.obj = new MeasureParams(stats, observer);
+ mHandler.sendMessage(msg);
}
private boolean getPackageSizeInfoLI(String packageName, PackageStats pStats) {
diff --git a/core/java/com/android/internal/app/ShutdownThread.java b/services/java/com/android/server/pm/ShutdownThread.java
similarity index 98%
rename from core/java/com/android/internal/app/ShutdownThread.java
rename to services/java/com/android/server/pm/ShutdownThread.java
index d867ff9..1d6e068 100644
--- a/core/java/com/android/internal/app/ShutdownThread.java
+++ b/services/java/com/android/server/pm/ShutdownThread.java
@@ -15,7 +15,7 @@
*/
-package com.android.internal.app;
+package com.android.server.pm;
import android.app.ActivityManagerNative;
import android.app.AlertDialog;
@@ -32,7 +32,6 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
-import android.os.Power;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -44,6 +43,8 @@
import android.os.storage.IMountShutdownObserver;
import com.android.internal.telephony.ITelephony;
+import com.android.server.PowerManagerService;
+
import android.util.Log;
import android.view.WindowManager;
@@ -456,7 +457,7 @@
if (reboot) {
Log.i(TAG, "Rebooting, reason: " + reason);
try {
- Power.reboot(reason);
+ PowerManagerService.lowLevelReboot(reason);
} catch (Exception e) {
Log.e(TAG, "Reboot failed, will attempt shutdown instead", e);
}
@@ -479,6 +480,6 @@
// Shutdown power
Log.i(TAG, "Performing low-level shutdown...");
- Power.shutdown();
+ PowerManagerService.lowLevelShutdown();
}
}
diff --git a/services/java/com/android/server/wm/Session.java b/services/java/com/android/server/wm/Session.java
index 53c0e07..61c0e9c 100644
--- a/services/java/com/android/server/wm/Session.java
+++ b/services/java/com/android/server/wm/Session.java
@@ -151,13 +151,13 @@
public int relayout(IWindow window, int seq, WindowManager.LayoutParams attrs,
int requestedWidth, int requestedHeight, int viewFlags,
- int flags, Rect outFrame, Rect outSystemInsets, Rect outContentInsets,
+ int flags, Rect outFrame, Rect outContentInsets,
Rect outVisibleInsets, Configuration outConfig, Surface outSurface) {
if (false) Slog.d(WindowManagerService.TAG, ">>>>>> ENTERED relayout from "
+ Binder.getCallingPid());
int res = mService.relayoutWindow(this, window, seq, attrs,
requestedWidth, requestedHeight, viewFlags, flags,
- outFrame, outSystemInsets, outContentInsets, outVisibleInsets,
+ outFrame, outContentInsets, outVisibleInsets,
outConfig, outSurface);
if (false) Slog.d(WindowManagerService.TAG, "<<<<<< EXITING relayout to "
+ Binder.getCallingPid());
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 2efcb8e..b3ac6f1 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -34,7 +34,6 @@
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import com.android.internal.app.IBatteryStats;
-import com.android.internal.app.ShutdownThread;
import com.android.internal.policy.PolicyManager;
import com.android.internal.policy.impl.PhoneWindowManager;
import com.android.internal.view.IInputContext;
@@ -48,6 +47,7 @@
import com.android.server.am.BatteryStatsService;
import com.android.server.input.InputFilter;
import com.android.server.input.InputManagerService;
+import com.android.server.pm.ShutdownThread;
import android.Manifest;
import android.app.ActivityManagerNative;
@@ -82,7 +82,6 @@
import android.os.Message;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
-import android.os.Power;
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
@@ -480,6 +479,9 @@
= new ArrayList<IRotationWatcher>();
int mDeferredRotationPauseCount;
+ final Rect mSystemDecorRect = new Rect();
+ int mSystemDecorLayer = 0;
+
int mPendingLayoutChanges = 0;
boolean mLayoutNeeded = true;
boolean mTraversalScheduled = false;
@@ -2647,7 +2649,7 @@
public int relayoutWindow(Session session, IWindow client, int seq,
WindowManager.LayoutParams attrs, int requestedWidth,
int requestedHeight, int viewVisibility, int flags,
- Rect outFrame, Rect outSystemInsets, Rect outContentInsets,
+ Rect outFrame, Rect outContentInsets,
Rect outVisibleInsets, Configuration outConfig, Surface outSurface) {
boolean displayed = false;
boolean inTouchMode;
@@ -2939,7 +2941,6 @@
win.mAppToken.updateReportedVisibilityLocked();
}
outFrame.set(win.mCompatFrame);
- outSystemInsets.set(win.mSystemInsets);
outContentInsets.set(win.mContentInsets);
outVisibleInsets.set(win.mVisibleInsets);
if (localLOGV) Slog.v(
@@ -3222,28 +3223,23 @@
// Entering app zooms out from the center of the thumbnail.
float scaleW = thumbWidth / mAppDisplayWidth;
float scaleH = thumbHeight / mAppDisplayHeight;
- AnimationSet set = new AnimationSet(true);
Animation scale = new ScaleAnimation(scaleW, 1, scaleH, 1,
computePivot(mNextAppTransitionStartX, scaleW),
computePivot(mNextAppTransitionStartY, scaleH));
scale.setDuration(duration);
scale.setFillBefore(true);
- set.addAnimation(scale);
- // Need to set an alpha animation on the entering app window
- // in case it appears one frame before the thumbnail window
- // (this solves flicker)
- Animation alpha = new AlphaAnimation(0, 1);
- alpha.setDuration(1);
- alpha.setFillAfter(true);
- set.addAnimation(alpha);
- a = set;
if (delayDuration > 0) {
- a.setStartOffset(delayDuration);
+ scale.setStartOffset(delayDuration);
}
+ a = scale;
} else {
- a = createExitAnimationLocked(transit, duration);
- if (delayDuration > 0) {
- a.setStartOffset(delayDuration);
+ if (delayed) {
+ a = new AlphaAnimation(1, 0);
+ a.setStartOffset(0);
+ a.setDuration(delayDuration - 50);
+ a.setBackgroundColor(0xFF000000);
+ } else {
+ a = createExitAnimationLocked(transit, duration);
}
}
a.setFillAfter(true);
@@ -5025,6 +5021,18 @@
return mInputManager.monitorInput(inputChannelName);
}
+ // Called by window manager policy. Not exposed externally.
+ @Override
+ public void shutdown() {
+ ShutdownThread.shutdown(mContext, true);
+ }
+
+ // Called by window manager policy. Not exposed externally.
+ @Override
+ public void rebootSafeMode() {
+ ShutdownThread.rebootSafeMode(mContext, true);
+ }
+
public void setInputFilter(InputFilter filter) {
mInputManager.setInputFilter(filter);
}
@@ -7710,6 +7718,7 @@
}
mPolicy.beginLayoutLw(dw, dh, mRotation);
+ mSystemDecorLayer = mPolicy.getSystemDecorRectLw(mSystemDecorRect);
int seq = mLayoutSeq+1;
if (seq < 0) seq = 0;
@@ -8172,8 +8181,6 @@
private void updateResizingWindows(final WindowState w) {
final WindowStateAnimator winAnimator = w.mWinAnimator;
if (w.mHasSurface && !w.mAppFreezing && w.mLayoutSeq == mLayoutSeq) {
- w.mSystemInsetsChanged |=
- !w.mLastSystemInsets.equals(w.mSystemInsets);
w.mContentInsetsChanged |=
!w.mLastContentInsets.equals(w.mContentInsets);
w.mVisibleInsetsChanged |=
@@ -8190,8 +8197,7 @@
+ ": configChanged=" + configChanged
+ " last=" + w.mLastFrame + " frame=" + w.mFrame);
w.mLastFrame.set(w.mFrame);
- if (w.mSystemInsetsChanged
- || w.mContentInsetsChanged
+ if (w.mContentInsetsChanged
|| w.mVisibleInsetsChanged
|| winAnimator.mSurfaceResized
|| configChanged) {
@@ -8203,7 +8209,6 @@
+ " configChanged=" + configChanged);
}
- w.mLastSystemInsets.set(w.mSystemInsets);
w.mLastContentInsets.set(w.mContentInsets);
w.mLastVisibleInsets.set(w.mVisibleInsets);
makeWindowFreezingScreenIfNeededLocked(w);
@@ -8587,11 +8592,10 @@
winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING) Slog.i(
TAG, "Resizing " + win + " WITH DRAW PENDING");
win.mClient.resized((int)winAnimator.mSurfaceW,
- (int)winAnimator.mSurfaceH, win.mLastSystemInsets,
+ (int)winAnimator.mSurfaceH,
win.mLastContentInsets, win.mLastVisibleInsets,
winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING,
configChanged ? win.mConfiguration : null);
- win.mSystemInsetsChanged = false;
win.mContentInsetsChanged = false;
win.mVisibleInsetsChanged = false;
winAnimator.mSurfaceResized = false;
@@ -8700,13 +8704,13 @@
mPowerManager.setScreenBrightnessOverride(-1);
} else {
mPowerManager.setScreenBrightnessOverride((int)
- (mInnerFields.mScreenBrightness * Power.BRIGHTNESS_ON));
+ (mInnerFields.mScreenBrightness * PowerManager.BRIGHTNESS_ON));
}
if (mInnerFields.mButtonBrightness < 0 || mInnerFields.mButtonBrightness > 1.0f) {
mPowerManager.setButtonBrightnessOverride(-1);
} else {
mPowerManager.setButtonBrightnessOverride((int)
- (mInnerFields.mButtonBrightness * Power.BRIGHTNESS_ON));
+ (mInnerFields.mButtonBrightness * PowerManager.BRIGHTNESS_ON));
}
}
if (mInnerFields.mHoldScreen != mHoldingScreenOn) {
@@ -9582,6 +9586,8 @@
pw.print(" mInTouchMode="); pw.print(mInTouchMode);
pw.print(" mLayoutSeq="); pw.println(mLayoutSeq);
if (dumpAll) {
+ pw.print(" mSystemDecorRect="); pw.print(mSystemDecorRect.toShortString());
+ pw.print(" mSystemDecorLayer="); pw.println(mSystemDecorLayer);
if (mLastStatusBarVisibility != 0) {
pw.print(" mLastStatusBarVisibility=0x");
pw.println(Integer.toHexString(mLastStatusBarVisibility));
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index 05e7d3a..1fd80c2 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -133,14 +133,6 @@
boolean mContentInsetsChanged;
/**
- * Insets that are covered by system windows such as the status bar. These
- * are in the application's coordinate space (without compatibility scale applied).
- */
- final Rect mSystemInsets = new Rect();
- final Rect mLastSystemInsets = new Rect();
- boolean mSystemInsetsChanged;
-
- /**
* Set to true if we are waiting for this window to receive its
* given internal insets before laying out other windows based on it.
*/
@@ -171,6 +163,13 @@
*/
int mTouchableInsets = ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME;
+ /**
+ * This is rectangle of the window's surface that is not covered by
+ * system decorations.
+ */
+ final Rect mSystemDecorRect = new Rect();
+ final Rect mLastSystemDecorRect = new Rect();
+
// Current transformation being applied.
float mGlobalScale=1;
float mInvGlobalScale=1;
@@ -187,7 +186,6 @@
final Rect mContainingFrame = new Rect();
final Rect mDisplayFrame = new Rect();
- final Rect mSystemFrame = new Rect();
final Rect mContentFrame = new Rect();
final Rect mParentFrame = new Rect();
final Rect mVisibleFrame = new Rect();
@@ -356,7 +354,7 @@
}
@Override
- public void computeFrameLw(Rect pf, Rect df, Rect sf, Rect cf, Rect vf) {
+ public void computeFrameLw(Rect pf, Rect df, Rect cf, Rect vf) {
mHaveFrame = true;
final Rect container = mContainingFrame;
@@ -413,9 +411,6 @@
mContentChanged = true;
}
- final Rect system = mSystemFrame;
- system.set(sf);
-
final Rect content = mContentFrame;
content.set(cf);
@@ -449,10 +444,6 @@
// Make sure the system, content and visible frames are inside of the
// final window frame.
- if (system.left < frame.left) system.left = frame.left;
- if (system.top < frame.top) system.top = frame.top;
- if (system.right > frame.right) system.right = frame.right;
- if (system.bottom > frame.bottom) system.bottom = frame.bottom;
if (content.left < frame.left) content.left = frame.left;
if (content.top < frame.top) content.top = frame.top;
if (content.right > frame.right) content.right = frame.right;
@@ -462,12 +453,6 @@
if (visible.right > frame.right) visible.right = frame.right;
if (visible.bottom > frame.bottom) visible.bottom = frame.bottom;
- final Rect systemInsets = mSystemInsets;
- systemInsets.left = system.left-frame.left;
- systemInsets.top = system.top-frame.top;
- systemInsets.right = frame.right-system.right;
- systemInsets.bottom = frame.bottom-system.bottom;
-
final Rect contentInsets = mContentInsets;
contentInsets.left = content.left-frame.left;
contentInsets.top = content.top-frame.top;
@@ -485,7 +470,6 @@
// If there is a size compatibility scale being applied to the
// window, we need to apply this to its insets so that they are
// reported to the app in its coordinate space.
- systemInsets.scale(mInvGlobalScale);
contentInsets.scale(mInvGlobalScale);
visibleInsets.scale(mInvGlobalScale);
@@ -506,7 +490,6 @@
+ mRequestedWidth + ", mRequestedheight="
+ mRequestedHeight + ") to" + " (pw=" + pw + ", ph=" + ph
+ "): frame=" + mFrame.toShortString()
- + " si=" + systemInsets.toShortString()
+ " ci=" + contentInsets.toShortString()
+ " vi=" + visibleInsets.toShortString());
//}
@@ -529,11 +512,6 @@
}
@Override
- public Rect getSystemFrameLw() {
- return mSystemFrame;
- }
-
- @Override
public Rect getContentFrameLw() {
return mContentFrame;
}
@@ -1067,6 +1045,9 @@
pw.print(prefix); pw.print("mFrame="); mFrame.printShortString(pw);
pw.print(" last="); mLastFrame.printShortString(pw);
pw.println();
+ pw.print(prefix); pw.print("mSystemDecorRect="); mSystemDecorRect.printShortString(pw);
+ pw.print(" last="); mLastSystemDecorRect.printShortString(pw);
+ pw.println();
}
if (mEnforceSizeCompat) {
pw.print(prefix); pw.print("mCompatFrame="); mCompatFrame.printShortString(pw);
@@ -1078,16 +1059,15 @@
pw.print(" parent="); mParentFrame.printShortString(pw);
pw.print(" display="); mDisplayFrame.printShortString(pw);
pw.println();
- pw.print(prefix); pw.print(" system="); mSystemFrame.printShortString(pw);
- pw.print(" content="); mContentFrame.printShortString(pw);
+ pw.print(prefix); pw.print(" content="); mContentFrame.printShortString(pw);
pw.print(" visible="); mVisibleFrame.printShortString(pw);
pw.println();
- pw.print(prefix); pw.print("Cur insets: system="); mSystemInsets.printShortString(pw);
- pw.print(" content="); mContentInsets.printShortString(pw);;
+ pw.print(prefix); pw.print("Cur insets: content=");
+ mContentInsets.printShortString(pw);
pw.print(" visible="); mVisibleInsets.printShortString(pw);
pw.println();
- pw.print(prefix); pw.print("Lst insets: system="); mLastSystemInsets.printShortString(pw);
- pw.print(" content="); mLastContentInsets.printShortString(pw);;
+ pw.print(prefix); pw.print("Lst insets: content=");
+ mLastContentInsets.printShortString(pw);
pw.print(" visible="); mLastVisibleInsets.printShortString(pw);
pw.println();
}
diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java
index 293d3e8..cba92f3 100644
--- a/services/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/java/com/android/server/wm/WindowStateAnimator.java
@@ -436,8 +436,9 @@
private float mSurfaceTraceAlpha = 0;
private int mLayer;
- private PointF mPosition = new PointF();
- private Point mSize;
+ private final PointF mPosition = new PointF();
+ private final Point mSize = new Point();
+ private final Rect mWindowCrop = new Rect();
private boolean mShown = false;
private String mName = "Not named";
@@ -445,7 +446,7 @@
int pid, int display, int w, int h, int format, int flags) throws
OutOfResourcesException {
super(s, pid, display, w, h, format, flags);
- mSize = new Point(w, h);
+ mSize.set(w, h);
Slog.v(SURFACE_TAG, "ctor: " + this + ". Called by "
+ Debug.getCallers(3));
}
@@ -455,7 +456,7 @@
throws OutOfResourcesException {
super(s, pid, name, display, w, h, format, flags);
mName = name;
- mSize = new Point(w, h);
+ mSize.set(w, h);
Slog.v(SURFACE_TAG, "ctor: " + this + ". Called by "
+ Debug.getCallers(3));
}
@@ -489,7 +490,7 @@
@Override
public void setPosition(float x, float y) {
super.setPosition(x, y);
- mPosition = new PointF(x, y);
+ mPosition.set(x, y);
Slog.v(SURFACE_TAG, "setPosition: " + this + ". Called by "
+ Debug.getCallers(3));
}
@@ -497,12 +498,20 @@
@Override
public void setSize(int w, int h) {
super.setSize(w, h);
- mSize = new Point(w, h);
+ mSize.set(w, h);
Slog.v(SURFACE_TAG, "setSize: " + this + ". Called by "
+ Debug.getCallers(3));
}
@Override
+ public void setWindowCrop(Rect crop) {
+ super.setWindowCrop(crop);
+ mWindowCrop.set(crop);
+ Slog.v(SURFACE_TAG, "setWindowCrop: " + this + ". Called by "
+ + Debug.getCallers(3));
+ }
+
+ @Override
public void hide() {
super.hide();
mShown = false;
@@ -545,7 +554,8 @@
return "Surface " + Integer.toHexString(System.identityHashCode(this)) + " "
+ mName + ": shown=" + mShown + " layer=" + mLayer
+ " alpha=" + mSurfaceTraceAlpha + " " + mPosition.x + "," + mPosition.y
- + " " + mSize.x + "x" + mSize.y;
+ + " " + mSize.x + "x" + mSize.y
+ + " crop=" + mWindowCrop.toShortString();
}
}
@@ -596,6 +606,7 @@
mSurfaceY = 0;
mSurfaceW = w;
mSurfaceH = h;
+ mWin.mLastSystemDecorRect.set(0, 0, 0, 0);
try {
final boolean isHwAccelerated = (attrs.flags &
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0;
@@ -991,6 +1002,55 @@
}
}
}
+
+ // Need to recompute a new system decor rect each time.
+ if ((w.mAttrs.flags & LayoutParams.FLAG_SCALED) != 0) {
+ // Currently can't do this cropping for scaled windows. We'll
+ // just keep the crop rect the same as the source surface.
+ w.mSystemDecorRect.set(0, 0, w.mRequestedWidth, w.mRequestedHeight);
+ } else if (w.mLayer >= mService.mSystemDecorLayer) {
+ // Above the decor layer is easy, just use the entire window.
+ w.mSystemDecorRect.set(0, 0, w.mCompatFrame.width(),
+ w.mCompatFrame.height());
+ } else {
+ final Rect decorRect = mService.mSystemDecorRect;
+ // Compute the offset of the window in relation to the decor rect.
+ final int offX = w.mXOffset + w.mFrame.left;
+ final int offY = w.mYOffset + w.mFrame.top;
+ // Initialize the decor rect to the entire frame.
+ w.mSystemDecorRect.set(0, 0, w.mFrame.width(), w.mFrame.height());
+ // Intersect with the decor rect, offsetted by window position.
+ w.mSystemDecorRect.intersect(decorRect.left-offX, decorRect.top-offY,
+ decorRect.right-offX, decorRect.bottom-offY);
+ // If size compatibility is being applied to the window, the
+ // surface is scaled relative to the screen. Also apply this
+ // scaling to the crop rect. We aren't using the standard rect
+ // scale function because we want to round things to make the crop
+ // always round to a larger rect to ensure we don't crop too
+ // much and hide part of the window that should be seen.
+ if (w.mEnforceSizeCompat && w.mInvGlobalScale != 1.0f) {
+ final float scale = w.mInvGlobalScale;
+ w.mSystemDecorRect.left = (int) (w.mSystemDecorRect.left * scale - 0.5f);
+ w.mSystemDecorRect.top = (int) (w.mSystemDecorRect.top * scale - 0.5f);
+ w.mSystemDecorRect.right = (int) ((w.mSystemDecorRect.right+1) * scale - 0.5f);
+ w.mSystemDecorRect.bottom = (int) ((w.mSystemDecorRect.bottom+1) * scale - 0.5f);
+ }
+ }
+
+ if (!w.mSystemDecorRect.equals(w.mLastSystemDecorRect)) {
+ w.mLastSystemDecorRect.set(w.mSystemDecorRect);
+ try {
+ if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
+ "CROP " + w.mSystemDecorRect.toShortString(), null);
+ mSurface.setWindowCrop(w.mSystemDecorRect);
+ } catch (RuntimeException e) {
+ Slog.w(TAG, "Error setting crop surface of " + w
+ + " crop=" + w.mSystemDecorRect.toShortString(), e);
+ if (!recoveringMemory) {
+ mService.reclaimSomeSurfaceMemoryLocked(this, "crop", true);
+ }
+ }
+ }
}
public void prepareSurfaceLocked(final boolean recoveringMemory) {
@@ -1126,6 +1186,7 @@
mSurfaceX = left;
mSurfaceY = top;
mSurface.setPosition(left, top);
+ mSurface.setWindowCrop(null);
} catch (RuntimeException e) {
Slog.w(TAG, "Error positioning surface of " + mWin
+ " pos=(" + left + "," + top + ")", e);
diff --git a/services/jni/Android.mk b/services/jni/Android.mk
index e2bd622..e0a14af 100644
--- a/services/jni/Android.mk
+++ b/services/jni/Android.mk
@@ -23,7 +23,10 @@
frameworks/base/services \
frameworks/base/core/jni \
external/skia/include/core \
- libcore/include
+ libcore/include \
+ libcore/include/libsuspend \
+ $(call include-path-for, libhardware)/hardware \
+ $(call include-path-for, libhardware_legacy)/hardware_legacy \
LOCAL_SHARED_LIBRARIES := \
libandroid_runtime \
@@ -38,7 +41,8 @@
libinput \
libskia \
libgui \
- libusbhost
+ libusbhost \
+ libsuspend
ifeq ($(WITH_MALLOC_LEAK_CHECK),true)
LOCAL_CFLAGS += -DMALLOC_LEAK_CHECK
diff --git a/services/jni/com_android_server_PowerManagerService.cpp b/services/jni/com_android_server_PowerManagerService.cpp
index ce80c1f..a47f8fd 100644
--- a/services/jni/com_android_server_PowerManagerService.cpp
+++ b/services/jni/com_android_server_PowerManagerService.cpp
@@ -24,8 +24,14 @@
#include <limits.h>
#include <android_runtime/AndroidRuntime.h>
-#include <utils/Timers.h>
#include <gui/ISurfaceComposer.h>
+#include <utils/Timers.h>
+#include <utils/misc.h>
+#include <utils/String8.h>
+#include <hardware/power.h>
+#include <hardware_legacy/power.h>
+#include <cutils/android_reboot.h>
+#include <suspend/autosuspend.h>
#include <private/gui/ComposerService.h>
@@ -43,6 +49,7 @@
// ----------------------------------------------------------------------------
static jobject gPowerManagerServiceObj;
+static struct power_module* gPowerModule;
static Mutex gPowerManagerLock;
static bool gScreenOn;
@@ -76,6 +83,13 @@
}
void android_server_PowerManagerService_userActivity(nsecs_t eventTime, int32_t eventType) {
+ if (gPowerModule) {
+ // Tell the power HAL when user activity occurs.
+ if (gPowerModule->powerHint) {
+ gPowerModule->powerHint(gPowerModule, POWER_HINT_INTERACTION, NULL);
+ }
+ }
+
if (gPowerManagerServiceObj) {
// Throttle calls into user activity by event type.
// We're a little conservative about argument checking here in case the caller
@@ -112,33 +126,115 @@
// ----------------------------------------------------------------------------
-static void android_server_PowerManagerService_nativeInit(JNIEnv* env, jobject obj) {
+static void nativeInit(JNIEnv* env, jobject obj) {
gPowerManagerServiceObj = env->NewGlobalRef(obj);
+
+ status_t err = hw_get_module(POWER_HARDWARE_MODULE_ID,
+ (hw_module_t const**)&gPowerModule);
+ if (err) {
+ String8 msg;
+ msg.appendFormat("Couldn't load %s module (%s)",
+ POWER_HARDWARE_MODULE_ID, strerror(-err));
+ ALOGE("%s", msg.string());
+ jniThrowRuntimeException(env, msg.string());
+ return;
+ }
+
+ gPowerModule->init(gPowerModule);
}
-static void android_server_PowerManagerService_nativeSetPowerState(JNIEnv* env,
+static void nativeSetPowerState(JNIEnv* env,
jobject serviceObj, jboolean screenOn, jboolean screenBright) {
AutoMutex _l(gPowerManagerLock);
gScreenOn = screenOn;
gScreenBright = screenBright;
}
-static void android_server_PowerManagerService_nativeStartSurfaceFlingerAnimation(JNIEnv* env,
+static void nativeStartSurfaceFlingerAnimation(JNIEnv* env,
jobject obj, jint mode) {
sp<ISurfaceComposer> s(ComposerService::getComposerService());
s->turnElectronBeamOff(mode);
}
+static void nativeAcquireWakeLock(JNIEnv *env, jobject clazz, jint lock, jstring idObj) {
+ if (idObj == NULL) {
+ jniThrowNullPointerException(env, "id is null");
+ return;
+ }
+
+ const char *id = env->GetStringUTFChars(idObj, NULL);
+
+ acquire_wake_lock(lock, id);
+
+ env->ReleaseStringUTFChars(idObj, id);
+}
+
+static void nativeReleaseWakeLock(JNIEnv *env, jobject clazz, jstring idObj) {
+ if (idObj == NULL) {
+ jniThrowNullPointerException(env, "id is null");
+ return ;
+ }
+
+ const char *id = env->GetStringUTFChars(idObj, NULL);
+
+ release_wake_lock(id);
+
+ env->ReleaseStringUTFChars(idObj, id);
+
+}
+
+static int nativeSetScreenState(JNIEnv *env, jobject clazz, jboolean on) {
+ if (on) {
+ autosuspend_disable();
+ if (gPowerModule) {
+ gPowerModule->setInteractive(gPowerModule, true);
+ }
+ } else {
+ if (gPowerModule) {
+ gPowerModule->setInteractive(gPowerModule, false);
+ }
+ autosuspend_enable();
+ }
+
+ return 0;
+}
+
+static void nativeShutdown(JNIEnv *env, jobject clazz) {
+ android_reboot(ANDROID_RB_POWEROFF, 0, 0);
+}
+
+static void nativeReboot(JNIEnv *env, jobject clazz, jstring reason) {
+ if (reason == NULL) {
+ android_reboot(ANDROID_RB_RESTART, 0, 0);
+ } else {
+ const char *chars = env->GetStringUTFChars(reason, NULL);
+ android_reboot(ANDROID_RB_RESTART2, 0, (char *) chars);
+ env->ReleaseStringUTFChars(reason, chars); // In case it fails.
+ }
+ jniThrowIOException(env, errno);
+}
+
+
// ----------------------------------------------------------------------------
static JNINativeMethod gPowerManagerServiceMethods[] = {
/* name, signature, funcPtr */
{ "nativeInit", "()V",
- (void*) android_server_PowerManagerService_nativeInit },
+ (void*) nativeInit },
{ "nativeSetPowerState", "(ZZ)V",
- (void*) android_server_PowerManagerService_nativeSetPowerState },
+ (void*) nativeSetPowerState },
{ "nativeStartSurfaceFlingerAnimation", "(I)V",
- (void*) android_server_PowerManagerService_nativeStartSurfaceFlingerAnimation },
+ (void*) nativeStartSurfaceFlingerAnimation },
+ { "nativeAcquireWakeLock", "(ILjava/lang/String;)V",
+ (void*) nativeAcquireWakeLock },
+ { "nativeReleaseWakeLock", "(Ljava/lang/String;)V",
+ (void*) nativeReleaseWakeLock },
+ { "nativeSetScreenState", "(Z)I",
+ (void*) nativeSetScreenState },
+ { "nativeShutdown", "()V",
+ (void*) nativeShutdown },
+ { "nativeReboot", "(Ljava/lang/String;)V",
+ (void*) nativeReboot },
};
#define FIND_CLASS(var, className) \
@@ -175,6 +271,8 @@
}
gScreenOn = true;
gScreenBright = true;
+ gPowerManagerServiceObj = NULL;
+ gPowerModule = NULL;
return 0;
}
diff --git a/services/tests/servicestests/src/com/android/server/CertBlacklisterTest.java b/services/tests/servicestests/src/com/android/server/CertBlacklisterTest.java
new file mode 100644
index 0000000..10b9e7c
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/CertBlacklisterTest.java
@@ -0,0 +1,169 @@
+/*
+ * 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 com.android.server;
+
+import android.content.Context;
+import android.content.Intent;
+import android.test.AndroidTestCase;
+import android.provider.Settings;
+import android.util.Log;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.HashSet;
+
+import libcore.io.IoUtils;
+
+/**
+ * Tests for {@link com.android.server.CertBlacklister}
+ */
+public class CertBlacklisterTest extends AndroidTestCase {
+
+ private static final String BLACKLIST_ROOT = System.getenv("ANDROID_DATA") + "/misc/keychain/";
+
+ public static final String PUBKEY_PATH = BLACKLIST_ROOT + "pubkey_blacklist.txt";
+ public static final String SERIAL_PATH = BLACKLIST_ROOT + "serial_blacklist.txt";
+
+ public static final String PUBKEY_KEY = "pubkey_blacklist";
+ public static final String SERIAL_KEY = "serial_blacklist";
+
+ private void overrideSettings(String key, String value) throws Exception {
+ Settings.Secure.putString(mContext.getContentResolver(), key, value);
+ Thread.sleep(1000);
+ }
+
+ public void testClearBlacklistPubkey() throws Exception {
+ // clear the gservices setting for a clean slate
+ overrideSettings(PUBKEY_KEY, "");
+ // read the contents of the pubkey blacklist
+ String blacklist = IoUtils.readFileAsString(PUBKEY_PATH);
+ // Verify that it's empty
+ assertEquals("", blacklist);
+ }
+
+ public void testSetBlacklistPubkey() throws Exception {
+ // build a new thing to blacklist
+ String badPubkey = "7ccabd7db47e94a5759901b6a7dfd45d1c091ccc";
+ // add the gservices override
+ overrideSettings(PUBKEY_KEY, badPubkey);
+ // check the contents again
+ String blacklist = IoUtils.readFileAsString(PUBKEY_PATH);
+ // make sure that we're equal to the string we sent out
+ assertEquals(badPubkey, blacklist);
+ }
+
+ public void testChangeBlacklistPubkey() throws Exception {
+ String badPubkey = "6ccabd7db47e94a5759901b6a7dfd45d1c091ccc";
+ overrideSettings(PUBKEY_KEY, badPubkey);
+ badPubkey = "6ccabd7db47e94a5759901b6a7dfd45d1c091cce";
+ overrideSettings(PUBKEY_KEY, badPubkey);
+ String blacklist = IoUtils.readFileAsString(PUBKEY_PATH);
+ assertEquals(badPubkey, blacklist);
+ }
+
+ public void testMultiBlacklistPubkey() throws Exception {
+ String badPubkey = "6ccabd7db47e94a5759901b6a7dfd45d1c091ccc,6ccabd7db47e94a5759901b6a7dfd45d1c091ccd";
+ overrideSettings(PUBKEY_KEY, badPubkey);
+ String blacklist = IoUtils.readFileAsString(PUBKEY_PATH);
+ assertEquals(badPubkey, blacklist);
+ }
+
+ public void testInvalidMultiBlacklistPubkey() throws Exception {
+ String badPubkey = "6ccabd7db47e94a5759901b6a7dfd45d1c091ccc,ZZZZZ,6ccabd7db47e94a5759901b6a7dfd45d1c091ccd";
+ overrideSettings(PUBKEY_KEY, badPubkey);
+ String blacklist = IoUtils.readFileAsString(PUBKEY_PATH);
+ assertEquals(badPubkey, blacklist);
+ }
+
+ public void testInvalidCharsBlacklistPubkey() throws Exception {
+ String badPubkey = "\n6ccabd7db47e94a5759901b6a7dfd45d1c091ccc,-ZZZZZ,+6ccabd7db47e94a5759901b6a7dfd45d1c091ccd";
+ overrideSettings(PUBKEY_KEY, badPubkey);
+ String blacklist = IoUtils.readFileAsString(PUBKEY_PATH);
+ assertEquals(badPubkey, blacklist);
+ }
+
+ public void testLotsOfBlacklistedPubkeys() throws Exception {
+ StringBuilder bl = new StringBuilder();
+ for (int i=0; i < 1000; i++) {
+ bl.append("6ccabd7db47e94a5759901b6a7dfd45d1c091ccc,");
+ }
+ overrideSettings(PUBKEY_KEY, bl.toString());
+ String blacklist = IoUtils.readFileAsString(PUBKEY_PATH);
+ assertEquals(bl.toString(), blacklist);
+ }
+
+ public void testClearBlacklistSerial() throws Exception {
+ // clear the gservices setting for a clean slate
+ overrideSettings(SERIAL_KEY, "");
+ // read the contents of the pubkey blacklist
+ String blacklist = IoUtils.readFileAsString(SERIAL_PATH);
+ // Verify that it's empty
+ assertEquals("", blacklist);
+ }
+
+ public void testSetBlacklistSerial() throws Exception {
+ // build a new thing to blacklist
+ String badSerial = "22e514121e61c643b1e9b06bd4b9f7d0";
+ // add the gservices override
+ overrideSettings(SERIAL_KEY, badSerial);
+ // check the contents again
+ String blacklist = IoUtils.readFileAsString(SERIAL_PATH);
+ // make sure that we're equal to the string we sent out
+ assertEquals(badSerial, blacklist);
+ }
+
+ public void testChangeBlacklistSerial() throws Exception {
+ String badSerial = "22e514121e61c643b1e9b06bd4b9f7d0";
+ overrideSettings(SERIAL_KEY, badSerial);
+ badSerial = "22e514121e61c643b1e9b06bd4b9f7d1";
+ overrideSettings(SERIAL_KEY, badSerial);
+ String blacklist = IoUtils.readFileAsString(SERIAL_PATH);
+ assertEquals(badSerial, blacklist);
+ }
+
+ public void testMultiBlacklistSerial() throws Exception {
+ String badSerial = "22e514121e61c643b1e9b06bd4b9f7d0,22e514121e61c643b1e9b06bd4b9f7d1";
+ overrideSettings(SERIAL_KEY, badSerial);
+ String blacklist = IoUtils.readFileAsString(SERIAL_PATH);
+ assertEquals(badSerial, blacklist);
+ }
+
+ public void testInvalidMultiBlacklistSerial() throws Exception {
+ String badSerial = "22e514121e61c643b1e9b06bd4b9f7d0,ZZZZ,22e514121e61c643b1e9b06bd4b9f7d1";
+ overrideSettings(SERIAL_KEY, badSerial);
+ String blacklist = IoUtils.readFileAsString(SERIAL_PATH);
+ assertEquals(badSerial, blacklist);
+ }
+
+ public void testInvalidCharsBlacklistSerial() throws Exception {
+ String badSerial = "\n22e514121e61c643b1e9b06bd4b9f7d0,-ZZZZ,+22e514121e61c643b1e9b06bd4b9f7d1";
+ overrideSettings(SERIAL_KEY, badSerial);
+ String blacklist = IoUtils.readFileAsString(SERIAL_PATH);
+ assertEquals(badSerial, blacklist);
+ }
+
+ public void testLotsOfBlacklistedSerials() throws Exception {
+ StringBuilder bl = new StringBuilder();
+ for (int i=0; i < 1000; i++) {
+ bl.append("22e514121e61c643b1e9b06bd4b9f7d0,");
+ }
+ overrideSettings(SERIAL_KEY, bl.toString());
+ String blacklist = IoUtils.readFileAsString(SERIAL_PATH);
+ assertEquals(bl.toString(), blacklist);
+ }
+}
diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java
index 92024cd..d738d7b 100644
--- a/telephony/java/com/android/internal/telephony/IccCard.java
+++ b/telephony/java/com/android/internal/telephony/IccCard.java
@@ -26,7 +26,6 @@
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
-import android.os.Power;
import android.os.PowerManager;
import android.os.Registrant;
import android.os.RegistrantList;
diff --git a/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java b/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java
index 9763265..5fef6de 100644
--- a/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java
+++ b/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java
@@ -112,7 +112,7 @@
*/
public void sendText(String destAddr, String scAddr,
String text, PendingIntent sentIntent, PendingIntent deliveryIntent) {
- mPhone.getContext().enforceCallingOrSelfPermission(
+ mPhone.getContext().enforceCallingPermission(
"android.permission.SEND_SMS",
"Sending SMS message");
if (Log.isLoggable("SMS", Log.VERBOSE)) {
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapMutateActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapMutateActivity.java
index db9017c..0d825d7 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapMutateActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapMutateActivity.java
@@ -87,7 +87,7 @@
int width = mBitmap1.getWidth();
int height = mBitmap1.getHeight();
- canvas.translate((getWidth() - width) / 2, (getHeight() - height) / 2);
+ canvas.translate((getWidth() - width) / 2, 0);
for (int x = 0; x < width; x++) {
int color = 0xff000000;
@@ -101,6 +101,11 @@
mBitmap1.setPixels(mPixels, 0, width, 0, 0, width, height);
canvas.drawBitmap(mBitmap1, 0.0f, 0.0f, mBitmapPaint);
+
+ canvas.save();
+ canvas.translate(0.0f, height + 32);
+ canvas.drawBitmap(mPixels, 0, width, 0.0f, 0.0f, width, height, false, mBitmapPaint);
+ canvas.restore();
}
}
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java
index c44ddc6..379fb81 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindow.java
@@ -47,7 +47,7 @@
}
@Override
- public void resized(int arg0, int arg1, Rect argBlah, Rect arg2, Rect arg3,
+ public void resized(int arg0, int arg1, Rect arg2, Rect arg3,
boolean arg4, Configuration arg5) throws RemoteException {
// pass for now.
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java
index 3996d26..6fb599d 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowSession.java
@@ -69,7 +69,7 @@
}
@Override
public int relayout(IWindow arg0, int seq, LayoutParams arg1, int arg2, int arg3, int arg4,
- int arg4_5, Rect arg4_6, Rect arg5, Rect arg6, Rect arg7, Configuration arg7b,
+ int arg4_5, Rect arg5, Rect arg6, Rect arg7, Configuration arg7b,
Surface arg8) throws RemoteException {
// pass for now.
return 0;
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index b099202..2903faa 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -182,6 +182,14 @@
/* Tracks sequence number on a tether notification time out */
private int mTetherToken = 0;
+ /**
+ * Driver start time out.
+ */
+ private static final int DRIVER_START_TIME_OUT_MSECS = 10000;
+
+ /* Tracks sequence number on a driver time out */
+ private int mDriverStartToken = 0;
+
private LinkProperties mLinkProperties;
/* Tracks sequence number on a periodic scan message */
@@ -250,7 +258,8 @@
static final int CMD_STOP_SUPPLICANT_FAILED = BASE + 17;
/* Delayed stop to avoid shutting down driver too quick*/
static final int CMD_DELAYED_STOP_DRIVER = BASE + 18;
-
+ /* A delayed message sent to start driver when it fail to come up */
+ static final int CMD_DRIVER_START_TIMED_OUT = BASE + 19;
/* Start the soft access point */
static final int CMD_START_AP = BASE + 21;
@@ -1837,6 +1846,7 @@
case CMD_START_DRIVER:
case CMD_STOP_DRIVER:
case CMD_DELAYED_STOP_DRIVER:
+ case CMD_DRIVER_START_TIMED_OUT:
case CMD_START_AP:
case CMD_START_AP_SUCCESS:
case CMD_START_AP_FAILURE:
@@ -2476,10 +2486,16 @@
}
class DriverStartingState extends State {
+ private int mTries;
@Override
public void enter() {
if (DBG) log(getName() + "\n");
EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName());
+
+ mTries = 1;
+ /* Send ourselves a delayed message to start driver a second time */
+ sendMessageDelayed(obtainMessage(CMD_DRIVER_START_TIMED_OUT,
+ ++mDriverStartToken, 0), DRIVER_START_TIME_OUT_MSECS);
}
@Override
public boolean processMessage(Message message) {
@@ -2495,6 +2511,24 @@
transitionTo(mDriverStartedState);
}
break;
+ case CMD_DRIVER_START_TIMED_OUT:
+ if (message.arg1 == mDriverStartToken) {
+ if (mTries >= 2) {
+ loge("Failed to start driver after " + mTries);
+ transitionTo(mDriverStoppedState);
+ } else {
+ loge("Driver start failed, retrying");
+ mWakeLock.acquire();
+ mWifiNative.startDriver();
+ mWakeLock.release();
+
+ ++mTries;
+ /* Send ourselves a delayed message to start driver again */
+ sendMessageDelayed(obtainMessage(CMD_DRIVER_START_TIMED_OUT,
+ ++mDriverStartToken, 0), DRIVER_START_TIME_OUT_MSECS);
+ }
+ }
+ break;
/* Queue driver commands & connection events */
case CMD_START_DRIVER:
case CMD_STOP_DRIVER: