Merge "Update to TextView#didTouchFocusSelect documentation"
diff --git a/api/current.txt b/api/current.txt
index 0e3fee6..c3c5b24 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -2744,6 +2744,7 @@
method public static boolean isUserAMonkey();
method public void killBackgroundProcesses(java.lang.String);
method public void moveTaskToFront(int, int);
+ method public void moveTaskToFront(int, int, android.os.Bundle);
method public deprecated void restartPackage(java.lang.String);
field public static final int MOVE_TASK_NO_USER_ACTION = 2; // 0x2
field public static final int MOVE_TASK_WITH_HOME = 1; // 0x1
@@ -2864,6 +2865,17 @@
field public android.content.ComponentName topActivity;
}
+ public class ActivityOptions {
+ method public void join(android.app.ActivityOptions);
+ method public static android.app.ActivityOptions makeCustomAnimation(android.content.Context, int, int);
+ method public static android.app.ActivityOptions makeThumbnailScaleUpAnimation(android.view.View, android.graphics.Bitmap, int, int, android.app.ActivityOptions.OnAnimationStartedListener);
+ method public android.os.Bundle toBundle();
+ }
+
+ public static abstract interface ActivityOptions.OnAnimationStartedListener {
+ method public abstract void onAnimationStarted();
+ }
+
public class AlarmManager {
method public void cancel(android.app.PendingIntent);
method public void set(int, long, android.app.PendingIntent);
@@ -3688,6 +3700,7 @@
public static class Notification.Builder {
ctor public Notification.Builder(android.content.Context);
+ method public android.app.Notification.Builder addAction(int, java.lang.CharSequence, android.app.PendingIntent);
method public android.app.Notification.Builder addKind(java.lang.String);
method public android.app.Notification getNotification();
method public android.app.Notification.Builder setAutoCancel(boolean);
@@ -3728,7 +3741,9 @@
method public void cancel();
method public int describeContents();
method public static android.app.PendingIntent getActivities(android.content.Context, int, android.content.Intent[], int);
+ method public static android.app.PendingIntent getActivities(android.content.Context, int, android.content.Intent[], int, android.os.Bundle);
method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int);
+ method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle);
method public static android.app.PendingIntent getBroadcast(android.content.Context, int, android.content.Intent, int);
method public android.content.IntentSender getIntentSender();
method public static android.app.PendingIntent getService(android.content.Context, int, android.content.Intent, int);
@@ -5195,6 +5210,7 @@
field public static final java.lang.String LAYOUT_INFLATER_SERVICE = "layout_inflater";
field public static final java.lang.String LOCATION_SERVICE = "location";
field public static final int MODE_APPEND = 32768; // 0x8000
+ field public static final int MODE_ENABLE_WRITE_AHEAD_LOGGING = 8; // 0x8
field public static final int MODE_MULTI_PROCESS = 4; // 0x4
field public static final int MODE_PRIVATE = 0; // 0x0
field public static final int MODE_WORLD_READABLE = 1; // 0x1
@@ -7226,6 +7242,7 @@
public class SQLException extends java.lang.RuntimeException {
ctor public SQLException();
ctor public SQLException(java.lang.String);
+ ctor public SQLException(java.lang.String, java.lang.Throwable);
}
public class StaleDataException extends java.lang.RuntimeException {
@@ -7303,6 +7320,7 @@
method public static android.database.sqlite.SQLiteDatabase create(android.database.sqlite.SQLiteDatabase.CursorFactory);
method public int delete(java.lang.String, java.lang.String, java.lang.String[]);
method public static boolean deleteDatabase(java.io.File);
+ method public void disableWriteAheadLogging();
method public boolean enableWriteAheadLogging();
method public void endTransaction();
method public void execSQL(java.lang.String) throws android.database.SQLException;
@@ -7323,6 +7341,7 @@
method public deprecated boolean isDbLockedByOtherThreads();
method public boolean isOpen();
method public boolean isReadOnly();
+ method public boolean isWriteAheadLoggingEnabled();
method public deprecated void markTableSyncable(java.lang.String, java.lang.String);
method public deprecated void markTableSyncable(java.lang.String, java.lang.String, java.lang.String);
method public boolean needUpgrade(int);
@@ -7345,6 +7364,7 @@
method public static int releaseMemory();
method public long replace(java.lang.String, java.lang.String, android.content.ContentValues);
method public long replaceOrThrow(java.lang.String, java.lang.String, android.content.ContentValues) throws android.database.SQLException;
+ method public void setForeignKeyConstraintsEnabled(boolean);
method public void setLocale(java.util.Locale);
method public deprecated void setLockingEnabled(boolean);
method public void setMaxSqlCacheSize(int);
@@ -7364,6 +7384,7 @@
field public static final int CONFLICT_REPLACE = 5; // 0x5
field public static final int CONFLICT_ROLLBACK = 1; // 0x1
field public static final int CREATE_IF_NECESSARY = 268435456; // 0x10000000
+ field public static final int ENABLE_WRITE_AHEAD_LOGGING = 536870912; // 0x20000000
field public static final int MAX_SQL_CACHE_SIZE = 100; // 0x64
field public static final int NO_LOCALIZED_COLLATORS = 16; // 0x10
field public static final int OPEN_READONLY = 1; // 0x1
@@ -7403,6 +7424,7 @@
public class SQLiteException extends android.database.SQLException {
ctor public SQLiteException();
ctor public SQLiteException(java.lang.String);
+ ctor public SQLiteException(java.lang.String, java.lang.Throwable);
}
public class SQLiteFullException extends android.database.sqlite.SQLiteException {
@@ -7422,10 +7444,12 @@
method public java.lang.String getDatabaseName();
method public android.database.sqlite.SQLiteDatabase getReadableDatabase();
method public android.database.sqlite.SQLiteDatabase getWritableDatabase();
+ method public void onConfigure(android.database.sqlite.SQLiteDatabase);
method public abstract void onCreate(android.database.sqlite.SQLiteDatabase);
method public void onDowngrade(android.database.sqlite.SQLiteDatabase, int, int);
method public void onOpen(android.database.sqlite.SQLiteDatabase);
method public abstract void onUpgrade(android.database.sqlite.SQLiteDatabase, int, int);
+ method public void setWriteAheadLoggingEnabled(boolean);
}
public class SQLiteOutOfMemoryException extends android.database.sqlite.SQLiteException {
@@ -10891,6 +10915,7 @@
method public void setDataSource(java.io.FileDescriptor, long, long) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException;
method public void setDisplay(android.view.SurfaceHolder);
method public void setLooping(boolean);
+ method public void setNextMediaPlayer(android.media.MediaPlayer);
method public void setOnBufferingUpdateListener(android.media.MediaPlayer.OnBufferingUpdateListener);
method public void setOnCompletionListener(android.media.MediaPlayer.OnCompletionListener);
method public void setOnErrorListener(android.media.MediaPlayer.OnErrorListener);
@@ -11899,8 +11924,10 @@
method public java.lang.String[] getDefaultCipherSuites();
method public static org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int, android.net.SSLSessionCache);
method public static javax.net.ssl.SSLSocketFactory getInsecure(int, android.net.SSLSessionCache);
+ method public byte[] getNpnSelectedProtocol(java.net.Socket);
method public java.lang.String[] getSupportedCipherSuites();
method public void setKeyManagers(javax.net.ssl.KeyManager[]);
+ method public void setNpnProtocols(byte[][]);
method public void setTrustManagers(javax.net.ssl.TrustManager[]);
}
@@ -18852,6 +18879,7 @@
method public static android.content.Intent createInstallIntent();
method public static java.security.cert.X509Certificate[] getCertificateChain(android.content.Context, java.lang.String) throws java.lang.InterruptedException, android.security.KeyChainException;
method public static java.security.PrivateKey getPrivateKey(android.content.Context, java.lang.String) throws java.lang.InterruptedException, android.security.KeyChainException;
+ field public static final java.lang.String ACTION_STORAGE_CHANGED = "android.security.STORAGE_CHANGED";
field public static final java.lang.String EXTRA_CERTIFICATE = "CERT";
field public static final java.lang.String EXTRA_NAME = "name";
field public static final java.lang.String EXTRA_PKCS12 = "PKCS12";
@@ -23163,6 +23191,7 @@
method public void buildLayer();
method public boolean callOnClick();
method public boolean canResolveLayoutDirection();
+ method public boolean canResolveTextDirection();
method public boolean canScrollHorizontally(int);
method public boolean canScrollVertically(int);
method public void cancelLongPress();
@@ -23445,6 +23474,7 @@
method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
method public void resetResolvedLayoutDirection();
method public void resetResolvedTextDirection();
+ method public void resolveLayoutDirection();
method public void resolvePadding();
method public static int resolveSize(int, int);
method public static int resolveSizeAndState(int, int, int);
@@ -23554,7 +23584,6 @@
method public boolean willNotCacheDrawing();
method public boolean willNotDraw();
field public static final android.util.Property ALPHA;
- field protected static int DEFAULT_TEXT_DIRECTION;
field public static final int DRAWING_CACHE_QUALITY_AUTO = 0; // 0x0
field public static final int DRAWING_CACHE_QUALITY_HIGH = 1048576; // 0x100000
field public static final int DRAWING_CACHE_QUALITY_LOW = 524288; // 0x80000
@@ -23588,10 +23617,10 @@
field public static final int LAYER_TYPE_HARDWARE = 2; // 0x2
field public static final int LAYER_TYPE_NONE = 0; // 0x0
field public static final int LAYER_TYPE_SOFTWARE = 1; // 0x1
- field public static final int LAYOUT_DIRECTION_INHERIT = -2147483648; // 0x80000000
- field public static final int LAYOUT_DIRECTION_LOCALE = -1073741824; // 0xc0000000
+ field public static final int LAYOUT_DIRECTION_INHERIT = 2; // 0x2
+ field public static final int LAYOUT_DIRECTION_LOCALE = 3; // 0x3
field public static final int LAYOUT_DIRECTION_LTR = 0; // 0x0
- field public static final int LAYOUT_DIRECTION_RTL = 1073741824; // 0x40000000
+ field public static final int LAYOUT_DIRECTION_RTL = 1; // 0x1
field public static final int MEASURED_HEIGHT_STATE_SHIFT = 16; // 0x10
field public static final int MEASURED_SIZE_MASK = 16777215; // 0xffffff
field public static final int MEASURED_STATE_MASK = -16777216; // 0xff000000
@@ -23638,6 +23667,7 @@
field public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1
field public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0
field public static final int TEXT_DIRECTION_ANY_RTL = 2; // 0x2
+ field protected static int TEXT_DIRECTION_DEFAULT;
field public static final int TEXT_DIRECTION_FIRST_STRONG = 1; // 0x1
field public static final int TEXT_DIRECTION_INHERIT = 0; // 0x0
field public static final int TEXT_DIRECTION_LOCALE = 5; // 0x5
@@ -25887,6 +25917,7 @@
ctor public AbsSeekBar(android.content.Context, android.util.AttributeSet);
ctor public AbsSeekBar(android.content.Context, android.util.AttributeSet, int);
method public int getKeyProgressIncrement();
+ method public android.graphics.drawable.Drawable getThumb();
method public int getThumbOffset();
method public void setKeyProgressIncrement(int);
method public void setThumb(android.graphics.drawable.Drawable);
@@ -26024,6 +26055,7 @@
public class AdapterViewFlipper extends android.widget.AdapterViewAnimator {
ctor public AdapterViewFlipper(android.content.Context);
ctor public AdapterViewFlipper(android.content.Context, android.util.AttributeSet);
+ method public int getFlipInterval();
method public boolean isAutoStart();
method public boolean isFlipping();
method public void setAutoStart(boolean);
@@ -26609,8 +26641,14 @@
ctor public GridView(android.content.Context, android.util.AttributeSet);
ctor public GridView(android.content.Context, android.util.AttributeSet, int);
method public android.widget.ListAdapter getAdapter();
+ method public int getColumnWidth();
+ method public int getGravity();
+ method public int getHorizontalSpacing();
method public int getNumColumns();
+ method public int getRequestedColumnWidth();
+ method public int getRequestedHorizontalSpacing();
method public int getStretchMode();
+ method public int getVerticalSpacing();
method public void setColumnWidth(int);
method public void setGravity(int);
method public void setHorizontalSpacing(int);
@@ -26693,19 +26731,27 @@
ctor public ImageView(android.content.Context, android.util.AttributeSet);
ctor public ImageView(android.content.Context, android.util.AttributeSet, int);
method public final void clearColorFilter();
+ method public boolean getAdjustViewBounds();
method public boolean getBaselineAlignBottom();
+ method public android.graphics.ColorFilter getColorFilter();
+ method public boolean getCropToPadding();
method public android.graphics.drawable.Drawable getDrawable();
+ method public int getImageAlpha();
method public android.graphics.Matrix getImageMatrix();
+ method public int getMaxHeight();
+ method public int getMaxWidth();
method public android.widget.ImageView.ScaleType getScaleType();
method public int[] onCreateDrawableState(int);
method public void setAdjustViewBounds(boolean);
- method public void setAlpha(int);
+ method public deprecated void setAlpha(int);
method public void setBaseline(int);
method public void setBaselineAlignBottom(boolean);
method public final void setColorFilter(int, android.graphics.PorterDuff.Mode);
method public final void setColorFilter(int);
method public void setColorFilter(android.graphics.ColorFilter);
+ method public void setCropToPadding(boolean);
method protected boolean setFrame(int, int, int, int);
+ method public void setImageAlpha(int);
method public void setImageBitmap(android.graphics.Bitmap);
method public void setImageDrawable(android.graphics.drawable.Drawable);
method public void setImageLevel(int);
@@ -26946,7 +26992,6 @@
method public void setOnValueChangedListener(android.widget.NumberPicker.OnValueChangeListener);
method public void setValue(int);
method public void setWrapSelectorWheel(boolean);
- field public static final int SELECTOR_WHEEL_ITEM_COUNT = 5; // 0x5
}
public static abstract interface NumberPicker.Formatter {
@@ -27239,6 +27284,8 @@
method public void setShort(int, java.lang.String, short);
method public void setString(int, java.lang.String, java.lang.String);
method public void setTextColor(int, int);
+ method public void setTextViewCompoundDrawables(int, int, int, int, int);
+ method public void setTextViewCompoundDrawablesRelative(int, int, int, int, int);
method public void setTextViewText(int, java.lang.CharSequence);
method public void setUri(int, java.lang.String, android.net.Uri);
method public void setViewVisibility(int, int);
diff --git a/build/jarjar-rules.txt b/build/jarjar-rules.txt
deleted file mode 100644
index 5fdb022..0000000
--- a/build/jarjar-rules.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-rule org.apache.commons com.android.internal.apache.commons
-
diff --git a/build/phone-hdpi-512-dalvik-heap.mk b/build/phone-hdpi-512-dalvik-heap.mk
deleted file mode 100644
index 16e0505..0000000
--- a/build/phone-hdpi-512-dalvik-heap.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (C) 2010 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.
-#
-
-# Provides overrides to configure the Dalvik heap for a standard high density
-# phone with around 512MB total RAM.
-
-PRODUCT_PROPERTY_OVERRIDES += \
- dalvik.vm.heapstartsize=5m \
- dalvik.vm.heapgrowthlimit=48m \
- dalvik.vm.heapsize=128m
diff --git a/build/phone-hdpi-dalvik-heap.mk b/build/phone-hdpi-dalvik-heap.mk
deleted file mode 100644
index ab33b96..0000000
--- a/build/phone-hdpi-dalvik-heap.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Copyright (C) 2010 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.
-#
-
-# Provides overrides to configure the Dalvik heap for a standard high density phone.
-
-PRODUCT_PROPERTY_OVERRIDES += \
- dalvik.vm.heapstartsize=5m \
- dalvik.vm.heapsize=32m
diff --git a/build/phone-xhdpi-1024-dalvik-heap.mk b/build/phone-xhdpi-1024-dalvik-heap.mk
deleted file mode 100644
index f76535a..0000000
--- a/build/phone-xhdpi-1024-dalvik-heap.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# 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.
-#
-
-# Provides overrides to configure the Dalvik heap for a standard tablet device.
-
-PRODUCT_PROPERTY_OVERRIDES += \
- dalvik.vm.heapstartsize=8m \
- dalvik.vm.heapgrowthlimit=64m \
- dalvik.vm.heapsize=256m
diff --git a/build/tablet-dalvik-heap.mk b/build/tablet-dalvik-heap.mk
deleted file mode 100644
index 826a380..0000000
--- a/build/tablet-dalvik-heap.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Copyright (C) 2010 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.
-#
-
-# Provides overrides to configure the Dalvik heap for a standard tablet device.
-
-PRODUCT_PROPERTY_OVERRIDES += \
- dalvik.vm.heapstartsize=5m \
- dalvik.vm.heapgrowthlimit=48m \
- dalvik.vm.heapsize=256m
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index c15c49f..53a0186 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -62,6 +62,7 @@
private boolean mStopOption = false;
private int mRepeat = 0;
+ private int mUserId = 0;
private String mProfileFile;
@@ -135,7 +136,7 @@
runToUri(false);
} else if (op.equals("to-intent-uri")) {
runToUri(true);
- } else if (op.equals("switch-profile")) {
+ } else if (op.equals("switch-user")) {
runSwitchUser();
} else {
throw new IllegalArgumentException("Unknown command: " + op);
@@ -152,6 +153,7 @@
mStopOption = false;
mRepeat = 0;
mProfileFile = null;
+ mUserId = 0;
Uri data = null;
String type = null;
@@ -308,6 +310,8 @@
mStopOption = true;
} else if (opt.equals("--opengl-trace")) {
mStartFlags |= ActivityManager.START_FLAG_OPENGL_TRACES;
+ } else if (opt.equals("--user")) {
+ mUserId = Integer.parseInt(nextArgRequired());
} else {
System.err.println("Error: Unknown option: " + opt);
showUsage();
@@ -407,7 +411,8 @@
System.err.println("Error: Package manager not running; aborting");
return;
}
- List<ResolveInfo> activities = pm.queryIntentActivities(intent, mimeType, 0);
+ List<ResolveInfo> activities = pm.queryIntentActivities(intent, mimeType, 0,
+ mUserId);
if (activities == null || activities.size() <= 0) {
System.err.println("Error: Intent does not match any activities: "
+ intent);
@@ -550,7 +555,7 @@
IntentReceiver receiver = new IntentReceiver();
System.out.println("Broadcasting: " + intent);
mAm.broadcastIntent(null, intent, null, receiver, 0, null, null, null, true, false,
- Binder.getOrigCallingUser());
+ mUserId);
receiver.waitForFinish();
}
@@ -1294,6 +1299,7 @@
" am display-size [reset|MxN]\n" +
" am to-uri [INTENT]\n" +
" am to-intent-uri [INTENT]\n" +
+ " am switch-user <USER_ID>\n" +
"\n" +
"am start: start an Activity. Options are:\n" +
" -D: enable debugging\n" +
diff --git a/cmds/dumpstate/Android.mk b/cmds/dumpstate/Android.mk
deleted file mode 100644
index d602500..0000000
--- a/cmds/dumpstate/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-ifdef BOARD_WLAN_DEVICE
-LOCAL_CFLAGS := -DFWDUMP_$(BOARD_WLAN_DEVICE)
-endif
-
-LOCAL_SRC_FILES := dumpstate.c utils.c
-
-LOCAL_MODULE := dumpstate
-
-LOCAL_SHARED_LIBRARIES := libcutils
-
-ifdef BOARD_LIB_DUMPSTATE
-LOCAL_STATIC_LIBRARIES := $(BOARD_LIB_DUMPSTATE)
-LOCAL_CFLAGS += -DBOARD_HAS_DUMPSTATE
-endif
-
-include $(BUILD_EXECUTABLE)
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
deleted file mode 100644
index ba79c9f..0000000
--- a/cmds/dumpstate/dumpstate.c
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <linux/capability.h>
-#include <linux/prctl.h>
-
-#include <cutils/properties.h>
-
-#include "private/android_filesystem_config.h"
-
-#define LOG_TAG "dumpstate"
-#include <utils/Log.h>
-
-#include "dumpstate.h"
-
-/* read before root is shed */
-static char cmdline_buf[16384] = "(unknown)";
-static const char *dump_traces_path = NULL;
-
-static char screenshot_path[PATH_MAX] = "";
-
-/* dumps the current system state to stdout */
-static void dumpstate() {
- time_t now = time(NULL);
- char build[PROPERTY_VALUE_MAX], fingerprint[PROPERTY_VALUE_MAX];
- char radio[PROPERTY_VALUE_MAX], bootloader[PROPERTY_VALUE_MAX];
- char network[PROPERTY_VALUE_MAX], date[80];
- char build_type[PROPERTY_VALUE_MAX];
-
- property_get("ro.build.display.id", build, "(unknown)");
- property_get("ro.build.fingerprint", fingerprint, "(unknown)");
- property_get("ro.build.type", build_type, "(unknown)");
- property_get("ro.baseband", radio, "(unknown)");
- property_get("ro.bootloader", bootloader, "(unknown)");
- property_get("gsm.operator.alpha", network, "(unknown)");
- strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&now));
-
- printf("========================================================\n");
- printf("== dumpstate: %s\n", date);
- printf("========================================================\n");
-
- printf("\n");
- printf("Build: %s\n", build);
- printf("Build fingerprint: '%s'\n", fingerprint); /* format is important for other tools */
- printf("Bootloader: %s\n", bootloader);
- printf("Radio: %s\n", radio);
- printf("Network: %s\n", network);
-
- printf("Kernel: ");
- dump_file(NULL, "/proc/version");
- printf("Command line: %s\n", strtok(cmdline_buf, "\n"));
- printf("\n");
-
- run_command("UPTIME", 10, "uptime", NULL);
- dump_file("MEMORY INFO", "/proc/meminfo");
- run_command("CPU INFO", 10, "top", "-n", "1", "-d", "1", "-m", "30", "-t", NULL);
- run_command("PROCRANK", 20, "procrank", NULL);
- dump_file("VIRTUAL MEMORY STATS", "/proc/vmstat");
- dump_file("VMALLOC INFO", "/proc/vmallocinfo");
- dump_file("SLAB INFO", "/proc/slabinfo");
- dump_file("ZONEINFO", "/proc/zoneinfo");
- dump_file("PAGETYPEINFO", "/proc/pagetypeinfo");
- dump_file("BUDDYINFO", "/proc/buddyinfo");
-
-
- dump_file("KERNEL WAKELOCKS", "/proc/wakelocks");
- dump_file("KERNEL CPUFREQ", "/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state");
-
- run_command("PROCESSES", 10, "ps", "-P", NULL);
- run_command("PROCESSES AND THREADS", 10, "ps", "-t", "-p", "-P", NULL);
- run_command("LIBRANK", 10, "librank", NULL);
-
- do_dmesg();
-
- run_command("LIST OF OPEN FILES", 10, SU_PATH, "root", "lsof", NULL);
-
- for_each_pid(do_showmap, "SMAPS OF ALL PROCESSES");
- for_each_pid(show_wchan, "BLOCKED PROCESS WAIT-CHANNELS");
-
- // dump_file("EVENT LOG TAGS", "/etc/event-log-tags");
- run_command("SYSTEM LOG", 20, "logcat", "-v", "threadtime", "-d", "*:v", NULL);
- run_command("EVENT LOG", 20, "logcat", "-b", "events", "-v", "threadtime", "-d", "*:v", NULL);
- run_command("RADIO LOG", 20, "logcat", "-b", "radio", "-v", "threadtime", "-d", "*:v", NULL);
-
-
- /* show the traces we collected in main(), if that was done */
- if (dump_traces_path != NULL) {
- dump_file("VM TRACES JUST NOW", dump_traces_path);
- }
-
- /* only show ANR traces if they're less than 15 minutes old */
- struct stat st;
- char anr_traces_path[PATH_MAX];
- property_get("dalvik.vm.stack-trace-file", anr_traces_path, "");
- if (!anr_traces_path[0]) {
- printf("*** NO VM TRACES FILE DEFINED (dalvik.vm.stack-trace-file)\n\n");
- } else if (stat(anr_traces_path, &st)) {
- printf("*** NO ANR VM TRACES FILE (%s): %s\n\n", anr_traces_path, strerror(errno));
- } else {
- dump_file("VM TRACES AT LAST ANR", anr_traces_path);
- }
-
- dump_file("NETWORK DEV INFO", "/proc/net/dev");
- dump_file("QTAGUID NETWORK INTERFACES INFO", "/proc/net/xt_qtaguid/iface_stat_all");
- dump_file("QTAGUID CTRL INFO", "/proc/net/xt_qtaguid/ctrl");
- dump_file("QTAGUID STATS INFO", "/proc/net/xt_qtaguid/stats");
-
- dump_file("NETWORK ROUTES", "/proc/net/route");
- dump_file("NETWORK ROUTES IPV6", "/proc/net/ipv6_route");
-
- /* TODO: Make last_kmsg CAP_SYSLOG protected. b/5555691 */
- dump_file("LAST KMSG", "/proc/last_kmsg");
- dump_file("LAST PANIC CONSOLE", "/data/dontpanic/apanic_console");
- dump_file("LAST PANIC THREADS", "/data/dontpanic/apanic_threads");
-
- if (screenshot_path[0]) {
- ALOGI("taking screenshot\n");
- run_command(NULL, 5, SU_PATH, "root", "screenshot", screenshot_path, NULL);
- ALOGI("wrote screenshot: %s\n", screenshot_path);
- }
-
- run_command("SYSTEM SETTINGS", 20, SU_PATH, "root", "sqlite3",
- "/data/data/com.android.providers.settings/databases/settings.db",
- "pragma user_version; select * from system; select * from secure;", NULL);
-
- /* The following have a tendency to get wedged when wifi drivers/fw goes belly-up. */
- run_command("NETWORK INTERFACES", 10, SU_PATH, "root", "netcfg", NULL);
- run_command("IP RULES", 10, "ip", "rule", "show", NULL);
- run_command("IP RULES v6", 10, "ip", "-6", "rule", "show", NULL);
- run_command("ROUTE TABLE 60", 10, "ip", "route", "show", "table", "60", NULL);
- run_command("ROUTE TABLE 61 v6", 10, "ip", "-6", "route", "show", "table", "60", NULL);
- run_command("ROUTE TABLE 61", 10, "ip", "route", "show", "table", "61", NULL);
- run_command("ROUTE TABLE 61 v6", 10, "ip", "-6", "route", "show", "table", "61", NULL);
- dump_file("ARP CACHE", "/proc/net/arp");
- run_command("IPTABLES", 10, SU_PATH, "root", "iptables", "-L", "-nvx", NULL);
- run_command("IP6TABLES", 10, SU_PATH, "root", "ip6tables", "-L", "-nvx", NULL);
- run_command("IPTABLE NAT", 10, SU_PATH, "root", "iptables", "-t", "nat", "-L", "-n", NULL);
- run_command("IPT6ABLE NAT", 10, SU_PATH, "root", "ip6tables", "-t", "nat", "-L", "-n", NULL);
-
- run_command("WIFI NETWORKS", 20,
- SU_PATH, "root", "wpa_cli", "list_networks", NULL);
-
- property_get("dhcp.wlan0.gateway", network, "");
- if (network[0])
- run_command("PING GATEWAY", 10, SU_PATH, "root", "ping", "-c", "3", "-i", ".5", network, NULL);
- property_get("dhcp.wlan0.dns1", network, "");
- if (network[0])
- run_command("PING DNS1", 10, SU_PATH, "root", "ping", "-c", "3", "-i", ".5", network, NULL);
- property_get("dhcp.wlan0.dns2", network, "");
- if (network[0])
- run_command("PING DNS2", 10, SU_PATH, "root", "ping", "-c", "3", "-i", ".5", network, NULL);
-#ifdef FWDUMP_bcm4329
- run_command("DUMP WIFI STATUS", 20,
- SU_PATH, "root", "dhdutil", "-i", "wlan0", "dump", NULL);
- run_command("DUMP WIFI INTERNAL COUNTERS", 20,
- SU_PATH, "root", "wlutil", "counters", NULL);
-#endif
-
- print_properties();
-
- run_command("VOLD DUMP", 10, "vdc", "dump", NULL);
- run_command("SECURE CONTAINERS", 10, "vdc", "asec", "list", NULL);
-
- run_command("FILESYSTEMS & FREE SPACE", 10, SU_PATH, "root", "df", NULL);
-
- dump_file("PACKAGE SETTINGS", "/data/system/packages.xml");
- dump_file("PACKAGE UID ERRORS", "/data/system/uiderrors.txt");
-
- run_command("LAST RADIO LOG", 10, "parse_radio_log", "/proc/last_radio_log", NULL);
-
- printf("------ BACKLIGHTS ------\n");
- printf("LCD brightness=");
- dump_file(NULL, "/sys/class/leds/lcd-backlight/brightness");
- printf("Button brightness=");
- dump_file(NULL, "/sys/class/leds/button-backlight/brightness");
- printf("Keyboard brightness=");
- dump_file(NULL, "/sys/class/leds/keyboard-backlight/brightness");
- printf("ALS mode=");
- dump_file(NULL, "/sys/class/leds/lcd-backlight/als");
- printf("LCD driver registers:\n");
- dump_file(NULL, "/sys/class/leds/lcd-backlight/registers");
- printf("\n");
-
- /* Binder state is expensive to look at as it uses a lot of memory. */
- dump_file("BINDER FAILED TRANSACTION LOG", "/sys/kernel/debug/binder/failed_transaction_log");
- dump_file("BINDER TRANSACTION LOG", "/sys/kernel/debug/binder/transaction_log");
- dump_file("BINDER TRANSACTIONS", "/sys/kernel/debug/binder/transactions");
- dump_file("BINDER STATS", "/sys/kernel/debug/binder/stats");
- dump_file("BINDER STATE", "/sys/kernel/debug/binder/state");
-
-#ifdef BOARD_HAS_DUMPSTATE
- printf("========================================================\n");
- printf("== Board\n");
- printf("========================================================\n");
-
- dumpstate_board();
- printf("\n");
-#endif
-
- /* Migrate the ril_dumpstate to a dumpstate_board()? */
- char ril_dumpstate_timeout[PROPERTY_VALUE_MAX] = {0};
- property_get("ril.dumpstate.timeout", ril_dumpstate_timeout, "30");
- if (strnlen(ril_dumpstate_timeout, PROPERTY_VALUE_MAX - 1) > 0) {
- if (0 == strncmp(build_type, "user", PROPERTY_VALUE_MAX - 1)) {
- // su does not exist on user builds, so try running without it.
- // This way any implementations of vril-dump that do not require
- // root can run on user builds.
- run_command("DUMP VENDOR RIL LOGS", atoi(ril_dumpstate_timeout),
- "vril-dump", NULL);
- } else {
- run_command("DUMP VENDOR RIL LOGS", atoi(ril_dumpstate_timeout),
- SU_PATH, "root", "vril-dump", NULL);
- }
- }
-
- printf("========================================================\n");
- printf("== Android Framework Services\n");
- printf("========================================================\n");
-
- /* the full dumpsys is starting to take a long time, so we need
- to increase its timeout. we really need to do the timeouts in
- dumpsys itself... */
- run_command("DUMPSYS", 60, "dumpsys", NULL);
-
- printf("========================================================\n");
- printf("== Running Application Activities\n");
- printf("========================================================\n");
-
- run_command("APP ACTIVITIES", 30, "dumpsys", "activity", "all", NULL);
-
- printf("========================================================\n");
- printf("== Running Application Services\n");
- printf("========================================================\n");
-
- run_command("APP SERVICES", 30, "dumpsys", "activity", "service", "all", NULL);
-
- printf("========================================================\n");
- printf("== Running Application Providers\n");
- printf("========================================================\n");
-
- run_command("APP SERVICES", 30, "dumpsys", "activity", "provider", "all", NULL);
-
-
- printf("========================================================\n");
- printf("== dumpstate: done\n");
- printf("========================================================\n");
-}
-
-static void usage() {
- fprintf(stderr, "usage: dumpstate [-b soundfile] [-e soundfile] [-o file [-d] [-p] [-z]] [-s]\n"
- " -o: write to file (instead of stdout)\n"
- " -d: append date to filename (requires -o)\n"
- " -z: gzip output (requires -o)\n"
- " -p: capture screenshot to filename.png (requires -o)\n"
- " -s: write output to control socket (for init)\n"
- " -b: play sound file instead of vibrate, at beginning of job\n"
- " -e: play sound file instead of vibrate, at end of job\n"
- );
-}
-
-int main(int argc, char *argv[]) {
- int do_add_date = 0;
- int do_compress = 0;
- char* use_outfile = 0;
- char* begin_sound = 0;
- char* end_sound = 0;
- int use_socket = 0;
- int do_fb = 0;
-
- ALOGI("begin\n");
-
- /* set as high priority, and protect from OOM killer */
- setpriority(PRIO_PROCESS, 0, -20);
- FILE *oom_adj = fopen("/proc/self/oom_adj", "w");
- if (oom_adj) {
- fputs("-17", oom_adj);
- fclose(oom_adj);
- }
-
- /* very first thing, collect VM traces from Dalvik (needs root) */
- dump_traces_path = dump_vm_traces();
-
- int c;
- while ((c = getopt(argc, argv, "b:de:ho:svzp")) != -1) {
- switch (c) {
- case 'b': begin_sound = optarg; break;
- case 'd': do_add_date = 1; break;
- case 'e': end_sound = optarg; break;
- case 'o': use_outfile = optarg; break;
- case 's': use_socket = 1; break;
- case 'v': break; // compatibility no-op
- case 'z': do_compress = 6; break;
- case 'p': do_fb = 1; break;
- case '?': printf("\n");
- case 'h':
- usage();
- exit(1);
- }
- }
-
- /* open the vibrator before dropping root */
- FILE *vibrator = fopen("/sys/class/timed_output/vibrator/enable", "w");
- if (vibrator) fcntl(fileno(vibrator), F_SETFD, FD_CLOEXEC);
-
- /* read /proc/cmdline before dropping root */
- FILE *cmdline = fopen("/proc/cmdline", "r");
- if (cmdline != NULL) {
- fgets(cmdline_buf, sizeof(cmdline_buf), cmdline);
- fclose(cmdline);
- }
-
- if (getuid() == 0) {
- if (prctl(PR_SET_KEEPCAPS, 1) < 0) {
- ALOGE("prctl(PR_SET_KEEPCAPS) failed: %s\n", strerror(errno));
- return -1;
- }
-
- /* switch to non-root user and group */
- gid_t groups[] = { AID_LOG, AID_SDCARD_RW, AID_MOUNT, AID_INET, AID_NET_BW_STATS };
- if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) {
- ALOGE("Unable to setgroups, aborting: %s\n", strerror(errno));
- return -1;
- }
- if (setgid(AID_SHELL) != 0) {
- ALOGE("Unable to setgid, aborting: %s\n", strerror(errno));
- return -1;
- }
- if (setuid(AID_SHELL) != 0) {
- ALOGE("Unable to setuid, aborting: %s\n", strerror(errno));
- return -1;
- }
-
- struct __user_cap_header_struct capheader;
- struct __user_cap_data_struct capdata[2];
- memset(&capheader, 0, sizeof(capheader));
- memset(&capdata, 0, sizeof(capdata));
- capheader.version = _LINUX_CAPABILITY_VERSION_3;
- capheader.pid = 0;
-
- capdata[CAP_TO_INDEX(CAP_SYSLOG)].permitted = CAP_TO_MASK(CAP_SYSLOG);
- capdata[CAP_TO_INDEX(CAP_SYSLOG)].effective = CAP_TO_MASK(CAP_SYSLOG);
- capdata[0].inheritable = 0;
- capdata[1].inheritable = 0;
-
- if (capset(&capheader, &capdata[0]) < 0) {
- ALOGE("capset failed: %s\n", strerror(errno));
- return -1;
- }
- }
-
- char path[PATH_MAX], tmp_path[PATH_MAX];
- pid_t gzip_pid = -1;
-
- if (use_socket) {
- redirect_to_socket(stdout, "dumpstate");
- } else if (use_outfile) {
- strlcpy(path, use_outfile, sizeof(path));
- if (do_add_date) {
- char date[80];
- time_t now = time(NULL);
- strftime(date, sizeof(date), "-%Y-%m-%d-%H-%M-%S", localtime(&now));
- strlcat(path, date, sizeof(path));
- }
- if (do_fb) {
- strlcpy(screenshot_path, path, sizeof(screenshot_path));
- strlcat(screenshot_path, ".png", sizeof(screenshot_path));
- }
- strlcat(path, ".txt", sizeof(path));
- if (do_compress) strlcat(path, ".gz", sizeof(path));
- strlcpy(tmp_path, path, sizeof(tmp_path));
- strlcat(tmp_path, ".tmp", sizeof(tmp_path));
- gzip_pid = redirect_to_file(stdout, tmp_path, do_compress);
- }
-
- if (begin_sound) {
- play_sound(begin_sound);
- } else if (vibrator) {
- fputs("150", vibrator);
- fflush(vibrator);
- }
-
- dumpstate();
-
- if (end_sound) {
- play_sound(end_sound);
- } else if (vibrator) {
- int i;
- for (i = 0; i < 3; i++) {
- fputs("75\n", vibrator);
- fflush(vibrator);
- usleep((75 + 50) * 1000);
- }
- fclose(vibrator);
- }
-
- /* wait for gzip to finish, otherwise it might get killed when we exit */
- if (gzip_pid > 0) {
- fclose(stdout);
- waitpid(gzip_pid, NULL, 0);
- }
-
- /* rename the (now complete) .tmp file to its final location */
- if (use_outfile && rename(tmp_path, path)) {
- fprintf(stderr, "rename(%s, %s): %s\n", tmp_path, path, strerror(errno));
- }
-
- ALOGI("done\n");
-
- return 0;
-}
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
deleted file mode 100644
index c1c2ad8..0000000
--- a/cmds/dumpstate/dumpstate.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#ifndef _DUMPSTATE_H_
-#define _DUMPSTATE_H_
-
-#include <time.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#define SU_PATH "/system/xbin/su"
-
-/* prints the contents of a file */
-int dump_file(const char *title, const char* path);
-
-/* forks a command and waits for it to finish -- terminate args with NULL */
-int run_command(const char *title, int timeout_seconds, const char *command, ...);
-
-/* prints all the system properties */
-void print_properties();
-
-/* redirect output to a service control socket */
-void redirect_to_socket(FILE *redirect, const char *service);
-
-/* redirect output to a file, optionally gzipping; returns gzip pid */
-pid_t redirect_to_file(FILE *redirect, char *path, int gzip_level);
-
-/* dump Dalvik stack traces, return the trace file location (NULL if none) */
-const char *dump_vm_traces();
-
-/* for each process in the system, run the specified function */
-void for_each_pid(void (*func)(int, const char *), const char *header);
-
-/* Displays a blocked processes in-kernel wait channel */
-void show_wchan(int pid, const char *name);
-
-/* Runs "showmap" for a process */
-void do_showmap(int pid, const char *name);
-
-/* Gets the dmesg output for the kernel */
-void do_dmesg();
-
-/* Play a sound via Stagefright */
-void play_sound(const char* path);
-
-/* Implemented by libdumpstate_board to dump board-specific info */
-void dumpstate_board();
-
-#endif /* _DUMPSTATE_H_ */
diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c
deleted file mode 100644
index 0d5ab90..0000000
--- a/cmds/dumpstate/utils.c
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <poll.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/inotify.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <sys/klog.h>
-#include <time.h>
-#include <unistd.h>
-
-#include <cutils/properties.h>
-#include <cutils/sockets.h>
-#include <private/android_filesystem_config.h>
-
-#include "dumpstate.h"
-
-void for_each_pid(void (*func)(int, const char *), const char *header) {
- DIR *d;
- struct dirent *de;
-
- if (!(d = opendir("/proc"))) {
- printf("Failed to open /proc (%s)\n", strerror(errno));
- return;
- }
-
- printf("\n------ %s ------\n", header);
- while ((de = readdir(d))) {
- int pid;
- int fd;
- char cmdpath[255];
- char cmdline[255];
-
- if (!(pid = atoi(de->d_name))) {
- continue;
- }
-
- sprintf(cmdpath,"/proc/%d/cmdline", pid);
- memset(cmdline, 0, sizeof(cmdline));
- if ((fd = open(cmdpath, O_RDONLY)) < 0) {
- strcpy(cmdline, "N/A");
- } else {
- read(fd, cmdline, sizeof(cmdline));
- close(fd);
- }
- func(pid, cmdline);
- }
-
- closedir(d);
-}
-
-void show_wchan(int pid, const char *name) {
- char path[255];
- char buffer[255];
- int fd;
-
- memset(buffer, 0, sizeof(buffer));
-
- sprintf(path, "/proc/%d/wchan", pid);
- if ((fd = open(path, O_RDONLY)) < 0) {
- printf("Failed to open '%s' (%s)\n", path, strerror(errno));
- return;
- }
-
- if (read(fd, buffer, sizeof(buffer)) < 0) {
- printf("Failed to read '%s' (%s)\n", path, strerror(errno));
- goto out_close;
- }
-
- printf("%-7d %-32s %s\n", pid, name, buffer);
-
-out_close:
- close(fd);
- return;
-}
-
-void do_dmesg() {
- printf("------ KERNEL LOG (dmesg) ------\n");
- int size = klogctl(10, NULL, 0); /* Get size of kernel buffer */
- if (size <= 0) {
- printf("Unexpected klogctl return value: %d\n\n", size);
- return;
- }
- char *buf = (char *) malloc(size + 1);
- if (buf == NULL) {
- printf("memory allocation failed\n\n");
- return;
- }
- int retval = klogctl(KLOG_READ_ALL, buf, size);
- if (retval < 0) {
- printf("klogctl failure\n\n");
- free(buf);
- return;
- }
- buf[retval] = '\0';
- printf("%s\n\n", buf);
- free(buf);
- return;
-}
-
-void do_showmap(int pid, const char *name) {
- char title[255];
- char arg[255];
-
- sprintf(title, "SHOW MAP %d (%s)", pid, name);
- sprintf(arg, "%d", pid);
- run_command(title, 10, SU_PATH, "root", "showmap", arg, NULL);
-}
-
-/* prints the contents of a file */
-int dump_file(const char *title, const char* path) {
- char buffer[32768];
- int fd = open(path, O_RDONLY);
- if (fd < 0) {
- int err = errno;
- if (title) printf("------ %s (%s) ------\n", title, path);
- printf("*** %s: %s\n", path, strerror(err));
- if (title) printf("\n");
- return -1;
- }
-
- if (title) printf("------ %s (%s", title, path);
-
- if (title) {
- struct stat st;
- if (memcmp(path, "/proc/", 6) && memcmp(path, "/sys/", 5) && !fstat(fd, &st)) {
- char stamp[80];
- time_t mtime = st.st_mtime;
- strftime(stamp, sizeof(stamp), "%Y-%m-%d %H:%M:%S", localtime(&mtime));
- printf(": %s", stamp);
- }
- printf(") ------\n");
- }
-
- int newline = 0;
- for (;;) {
- int ret = read(fd, buffer, sizeof(buffer));
- if (ret > 0) {
- newline = (buffer[ret - 1] == '\n');
- ret = fwrite(buffer, ret, 1, stdout);
- }
- if (ret <= 0) break;
- }
-
- close(fd);
- if (!newline) printf("\n");
- if (title) printf("\n");
- return 0;
-}
-
-/* forks a command and waits for it to finish */
-int run_command(const char *title, int timeout_seconds, const char *command, ...) {
- fflush(stdout);
- clock_t start = clock();
- pid_t pid = fork();
-
- /* handle error case */
- if (pid < 0) {
- printf("*** fork: %s\n", strerror(errno));
- return pid;
- }
-
- /* handle child case */
- if (pid == 0) {
- const char *args[1024] = {command};
- size_t arg;
-
- va_list ap;
- va_start(ap, command);
- if (title) printf("------ %s (%s", title, command);
- for (arg = 1; arg < sizeof(args) / sizeof(args[0]); ++arg) {
- args[arg] = va_arg(ap, const char *);
- if (args[arg] == NULL) break;
- if (title) printf(" %s", args[arg]);
- }
- if (title) printf(") ------\n");
- fflush(stdout);
-
- execvp(command, (char**) args);
- printf("*** exec(%s): %s\n", command, strerror(errno));
- fflush(stdout);
- _exit(-1);
- }
-
- /* handle parent case */
- for (;;) {
- int status;
- pid_t p = waitpid(pid, &status, WNOHANG);
- float elapsed = (float) (clock() - start) / CLOCKS_PER_SEC;
- if (p == pid) {
- if (WIFSIGNALED(status)) {
- printf("*** %s: Killed by signal %d\n", command, WTERMSIG(status));
- } else if (WIFEXITED(status) && WEXITSTATUS(status) > 0) {
- printf("*** %s: Exit code %d\n", command, WEXITSTATUS(status));
- }
- if (title) printf("[%s: %.1fs elapsed]\n\n", command, elapsed);
- return status;
- }
-
- if (timeout_seconds && elapsed > timeout_seconds) {
- printf("*** %s: Timed out after %.1fs (killing pid %d)\n", command, elapsed, pid);
- kill(pid, SIGTERM);
- return -1;
- }
-
- usleep(100000); // poll every 0.1 sec
- }
-}
-
-size_t num_props = 0;
-static char* props[2000];
-
-static void print_prop(const char *key, const char *name, void *user) {
- (void) user;
- if (num_props < sizeof(props) / sizeof(props[0])) {
- char buf[PROPERTY_KEY_MAX + PROPERTY_VALUE_MAX + 10];
- snprintf(buf, sizeof(buf), "[%s]: [%s]\n", key, name);
- props[num_props++] = strdup(buf);
- }
-}
-
-static int compare_prop(const void *a, const void *b) {
- return strcmp(*(char * const *) a, *(char * const *) b);
-}
-
-/* prints all the system properties */
-void print_properties() {
- size_t i;
- num_props = 0;
- property_list(print_prop, NULL);
- qsort(&props, num_props, sizeof(props[0]), compare_prop);
-
- printf("------ SYSTEM PROPERTIES ------\n");
- for (i = 0; i < num_props; ++i) {
- fputs(props[i], stdout);
- free(props[i]);
- }
- printf("\n");
-}
-
-/* redirect output to a service control socket */
-void redirect_to_socket(FILE *redirect, const char *service) {
- int s = android_get_control_socket(service);
- if (s < 0) {
- fprintf(stderr, "android_get_control_socket(%s): %s\n", service, strerror(errno));
- exit(1);
- }
- if (listen(s, 4) < 0) {
- fprintf(stderr, "listen(control socket): %s\n", strerror(errno));
- exit(1);
- }
-
- struct sockaddr addr;
- socklen_t alen = sizeof(addr);
- int fd = accept(s, &addr, &alen);
- if (fd < 0) {
- fprintf(stderr, "accept(control socket): %s\n", strerror(errno));
- exit(1);
- }
-
- fflush(redirect);
- dup2(fd, fileno(redirect));
- close(fd);
-}
-
-/* redirect output to a file, optionally gzipping; returns gzip pid (or -1) */
-pid_t redirect_to_file(FILE *redirect, char *path, int gzip_level) {
- char *chp = path;
-
- /* skip initial slash */
- if (chp[0] == '/')
- chp++;
-
- /* create leading directories, if necessary */
- while (chp && chp[0]) {
- chp = strchr(chp, '/');
- if (chp) {
- *chp = 0;
- mkdir(path, 0775); /* drwxrwxr-x */
- *chp++ = '/';
- }
- }
-
- int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
- if (fd < 0) {
- fprintf(stderr, "%s: %s\n", path, strerror(errno));
- exit(1);
- }
-
- pid_t gzip_pid = -1;
- if (gzip_level > 0) {
- int fds[2];
- if (pipe(fds)) {
- fprintf(stderr, "pipe: %s\n", strerror(errno));
- exit(1);
- }
-
- fflush(redirect);
- fflush(stdout);
-
- gzip_pid = fork();
- if (gzip_pid < 0) {
- fprintf(stderr, "fork: %s\n", strerror(errno));
- exit(1);
- }
-
- if (gzip_pid == 0) {
- dup2(fds[0], STDIN_FILENO);
- dup2(fd, STDOUT_FILENO);
-
- close(fd);
- close(fds[0]);
- close(fds[1]);
-
- char level[10];
- snprintf(level, sizeof(level), "-%d", gzip_level);
- execlp("gzip", "gzip", level, NULL);
- fprintf(stderr, "exec(gzip): %s\n", strerror(errno));
- _exit(-1);
- }
-
- close(fd);
- close(fds[0]);
- fd = fds[1];
- }
-
- dup2(fd, fileno(redirect));
- close(fd);
- return gzip_pid;
-}
-
-/* dump Dalvik stack traces, return the trace file location (NULL if none) */
-const char *dump_vm_traces() {
- char traces_path[PROPERTY_VALUE_MAX] = "";
- property_get("dalvik.vm.stack-trace-file", traces_path, "");
- if (!traces_path[0]) return NULL;
-
- /* move the old traces.txt (if any) out of the way temporarily */
- char anr_traces_path[PATH_MAX];
- strlcpy(anr_traces_path, traces_path, sizeof(anr_traces_path));
- strlcat(anr_traces_path, ".anr", sizeof(anr_traces_path));
- if (rename(traces_path, anr_traces_path) && errno != ENOENT) {
- fprintf(stderr, "rename(%s, %s): %s\n", traces_path, anr_traces_path, strerror(errno));
- return NULL; // Can't rename old traces.txt -- no permission? -- leave it alone instead
- }
-
- /* make the directory if necessary */
- char anr_traces_dir[PATH_MAX];
- strlcpy(anr_traces_dir, traces_path, sizeof(anr_traces_dir));
- char *slash = strrchr(anr_traces_dir, '/');
- if (slash != NULL) {
- *slash = '\0';
- if (!mkdir(anr_traces_dir, 0775)) {
- chown(anr_traces_dir, AID_SYSTEM, AID_SYSTEM);
- } else if (errno != EEXIST) {
- fprintf(stderr, "mkdir(%s): %s\n", anr_traces_dir, strerror(errno));
- return NULL;
- }
- }
-
- /* create a new, empty traces.txt file to receive stack dumps */
- int fd = open(traces_path, O_CREAT | O_WRONLY | O_TRUNC, 0666); /* -rw-rw-rw- */
- if (fd < 0) {
- fprintf(stderr, "%s: %s\n", traces_path, strerror(errno));
- return NULL;
- }
- close(fd);
-
- /* walk /proc and kill -QUIT all Dalvik processes */
- DIR *proc = opendir("/proc");
- if (proc == NULL) {
- fprintf(stderr, "/proc: %s\n", strerror(errno));
- return NULL;
- }
-
- /* use inotify to find when processes are done dumping */
- int ifd = inotify_init();
- if (ifd < 0) {
- fprintf(stderr, "inotify_init: %s\n", strerror(errno));
- return NULL;
- }
-
- int wfd = inotify_add_watch(ifd, traces_path, IN_CLOSE_WRITE);
- if (wfd < 0) {
- fprintf(stderr, "inotify_add_watch(%s): %s\n", traces_path, strerror(errno));
- return NULL;
- }
-
- struct dirent *d;
- int dalvik_found = 0;
- while ((d = readdir(proc))) {
- int pid = atoi(d->d_name);
- if (pid <= 0) continue;
-
- /* identify Dalvik: /proc/(pid)/exe = /system/bin/app_process */
- char path[PATH_MAX], data[PATH_MAX];
- snprintf(path, sizeof(path), "/proc/%d/exe", pid);
- size_t len = readlink(path, data, sizeof(data) - 1);
- if (len <= 0 || memcmp(data, "/system/bin/app_process", 23)) continue;
-
- /* skip zygote -- it won't dump its stack anyway */
- snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
- int fd = open(path, O_RDONLY);
- len = read(fd, data, sizeof(data) - 1);
- close(fd);
- if (len <= 0 || !memcmp(data, "zygote", 6)) continue;
-
- ++dalvik_found;
- if (kill(pid, SIGQUIT)) {
- fprintf(stderr, "kill(%d, SIGQUIT): %s\n", pid, strerror(errno));
- continue;
- }
-
- /* wait for the writable-close notification from inotify */
- struct pollfd pfd = { ifd, POLLIN, 0 };
- int ret = poll(&pfd, 1, 200); /* 200 msec timeout */
- if (ret < 0) {
- fprintf(stderr, "poll: %s\n", strerror(errno));
- } else if (ret == 0) {
- fprintf(stderr, "warning: timed out dumping pid %d\n", pid);
- } else {
- struct inotify_event ie;
- read(ifd, &ie, sizeof(ie));
- }
- }
-
- close(ifd);
- if (dalvik_found == 0) {
- fprintf(stderr, "Warning: no Dalvik processes found to dump stacks\n");
- }
-
- static char dump_traces_path[PATH_MAX];
- strlcpy(dump_traces_path, traces_path, sizeof(dump_traces_path));
- strlcat(dump_traces_path, ".bugreport", sizeof(dump_traces_path));
- if (rename(traces_path, dump_traces_path)) {
- fprintf(stderr, "rename(%s, %s): %s\n", traces_path, dump_traces_path, strerror(errno));
- return NULL;
- }
-
- /* replace the saved [ANR] traces.txt file */
- rename(anr_traces_path, traces_path);
- return dump_traces_path;
-}
-
-void play_sound(const char* path) {
- run_command(NULL, 5, "/system/bin/stagefright", "-o", "-a", path, NULL);
-}
diff --git a/cmds/dumpsys/Android.mk b/cmds/dumpsys/Android.mk
deleted file mode 100644
index 42b1b73..0000000
--- a/cmds/dumpsys/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
- dumpsys.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libutils \
- libbinder
-
-
-ifeq ($(TARGET_OS),linux)
- LOCAL_CFLAGS += -DXP_UNIX
- #LOCAL_SHARED_LIBRARIES += librt
-endif
-
-LOCAL_MODULE:= dumpsys
-
-include $(BUILD_EXECUTABLE)
diff --git a/cmds/dumpsys/MODULE_LICENSE_APACHE2 b/cmds/dumpsys/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/cmds/dumpsys/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/cmds/dumpsys/NOTICE b/cmds/dumpsys/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/cmds/dumpsys/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-2008, 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.
-
- 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.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/cmds/dumpsys/dumpsys.cpp b/cmds/dumpsys/dumpsys.cpp
deleted file mode 100644
index 7dad6b6..0000000
--- a/cmds/dumpsys/dumpsys.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Command that dumps interesting system state to the log.
- *
- */
-
-#define LOG_TAG "dumpsys"
-
-#include <utils/Log.h>
-#include <binder/Parcel.h>
-#include <binder/ProcessState.h>
-#include <binder/IServiceManager.h>
-#include <utils/TextOutput.h>
-#include <utils/Vector.h>
-
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/time.h>
-
-using namespace android;
-
-static int sort_func(const String16* lhs, const String16* rhs)
-{
- return lhs->compare(*rhs);
-}
-
-int main(int argc, char* const argv[])
-{
- sp<IServiceManager> sm = defaultServiceManager();
- fflush(stdout);
- if (sm == NULL) {
- ALOGE("Unable to get default service manager!");
- aerr << "dumpsys: Unable to get default service manager!" << endl;
- return 20;
- }
-
- Vector<String16> services;
- Vector<String16> args;
- if (argc == 1) {
- services = sm->listServices();
- services.sort(sort_func);
- args.add(String16("-a"));
- } else {
- services.add(String16(argv[1]));
- for (int i=2; i<argc; i++) {
- args.add(String16(argv[i]));
- }
- }
-
- const size_t N = services.size();
-
- if (N > 1) {
- // first print a list of the current services
- aout << "Currently running services:" << endl;
-
- for (size_t i=0; i<N; i++) {
- sp<IBinder> service = sm->checkService(services[i]);
- if (service != NULL) {
- aout << " " << services[i] << endl;
- }
- }
- }
-
- for (size_t i=0; i<N; i++) {
- sp<IBinder> service = sm->checkService(services[i]);
- if (service != NULL) {
- if (N > 1) {
- aout << "------------------------------------------------------------"
- "-------------------" << endl;
- aout << "DUMP OF SERVICE " << services[i] << ":" << endl;
- }
- int err = service->dump(STDOUT_FILENO, args);
- if (err != 0) {
- aerr << "Error dumping service info: (" << strerror(err)
- << ") " << services[i] << endl;
- }
- } else {
- aerr << "Can't find service: " << services[i] << endl;
- }
- }
-
- return 0;
-}
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 7f94a96..c2c749a 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -332,12 +332,15 @@
ret = 0;
// Make the /data/user directory if necessary
if (access(user_data_dir, R_OK) < 0) {
- if (mkdir(user_data_dir, 0755) < 0) {
+ if (mkdir(user_data_dir, 0711) < 0) {
return -1;
}
if (chown(user_data_dir, AID_SYSTEM, AID_SYSTEM) < 0) {
return -1;
}
+ if (chmod(user_data_dir, 0711) < 0) {
+ return -1;
+ }
}
// Make the /data/user/0 symlink to /data/data if necessary
if (access(primary_data_dir, R_OK) < 0) {
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java
index ac5bffe..4d638d0 100644
--- a/cmds/pm/src/com/android/commands/pm/Pm.java
+++ b/cmds/pm/src/com/android/commands/pm/Pm.java
@@ -146,18 +146,18 @@
return;
}
- if ("create-profile".equals(op)) {
- runCreateProfile();
+ if ("create-user".equals(op)) {
+ runCreateUser();
return;
}
- if ("remove-profile".equals(op)) {
- runRemoveProfile();
+ if ("remove-user".equals(op)) {
+ runRemoveUser();
return;
}
- if ("list-profiles".equals(op)) {
- runListProfiles();
+ if ("list-users".equals(op)) {
+ runListUsers();
return;
}
@@ -215,6 +215,8 @@
runListLibraries();
} else if ("instrumentation".equals(type)) {
runListInstrumentation();
+ } else if ("users".equals(type)) {
+ runListUsers();
} else {
System.err.println("Error: unknown list type '" + type + "'");
showUsage();
@@ -832,10 +834,10 @@
}
}
- public void runCreateProfile() {
+ public void runCreateUser() {
// Need to be run as root
if (Process.myUid() != ROOT_UID) {
- System.err.println("Error: create-profile must be run as root");
+ System.err.println("Error: create-user must be run as root");
return;
}
String name;
@@ -848,7 +850,7 @@
name = arg;
try {
if (mPm.createUser(name, 0) == null) {
- System.err.println("Error: couldn't create profile.");
+ System.err.println("Error: couldn't create User.");
showUsage();
}
} catch (RemoteException e) {
@@ -858,10 +860,10 @@
}
- public void runRemoveProfile() {
+ public void runRemoveUser() {
// Need to be run as root
if (Process.myUid() != ROOT_UID) {
- System.err.println("Error: remove-profile must be run as root");
+ System.err.println("Error: remove-user must be run as root");
return;
}
int userId;
@@ -880,7 +882,7 @@
}
try {
if (!mPm.removeUser(userId)) {
- System.err.println("Error: couldn't remove profile.");
+ System.err.println("Error: couldn't remove user.");
showUsage();
}
} catch (RemoteException e) {
@@ -889,10 +891,10 @@
}
}
- public void runListProfiles() {
+ public void runListUsers() {
// Need to be run as root
if (Process.myUid() != ROOT_UID) {
- System.err.println("Error: list-profiles must be run as root");
+ System.err.println("Error: list-users must be run as root");
return;
}
try {
@@ -1029,7 +1031,29 @@
return "unknown";
}
+ private boolean isNumber(String s) {
+ try {
+ Integer.parseInt(s);
+ } catch (NumberFormatException nfe) {
+ return false;
+ }
+ return true;
+ }
+
private void runSetEnabledSetting(int state) {
+ int userId = 0;
+ String option = nextOption();
+ if (option != null && option.equals("--user")) {
+ String optionData = nextOptionData();
+ if (optionData == null || !isNumber(optionData)) {
+ System.err.println("Error: no USER_ID specified");
+ showUsage();
+ return;
+ } else {
+ userId = Integer.parseInt(optionData);
+ }
+ }
+
String pkg = nextArg();
if (pkg == null) {
System.err.println("Error: no package or component specified");
@@ -1039,20 +1063,20 @@
ComponentName cn = ComponentName.unflattenFromString(pkg);
if (cn == null) {
try {
- mPm.setApplicationEnabledSetting(pkg, state, 0);
+ mPm.setApplicationEnabledSetting(pkg, state, 0, userId);
System.err.println("Package " + pkg + " new state: "
+ enabledSettingToString(
- mPm.getApplicationEnabledSetting(pkg)));
+ mPm.getApplicationEnabledSetting(pkg, userId)));
} catch (RemoteException e) {
System.err.println(e.toString());
System.err.println(PM_NOT_RUNNING_ERR);
}
} else {
try {
- mPm.setComponentEnabledSetting(cn, state, 0);
+ mPm.setComponentEnabledSetting(cn, state, 0, userId);
System.err.println("Component " + cn.toShortString() + " new state: "
+ enabledSettingToString(
- mPm.getComponentEnabledSetting(cn)));
+ mPm.getComponentEnabledSetting(cn, userId)));
} catch (RemoteException e) {
System.err.println(e.toString());
System.err.println(PM_NOT_RUNNING_ERR);
@@ -1096,7 +1120,7 @@
*/
private void displayPackageFilePath(String pckg) {
try {
- PackageInfo info = mPm.getPackageInfo(pckg, 0);
+ PackageInfo info = mPm.getPackageInfo(pckg, 0, 0);
if (info != null && info.applicationInfo != null) {
System.out.print("package:");
System.out.println(info.applicationInfo.sourceDir);
@@ -1112,7 +1136,7 @@
if (res != null) return res;
try {
- ApplicationInfo ai = mPm.getApplicationInfo(pii.packageName, 0);
+ ApplicationInfo ai = mPm.getApplicationInfo(pii.packageName, 0, 0);
AssetManager am = new AssetManager();
am.addAssetPath(ai.publicSourceDir);
res = new Resources(am, null, null);
@@ -1178,19 +1202,20 @@
System.err.println(" pm list instrumentation [-f] [TARGET-PACKAGE]");
System.err.println(" pm list features");
System.err.println(" pm list libraries");
+ System.err.println(" pm list users");
System.err.println(" pm path PACKAGE");
System.err.println(" pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f] PATH");
System.err.println(" pm uninstall [-k] PACKAGE");
System.err.println(" pm clear PACKAGE");
- System.err.println(" pm enable PACKAGE_OR_COMPONENT");
- System.err.println(" pm disable PACKAGE_OR_COMPONENT");
- System.err.println(" pm disable-user PACKAGE_OR_COMPONENT");
+ System.err.println(" pm enable [--user USER_ID] PACKAGE_OR_COMPONENT");
+ System.err.println(" pm disable [--user USER_ID] PACKAGE_OR_COMPONENT");
+ System.err.println(" pm disable-user [--user USER_ID] PACKAGE_OR_COMPONENT");
System.err.println(" pm grant PACKAGE PERMISSION");
System.err.println(" pm revoke PACKAGE PERMISSION");
System.err.println(" pm set-install-location [0/auto] [1/internal] [2/external]");
System.err.println(" pm get-install-location");
- System.err.println(" pm create-profile USER_NAME");
- System.err.println(" pm remove-profile USER_ID");
+ System.err.println(" pm create-user USER_NAME");
+ System.err.println(" pm remove-user USER_ID");
System.err.println("");
System.err.println("pm list packages: prints all packages, optionally only");
System.err.println(" those whose package name contains the text in FILTER. Options:");
diff --git a/cmds/stagefright/Android.mk b/cmds/stagefright/Android.mk
index e41b666..52a9293 100644
--- a/cmds/stagefright/Android.mk
+++ b/cmds/stagefright/Android.mk
@@ -4,19 +4,18 @@
LOCAL_SRC_FILES:= \
stagefright.cpp \
+ jpeg.cpp \
SineSource.cpp
LOCAL_SHARED_LIBRARIES := \
- libstagefright libmedia libutils libbinder libstagefright_foundation \
- libskia libgui
+ libstagefright libmedia libmedia_native libutils libbinder libstagefright_foundation \
+ libjpeg libgui
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
frameworks/base/media/libstagefright/include \
$(TOP)/frameworks/native/include/media/openmax \
- external/skia/include/core \
- external/skia/include/images \
+ external/jpeg \
LOCAL_CFLAGS += -Wno-multichar
@@ -38,7 +37,6 @@
libstagefright liblog libutils libbinder libstagefright_foundation
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
$(TOP)/frameworks/native/include/media/openmax
@@ -62,7 +60,6 @@
libstagefright liblog libutils libbinder libstagefright_foundation
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
$(TOP)/frameworks/native/include/media/openmax
@@ -87,7 +84,6 @@
libstagefright liblog libutils libbinder libstagefright_foundation
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
$(TOP)/frameworks/native/include/media/openmax
@@ -108,10 +104,9 @@
LOCAL_SHARED_LIBRARIES := \
libstagefright liblog libutils libbinder libgui \
- libstagefright_foundation libmedia
+ libstagefright_foundation libmedia libmedia_native
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
$(TOP)/frameworks/native/include/media/openmax
@@ -132,10 +127,9 @@
LOCAL_SHARED_LIBRARIES := \
libstagefright liblog libutils libbinder libstagefright_foundation \
- libmedia libgui libcutils libui
+ libmedia libmedia_native libgui libcutils libui
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
$(TOP)/frameworks/native/include/media/openmax
@@ -157,10 +151,9 @@
LOCAL_SHARED_LIBRARIES := \
libstagefright liblog libutils libbinder libstagefright_foundation \
- libmedia libgui libcutils libui
+ libmedia libmedia_native libgui libcutils libui
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
$(TOP)/frameworks/native/include/media/openmax
diff --git a/cmds/stagefright/SimplePlayer.cpp b/cmds/stagefright/SimplePlayer.cpp
index fac3a8c..0cfeb3e 100644
--- a/cmds/stagefright/SimplePlayer.cpp
+++ b/cmds/stagefright/SimplePlayer.cpp
@@ -583,8 +583,7 @@
AUDIO_STREAM_MUSIC,
sampleRate,
AUDIO_FORMAT_PCM_16_BIT,
- (channelCount == 1)
- ? AUDIO_CHANNEL_OUT_MONO : AUDIO_CHANNEL_OUT_STEREO,
+ audio_channel_out_mask_from_count(channelCount),
0);
state->mNumFramesWritten = 0;
diff --git a/cmds/stagefright/audioloop.cpp b/cmds/stagefright/audioloop.cpp
index a6362a4..ed7d6cb 100644
--- a/cmds/stagefright/audioloop.cpp
+++ b/cmds/stagefright/audioloop.cpp
@@ -32,9 +32,7 @@
sp<MediaSource> source = new AudioSource(
AUDIO_SOURCE_DEFAULT,
kSampleRate,
- kNumChannels == 1
- ? AUDIO_CHANNEL_IN_MONO
- : AUDIO_CHANNEL_IN_STEREO);
+ audio_channel_in_mask_from_count(kNumChannels));
#endif
sp<MetaData> meta = new MetaData;
diff --git a/cmds/stagefright/codec.cpp b/cmds/stagefright/codec.cpp
index fea62cc..cf2909e 100644
--- a/cmds/stagefright/codec.cpp
+++ b/cmds/stagefright/codec.cpp
@@ -28,6 +28,7 @@
#include <media/stagefright/foundation/AMessage.h>
#include <media/stagefright/DataSource.h>
#include <media/stagefright/MediaCodec.h>
+#include <media/stagefright/MediaCodecList.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/NuMediaExtractor.h>
#include <gui/SurfaceComposerClient.h>
@@ -36,7 +37,9 @@
fprintf(stderr, "usage: %s [-a] use audio\n"
"\t\t[-v] use video\n"
"\t\t[-p] playback\n"
- "\t\t[-S] allocate buffers from a surface\n", me);
+ "\t\t[-S] allocate buffers from a surface\n"
+ "\t\t[-D] decrypt input buffers\n",
+ me);
exit(1);
}
@@ -63,7 +66,8 @@
const char *path,
bool useAudio,
bool useVideo,
- const android::sp<android::Surface> &surface) {
+ const android::sp<android::Surface> &surface,
+ bool decryptInputBuffers) {
using namespace android;
static int64_t kTimeout = 500ll;
@@ -109,13 +113,31 @@
state->mNumBuffersDecoded = 0;
state->mIsAudio = isAudio;
- state->mCodec = MediaCodec::CreateByType(
- looper, mime.c_str(), false /* encoder */);
+ if (decryptInputBuffers && !isAudio) {
+ static const MediaCodecList *list = MediaCodecList::getInstance();
+
+ ssize_t index =
+ list->findCodecByType(mime.c_str(), false /* encoder */);
+
+ CHECK_GE(index, 0);
+
+ const char *componentName = list->getCodecName(index);
+
+ AString fullName = componentName;
+ fullName.append(".secure");
+
+ state->mCodec = MediaCodec::CreateByComponentName(
+ looper, fullName.c_str());
+ } else {
+ state->mCodec = MediaCodec::CreateByType(
+ looper, mime.c_str(), false /* encoder */);
+ }
CHECK(state->mCodec != NULL);
err = state->mCodec->configure(
- format, isVideo ? surface : NULL, 0 /* flags */);
+ format, isVideo ? surface : NULL,
+ decryptInputBuffers ? MediaCodec::CONFIGURE_FLAG_SECURE : 0);
CHECK_EQ(err, (status_t)OK);
@@ -202,12 +224,24 @@
err = extractor->getSampleTime(&timeUs);
CHECK_EQ(err, (status_t)OK);
+ uint32_t bufferFlags = 0;
+
+ uint32_t sampleFlags;
+ err = extractor->getSampleFlags(&sampleFlags);
+ CHECK_EQ(err, (status_t)OK);
+
+ if (sampleFlags & NuMediaExtractor::SAMPLE_FLAG_ENCRYPTED) {
+ CHECK(decryptInputBuffers);
+
+ bufferFlags |= MediaCodec::BUFFER_FLAG_ENCRYPTED;
+ }
+
err = state->mCodec->queueInputBuffer(
index,
0 /* offset */,
buffer->size(),
timeUs,
- 0 /* flags */);
+ bufferFlags);
CHECK_EQ(err, (status_t)OK);
@@ -341,9 +375,10 @@
bool useVideo = false;
bool playback = false;
bool useSurface = false;
+ bool decryptInputBuffers = false;
int res;
- while ((res = getopt(argc, argv, "havpS")) >= 0) {
+ while ((res = getopt(argc, argv, "havpSD")) >= 0) {
switch (res) {
case 'a':
{
@@ -369,6 +404,12 @@
break;
}
+ case 'D':
+ {
+ decryptInputBuffers = true;
+ break;
+ }
+
case '?':
case 'h':
default:
@@ -440,7 +481,8 @@
player->stop();
player->reset();
} else {
- decode(looper, argv[0], useAudio, useVideo, surface);
+ decode(looper, argv[0],
+ useAudio, useVideo, surface, decryptInputBuffers);
}
if (playback || (useSurface && useVideo)) {
diff --git a/cmds/stagefright/jpeg.cpp b/cmds/stagefright/jpeg.cpp
new file mode 100644
index 0000000..7e859c3
--- /dev/null
+++ b/cmds/stagefright/jpeg.cpp
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+#include <errno.h>
+#include <setjmp.h>
+#include <stdio.h>
+
+extern "C" {
+#include "jpeglib.h"
+}
+
+static inline uint8_t from565to8(uint16_t p, int start, int bits) {
+ uint8_t c = (p >> start) & ((1 << bits) - 1);
+ return (c << (8 - bits)) | (c >> (bits - (8 - bits)));
+}
+
+struct sf_jpeg_error_mgr {
+ struct jpeg_error_mgr jerr;
+ jmp_buf longjmp_buffer;
+};
+
+void sf_jpeg_error_exit(j_common_ptr cinfo) {
+ struct sf_jpeg_error_mgr *sf_err = (struct sf_jpeg_error_mgr *)cinfo->err;
+ longjmp(sf_err->longjmp_buffer, 0);
+}
+
+int writeJpegFile(const char *filename, uint8_t *frame, int width, int height) {
+ struct sf_jpeg_error_mgr sf_err;
+ struct jpeg_compress_struct cinfo;
+ uint8_t row_data[width * 3];
+ JSAMPROW row_pointer = row_data;
+ FILE *f;
+
+ f = fopen(filename, "w");
+ if (!f) {
+ return -errno;
+ }
+
+ cinfo.err = jpeg_std_error(&sf_err.jerr);
+ sf_err.jerr.error_exit = sf_jpeg_error_exit;
+ if (setjmp(sf_err.longjmp_buffer)) {
+ jpeg_destroy_compress(&cinfo);
+ fclose(f);
+ return -1;
+ }
+
+ jpeg_create_compress(&cinfo);
+ jpeg_stdio_dest(&cinfo, f);
+
+ cinfo.image_width = width;
+ cinfo.image_height = height;
+ cinfo.input_components = 3;
+ cinfo.in_color_space = JCS_RGB;
+
+ jpeg_set_defaults(&cinfo);
+ jpeg_set_quality(&cinfo, 80, TRUE);
+
+ jpeg_start_compress(&cinfo, TRUE);
+
+ for (int row = 0; row < height; row++) {
+ uint16_t *src = (uint16_t *)(frame + row * width * 2);
+ uint8_t *dst = row_data;
+ for (int col = 0; col < width; col++) {
+ dst[0] = from565to8(*src, 11, 5);
+ dst[1] = from565to8(*src, 5, 6);
+ dst[2] = from565to8(*src, 0, 5);
+ dst += 3;
+ src++;
+ }
+ jpeg_write_scanlines(&cinfo, &row_pointer, 1);
+ }
+
+ jpeg_finish_compress(&cinfo);
+ jpeg_destroy_compress(&cinfo);
+
+ fclose(f);
+ return 0;
+}
diff --git a/cmds/stagefright/jpeg.h b/cmds/stagefright/jpeg.h
new file mode 100644
index 0000000..ce86cf2
--- /dev/null
+++ b/cmds/stagefright/jpeg.h
@@ -0,0 +1,6 @@
+#ifndef _STAGEFRIGHT_JPEG_H_
+#define _STAGEFRIGHT_JPEG_H_
+
+int writeJpegFile(const char *filename, uint8_t *frame, int width, int height);
+
+#endif
diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp
index 1d28793..3bbfbdc 100644
--- a/cmds/stagefright/sf2.cpp
+++ b/cmds/stagefright/sf2.cpp
@@ -14,6 +14,10 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "sf2"
+#include <utils/Log.h>
+
#include <binder/ProcessState.h>
#include <media/stagefright/foundation/hexdump.h>
@@ -172,8 +176,9 @@
}
onDrainThisBuffer(msg);
- } else if (what == ACodec::kWhatEOS) {
- printf("$\n");
+ } else if (what == ACodec::kWhatEOS
+ || what == ACodec::kWhatError) {
+ printf((what == ACodec::kWhatEOS) ? "$\n" : "E\n");
int64_t delayUs = ALooper::GetNowUs() - mStartTimeUs;
@@ -205,6 +210,12 @@
}
looper()->stop();
+ } else if (what == ACodec::kWhatError) {
+ ALOGE("something went wrong, codec reported an error.");
+
+ printf("E\n");
+
+ (new AMessage(kWhatStop, id()))->post();
}
break;
}
@@ -276,6 +287,11 @@
msg->setInt32("channel-count", numChannels);
msg->setInt32("sample-rate", sampleRate);
+
+ int32_t isADTS;
+ if (meta->findInt32(kKeyIsADTS, &isADTS) && isADTS != 0) {
+ msg->setInt32("is-adts", true);
+ }
}
uint32_t type;
@@ -402,7 +418,8 @@
sp<AMessage> reply;
CHECK(msg->findMessage("reply", &reply));
- if (mSeekState == SEEK_FLUSHING) {
+ if (mSource == NULL || mSeekState == SEEK_FLUSHING) {
+ reply->setInt32("err", ERROR_END_OF_STREAM);
reply->post();
return;
}
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index dab2e0f..d70c862 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -24,6 +24,7 @@
#include <string.h>
#include <unistd.h>
+#include "jpeg.h"
#include "SineSource.h"
#include <binder/IServiceManager.h>
@@ -49,8 +50,6 @@
#include <media/stagefright/MPEG4Writer.h>
#include <private/media/VideoFrame.h>
-#include <SkBitmap.h>
-#include <SkImageEncoder.h>
#include <fcntl.h>
@@ -787,16 +786,9 @@
VideoFrame *frame = (VideoFrame *)mem->pointer();
- SkBitmap bitmap;
- bitmap.setConfig(
- SkBitmap::kRGB_565_Config, frame->mWidth, frame->mHeight);
-
- bitmap.setPixels((uint8_t *)frame + sizeof(VideoFrame));
-
- CHECK(SkImageEncoder::EncodeFile(
- "/sdcard/out.jpg", bitmap,
- SkImageEncoder::kJPEG_Type,
- SkImageEncoder::kDefaultQuality));
+ CHECK_EQ(writeJpegFile("/sdcard/out.jpg",
+ (uint8_t *)frame + sizeof(VideoFrame),
+ frame->mWidth, frame->mHeight), 0);
}
{
diff --git a/cmds/system_server/library/Android.mk b/cmds/system_server/library/Android.mk
index 7d08a8c..9f92330 100644
--- a/cmds/system_server/library/Android.mk
+++ b/cmds/system_server/library/Android.mk
@@ -8,10 +8,7 @@
native = $(LOCAL_PATH)/../../../../native
LOCAL_C_INCLUDES := \
- $(base)/services/camera/libcameraservice \
- $(base)/services/audioflinger \
$(base)/services/sensorservice \
- $(base)/media/libmediaplayerservice \
$(native)/services/surfaceflinger \
$(JNI_H_INCLUDE)
@@ -19,9 +16,6 @@
libandroid_runtime \
libsensorservice \
libsurfaceflinger \
- libaudioflinger \
- libcameraservice \
- libmediaplayerservice \
libinput \
libutils \
libbinder \
diff --git a/cmds/system_server/library/system_init.cpp b/cmds/system_server/library/system_init.cpp
index bfbc138..745c34a 100644
--- a/cmds/system_server/library/system_init.cpp
+++ b/cmds/system_server/library/system_init.cpp
@@ -15,10 +15,6 @@
#include <utils/Log.h>
#include <SurfaceFlinger.h>
-#include <AudioFlinger.h>
-#include <CameraService.h>
-#include <AudioPolicyService.h>
-#include <MediaPlayerService.h>
#include <SensorService.h>
#include <android_runtime/AndroidRuntime.h>
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index adc7d35..27c9c8b 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -217,10 +217,10 @@
mAuthenticatorCache = authenticatorCache;
mAuthenticatorCache.setListener(this, null /* Handler */);
- UserAccounts accounts = initUser(0);
-
sThis.set(this);
+ UserAccounts accounts = initUser(0);
+
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
intentFilter.addDataScheme("package");
@@ -1780,7 +1780,7 @@
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "performing bindService to " + authenticatorInfo.componentName);
}
- if (!mContext.bindService(intent, this, Context.BIND_AUTO_CREATE)) {
+ if (!mContext.bindService(intent, this, Context.BIND_AUTO_CREATE, mAccounts.userId)) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "bindService to " + authenticatorInfo.componentName + " failed");
}
@@ -1817,7 +1817,16 @@
// Migrate old file, if it exists, to the new location
File oldFile = new File(systemDir, DATABASE_NAME);
if (oldFile.exists()) {
- oldFile.renameTo(databaseFile);
+ // Check for use directory; create if it doesn't exist, else renameTo will fail
+ File userDir = new File(systemDir, "users/" + userId);
+ if (!userDir.exists()) {
+ if (!userDir.mkdirs()) {
+ throw new IllegalStateException("User dir cannot be created: " + userDir);
+ }
+ }
+ if (!oldFile.renameTo(databaseFile)) {
+ throw new IllegalStateException("User dir cannot be migrated: " + databaseFile);
+ }
}
}
return databaseFile.getPath();
diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java
index f69120a..e2b8ce4 100755
--- a/core/java/android/animation/ValueAnimator.java
+++ b/core/java/android/animation/ValueAnimator.java
@@ -557,12 +557,22 @@
public void handleMessage(Message msg) {
switch (msg.what) {
case ANIMATION_START:
- doAnimationStart();
+ // If there are already active animations, or if another ANIMATION_START
+ // message was processed during this frame, then the pending list may already
+ // have been cleared. If that's the case, we've already processed the
+ // active animations for this frame - don't do it again.
+ if (mPendingAnimations.size() > 0) {
+ doAnimationFrame();
+ }
break;
}
}
- private void doAnimationStart() {
+ private void doAnimationFrame() {
+ // currentTime holds the common time for all animations processed
+ // during this frame
+ long currentTime = AnimationUtils.currentAnimationTimeMillis();
+
// mPendingAnimations holds any animations that have requested to be started
// We're going to clear mPendingAnimations, but starting animation may
// cause more to be added to the pending list (for example, if one animation
@@ -583,15 +593,7 @@
}
}
}
- doAnimationFrame();
- }
-
- private void doAnimationFrame() {
- // currentTime holds the common time for all animations processed
- // during this frame
- long currentTime = AnimationUtils.currentAnimationTimeMillis();
-
- // First, process animations currently sitting on the delayed queue, adding
+ // Next, process animations currently sitting on the delayed queue, adding
// them to the active animations if they are ready
int numDelayedAnims = mDelayedAnims.size();
for (int i = 0; i < numDelayedAnims; ++i) {
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index dc12acd..b277efb 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -32,7 +32,6 @@
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.content.res.Resources.Theme;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -55,7 +54,6 @@
import android.util.EventLog;
import android.util.Log;
import android.util.SparseArray;
-import android.util.TypedValue;
import android.view.ActionMode;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
@@ -3208,7 +3206,8 @@
* @param requestCode If >= 0, this code will be returned in
* onActivityResult() when the activity exits.
* @param options Additional options for how the Activity should be started.
- * May be null if there are no options.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @throws android.content.ActivityNotFoundException
*
@@ -3288,7 +3287,10 @@
* <var>flagsMask</var>
* @param extraFlags Always set to 0.
* @param options Additional options for how the Activity should be started.
- * May be null if there are no options.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details. If options
+ * have also been supplied by the IntentSender, options given here will
+ * override any that conflict with those given by the IntentSender.
*/
public void startIntentSenderForResult(IntentSender intent, int requestCode,
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
@@ -3369,7 +3371,8 @@
*
* @param intent The intent to start.
* @param options Additional options for how the Activity should be started.
- * May be null if there are no options.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @throws android.content.ActivityNotFoundException
*
@@ -3417,7 +3420,8 @@
*
* @param intents The intents to start.
* @param options Additional options for how the Activity should be started.
- * May be null if there are no options.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @throws android.content.ActivityNotFoundException
*
@@ -3465,7 +3469,10 @@
* <var>flagsMask</var>
* @param extraFlags Always set to 0.
* @param options Additional options for how the Activity should be started.
- * May be null if there are no options.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details. If options
+ * have also been supplied by the IntentSender, options given here will
+ * override any that conflict with those given by the IntentSender.
*/
public void startIntentSender(IntentSender intent,
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
@@ -3521,7 +3528,8 @@
* onActivityResult() when the activity exits, as described in
* {@link #startActivityForResult}.
* @param options Additional options for how the Activity should be started.
- * May be null if there are no options.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @return If a new activity was launched then true is returned; otherwise
* false is returned and you must handle the Intent yourself.
@@ -3592,7 +3600,8 @@
* your own activity; the only changes you can make are to the extras
* inside of it.
* @param options Additional options for how the Activity should be started.
- * May be null if there are no options.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @return Returns a boolean indicating whether there was another Activity
* to start: true if there was a next activity to start, false if there
@@ -3630,7 +3639,7 @@
*/
public void startActivityFromChild(Activity child, Intent intent,
int requestCode) {
- startActivityFromChild(child, intent, requestCode);
+ startActivityFromChild(child, intent, requestCode, null);
}
/**
@@ -3644,7 +3653,8 @@
* @param intent The intent to start.
* @param requestCode Reply request code. < 0 if reply is not requested.
* @param options Additional options for how the Activity should be started.
- * May be null if there are no options.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @throws android.content.ActivityNotFoundException
*
@@ -3694,7 +3704,8 @@
* @param intent The intent to start.
* @param requestCode Reply request code. < 0 if reply is not requested.
* @param options Additional options for how the Activity should be started.
- * May be null if there are no options.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @throws android.content.ActivityNotFoundException
*
@@ -3744,6 +3755,14 @@
* Call immediately after one of the flavors of {@link #startActivity(Intent)}
* or {@link #finish} to specify an explicit transition animation to
* perform next.
+ *
+ * <p>As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN} an alternative
+ * to using this with starting activities is to supply the desired animation
+ * information through a {@link ActivityOptions} bundle to
+ * {@link #startActivity(Intent, Bundle) or a related function. This allows
+ * you to specify a custom animation even when starting an activity from
+ * outside the context of the current top activity.
+ *
* @param enterAnim A resource ID of the animation resource to use for
* the incoming activity. Use 0 for no animation.
* @param exitAnim A resource ID of the animation resource to use for
@@ -4065,7 +4084,7 @@
ActivityManagerNative.getDefault().getIntentSender(
ActivityManager.INTENT_SENDER_ACTIVITY_RESULT, packageName,
mParent == null ? mToken : mParent.mToken,
- mEmbeddedID, requestCode, new Intent[] { data }, null, flags);
+ mEmbeddedID, requestCode, new Intent[] { data }, null, flags, null);
return target != null ? new PendingIntent(target) : null;
} catch (RemoteException e) {
// Empty
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index d056b17..531a695 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -31,6 +31,7 @@
import android.graphics.Bitmap;
import android.graphics.Point;
import android.os.Binder;
+import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
import android.os.Parcel;
@@ -816,6 +817,19 @@
public static final int MOVE_TASK_NO_USER_ACTION = 0x00000002;
/**
+ * Equivalent to calling {@link #moveTaskToFront(int, int, Bundle)}
+ * with a null options argument.
+ *
+ * @param taskId The identifier of the task to be moved, as found in
+ * {@link RunningTaskInfo} or {@link RecentTaskInfo}.
+ * @param flags Additional operational flags, 0 or more of
+ * {@link #MOVE_TASK_WITH_HOME}.
+ */
+ public void moveTaskToFront(int taskId, int flags) {
+ moveTaskToFront(taskId, flags, null);
+ }
+
+ /**
* Ask that the task associated with a given task ID be moved to the
* front of the stack, so it is now visible to the user. Requires that
* the caller hold permission {@link android.Manifest.permission#REORDER_TASKS}
@@ -825,10 +839,13 @@
* {@link RunningTaskInfo} or {@link RecentTaskInfo}.
* @param flags Additional operational flags, 0 or more of
* {@link #MOVE_TASK_WITH_HOME}.
+ * @param options Additional options for the operation, either null or
+ * as per {@link Context#startActivity(Intent, android.os.Bundle)
+ * Context.startActivity(Intent, Bundle)}.
*/
- public void moveTaskToFront(int taskId, int flags) {
+ public void moveTaskToFront(int taskId, int flags, Bundle options) {
try {
- ActivityManagerNative.getDefault().moveTaskToFront(taskId, flags);
+ ActivityManagerNative.getDefault().moveTaskToFront(taskId, flags, options);
} catch (RemoteException e) {
// System dead, we will be dead too soon!
}
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 732d211..c402329 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -510,7 +510,9 @@
data.enforceInterface(IActivityManager.descriptor);
int task = data.readInt();
int fl = data.readInt();
- moveTaskToFront(task, fl);
+ Bundle options = data.readInt() != 0
+ ? Bundle.CREATOR.createFromParcel(data) : null;
+ moveTaskToFront(task, fl, options);
reply.writeNoException();
return true;
}
@@ -835,9 +837,11 @@
requestResolvedTypes = null;
}
int fl = data.readInt();
+ Bundle options = data.readInt() != 0
+ ? Bundle.CREATOR.createFromParcel(data) : null;
IIntentSender res = getIntentSender(type, packageName, token,
resultWho, requestCode, requestIntents,
- requestResolvedTypes, fl);
+ requestResolvedTypes, fl, options);
reply.writeNoException();
reply.writeStrongBinder(res != null ? res.asBinder() : null);
return true;
@@ -1053,6 +1057,15 @@
return true;
}
+ case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
+ data.enforceInterface(IActivityManager.descriptor);
+ String reason = data.readString();
+ boolean res = killProcessesBelowForeground(reason);
+ reply.writeNoException();
+ reply.writeInt(res ? 1 : 0);
+ return true;
+ }
+
case START_RUNNING_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
String pkg = data.readString();
@@ -2132,13 +2145,19 @@
reply.recycle();
return list;
}
- public void moveTaskToFront(int task, int flags) throws RemoteException
+ public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
{
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeInt(task);
data.writeInt(flags);
+ if (options != null) {
+ data.writeInt(1);
+ options.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
reply.readException();
data.recycle();
@@ -2607,8 +2626,8 @@
}
public IIntentSender getIntentSender(int type,
String packageName, IBinder token, String resultWho,
- int requestCode, Intent[] intents, String[] resolvedTypes, int flags)
- throws RemoteException {
+ int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
+ Bundle options) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
@@ -2625,6 +2644,12 @@
data.writeInt(0);
}
data.writeInt(flags);
+ if (options != null) {
+ data.writeInt(1);
+ options.writeToParcel(data, 0);
+ } else {
+ data.writeInt(0);
+ }
mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
reply.readException();
IIntentSender res = IIntentSender.Stub.asInterface(
@@ -2894,6 +2919,18 @@
reply.recycle();
return res;
}
+ @Override
+ public boolean killProcessesBelowForeground(String reason) throws RemoteException {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInterfaceToken(IActivityManager.descriptor);
+ data.writeString(reason);
+ mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
+ boolean res = reply.readInt() != 0;
+ data.recycle();
+ reply.recycle();
+ return res;
+ }
public void startRunning(String pkg, String cls, String action,
String indata) throws RemoteException {
Parcel data = Parcel.obtain();
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
new file mode 100644
index 0000000..c637df0
--- /dev/null
+++ b/core/java/android/app/ActivityOptions.java
@@ -0,0 +1,309 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.app;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IRemoteCallback;
+import android.os.Message;
+import android.os.RemoteException;
+import android.view.View;
+
+/**
+ * Helper class for building an options Bundle that can be used with
+ * {@link android.content.Context#startActivity(android.content.Intent, android.os.Bundle)
+ * Context.startActivity(Intent, Bundle)} and related methods.
+ */
+public class ActivityOptions {
+ /**
+ * The package name that created the options.
+ * @hide
+ */
+ public static final String KEY_PACKAGE_NAME = "android:packageName";
+
+ /**
+ * Type of animation that arguments specify.
+ * @hide
+ */
+ public static final String KEY_ANIM_TYPE = "android:animType";
+
+ /**
+ * Custom enter animation resource ID.
+ * @hide
+ */
+ public static final String KEY_ANIM_ENTER_RES_ID = "android:animEnterRes";
+
+ /**
+ * Custom exit animation resource ID.
+ * @hide
+ */
+ public static final String KEY_ANIM_EXIT_RES_ID = "android:animExitRes";
+
+ /**
+ * Bitmap for thumbnail animation.
+ * @hide
+ */
+ public static final String KEY_ANIM_THUMBNAIL = "android:animThumbnail";
+
+ /**
+ * Start X position of thumbnail animation.
+ * @hide
+ */
+ public static final String KEY_ANIM_START_X = "android:animStartX";
+
+ /**
+ * Start Y position of thumbnail animation.
+ * @hide
+ */
+ public static final String KEY_ANIM_START_Y = "android:animStartY";
+
+ /**
+ * Callback for when animation is started.
+ * @hide
+ */
+ public static final String KEY_ANIM_START_LISTENER = "android:animStartListener";
+
+ /** @hide */
+ public static final int ANIM_NONE = 0;
+ /** @hide */
+ public static final int ANIM_CUSTOM = 1;
+ /** @hide */
+ public static final int ANIM_THUMBNAIL = 2;
+
+ private String mPackageName;
+ private int mAnimationType = ANIM_NONE;
+ private int mCustomEnterResId;
+ private int mCustomExitResId;
+ private Bitmap mThumbnail;
+ private int mStartX;
+ private int mStartY;
+ private IRemoteCallback mAnimationStartedListener;
+
+ /**
+ * Create an ActivityOptions specifying a custom animation to run when
+ * the activity is displayed.
+ *
+ * @param context Who is defining this. This is the application that the
+ * animation resources will be loaded from.
+ * @param enterResId A resource ID of the animation resource to use for
+ * the incoming activity. Use 0 for no animation.
+ * @param exitResId A resource ID of the animation resource to use for
+ * the outgoing activity. Use 0 for no animation.
+ * @return Returns a new ActivityOptions object that you can use to
+ * supply these options as the options Bundle when starting an activity.
+ */
+ public static ActivityOptions makeCustomAnimation(Context context,
+ int enterResId, int exitResId) {
+ ActivityOptions opts = new ActivityOptions();
+ opts.mPackageName = context.getPackageName();
+ opts.mAnimationType = ANIM_CUSTOM;
+ opts.mCustomEnterResId = enterResId;
+ opts.mCustomExitResId = exitResId;
+ return opts;
+ }
+
+ /**
+ * Callback for use with {@link ActivityOptions#makeThumbnailScaleUpAnimation}
+ * to find out when the given animation has started running.
+ */
+ public interface OnAnimationStartedListener {
+ void onAnimationStarted();
+ }
+
+ /**
+ * Create an ActivityOptions specifying an animation where a thumbnail
+ * is scaled from a given position to the new activity window that is
+ * being started.
+ *
+ * @param source The View that this thumbnail is animating from. This
+ * defines the coordinate space for <var>startX</var> and <var>startY</var>.
+ * @param thumbnail The bitmap that will be shown as the initial thumbnail
+ * of the animation.
+ * @param startX The x starting location of the bitmap, in screen coordiantes.
+ * @param startY The y starting location of the bitmap, in screen coordinates.
+ * @param listener Optional OnAnimationStartedListener to find out when the
+ * requested animation has started running. If for some reason the animation
+ * is not executed, the callback will happen immediately.
+ * @return Returns a new ActivityOptions object that you can use to
+ * supply these options as the options Bundle when starting an activity.
+ */
+ public static ActivityOptions makeThumbnailScaleUpAnimation(View source,
+ Bitmap thumbnail, int startX, int startY, OnAnimationStartedListener listener) {
+ ActivityOptions opts = new ActivityOptions();
+ opts.mPackageName = source.getContext().getPackageName();
+ opts.mAnimationType = ANIM_THUMBNAIL;
+ opts.mThumbnail = thumbnail;
+ int[] pts = new int[2];
+ source.getLocationOnScreen(pts);
+ opts.mStartX = pts[0] + startX;
+ opts.mStartY = pts[1] + startY;
+ if (listener != null) {
+ final Handler h = source.getHandler();
+ final OnAnimationStartedListener finalListener = listener;
+ opts.mAnimationStartedListener = new IRemoteCallback.Stub() {
+ @Override public void sendResult(Bundle data) throws RemoteException {
+ h.post(new Runnable() {
+ @Override public void run() {
+ finalListener.onAnimationStarted();
+ }
+ });
+ }
+ };
+ }
+ return opts;
+ }
+
+ private ActivityOptions() {
+ }
+
+ /** @hide */
+ public ActivityOptions(Bundle opts) {
+ mPackageName = opts.getString(KEY_PACKAGE_NAME);
+ mAnimationType = opts.getInt(KEY_ANIM_TYPE);
+ if (mAnimationType == ANIM_CUSTOM) {
+ mCustomEnterResId = opts.getInt(KEY_ANIM_ENTER_RES_ID, 0);
+ mCustomExitResId = opts.getInt(KEY_ANIM_EXIT_RES_ID, 0);
+ } else if (mAnimationType == ANIM_THUMBNAIL) {
+ mThumbnail = (Bitmap)opts.getParcelable(KEY_ANIM_THUMBNAIL);
+ mStartX = opts.getInt(KEY_ANIM_START_X, 0);
+ mStartY = opts.getInt(KEY_ANIM_START_Y, 0);
+ mAnimationStartedListener = IRemoteCallback.Stub.asInterface(
+ opts.getIBinder(KEY_ANIM_START_LISTENER));
+ }
+ }
+
+ /** @hide */
+ public String getPackageName() {
+ return mPackageName;
+ }
+
+ /** @hide */
+ public int getAnimationType() {
+ return mAnimationType;
+ }
+
+ /** @hide */
+ public int getCustomEnterResId() {
+ return mCustomEnterResId;
+ }
+
+ /** @hide */
+ public int getCustomExitResId() {
+ return mCustomExitResId;
+ }
+
+ /** @hide */
+ public Bitmap getThumbnail() {
+ return mThumbnail;
+ }
+
+ /** @hide */
+ public int getStartX() {
+ return mStartX;
+ }
+
+ /** @hide */
+ public int getStartY() {
+ return mStartY;
+ }
+
+ /** @hide */
+ public IRemoteCallback getOnAnimationStartListener() {
+ return mAnimationStartedListener;
+ }
+
+ /** @hide */
+ public void abort() {
+ if (mAnimationStartedListener != null) {
+ try {
+ mAnimationStartedListener.sendResult(null);
+ } catch (RemoteException e) {
+ }
+ }
+ }
+
+ /** @hide */
+ public static void abort(Bundle options) {
+ if (options != null) {
+ (new ActivityOptions(options)).abort();
+ }
+ }
+
+ /**
+ * Join the values in <var>otherOptions</var> in to this one. Any values
+ * defined in <var>otherOptions</var> replace those in the base options.
+ */
+ public void join(ActivityOptions otherOptions) {
+ if (otherOptions.mPackageName != null) {
+ mPackageName = otherOptions.mPackageName;
+ }
+ switch (otherOptions.mAnimationType) {
+ case ANIM_CUSTOM:
+ mAnimationType = otherOptions.mAnimationType;
+ mCustomEnterResId = otherOptions.mCustomEnterResId;
+ mCustomExitResId = otherOptions.mCustomExitResId;
+ mThumbnail = null;
+ mAnimationStartedListener = null;
+ break;
+ case ANIM_THUMBNAIL:
+ mAnimationType = otherOptions.mAnimationType;
+ mThumbnail = otherOptions.mThumbnail;
+ mStartX = otherOptions.mStartX;
+ mStartY = otherOptions.mStartY;
+ if (otherOptions.mAnimationStartedListener != null) {
+ try {
+ otherOptions.mAnimationStartedListener.sendResult(null);
+ } catch (RemoteException e) {
+ }
+ }
+ mAnimationStartedListener = otherOptions.mAnimationStartedListener;
+ break;
+ }
+ }
+
+ /**
+ * Returns the created options as a Bundle, which can be passed to
+ * {@link android.content.Context#startActivity(android.content.Intent, android.os.Bundle)
+ * Context.startActivity(Intent, Bundle)} and related methods.
+ * Note that the returned Bundle is still owned by the ActivityOptions
+ * object; you must not modify it, but can supply it to the startActivity
+ * methods that take an options Bundle.
+ */
+ public Bundle toBundle() {
+ Bundle b = new Bundle();
+ if (mPackageName != null) {
+ b.putString(KEY_PACKAGE_NAME, mPackageName);
+ }
+ switch (mAnimationType) {
+ case ANIM_CUSTOM:
+ b.putInt(KEY_ANIM_TYPE, mAnimationType);
+ b.putInt(KEY_ANIM_ENTER_RES_ID, mCustomEnterResId);
+ b.putInt(KEY_ANIM_EXIT_RES_ID, mCustomExitResId);
+ break;
+ case ANIM_THUMBNAIL:
+ b.putInt(KEY_ANIM_TYPE, mAnimationType);
+ b.putParcelable(KEY_ANIM_THUMBNAIL, mThumbnail);
+ b.putInt(KEY_ANIM_START_X, mStartX);
+ b.putInt(KEY_ANIM_START_Y, mStartY);
+ b.putIBinder(KEY_ANIM_START_LISTENER, mAnimationStartedListener
+ != null ? mAnimationStartedListener.asBinder() : null);
+ }
+ return b;
+ }
+}
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 2a3e213..ab4e73d 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -404,6 +404,7 @@
try {
fd.close();
} catch (IOException e) {
+ // Ignore
}
}
return;
@@ -412,6 +413,7 @@
try {
profileFd.close();
} catch (IOException e) {
+ // Ignore
}
}
profileFile = file;
@@ -843,14 +845,13 @@
FileOutputStream fout = new FileOutputStream(fd);
PrintWriter pw = new PrintWriter(fout);
try {
- return dumpMemInfo(pw, checkin, all, args);
+ return dumpMemInfo(pw, checkin, all);
} finally {
pw.flush();
}
}
- private Debug.MemoryInfo dumpMemInfo(PrintWriter pw, boolean checkin, boolean all,
- String[] args) {
+ private Debug.MemoryInfo dumpMemInfo(PrintWriter pw, boolean checkin, boolean all) {
long nativeMax = Debug.getNativeHeapSize() / 1024;
long nativeAllocated = Debug.getNativeHeapAllocatedSize() / 1024;
long nativeFree = Debug.getNativeHeapFreeSize() / 1024;
@@ -1458,17 +1459,6 @@
return dm;
}
- static Configuration applyConfigCompat(Configuration config, CompatibilityInfo compat) {
- if (config == null) {
- return null;
- }
- if (compat != null && !compat.supportsScreen()) {
- config = new Configuration(config);
- compat.applyToConfiguration(config);
- }
- return config;
- }
-
private Configuration mMainThreadConfig = new Configuration();
Configuration applyConfigCompatMainThread(Configuration config, CompatibilityInfo compat) {
if (config == null) {
@@ -1586,7 +1576,7 @@
ApplicationInfo ai = null;
try {
ai = getPackageManager().getApplicationInfo(packageName,
- PackageManager.GET_SHARED_LIBRARY_FILES);
+ PackageManager.GET_SHARED_LIBRARY_FILES, UserId.myUserId());
} catch (RemoteException e) {
// Ignore
}
@@ -2509,7 +2499,7 @@
return r;
}
- final void cleanUpPendingRemoveWindows(ActivityClientRecord r) {
+ static final void cleanUpPendingRemoveWindows(ActivityClientRecord r) {
if (r.mPendingRemoveWindow != null) {
r.mPendingRemoveWindowManager.removeViewImmediate(r.mPendingRemoveWindow);
IBinder wtoken = r.mPendingRemoveWindow.getWindowToken();
@@ -3437,15 +3427,12 @@
= new ArrayList<ComponentCallbacks2>();
if (mActivities.size() > 0) {
- Iterator<ActivityClientRecord> it = mActivities.values().iterator();
- while (it.hasNext()) {
- ActivityClientRecord ar = it.next();
+ for (ActivityClientRecord ar : mActivities.values()) {
Activity a = ar.activity;
if (a != null) {
Configuration thisConfig = applyConfigCompatMainThread(newConfig,
ar.packageInfo.mCompatibilityInfo.getIfNeeded());
- if (!ar.activity.mFinished && (allActivities ||
- (a != null && !ar.paused))) {
+ if (!ar.activity.mFinished && (allActivities || !ar.paused)) {
// If the activity is currently resumed, its configuration
// needs to change right now.
callbacks.add(a);
@@ -3455,24 +3442,24 @@
// the activity manager may, before then, decide the
// activity needs to be destroyed to handle its new
// configuration.
- if (DEBUG_CONFIGURATION) Slog.v(TAG, "Setting activity "
- + ar.activityInfo.name + " newConfig=" + thisConfig);
+ if (DEBUG_CONFIGURATION) {
+ Slog.v(TAG, "Setting activity "
+ + ar.activityInfo.name + " newConfig=" + thisConfig);
+ }
ar.newConfig = thisConfig;
}
}
}
}
if (mServices.size() > 0) {
- Iterator<Service> it = mServices.values().iterator();
- while (it.hasNext()) {
- callbacks.add(it.next());
+ for (Service service : mServices.values()) {
+ callbacks.add(service);
}
}
synchronized (mProviderMap) {
if (mLocalProviders.size() > 0) {
- Iterator<ProviderClientRecord> it = mLocalProviders.values().iterator();
- while (it.hasNext()) {
- callbacks.add(it.next().mLocalProvider);
+ for (ProviderClientRecord providerClientRecord : mLocalProviders.values()) {
+ callbacks.add(providerClientRecord.mLocalProvider);
}
}
}
@@ -3484,8 +3471,7 @@
return callbacks;
}
- private final void performConfigurationChanged(
- ComponentCallbacks2 cb, Configuration config) {
+ private static void performConfigurationChanged(ComponentCallbacks2 cb, Configuration config) {
// Only for Activity objects, check that they actually call up to their
// superclass implementation. ComponentCallbacks2 is an interface, so
// we check the runtime type and act accordingly.
@@ -3692,7 +3678,7 @@
}
}
- final void handleDumpHeap(boolean managed, DumpHeapData dhd) {
+ static final void handleDumpHeap(boolean managed, DumpHeapData dhd) {
if (managed) {
try {
Debug.dumpHprofData(dhd.path, dhd.fd.getFileDescriptor());
@@ -3769,7 +3755,7 @@
}
final int N = callbacks.size();
- for (int i=0; i<N; i++) {
+ for (int i = 0; i < N; i++) {
callbacks.get(i).onTrimMemory(level);
}
WindowManagerImpl.getDefault().terminateEgl();
@@ -4057,9 +4043,7 @@
final ArrayList<IActivityManager.ContentProviderHolder> results =
new ArrayList<IActivityManager.ContentProviderHolder>();
- Iterator<ProviderInfo> i = providers.iterator();
- while (i.hasNext()) {
- ProviderInfo cpi = i.next();
+ for (ProviderInfo cpi : providers) {
StringBuilder buf = new StringBuilder(128);
buf.append("Pub ");
buf.append(cpi.authority);
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 758ce09..f38540c 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -49,6 +49,7 @@
import android.net.Uri;
import android.os.Process;
import android.os.RemoteException;
+import android.os.UserId;
import android.util.Log;
import java.lang.ref.WeakReference;
@@ -67,7 +68,7 @@
public PackageInfo getPackageInfo(String packageName, int flags)
throws NameNotFoundException {
try {
- PackageInfo pi = mPM.getPackageInfo(packageName, flags);
+ PackageInfo pi = mPM.getPackageInfo(packageName, flags, UserId.myUserId());
if (pi != null) {
return pi;
}
@@ -197,7 +198,7 @@
public ApplicationInfo getApplicationInfo(String packageName, int flags)
throws NameNotFoundException {
try {
- ApplicationInfo ai = mPM.getApplicationInfo(packageName, flags);
+ ApplicationInfo ai = mPM.getApplicationInfo(packageName, flags, UserId.myUserId());
if (ai != null) {
return ai;
}
@@ -212,7 +213,7 @@
public ActivityInfo getActivityInfo(ComponentName className, int flags)
throws NameNotFoundException {
try {
- ActivityInfo ai = mPM.getActivityInfo(className, flags);
+ ActivityInfo ai = mPM.getActivityInfo(className, flags, UserId.myUserId());
if (ai != null) {
return ai;
}
@@ -227,7 +228,7 @@
public ActivityInfo getReceiverInfo(ComponentName className, int flags)
throws NameNotFoundException {
try {
- ActivityInfo ai = mPM.getReceiverInfo(className, flags);
+ ActivityInfo ai = mPM.getReceiverInfo(className, flags, UserId.myUserId());
if (ai != null) {
return ai;
}
@@ -242,7 +243,7 @@
public ServiceInfo getServiceInfo(ComponentName className, int flags)
throws NameNotFoundException {
try {
- ServiceInfo si = mPM.getServiceInfo(className, flags);
+ ServiceInfo si = mPM.getServiceInfo(className, flags, UserId.myUserId());
if (si != null) {
return si;
}
@@ -257,7 +258,7 @@
public ProviderInfo getProviderInfo(ComponentName className, int flags)
throws NameNotFoundException {
try {
- ProviderInfo pi = mPM.getProviderInfo(className, flags);
+ ProviderInfo pi = mPM.getProviderInfo(className, flags, UserId.myUserId());
if (pi != null) {
return pi;
}
@@ -422,6 +423,7 @@
@SuppressWarnings("unchecked")
@Override
public List<ApplicationInfo> getInstalledApplications(int flags) {
+ int userId = UserId.getUserId(Process.myUid());
try {
final List<ApplicationInfo> applicationInfos = new ArrayList<ApplicationInfo>();
ApplicationInfo lastItem = null;
@@ -429,7 +431,7 @@
do {
final String lastKey = lastItem != null ? lastItem.packageName : null;
- slice = mPM.getInstalledApplications(flags, lastKey);
+ slice = mPM.getInstalledApplications(flags, lastKey, userId);
lastItem = slice.populateList(applicationInfos, ApplicationInfo.CREATOR);
} while (!slice.isLastSlice());
@@ -445,7 +447,7 @@
return mPM.resolveIntent(
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
- flags);
+ flags, UserId.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -458,7 +460,8 @@
return mPM.queryIntentActivities(
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
- flags);
+ flags,
+ UserId.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -490,7 +493,7 @@
try {
return mPM.queryIntentActivityOptions(caller, specifics,
specificTypes, intent, intent.resolveTypeIfNeeded(resolver),
- flags);
+ flags, UserId.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -502,7 +505,8 @@
return mPM.queryIntentReceivers(
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
- flags);
+ flags,
+ UserId.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -514,7 +518,8 @@
return mPM.resolveService(
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
- flags);
+ flags,
+ UserId.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -526,7 +531,8 @@
return mPM.queryIntentServices(
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
- flags);
+ flags,
+ UserId.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -536,7 +542,7 @@
public ProviderInfo resolveContentProvider(String name,
int flags) {
try {
- return mPM.resolveContentProvider(name, flags);
+ return mPM.resolveContentProvider(name, flags, UserId.myUserId());
} catch (RemoteException e) {
throw new RuntimeException("Package manager has died", e);
}
@@ -1026,7 +1032,7 @@
public void clearApplicationUserData(String packageName,
IPackageDataObserver observer) {
try {
- mPM.clearApplicationUserData(packageName, observer);
+ mPM.clearApplicationUserData(packageName, observer, UserId.myUserId());
} catch (RemoteException e) {
// Should never happen!
}
@@ -1139,7 +1145,7 @@
public void setComponentEnabledSetting(ComponentName componentName,
int newState, int flags) {
try {
- mPM.setComponentEnabledSetting(componentName, newState, flags);
+ mPM.setComponentEnabledSetting(componentName, newState, flags, UserId.myUserId());
} catch (RemoteException e) {
// Should never happen!
}
@@ -1148,7 +1154,7 @@
@Override
public int getComponentEnabledSetting(ComponentName componentName) {
try {
- return mPM.getComponentEnabledSetting(componentName);
+ return mPM.getComponentEnabledSetting(componentName, UserId.myUserId());
} catch (RemoteException e) {
// Should never happen!
}
@@ -1159,7 +1165,7 @@
public void setApplicationEnabledSetting(String packageName,
int newState, int flags) {
try {
- mPM.setApplicationEnabledSetting(packageName, newState, flags);
+ mPM.setApplicationEnabledSetting(packageName, newState, flags, UserId.myUserId());
} catch (RemoteException e) {
// Should never happen!
}
@@ -1168,7 +1174,7 @@
@Override
public int getApplicationEnabledSetting(String packageName) {
try {
- return mPM.getApplicationEnabledSetting(packageName);
+ return mPM.getApplicationEnabledSetting(packageName, UserId.myUserId());
} catch (RemoteException e) {
// Should never happen!
}
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 7043a73..d758ecae 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -766,17 +766,18 @@
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory) {
- File f = validateFilePath(name, true);
- SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(f, factory);
- setFilePermissionsFromMode(f.getPath(), mode, 0);
- return db;
+ return openOrCreateDatabase(name, mode, factory, null);
}
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory,
DatabaseErrorHandler errorHandler) {
File f = validateFilePath(name, true);
- SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(f.getPath(), factory, errorHandler);
+ int flags = SQLiteDatabase.CREATE_IF_NECESSARY;
+ if ((mode & MODE_ENABLE_WRITE_AHEAD_LOGGING) != 0) {
+ flags |= SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING;
+ }
+ SQLiteDatabase db = SQLiteDatabase.openDatabase(f.getPath(), factory, flags, errorHandler);
setFilePermissionsFromMode(f.getPath(), mode, 0);
return db;
}
diff --git a/core/java/android/app/Fragment.java b/core/java/android/app/Fragment.java
index dadc4e5..c493f0f 100644
--- a/core/java/android/app/Fragment.java
+++ b/core/java/android/app/Fragment.java
@@ -965,6 +965,8 @@
/**
* Call {@link Activity#startActivity(Intent)} on the fragment's
* containing Activity.
+ *
+ * @param intent The intent to start.
*/
public void startActivity(Intent intent) {
startActivity(intent, null);
@@ -973,6 +975,11 @@
/**
* Call {@link Activity#startActivity(Intent, Bundle)} on the fragment's
* containing Activity.
+ *
+ * @param intent The intent to start.
+ * @param options Additional options for how the Activity should be started.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*/
public void startActivity(Intent intent, Bundle options) {
if (mActivity == null) {
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 9306bd2..1d994d8 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -105,7 +105,7 @@
public List getServices(int maxNum, int flags) throws RemoteException;
public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
throws RemoteException;
- public void moveTaskToFront(int task, int flags) throws RemoteException;
+ public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException;
public void moveTaskToBack(int task) throws RemoteException;
public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) throws RemoteException;
public void moveTaskBackwards(int task) throws RemoteException;
@@ -169,7 +169,7 @@
public IIntentSender getIntentSender(int type,
String packageName, IBinder token, String resultWho,
int requestCode, Intent[] intents, String[] resolvedTypes,
- int flags) throws RemoteException;
+ int flags, Bundle options) throws RemoteException;
public void cancelIntentSender(IIntentSender sender) throws RemoteException;
public boolean clearApplicationUserData(final String packageName,
final IPackageDataObserver observer, int userId) throws RemoteException;
@@ -216,9 +216,10 @@
public void enterSafeMode() throws RemoteException;
public void noteWakeupAlarm(IIntentSender sender) throws RemoteException;
-
+
public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException;
-
+ public boolean killProcessesBelowForeground(String reason) throws RemoteException;
+
// Special low-level communication with activity manager.
public void startRunning(String pkg, String cls, String action,
String data) throws RemoteException;
@@ -573,4 +574,5 @@
int GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+140;
int REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+141;
int GET_MY_MEMORY_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+142;
+ int KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+143;
}
diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java
index 16299de..e4f7950 100644
--- a/core/java/android/app/Instrumentation.java
+++ b/core/java/android/app/Instrumentation.java
@@ -1381,6 +1381,7 @@
}
try {
intent.setAllowFds(false);
+ intent.migrateExtraStreamToClipData();
int result = ActivityManagerNative.getDefault()
.startActivity(whoThread, intent,
intent.resolveTypeIfNeeded(who.getContentResolver()),
@@ -1479,6 +1480,7 @@
}
try {
intent.setAllowFds(false);
+ intent.migrateExtraStreamToClipData();
int result = ActivityManagerNative.getDefault()
.startActivity(whoThread, intent,
intent.resolveTypeIfNeeded(who.getContentResolver()),
diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java
index de9470e..5340fbb 100644
--- a/core/java/android/app/LoadedApk.java
+++ b/core/java/android/app/LoadedApk.java
@@ -194,7 +194,7 @@
ApplicationInfo ai = null;
try {
ai = ActivityThread.getPackageManager().getApplicationInfo(packageName,
- PackageManager.GET_SHARED_LIBRARY_FILES);
+ PackageManager.GET_SHARED_LIBRARY_FILES, UserId.myUserId());
} catch (RemoteException e) {
throw new AssertionError(e);
}
@@ -351,7 +351,7 @@
IPackageManager pm = ActivityThread.getPackageManager();
android.content.pm.PackageInfo pi;
try {
- pi = pm.getPackageInfo(mPackageName, 0);
+ pi = pm.getPackageInfo(mPackageName, 0, UserId.myUserId());
} catch (RemoteException e) {
throw new AssertionError(e);
}
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 5325af0..04ab407 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -23,9 +23,11 @@
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
+import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
+import android.util.IntProperty;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.RemoteViews;
@@ -185,6 +187,13 @@
*/
public RemoteViews contentView;
+
+ /**
+ * The view that will represent this notification in the pop-up "intruder alert" dialog.
+ * @hide
+ */
+ public RemoteViews intruderView;
+
/**
* The bitmap that may escape the bounds of the panel and bar.
*/
@@ -418,6 +427,64 @@
private Bundle extras;
/**
+ * Structure to encapsulate an "action", including title and icon, that can be attached to a Notification.
+ * @hide
+ */
+ private static class Action implements Parcelable {
+ public int icon;
+ public CharSequence title;
+ public PendingIntent actionIntent;
+ @SuppressWarnings("unused")
+ public Action() { }
+ private Action(Parcel in) {
+ icon = in.readInt();
+ title = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
+ if (in.readInt() == 1) {
+ actionIntent = PendingIntent.CREATOR.createFromParcel(in);
+ }
+ }
+ public Action(int icon_, CharSequence title_, PendingIntent intent_) {
+ this.icon = icon_;
+ this.title = title_;
+ this.actionIntent = intent_;
+ }
+ @Override
+ public Action clone() {
+ return new Action(
+ this.icon,
+ this.title.toString(),
+ this.actionIntent // safe to alias
+ );
+ }
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeInt(icon);
+ TextUtils.writeToParcel(title, out, flags);
+ if (actionIntent != null) {
+ out.writeInt(1);
+ actionIntent.writeToParcel(out, flags);
+ } else {
+ out.writeInt(0);
+ }
+ }
+ public static final Parcelable.Creator<Action> CREATOR
+ = new Parcelable.Creator<Action>() {
+ public Action createFromParcel(Parcel in) {
+ return new Action(in);
+ }
+ public Action[] newArray(int size) {
+ return new Action[size];
+ }
+ };
+ }
+
+ private Action[] actions;
+
+ /**
* Constructs a Notification object with default values.
* You might want to consider using {@link Builder} instead.
*/
@@ -506,12 +573,17 @@
}
priority = parcel.readInt();
-
+
kind = parcel.createStringArray(); // may set kind to null
if (parcel.readInt() != 0) {
extras = parcel.readBundle();
}
+
+ actions = parcel.createTypedArray(Action.CREATOR);
+ if (parcel.readInt() != 0) {
+ intruderView = RemoteViews.CREATOR.createFromParcel(parcel);
+ }
}
@Override
@@ -571,6 +643,14 @@
}
+ that.actions = new Action[this.actions.length];
+ for(int i=0; i<this.actions.length; i++) {
+ that.actions[i] = this.actions[i].clone();
+ }
+ if (this.intruderView != null) {
+ that.intruderView = this.intruderView.clone();
+ }
+
return that;
}
@@ -658,6 +738,15 @@
} else {
parcel.writeInt(0);
}
+
+ parcel.writeTypedArray(actions, 0);
+
+ if (intruderView != null) {
+ parcel.writeInt(1);
+ intruderView.writeToParcel(parcel, 0);
+ } else {
+ parcel.writeInt(0);
+ }
}
/**
@@ -769,7 +858,14 @@
sb.append(this.kind[i]);
}
}
- sb.append("])");
+ sb.append("]");
+ if (actions != null) {
+ sb.append(" ");
+ sb.append(actions.length);
+ sb.append(" action");
+ if (actions.length > 1) sb.append("s");
+ }
+ sb.append(")");
return sb.toString();
}
@@ -821,6 +917,7 @@
private ArrayList<String> mKindList = new ArrayList<String>(1);
private Bundle mExtras;
private int mPriority;
+ private ArrayList<Action> mActions = new ArrayList<Action>(3);
/**
* Constructs a new Builder with the defaults:
@@ -1203,6 +1300,19 @@
return this;
}
+ /**
+ * Add an action to this notification. Actions are typically displayed by
+ * the system as a button adjacent to the notification content.
+ *
+ * @param icon Resource ID of a drawable that represents the action.
+ * @param title Text describing the action.
+ * @param intent PendingIntent to be fired when the action is invoked.
+ */
+ public Builder addAction(int icon, CharSequence title, PendingIntent intent) {
+ mActions.add(new Action(icon, title, intent));
+ return this;
+ }
+
private void setFlag(int mask, boolean value) {
if (value) {
mFlags |= mask;
@@ -1284,6 +1394,44 @@
}
}
+ private RemoteViews makeIntruderView() {
+ RemoteViews intruderView = new RemoteViews(mContext.getPackageName(),
+ R.layout.notification_intruder_content);
+ if (mLargeIcon != null) {
+ intruderView.setImageViewBitmap(R.id.icon, mLargeIcon);
+ intruderView.setViewVisibility(R.id.icon, View.VISIBLE);
+ } else if (mSmallIcon != 0) {
+ intruderView.setImageViewResource(R.id.icon, mSmallIcon);
+ intruderView.setViewVisibility(R.id.icon, View.VISIBLE);
+ } else {
+ intruderView.setViewVisibility(R.id.icon, View.GONE);
+ }
+ if (mContentTitle != null) {
+ intruderView.setTextViewText(R.id.title, mContentTitle);
+ }
+ if (mContentText != null) {
+ intruderView.setTextViewText(R.id.text, mContentText);
+ }
+ if (mActions.size() > 0) {
+ intruderView.setViewVisibility(R.id.actions, View.VISIBLE);
+ int N = mActions.size();
+ if (N>3) N=3;
+ final int[] BUTTONS = { R.id.action0, R.id.action1, R.id.action2 };
+ for (int i=0; i<N; i++) {
+ final Action action = mActions.get(i);
+ final int buttonId = BUTTONS[i];
+
+ intruderView.setViewVisibility(buttonId, View.VISIBLE);
+ intruderView.setImageViewResource(buttonId, action.icon);
+ intruderView.setContentDescription(buttonId, action.title);
+ intruderView.setOnClickPendingIntent(buttonId, action.actionIntent);
+ }
+ } else {
+ intruderView.setViewVisibility(R.id.actions, View.GONE);
+ }
+ return intruderView;
+ }
+
/**
* Combine all of the options that have been set and return a new {@link Notification}
* object.
@@ -1309,6 +1457,7 @@
n.ledOffMS = mLedOffMs;
n.defaults = mDefaults;
n.flags = mFlags;
+ n.intruderView = makeIntruderView();
if (mLedOnMs != 0 && mLedOffMs != 0) {
n.flags |= FLAG_SHOW_LIGHTS;
}
@@ -1323,6 +1472,10 @@
}
n.priority = mPriority;
n.extras = mExtras != null ? new Bundle(mExtras) : null;
+ if (mActions.size() > 0) {
+ n.actions = new Action[mActions.size()];
+ mActions.toArray(n.actions);
+ }
return n;
}
}
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index 57192c3..aa366b6 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -188,6 +188,35 @@
*/
public static PendingIntent getActivity(Context context, int requestCode,
Intent intent, int flags) {
+ return getActivity(context, requestCode, intent, flags, null);
+ }
+
+ /**
+ * Retrieve a PendingIntent that will start a new activity, like calling
+ * {@link Context#startActivity(Intent) Context.startActivity(Intent)}.
+ * Note that the activity will be started outside of the context of an
+ * existing activity, so you must use the {@link Intent#FLAG_ACTIVITY_NEW_TASK
+ * Intent.FLAG_ACTIVITY_NEW_TASK} launch flag in the Intent.
+ *
+ * @param context The Context in which this PendingIntent should start
+ * the activity.
+ * @param requestCode Private request code for the sender (currently
+ * not used).
+ * @param intent Intent of the activity to be launched.
+ * @param flags May be {@link #FLAG_ONE_SHOT}, {@link #FLAG_NO_CREATE},
+ * {@link #FLAG_CANCEL_CURRENT}, {@link #FLAG_UPDATE_CURRENT},
+ * or any of the flags as supported by
+ * {@link Intent#fillIn Intent.fillIn()} to control which unspecified parts
+ * of the intent that can be supplied when the actual send happens.
+ * @param options Additional options for how the Activity should be started.
+ * May be null if there are no options.
+ *
+ * @return Returns an existing or new PendingIntent matching the given
+ * parameters. May return null only if {@link #FLAG_NO_CREATE} has been
+ * supplied.
+ */
+ public static PendingIntent getActivity(Context context, int requestCode,
+ Intent intent, int flags, Bundle options) {
String packageName = context.getPackageName();
String resolvedType = intent != null ? intent.resolveTypeIfNeeded(
context.getContentResolver()) : null;
@@ -197,7 +226,8 @@
ActivityManagerNative.getDefault().getIntentSender(
ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
null, null, requestCode, new Intent[] { intent },
- resolvedType != null ? new String[] { resolvedType } : null, flags);
+ resolvedType != null ? new String[] { resolvedType } : null,
+ flags, options);
return target != null ? new PendingIntent(target) : null;
} catch (RemoteException e) {
}
@@ -247,6 +277,52 @@
*/
public static PendingIntent getActivities(Context context, int requestCode,
Intent[] intents, int flags) {
+ return getActivities(context, requestCode, intents, flags, null);
+ }
+
+ /**
+ * Like {@link #getActivity(Context, int, Intent, int)}, but allows an
+ * array of Intents to be supplied. The first Intent in the array is
+ * taken as the primary key for the PendingIntent, like the single Intent
+ * given to {@link #getActivity(Context, int, Intent, int)}. Upon sending
+ * the resulting PendingIntent, all of the Intents are started in the same
+ * way as they would be by passing them to {@link Context#startActivities(Intent[])}.
+ *
+ * <p class="note">
+ * The <em>first</em> intent in the array will be started outside of the context of an
+ * existing activity, so you must use the {@link Intent#FLAG_ACTIVITY_NEW_TASK
+ * Intent.FLAG_ACTIVITY_NEW_TASK} launch flag in the Intent. (Activities after
+ * the first in the array are started in the context of the previous activity
+ * in the array, so FLAG_ACTIVITY_NEW_TASK is not needed nor desired for them.)
+ * </p>
+ *
+ * <p class="note">
+ * The <em>last</em> intent in the array represents the key for the
+ * PendingIntent. In other words, it is the significant element for matching
+ * (as done with the single intent given to {@link #getActivity(Context, int, Intent, int)},
+ * its content will be the subject of replacement by
+ * {@link #send(Context, int, Intent)} and {@link #FLAG_UPDATE_CURRENT}, etc.
+ * This is because it is the most specific of the supplied intents, and the
+ * UI the user actually sees when the intents are started.
+ * </p>
+ *
+ * @param context The Context in which this PendingIntent should start
+ * the activity.
+ * @param requestCode Private request code for the sender (currently
+ * not used).
+ * @param intents Array of Intents of the activities to be launched.
+ * @param flags May be {@link #FLAG_ONE_SHOT}, {@link #FLAG_NO_CREATE},
+ * {@link #FLAG_CANCEL_CURRENT}, {@link #FLAG_UPDATE_CURRENT},
+ * or any of the flags as supported by
+ * {@link Intent#fillIn Intent.fillIn()} to control which unspecified parts
+ * of the intent that can be supplied when the actual send happens.
+ *
+ * @return Returns an existing or new PendingIntent matching the given
+ * parameters. May return null only if {@link #FLAG_NO_CREATE} has been
+ * supplied.
+ */
+ public static PendingIntent getActivities(Context context, int requestCode,
+ Intent[] intents, int flags, Bundle options) {
String packageName = context.getPackageName();
String[] resolvedTypes = new String[intents.length];
for (int i=0; i<intents.length; i++) {
@@ -257,7 +333,7 @@
IIntentSender target =
ActivityManagerNative.getDefault().getIntentSender(
ActivityManager.INTENT_SENDER_ACTIVITY, packageName,
- null, null, requestCode, intents, resolvedTypes, flags);
+ null, null, requestCode, intents, resolvedTypes, flags, options);
return target != null ? new PendingIntent(target) : null;
} catch (RemoteException e) {
}
@@ -294,7 +370,8 @@
ActivityManagerNative.getDefault().getIntentSender(
ActivityManager.INTENT_SENDER_BROADCAST, packageName,
null, null, requestCode, new Intent[] { intent },
- resolvedType != null ? new String[] { resolvedType } : null, flags);
+ resolvedType != null ? new String[] { resolvedType } : null,
+ flags, null);
return target != null ? new PendingIntent(target) : null;
} catch (RemoteException e) {
}
@@ -332,7 +409,8 @@
ActivityManagerNative.getDefault().getIntentSender(
ActivityManager.INTENT_SENDER_SERVICE, packageName,
null, null, requestCode, new Intent[] { intent },
- resolvedType != null ? new String[] { resolvedType } : null, flags);
+ resolvedType != null ? new String[] { resolvedType } : null,
+ flags, null);
return target != null ? new PendingIntent(target) : null;
} catch (RemoteException e) {
}
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index ec67d8c..05ef194 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -270,19 +270,24 @@
return CancellationSignal.createTransport();
}
- private boolean hasReadPermission(Uri uri) {
+ private void enforceReadPermission(Uri uri) throws SecurityException {
final Context context = getContext();
final int pid = Binder.getCallingPid();
final int uid = Binder.getCallingUid();
+ String missingPerm = null;
if (uid == mMyUid) {
- return true;
+ return;
+ }
- } else if (mExported) {
+ if (mExported) {
final String componentPerm = getReadPermission();
- if (componentPerm != null
- && (context.checkPermission(componentPerm, pid, uid) == PERMISSION_GRANTED)) {
- return true;
+ if (componentPerm != null) {
+ if (context.checkPermission(componentPerm, pid, uid) == PERMISSION_GRANTED) {
+ return;
+ } else {
+ missingPerm = componentPerm;
+ }
}
// track if unprotected read is allowed; any denied
@@ -296,11 +301,12 @@
final String pathPerm = pp.getReadPermission();
if (pathPerm != null && pp.match(path)) {
if (context.checkPermission(pathPerm, pid, uid) == PERMISSION_GRANTED) {
- return true;
+ return;
} else {
// any denied <path-permission> means we lose
// default <provider> access.
allowDefaultRead = false;
+ missingPerm = pathPerm;
}
}
}
@@ -308,44 +314,41 @@
// if we passed <path-permission> checks above, and no default
// <provider> permission, then allow access.
- if (allowDefaultRead) return true;
+ if (allowDefaultRead) return;
}
// last chance, check against any uri grants
if (context.checkUriPermission(uri, pid, uid, Intent.FLAG_GRANT_READ_URI_PERMISSION)
== PERMISSION_GRANTED) {
- return true;
- }
-
- return false;
- }
-
- private void enforceReadPermission(Uri uri) {
- if (hasReadPermission(uri)) {
return;
}
- String msg = "Permission Denial: reading "
- + ContentProvider.this.getClass().getName()
- + " uri " + uri + " from pid=" + Binder.getCallingPid()
- + ", uid=" + Binder.getCallingUid()
- + " requires " + getReadPermission();
- throw new SecurityException(msg);
+ final String failReason = mExported
+ ? " requires " + missingPerm + ", or grantUriPermission()"
+ : " requires the provider be exported, or grantUriPermission()";
+ throw new SecurityException("Permission Denial: reading "
+ + ContentProvider.this.getClass().getName() + " uri " + uri + " from pid=" + pid
+ + ", uid=" + uid + failReason);
}
- private boolean hasWritePermission(Uri uri) {
+ private void enforceWritePermission(Uri uri) throws SecurityException {
final Context context = getContext();
final int pid = Binder.getCallingPid();
final int uid = Binder.getCallingUid();
+ String missingPerm = null;
if (uid == mMyUid) {
- return true;
+ return;
+ }
- } else if (mExported) {
+ if (mExported) {
final String componentPerm = getWritePermission();
- if (componentPerm != null
- && (context.checkPermission(componentPerm, pid, uid) == PERMISSION_GRANTED)) {
- return true;
+ if (componentPerm != null) {
+ if (context.checkPermission(componentPerm, pid, uid) == PERMISSION_GRANTED) {
+ return;
+ } else {
+ missingPerm = componentPerm;
+ }
}
// track if unprotected write is allowed; any denied
@@ -359,11 +362,12 @@
final String pathPerm = pp.getWritePermission();
if (pathPerm != null && pp.match(path)) {
if (context.checkPermission(pathPerm, pid, uid) == PERMISSION_GRANTED) {
- return true;
+ return;
} else {
// any denied <path-permission> means we lose
// default <provider> access.
allowDefaultWrite = false;
+ missingPerm = pathPerm;
}
}
}
@@ -371,33 +375,24 @@
// if we passed <path-permission> checks above, and no default
// <provider> permission, then allow access.
- if (allowDefaultWrite) return true;
+ if (allowDefaultWrite) return;
}
// last chance, check against any uri grants
if (context.checkUriPermission(uri, pid, uid, Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
== PERMISSION_GRANTED) {
- return true;
- }
-
- return false;
- }
-
- private void enforceWritePermission(Uri uri) {
- if (hasWritePermission(uri)) {
return;
}
-
- String msg = "Permission Denial: writing "
- + ContentProvider.this.getClass().getName()
- + " uri " + uri + " from pid=" + Binder.getCallingPid()
- + ", uid=" + Binder.getCallingUid()
- + " requires " + getWritePermission();
- throw new SecurityException(msg);
+
+ final String failReason = mExported
+ ? " requires " + missingPerm + ", or grantUriPermission()"
+ : " requires the provider be exported, or grantUriPermission()";
+ throw new SecurityException("Permission Denial: writing "
+ + ContentProvider.this.getClass().getName() + " uri " + uri + " from pid=" + pid
+ + ", uid=" + uid + failReason);
}
}
-
/**
* Retrieves the Context this provider is running in. Only available once
* {@link #onCreate} has been called -- this will return null in the
diff --git a/core/java/android/content/ContentProviderNative.java b/core/java/android/content/ContentProviderNative.java
index eb83dbc..4b31552 100644
--- a/core/java/android/content/ContentProviderNative.java
+++ b/core/java/android/content/ContentProviderNative.java
@@ -17,6 +17,7 @@
package android.content;
import android.content.res.AssetFileDescriptor;
+import android.database.BulkCursorDescriptor;
import android.database.BulkCursorNative;
import android.database.BulkCursorToCursorAdaptor;
import android.database.Cursor;
@@ -113,20 +114,14 @@
if (cursor != null) {
CursorToBulkCursorAdaptor adaptor = new CursorToBulkCursorAdaptor(
cursor, observer, getProviderName());
- final IBinder binder = adaptor.asBinder();
- final int count = adaptor.count();
- final int index = BulkCursorToCursorAdaptor.findRowIdColumnIndex(
- adaptor.getColumnNames());
- final boolean wantsAllOnMoveCalls = adaptor.getWantsAllOnMoveCalls();
+ BulkCursorDescriptor d = adaptor.getBulkCursorDescriptor();
reply.writeNoException();
- reply.writeStrongBinder(binder);
- reply.writeInt(count);
- reply.writeInt(index);
- reply.writeInt(wantsAllOnMoveCalls ? 1 : 0);
+ reply.writeInt(1);
+ d.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
} else {
reply.writeNoException();
- reply.writeStrongBinder(null);
+ reply.writeInt(0);
}
return true;
@@ -369,12 +364,9 @@
DatabaseUtils.readExceptionFromParcel(reply);
- IBulkCursor bulkCursor = BulkCursorNative.asInterface(reply.readStrongBinder());
- if (bulkCursor != null) {
- int rowCount = reply.readInt();
- int idColumnPosition = reply.readInt();
- boolean wantsAllOnMoveCalls = reply.readInt() != 0;
- adaptor.initialize(bulkCursor, rowCount, idColumnPosition, wantsAllOnMoveCalls);
+ if (reply.readInt() != 0) {
+ BulkCursorDescriptor d = BulkCursorDescriptor.CREATOR.createFromParcel(reply);
+ adaptor.initialize(d);
} else {
adaptor.close();
adaptor = null;
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 19a5bc0..2902504 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -99,6 +99,16 @@
public static final int MODE_MULTI_PROCESS = 0x0004;
/**
+ * Database open flag: when set, the database is opened with write-ahead
+ * logging enabled by default.
+ *
+ * @see #openOrCreateDatabase(String, int, CursorFactory)
+ * @see #openOrCreateDatabase(String, int, CursorFactory, DatabaseErrorHandler)
+ * @see SQLiteDatabase#enableWriteAheadLogging
+ */
+ public static final int MODE_ENABLE_WRITE_AHEAD_LOGGING = 0x0008;
+
+ /**
* Flag for {@link #bindService}: automatically create the service as long
* as the binding exists. Note that while this will create the service,
* its {@link android.app.Service#onStartCommand}
@@ -691,6 +701,7 @@
* @param mode Operating mode. Use 0 or {@link #MODE_PRIVATE} for the
* default operation, {@link #MODE_WORLD_READABLE}
* and {@link #MODE_WORLD_WRITEABLE} to control permissions.
+ * Use {@link #MODE_ENABLE_WRITE_AHEAD_LOGGING} to enable write-ahead logging by default.
* @param factory An optional factory class that is called to instantiate a
* cursor when query is called.
*
@@ -700,6 +711,7 @@
* @see #MODE_PRIVATE
* @see #MODE_WORLD_READABLE
* @see #MODE_WORLD_WRITEABLE
+ * @see #MODE_ENABLE_WRITE_AHEAD_LOGGING
* @see #deleteDatabase
*/
public abstract SQLiteDatabase openOrCreateDatabase(String name,
@@ -716,6 +728,7 @@
* @param mode Operating mode. Use 0 or {@link #MODE_PRIVATE} for the
* default operation, {@link #MODE_WORLD_READABLE}
* and {@link #MODE_WORLD_WRITEABLE} to control permissions.
+ * Use {@link #MODE_ENABLE_WRITE_AHEAD_LOGGING} to enable write-ahead logging by default.
* @param factory An optional factory class that is called to instantiate a
* cursor when query is called.
* @param errorHandler the {@link DatabaseErrorHandler} to be used when sqlite reports database
@@ -726,6 +739,7 @@
* @see #MODE_PRIVATE
* @see #MODE_WORLD_READABLE
* @see #MODE_WORLD_WRITEABLE
+ * @see #MODE_ENABLE_WRITE_AHEAD_LOGGING
* @see #deleteDatabase
*/
public abstract SQLiteDatabase openOrCreateDatabase(String name,
@@ -846,7 +860,9 @@
*
* @param intent The description of the activity to start.
* @param options Additional options for how the Activity should be started.
- * May be null if there are no options.
+ * May be null if there are no options. See {@link android.app.ActivityOptions}
+ * for how to build the Bundle supplied here; there are no supported definitions
+ * for building it manually.
*
* @throws ActivityNotFoundException
*
@@ -884,7 +900,8 @@
*
* @param intents An array of Intents to be started.
* @param options Additional options for how the Activity should be started.
- * May be null if there are no options.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details.
*
* @throws ActivityNotFoundException
*
@@ -930,7 +947,10 @@
* <var>flagsMask</var>
* @param extraFlags Always set to 0.
* @param options Additional options for how the Activity should be started.
- * May be null if there are no options.
+ * See {@link android.content.Context#startActivity(Intent, Bundle)
+ * Context.startActivity(Intent, Bundle)} for more details. If options
+ * have also been supplied by the IntentSender, options given here will
+ * override any that conflict with those given by the IntentSender.
*
* @see #startActivity(Intent, Bundle)
* @see #startIntentSender(IntentSender, Intent, int, int, int)
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 6cf5b43..1c9ef38 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -6467,4 +6467,46 @@
}
return type;
}
+
+ /**
+ * Migrate any {@link #EXTRA_STREAM} in {@link #ACTION_SEND} and
+ * {@link #ACTION_SEND_MULTIPLE} to {@link ClipData}.
+ *
+ * @hide
+ */
+ public void migrateExtraStreamToClipData() {
+ // Refuse to touch if extras already parcelled
+ if (mExtras != null && mExtras.isParcelled()) return;
+
+ // Bail when someone already gave us ClipData
+ if (getClipData() != null) return;
+
+ final String action = getAction();
+ if (ACTION_SEND.equals(action)) {
+ final Uri stream = getParcelableExtra(EXTRA_STREAM);
+ if (stream != null) {
+ final ClipData clipData = new ClipData(
+ null, new String[] { getType() }, new ClipData.Item(stream));
+
+ setClipData(clipData);
+ addFlags(FLAG_GRANT_READ_URI_PERMISSION);
+ }
+
+ } else if (ACTION_SEND_MULTIPLE.equals(action)) {
+ final ArrayList<Uri> streams = getParcelableArrayListExtra(EXTRA_STREAM);
+ if (streams != null && streams.size() > 0) {
+ final Uri firstStream = streams.get(0);
+ final ClipData clipData = new ClipData(
+ null, new String[] { getType() }, new ClipData.Item(firstStream));
+
+ final int size = streams.size();
+ for (int i = 1; i < size; i++) {
+ clipData.addItem(new ClipData.Item(streams.get(i)));
+ }
+
+ setClipData(clipData);
+ addFlags(FLAG_GRANT_READ_URI_PERMISSION);
+ }
+ }
+ }
}
diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java
index 7bb9866..9c81c9e 100644
--- a/core/java/android/content/SyncStorageEngine.java
+++ b/core/java/android/content/SyncStorageEngine.java
@@ -1171,7 +1171,7 @@
syncs = new ArrayList<SyncInfo>();
mCurrentSyncs.put(userId, syncs);
}
- return new ArrayList<SyncInfo>(syncs);
+ return syncs;
}
}
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 95b6fee..d89d2de 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -49,8 +49,8 @@
* {@hide}
*/
interface IPackageManager {
- PackageInfo getPackageInfo(String packageName, int flags);
- int getPackageUid(String packageName);
+ PackageInfo getPackageInfo(String packageName, int flags, int userId);
+ int getPackageUid(String packageName, int userId);
int[] getPackageGids(String packageName);
String[] currentToCanonicalPackageNames(in String[] names);
@@ -64,15 +64,15 @@
List<PermissionGroupInfo> getAllPermissionGroups(int flags);
- ApplicationInfo getApplicationInfo(String packageName, int flags);
+ ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId);
- ActivityInfo getActivityInfo(in ComponentName className, int flags);
+ ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId);
- ActivityInfo getReceiverInfo(in ComponentName className, int flags);
+ ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId);
- ServiceInfo getServiceInfo(in ComponentName className, int flags);
+ ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId);
- ProviderInfo getProviderInfo(in ComponentName className, int flags);
+ ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId);
int checkPermission(String permName, String pkgName);
@@ -98,24 +98,24 @@
int getUidForSharedUser(String sharedUserName);
- ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags);
+ ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId);
List<ResolveInfo> queryIntentActivities(in Intent intent,
- String resolvedType, int flags);
+ String resolvedType, int flags, int userId);
List<ResolveInfo> queryIntentActivityOptions(
in ComponentName caller, in Intent[] specifics,
in String[] specificTypes, in Intent intent,
- String resolvedType, int flags);
+ String resolvedType, int flags, int userId);
List<ResolveInfo> queryIntentReceivers(in Intent intent,
- String resolvedType, int flags);
+ String resolvedType, int flags, int userId);
ResolveInfo resolveService(in Intent intent,
- String resolvedType, int flags);
+ String resolvedType, int flags, int userId);
List<ResolveInfo> queryIntentServices(in Intent intent,
- String resolvedType, int flags);
+ String resolvedType, int flags, int userId);
/**
* This implements getInstalledPackages via a "last returned row"
@@ -131,7 +131,7 @@
* limit that kicks in when flags are included that bloat up the data
* returned.
*/
- ParceledListSlice getInstalledApplications(int flags, in String lastRead);
+ ParceledListSlice getInstalledApplications(int flags, in String lastRead, int userId);
/**
* Retrieve all applications that are marked as persistent.
@@ -141,7 +141,7 @@
*/
List<ApplicationInfo> getPersistentApplications(int flags);
- ProviderInfo resolveContentProvider(String name, int flags);
+ ProviderInfo resolveContentProvider(String name, int flags, int userId);
/**
* Retrieve sync information for all content providers.
@@ -212,28 +212,28 @@
* As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
*/
void setComponentEnabledSetting(in ComponentName componentName,
- in int newState, in int flags);
+ in int newState, in int flags, int userId);
/**
* As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
*/
- int getComponentEnabledSetting(in ComponentName componentName);
+ int getComponentEnabledSetting(in ComponentName componentName, int userId);
/**
* As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
*/
- void setApplicationEnabledSetting(in String packageName, in int newState, int flags);
+ void setApplicationEnabledSetting(in String packageName, in int newState, int flags, int userId);
/**
* As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
*/
- int getApplicationEnabledSetting(in String packageName);
+ int getApplicationEnabledSetting(in String packageName, int userId);
/**
* Set whether the given package should be considered stopped, making
* it not visible to implicit intents that filter out stopped packages.
*/
- void setPackageStoppedState(String packageName, boolean stopped);
+ void setPackageStoppedState(String packageName, boolean stopped, int userId);
/**
* Free storage by deleting LRU sorted list of cache files across
@@ -296,7 +296,7 @@
* files need to be deleted
* @param observer a callback used to notify when the operation is completed.
*/
- void clearApplicationUserData(in String packageName, IPackageDataObserver observer);
+ void clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId);
/**
* Get package statistics including the code, data and cache size for
@@ -370,4 +370,7 @@
boolean isFirstBoot();
List<UserInfo> getUsers();
+
+ void setPermissionEnforcement(String permission, int enforcement);
+ int getPermissionEnforcement(String permission);
}
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 544bd9c..55426b8 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1090,6 +1090,11 @@
public static final String EXTRA_VERIFICATION_INSTALL_FLAGS
= "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS";
+ /** {@hide} */
+ public static final int ENFORCEMENT_DEFAULT = 0;
+ /** {@hide} */
+ public static final int ENFORCEMENT_YES = 1;
+
/**
* Retrieve overall information about an application package that is
* installed on the system.
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 207f077..07d231a 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -240,7 +240,13 @@
int gids[], int flags, long firstInstallTime, long lastUpdateTime,
HashSet<String> grantedPermissions) {
- final int userId = Binder.getOrigCallingUser();
+ return generatePackageInfo(p, gids, flags, firstInstallTime, lastUpdateTime,
+ grantedPermissions, UserId.getCallingUserId());
+ }
+
+ static PackageInfo generatePackageInfo(PackageParser.Package p,
+ int gids[], int flags, long firstInstallTime, long lastUpdateTime,
+ HashSet<String> grantedPermissions, int userId) {
PackageInfo pi = new PackageInfo();
pi.packageName = p.packageName;
@@ -3350,7 +3356,7 @@
}
public static ApplicationInfo generateApplicationInfo(Package p, int flags) {
- return generateApplicationInfo(p, flags, UserId.getUserId(Binder.getCallingUid()));
+ return generateApplicationInfo(p, flags, UserId.getCallingUserId());
}
public static ApplicationInfo generateApplicationInfo(Package p, int flags, int userId) {
@@ -3366,6 +3372,13 @@
} else {
p.applicationInfo.flags &= ~ApplicationInfo.FLAG_STOPPED;
}
+ if (p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
+ p.applicationInfo.enabled = true;
+ } else if (p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED
+ || p.mSetEnabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) {
+ p.applicationInfo.enabled = false;
+ }
+ p.applicationInfo.enabledSetting = p.mSetEnabled;
return p.applicationInfo;
}
diff --git a/core/java/android/database/AbstractCursor.java b/core/java/android/database/AbstractCursor.java
index b28ed8d..dd6692c 100644
--- a/core/java/android/database/AbstractCursor.java
+++ b/core/java/android/database/AbstractCursor.java
@@ -33,10 +33,39 @@
public abstract class AbstractCursor implements CrossProcessCursor {
private static final String TAG = "Cursor";
- DataSetObservable mDataSetObservable = new DataSetObservable();
- ContentObservable mContentObservable = new ContentObservable();
+ /**
+ * @deprecated This is never updated by this class and should not be used
+ */
+ @Deprecated
+ protected HashMap<Long, Map<String, Object>> mUpdatedRows;
- Bundle mExtras = Bundle.EMPTY;
+ protected int mPos;
+
+ /**
+ * This must be set to the index of the row ID column by any
+ * subclass that wishes to support updates.
+ */
+ protected int mRowIdColumnIndex;
+
+ /**
+ * If {@link #mRowIdColumnIndex} is not -1 this contains contains the value of
+ * the column at {@link #mRowIdColumnIndex} for the current row this cursor is
+ * pointing at.
+ */
+ protected Long mCurrentRowID;
+
+ protected boolean mClosed;
+ protected ContentResolver mContentResolver;
+ private Uri mNotifyUri;
+
+ private final Object mSelfObserverLock = new Object();
+ private ContentObserver mSelfObserver;
+ private boolean mSelfObserverRegistered;
+
+ private DataSetObservable mDataSetObservable = new DataSetObservable();
+ private ContentObservable mContentObservable = new ContentObservable();
+
+ private Bundle mExtras = Bundle.EMPTY;
/* -------------------------------------------------------- */
/* These need to be implemented by subclasses */
@@ -415,30 +444,4 @@
}
}
}
-
- /**
- * @deprecated This is never updated by this class and should not be used
- */
- @Deprecated
- protected HashMap<Long, Map<String, Object>> mUpdatedRows;
-
- /**
- * This must be set to the index of the row ID column by any
- * subclass that wishes to support updates.
- */
- protected int mRowIdColumnIndex;
-
- protected int mPos;
- /**
- * If {@link #mRowIdColumnIndex} is not -1 this contains contains the value of
- * the column at {@link #mRowIdColumnIndex} for the current row this cursor is
- * pointing at.
- */
- protected Long mCurrentRowID;
- protected ContentResolver mContentResolver;
- protected boolean mClosed = false;
- private Uri mNotifyUri;
- private ContentObserver mSelfObserver;
- final private Object mSelfObserverLock = new Object();
- private boolean mSelfObserverRegistered;
}
diff --git a/core/java/android/database/BulkCursorDescriptor.java b/core/java/android/database/BulkCursorDescriptor.java
new file mode 100644
index 0000000..c1e5e63
--- /dev/null
+++ b/core/java/android/database/BulkCursorDescriptor.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.database;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Describes the properties of a {@link CursorToBulkCursorAdaptor} that are
+ * needed to initialize its {@link BulkCursorToCursorAdaptor} counterpart on the client's end.
+ *
+ * {@hide}
+ */
+public final class BulkCursorDescriptor implements Parcelable {
+ public static final Parcelable.Creator<BulkCursorDescriptor> CREATOR =
+ new Parcelable.Creator<BulkCursorDescriptor>() {
+ @Override
+ public BulkCursorDescriptor createFromParcel(Parcel in) {
+ BulkCursorDescriptor d = new BulkCursorDescriptor();
+ d.readFromParcel(in);
+ return d;
+ }
+
+ @Override
+ public BulkCursorDescriptor[] newArray(int size) {
+ return new BulkCursorDescriptor[size];
+ }
+ };
+
+ public IBulkCursor cursor;
+ public String[] columnNames;
+ public boolean wantsAllOnMoveCalls;
+ public int count;
+ public CursorWindow window;
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeStrongBinder(cursor.asBinder());
+ out.writeStringArray(columnNames);
+ out.writeInt(wantsAllOnMoveCalls ? 1 : 0);
+ out.writeInt(count);
+ if (window != null) {
+ out.writeInt(1);
+ window.writeToParcel(out, flags);
+ } else {
+ out.writeInt(0);
+ }
+ }
+
+ public void readFromParcel(Parcel in) {
+ cursor = BulkCursorNative.asInterface(in.readStrongBinder());
+ columnNames = in.readStringArray();
+ wantsAllOnMoveCalls = in.readInt() != 0;
+ count = in.readInt();
+ if (in.readInt() != 0) {
+ window = CursorWindow.CREATOR.createFromParcel(in);
+ }
+ }
+}
diff --git a/core/java/android/database/BulkCursorNative.java b/core/java/android/database/BulkCursorNative.java
index 67cf0f8..d3c11e78 100644
--- a/core/java/android/database/BulkCursorNative.java
+++ b/core/java/android/database/BulkCursorNative.java
@@ -72,26 +72,6 @@
return true;
}
- case COUNT_TRANSACTION: {
- data.enforceInterface(IBulkCursor.descriptor);
- int count = count();
- reply.writeNoException();
- reply.writeInt(count);
- return true;
- }
-
- case GET_COLUMN_NAMES_TRANSACTION: {
- data.enforceInterface(IBulkCursor.descriptor);
- String[] columnNames = getColumnNames();
- reply.writeNoException();
- reply.writeInt(columnNames.length);
- int length = columnNames.length;
- for (int i = 0; i < length; i++) {
- reply.writeString(columnNames[i]);
- }
- return true;
- }
-
case DEACTIVATE_TRANSACTION: {
data.enforceInterface(IBulkCursor.descriptor);
deactivate();
@@ -125,14 +105,6 @@
return true;
}
- case WANTS_ON_MOVE_TRANSACTION: {
- data.enforceInterface(IBulkCursor.descriptor);
- boolean result = getWantsAllOnMoveCalls();
- reply.writeNoException();
- reply.writeInt(result ? 1 : 0);
- return true;
- }
-
case GET_EXTRAS_TRANSACTION: {
data.enforceInterface(IBulkCursor.descriptor);
Bundle extras = getExtras();
@@ -217,52 +189,6 @@
}
}
- public int count() throws RemoteException
- {
- Parcel data = Parcel.obtain();
- Parcel reply = Parcel.obtain();
- try {
- data.writeInterfaceToken(IBulkCursor.descriptor);
-
- boolean result = mRemote.transact(COUNT_TRANSACTION, data, reply, 0);
- DatabaseUtils.readExceptionFromParcel(reply);
-
- int count;
- if (result == false) {
- count = -1;
- } else {
- count = reply.readInt();
- }
- return count;
- } finally {
- data.recycle();
- reply.recycle();
- }
- }
-
- public String[] getColumnNames() throws RemoteException
- {
- Parcel data = Parcel.obtain();
- Parcel reply = Parcel.obtain();
- try {
- data.writeInterfaceToken(IBulkCursor.descriptor);
-
- mRemote.transact(GET_COLUMN_NAMES_TRANSACTION, data, reply, 0);
- DatabaseUtils.readExceptionFromParcel(reply);
-
- String[] columnNames = null;
- int numColumns = reply.readInt();
- columnNames = new String[numColumns];
- for (int i = 0; i < numColumns; i++) {
- columnNames[i] = reply.readString();
- }
- return columnNames;
- } finally {
- data.recycle();
- reply.recycle();
- }
- }
-
public void deactivate() throws RemoteException
{
Parcel data = Parcel.obtain();
@@ -317,23 +243,6 @@
}
}
- public boolean getWantsAllOnMoveCalls() throws RemoteException {
- Parcel data = Parcel.obtain();
- Parcel reply = Parcel.obtain();
- try {
- data.writeInterfaceToken(IBulkCursor.descriptor);
-
- mRemote.transact(WANTS_ON_MOVE_TRANSACTION, data, reply, 0);
- DatabaseUtils.readExceptionFromParcel(reply);
-
- int result = reply.readInt();
- return result != 0;
- } finally {
- data.recycle();
- reply.recycle();
- }
- }
-
public Bundle getExtras() throws RemoteException {
if (mExtras == null) {
Parcel data = Parcel.obtain();
diff --git a/core/java/android/database/BulkCursorToCursorAdaptor.java b/core/java/android/database/BulkCursorToCursorAdaptor.java
index 885046b..98c7043 100644
--- a/core/java/android/database/BulkCursorToCursorAdaptor.java
+++ b/core/java/android/database/BulkCursorToCursorAdaptor.java
@@ -30,34 +30,23 @@
private SelfContentObserver mObserverBridge = new SelfContentObserver(this);
private IBulkCursor mBulkCursor;
- private int mCount;
private String[] mColumns;
private boolean mWantsAllOnMoveCalls;
+ private int mCount;
/**
* Initializes the adaptor.
* Must be called before first use.
*/
- public void initialize(IBulkCursor bulkCursor, int count, int idIndex,
- boolean wantsAllOnMoveCalls) {
- mBulkCursor = bulkCursor;
- mColumns = null; // lazily retrieved
- mCount = count;
- mRowIdColumnIndex = idIndex;
- mWantsAllOnMoveCalls = wantsAllOnMoveCalls;
- }
-
- /**
- * Returns column index of "_id" column, or -1 if not found.
- */
- public static int findRowIdColumnIndex(String[] columnNames) {
- int length = columnNames.length;
- for (int i = 0; i < length; i++) {
- if (columnNames[i].equals("_id")) {
- return i;
- }
+ public void initialize(BulkCursorDescriptor d) {
+ mBulkCursor = d.cursor;
+ mColumns = d.columnNames;
+ mRowIdColumnIndex = DatabaseUtils.findRowIdColumnIndex(mColumns);
+ mWantsAllOnMoveCalls = d.wantsAllOnMoveCalls;
+ mCount = d.count;
+ if (d.window != null) {
+ setWindow(d.window);
}
- return -1;
}
/**
@@ -169,14 +158,6 @@
public String[] getColumnNames() {
throwIfCursorIsClosed();
- if (mColumns == null) {
- try {
- mColumns = mBulkCursor.getColumnNames();
- } catch (RemoteException ex) {
- Log.e(TAG, "Unable to fetch column names because the remote process is dead");
- return null;
- }
- }
return mColumns;
}
diff --git a/core/java/android/database/CursorToBulkCursorAdaptor.java b/core/java/android/database/CursorToBulkCursorAdaptor.java
index 167278a..525be96 100644
--- a/core/java/android/database/CursorToBulkCursorAdaptor.java
+++ b/core/java/android/database/CursorToBulkCursorAdaptor.java
@@ -132,6 +132,25 @@
}
}
+ public BulkCursorDescriptor getBulkCursorDescriptor() {
+ synchronized (mLock) {
+ throwIfCursorIsClosed();
+
+ BulkCursorDescriptor d = new BulkCursorDescriptor();
+ d.cursor = this;
+ d.columnNames = mCursor.getColumnNames();
+ d.wantsAllOnMoveCalls = mCursor.getWantsAllOnMoveCalls();
+ d.count = mCursor.getCount();
+ d.window = mCursor.getWindow();
+ if (d.window != null) {
+ // Acquire a reference to the window because its reference count will be
+ // decremented when it is returned as part of the binder call reply parcel.
+ d.window.acquireReference();
+ }
+ return d;
+ }
+ }
+
@Override
public CursorWindow getWindow(int position) {
synchronized (mLock) {
@@ -157,10 +176,9 @@
mCursor.fillWindow(position, window);
}
- // Acquire a reference before returning from this RPC.
- // The Binder proxy will decrement the reference count again as part of writing
- // the CursorWindow to the reply parcel as a return value.
if (window != null) {
+ // Acquire a reference to the window because its reference count will be
+ // decremented when it is returned as part of the binder call reply parcel.
window.acquireReference();
}
return window;
@@ -177,24 +195,6 @@
}
@Override
- public int count() {
- synchronized (mLock) {
- throwIfCursorIsClosed();
-
- return mCursor.getCount();
- }
- }
-
- @Override
- public String[] getColumnNames() {
- synchronized (mLock) {
- throwIfCursorIsClosed();
-
- return mCursor.getColumnNames();
- }
- }
-
- @Override
public void deactivate() {
synchronized (mLock) {
if (mCursor != null) {
@@ -237,15 +237,6 @@
}
}
- @Override
- public boolean getWantsAllOnMoveCalls() {
- synchronized (mLock) {
- throwIfCursorIsClosed();
-
- return mCursor.getWantsAllOnMoveCalls();
- }
- }
-
/**
* Create a ContentObserver from the observer and register it as an observer on the
* underlying cursor.
diff --git a/core/java/android/database/DatabaseUtils.java b/core/java/android/database/DatabaseUtils.java
index 99d260e..40a54cf 100644
--- a/core/java/android/database/DatabaseUtils.java
+++ b/core/java/android/database/DatabaseUtils.java
@@ -1386,4 +1386,18 @@
System.arraycopy(newValues, 0, result, originalValues.length, newValues.length);
return result;
}
+
+ /**
+ * Returns column index of "_id" column, or -1 if not found.
+ * @hide
+ */
+ public static int findRowIdColumnIndex(String[] columnNames) {
+ int length = columnNames.length;
+ for (int i = 0; i < length; i++) {
+ if (columnNames[i].equals("_id")) {
+ return i;
+ }
+ }
+ return -1;
+ }
}
diff --git a/core/java/android/database/IBulkCursor.java b/core/java/android/database/IBulkCursor.java
index 0f4500a..b551116 100644
--- a/core/java/android/database/IBulkCursor.java
+++ b/core/java/android/database/IBulkCursor.java
@@ -43,29 +43,12 @@
*/
public void onMove(int position) throws RemoteException;
- /**
- * Returns the number of rows in the cursor.
- *
- * @return the number of rows in the cursor.
- */
- public int count() throws RemoteException;
-
- /**
- * Returns a string array holding the names of all of the columns in the
- * cursor in the order in which they were listed in the result.
- *
- * @return the names of the columns returned in this query.
- */
- public String[] getColumnNames() throws RemoteException;
-
public void deactivate() throws RemoteException;
public void close() throws RemoteException;
public int requery(IContentObserver observer) throws RemoteException;
- boolean getWantsAllOnMoveCalls() throws RemoteException;
-
Bundle getExtras() throws RemoteException;
Bundle respond(Bundle extras) throws RemoteException;
@@ -74,13 +57,10 @@
static final String descriptor = "android.content.IBulkCursor";
static final int GET_CURSOR_WINDOW_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION;
- static final int COUNT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 1;
- static final int GET_COLUMN_NAMES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 2;
- static final int DEACTIVATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 5;
- static final int REQUERY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 6;
- static final int ON_MOVE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 7;
- static final int WANTS_ON_MOVE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 8;
- static final int GET_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 9;
- static final int RESPOND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 10;
- static final int CLOSE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 11;
+ static final int DEACTIVATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 1;
+ static final int REQUERY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 2;
+ static final int ON_MOVE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 3;
+ static final int GET_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 4;
+ static final int RESPOND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 5;
+ static final int CLOSE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 6;
}
diff --git a/core/java/android/database/SQLException.java b/core/java/android/database/SQLException.java
index 0386af0..3402026 100644
--- a/core/java/android/database/SQLException.java
+++ b/core/java/android/database/SQLException.java
@@ -19,12 +19,15 @@
/**
* An exception that indicates there was an error with SQL parsing or execution.
*/
-public class SQLException extends RuntimeException
-{
- public SQLException() {}
+public class SQLException extends RuntimeException {
+ public SQLException() {
+ }
- public SQLException(String error)
- {
+ public SQLException(String error) {
super(error);
}
+
+ public SQLException(String error, Throwable cause) {
+ super(error, cause);
+ }
}
diff --git a/core/java/android/database/sqlite/SQLiteConnection.java b/core/java/android/database/sqlite/SQLiteConnection.java
index 0db3e4f..254f652 100644
--- a/core/java/android/database/sqlite/SQLiteConnection.java
+++ b/core/java/android/database/sqlite/SQLiteConnection.java
@@ -99,6 +99,7 @@
private final SQLiteDatabaseConfiguration mConfiguration;
private final int mConnectionId;
private final boolean mIsPrimaryConnection;
+ private final boolean mIsReadOnlyConnection;
private final PreparedStatementCache mPreparedStatementCache;
private PreparedStatement mPreparedStatementPool;
@@ -111,7 +112,7 @@
private boolean mOnlyAllowReadOnlyOperations;
// The number of times attachCancellationSignal has been called.
- // Because SQLite statement execution can be re-entrant, we keep track of how many
+ // Because SQLite statement execution can be reentrant, we keep track of how many
// times we have attempted to attach a cancellation signal to the connection so that
// we can ensure that we detach the signal at the right time.
private int mCancellationSignalAttachCount;
@@ -121,7 +122,7 @@
private static native void nativeClose(int connectionPtr);
private static native void nativeRegisterCustomFunction(int connectionPtr,
SQLiteCustomFunction function);
- private static native void nativeSetLocale(int connectionPtr, String locale);
+ private static native void nativeRegisterLocalizedCollators(int connectionPtr, String locale);
private static native int nativePrepareStatement(int connectionPtr, String sql);
private static native void nativeFinalizeStatement(int connectionPtr, int statementPtr);
private static native int nativeGetParameterCount(int connectionPtr, int statementPtr);
@@ -163,6 +164,7 @@
mConfiguration = new SQLiteDatabaseConfiguration(configuration);
mConnectionId = connectionId;
mIsPrimaryConnection = primaryConnection;
+ mIsReadOnlyConnection = (configuration.openFlags & SQLiteDatabase.OPEN_READONLY) != 0;
mPreparedStatementCache = new PreparedStatementCache(
mConfiguration.maxSqlCacheSize);
mCloseGuard.open("close");
@@ -209,8 +211,8 @@
SQLiteDebug.DEBUG_SQL_STATEMENTS, SQLiteDebug.DEBUG_SQL_TIME);
setPageSize();
- setSyncModeFromConfiguration();
- setJournalModeFromConfiguration();
+ setForeignKeyModeFromConfiguration();
+ setWalModeFromConfiguration();
setJournalSizeLimit();
setAutoCheckpointInterval();
setLocaleFromConfiguration();
@@ -237,45 +239,153 @@
}
private void setPageSize() {
- if (!mConfiguration.isInMemoryDb()) {
- execute("PRAGMA page_size=" + SQLiteGlobal.getDefaultPageSize(), null, null);
- }
- }
-
- private void setAutoCheckpointInterval() {
- if (!mConfiguration.isInMemoryDb()) {
- executeForLong("PRAGMA wal_autocheckpoint=" + SQLiteGlobal.getWALAutoCheckpoint(),
- null, null);
- }
- }
-
- private void setJournalSizeLimit() {
- if (!mConfiguration.isInMemoryDb()) {
- executeForLong("PRAGMA journal_size_limit=" + SQLiteGlobal.getJournalSizeLimit(),
- null, null);
- }
- }
-
- private void setSyncModeFromConfiguration() {
- if (!mConfiguration.isInMemoryDb()) {
- execute("PRAGMA synchronous=" + mConfiguration.syncMode, null, null);
- }
- }
-
- private void setJournalModeFromConfiguration() {
- if (!mConfiguration.isInMemoryDb()) {
- String result = executeForString("PRAGMA journal_mode=" + mConfiguration.journalMode,
- null, null);
- if (!result.equalsIgnoreCase(mConfiguration.journalMode)) {
- Log.e(TAG, "setting journal_mode to " + mConfiguration.journalMode
- + " failed for db: " + mConfiguration.label
- + " (on pragma set journal_mode, sqlite returned:" + result);
+ if (!mConfiguration.isInMemoryDb() && !mIsReadOnlyConnection) {
+ final long newValue = SQLiteGlobal.getDefaultPageSize();
+ long value = executeForLong("PRAGMA page_size", null, null);
+ if (value != newValue) {
+ execute("PRAGMA page_size=" + newValue, null, null);
}
}
}
+ private void setAutoCheckpointInterval() {
+ if (!mConfiguration.isInMemoryDb() && !mIsReadOnlyConnection) {
+ final long newValue = SQLiteGlobal.getWALAutoCheckpoint();
+ long value = executeForLong("PRAGMA wal_autocheckpoint", null, null);
+ if (value != newValue) {
+ executeForLong("PRAGMA wal_autocheckpoint=" + newValue, null, null);
+ }
+ }
+ }
+
+ private void setJournalSizeLimit() {
+ if (!mConfiguration.isInMemoryDb() && !mIsReadOnlyConnection) {
+ final long newValue = SQLiteGlobal.getJournalSizeLimit();
+ long value = executeForLong("PRAGMA journal_size_limit", null, null);
+ if (value != newValue) {
+ executeForLong("PRAGMA journal_size_limit=" + newValue, null, null);
+ }
+ }
+ }
+
+ private void setForeignKeyModeFromConfiguration() {
+ if (!mIsReadOnlyConnection) {
+ final long newValue = mConfiguration.foreignKeyConstraintsEnabled ? 1 : 0;
+ long value = executeForLong("PRAGMA foreign_keys", null, null);
+ if (value != newValue) {
+ execute("PRAGMA foreign_keys=" + newValue, null, null);
+ }
+ }
+ }
+
+ private void setWalModeFromConfiguration() {
+ if (!mConfiguration.isInMemoryDb() && !mIsReadOnlyConnection) {
+ if ((mConfiguration.openFlags & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0) {
+ setJournalMode("WAL");
+ setSyncMode(SQLiteGlobal.getWALSyncMode());
+ } else {
+ setJournalMode(SQLiteGlobal.getDefaultJournalMode());
+ setSyncMode(SQLiteGlobal.getDefaultSyncMode());
+ }
+ }
+ }
+
+ private void setSyncMode(String newValue) {
+ String value = executeForString("PRAGMA synchronous", null, null);
+ if (!canonicalizeSyncMode(value).equalsIgnoreCase(
+ canonicalizeSyncMode(newValue))) {
+ execute("PRAGMA synchronous=" + newValue, null, null);
+ }
+ }
+
+ private static String canonicalizeSyncMode(String value) {
+ if (value.equals("0")) {
+ return "OFF";
+ } else if (value.equals("1")) {
+ return "NORMAL";
+ } else if (value.equals("2")) {
+ return "FULL";
+ }
+ return value;
+ }
+
+ private void setJournalMode(String newValue) {
+ String value = executeForString("PRAGMA journal_mode", null, null);
+ if (!value.equalsIgnoreCase(newValue)) {
+ try {
+ String result = executeForString("PRAGMA journal_mode=" + newValue, null, null);
+ if (result.equalsIgnoreCase(newValue)) {
+ return;
+ }
+ // PRAGMA journal_mode silently fails and returns the original journal
+ // mode in some cases if the journal mode could not be changed.
+ } catch (SQLiteDatabaseLockedException ex) {
+ // This error (SQLITE_BUSY) occurs if one connection has the database
+ // open in WAL mode and another tries to change it to non-WAL.
+ }
+ // Because we always disable WAL mode when a database is first opened
+ // (even if we intend to re-enable it), we can encounter problems if
+ // there is another open connection to the database somewhere.
+ // This can happen for a variety of reasons such as an application opening
+ // the same database in multiple processes at the same time or if there is a
+ // crashing content provider service that the ActivityManager has
+ // removed from its registry but whose process hasn't quite died yet
+ // by the time it is restarted in a new process.
+ //
+ // If we don't change the journal mode, nothing really bad happens.
+ // In the worst case, an application that enables WAL might not actually
+ // get it, although it can still use connection pooling.
+ Log.w(TAG, "Could not change the database journal mode of '"
+ + mConfiguration.label + "' from '" + value + "' to '" + newValue
+ + "' because the database is locked. This usually means that "
+ + "there are other open connections to the database which prevents "
+ + "the database from enabling or disabling write-ahead logging mode. "
+ + "Proceeding without changing the journal mode.");
+ }
+ }
+
private void setLocaleFromConfiguration() {
- nativeSetLocale(mConnectionPtr, mConfiguration.locale.toString());
+ if ((mConfiguration.openFlags & SQLiteDatabase.NO_LOCALIZED_COLLATORS) != 0) {
+ return;
+ }
+
+ // Register the localized collators.
+ final String newLocale = mConfiguration.locale.toString();
+ nativeRegisterLocalizedCollators(mConnectionPtr, newLocale);
+
+ // If the database is read-only, we cannot modify the android metadata table
+ // or existing indexes.
+ if (mIsReadOnlyConnection) {
+ return;
+ }
+
+ try {
+ // Ensure the android metadata table exists.
+ execute("CREATE TABLE IF NOT EXISTS android_metadata (locale TEXT)", null, null);
+
+ // Check whether the locale was actually changed.
+ final String oldLocale = executeForString("SELECT locale FROM android_metadata "
+ + "UNION SELECT NULL ORDER BY locale DESC LIMIT 1", null, null);
+ if (oldLocale != null && oldLocale.equals(newLocale)) {
+ return;
+ }
+
+ // Go ahead and update the indexes using the new locale.
+ execute("BEGIN", null, null);
+ boolean success = false;
+ try {
+ execute("DELETE FROM android_metadata", null, null);
+ execute("INSERT INTO android_metadata (locale) VALUES(?)",
+ new Object[] { newLocale }, null);
+ execute("REINDEX LOCALIZED", null, null);
+ success = true;
+ } finally {
+ execute(success ? "COMMIT" : "ROLLBACK", null, null);
+ }
+ } catch (RuntimeException ex) {
+ throw new SQLiteException("Failed to change locale for db '" + mConfiguration.label
+ + "' to '" + newLocale + "'.", ex);
+ }
}
// Called by SQLiteConnectionPool only.
@@ -290,10 +400,10 @@
}
// Remember what changed.
- boolean syncModeChanged = !configuration.syncMode.equalsIgnoreCase(
- mConfiguration.syncMode);
- boolean journalModeChanged = !configuration.journalMode.equalsIgnoreCase(
- mConfiguration.journalMode);
+ boolean foreignKeyModeChanged = configuration.foreignKeyConstraintsEnabled
+ != mConfiguration.foreignKeyConstraintsEnabled;
+ boolean walModeChanged = ((configuration.openFlags ^ mConfiguration.openFlags)
+ & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0;
boolean localeChanged = !configuration.locale.equals(mConfiguration.locale);
// Update configuration parameters.
@@ -302,14 +412,14 @@
// Update prepared statement cache size.
mPreparedStatementCache.resize(configuration.maxSqlCacheSize);
- // Update sync mode.
- if (syncModeChanged) {
- setSyncModeFromConfiguration();
+ // Update foreign key mode.
+ if (foreignKeyModeChanged) {
+ setForeignKeyModeFromConfiguration();
}
- // Update journal mode.
- if (journalModeChanged) {
- setJournalModeFromConfiguration();
+ // Update WAL.
+ if (walModeChanged) {
+ setWalModeFromConfiguration();
}
// Update locale.
diff --git a/core/java/android/database/sqlite/SQLiteConnectionPool.java b/core/java/android/database/sqlite/SQLiteConnectionPool.java
index 3562e89..5c8e38bf 100644
--- a/core/java/android/database/sqlite/SQLiteConnectionPool.java
+++ b/core/java/android/database/sqlite/SQLiteConnectionPool.java
@@ -81,6 +81,7 @@
private final Object mLock = new Object();
private final AtomicBoolean mConnectionLeaked = new AtomicBoolean();
private final SQLiteDatabaseConfiguration mConfiguration;
+ private int mMaxConnectionPoolSize;
private boolean mIsOpen;
private int mNextConnectionId;
@@ -146,6 +147,7 @@
private SQLiteConnectionPool(SQLiteDatabaseConfiguration configuration) {
mConfiguration = new SQLiteDatabaseConfiguration(configuration);
+ setMaxConnectionPoolSizeLocked();
}
@Override
@@ -257,7 +259,46 @@
synchronized (mLock) {
throwIfClosedLocked();
+ boolean walModeChanged = ((configuration.openFlags ^ mConfiguration.openFlags)
+ & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0;
+ if (walModeChanged) {
+ // WAL mode can only be changed if there are no acquired connections
+ // because we need to close all but the primary connection first.
+ if (!mAcquiredConnections.isEmpty()) {
+ throw new IllegalStateException("Write Ahead Logging (WAL) mode cannot "
+ + "be enabled or disabled while there are transactions in "
+ + "progress. Finish all transactions and release all active "
+ + "database connections first.");
+ }
+
+ // Close all non-primary connections. This should happen immediately
+ // because none of them are in use.
+ closeAvailableNonPrimaryConnectionsAndLogExceptionsLocked();
+ assert mAvailableNonPrimaryConnections.isEmpty();
+ }
+
+ boolean foreignKeyModeChanged = configuration.foreignKeyConstraintsEnabled
+ != mConfiguration.foreignKeyConstraintsEnabled;
+ if (foreignKeyModeChanged) {
+ // Foreign key constraints can only be changed if there are no transactions
+ // in progress. To make this clear, we throw an exception if there are
+ // any acquired connections.
+ if (!mAcquiredConnections.isEmpty()) {
+ throw new IllegalStateException("Foreign Key Constraints cannot "
+ + "be enabled or disabled while there are transactions in "
+ + "progress. Finish all transactions and release all active "
+ + "database connections first.");
+ }
+ }
+
if (mConfiguration.openFlags != configuration.openFlags) {
+ // If we are changing open flags and WAL mode at the same time, then
+ // we have no choice but to close the primary connection beforehand
+ // because there can only be one connection open when we change WAL mode.
+ if (walModeChanged) {
+ closeAvailableConnectionsAndLogExceptionsLocked();
+ }
+
// Try to reopen the primary connection using the new open flags then
// close and discard all existing connections.
// This might throw if the database is corrupt or cannot be opened in
@@ -270,9 +311,11 @@
mAvailablePrimaryConnection = newPrimaryConnection;
mConfiguration.updateParametersFrom(configuration);
+ setMaxConnectionPoolSizeLocked();
} else {
// Reconfigure the database connections in place.
mConfiguration.updateParametersFrom(configuration);
+ setMaxConnectionPoolSizeLocked();
closeExcessConnectionsAndLogExceptionsLocked();
reconfigureAllConnectionsLocked();
@@ -334,8 +377,7 @@
mAvailablePrimaryConnection = connection;
}
wakeConnectionWaitersLocked();
- } else if (mAvailableNonPrimaryConnections.size() >=
- mConfiguration.maxConnectionPoolSize - 1) {
+ } else if (mAvailableNonPrimaryConnections.size() >= mMaxConnectionPoolSize - 1) {
closeConnectionAndLogExceptionsLocked(connection);
} else {
if (recycleConnectionLocked(connection, status)) {
@@ -453,11 +495,7 @@
// Can't throw.
private void closeAvailableConnectionsAndLogExceptionsLocked() {
- final int count = mAvailableNonPrimaryConnections.size();
- for (int i = 0; i < count; i++) {
- closeConnectionAndLogExceptionsLocked(mAvailableNonPrimaryConnections.get(i));
- }
- mAvailableNonPrimaryConnections.clear();
+ closeAvailableNonPrimaryConnectionsAndLogExceptionsLocked();
if (mAvailablePrimaryConnection != null) {
closeConnectionAndLogExceptionsLocked(mAvailablePrimaryConnection);
@@ -466,9 +504,18 @@
}
// Can't throw.
+ private void closeAvailableNonPrimaryConnectionsAndLogExceptionsLocked() {
+ final int count = mAvailableNonPrimaryConnections.size();
+ for (int i = 0; i < count; i++) {
+ closeConnectionAndLogExceptionsLocked(mAvailableNonPrimaryConnections.get(i));
+ }
+ mAvailableNonPrimaryConnections.clear();
+ }
+
+ // Can't throw.
private void closeExcessConnectionsAndLogExceptionsLocked() {
int availableCount = mAvailableNonPrimaryConnections.size();
- while (availableCount-- > mConfiguration.maxConnectionPoolSize - 1) {
+ while (availableCount-- > mMaxConnectionPoolSize - 1) {
SQLiteConnection connection =
mAvailableNonPrimaryConnections.remove(availableCount);
closeConnectionAndLogExceptionsLocked(connection);
@@ -843,7 +890,7 @@
if (mAvailablePrimaryConnection != null) {
openConnections += 1;
}
- if (openConnections >= mConfiguration.maxConnectionPoolSize) {
+ if (openConnections >= mMaxConnectionPoolSize) {
return null;
}
connection = openConnectionLocked(mConfiguration,
@@ -895,6 +942,18 @@
return (connectionFlags & CONNECTION_FLAG_INTERACTIVE) != 0 ? 1 : 0;
}
+ private void setMaxConnectionPoolSizeLocked() {
+ if ((mConfiguration.openFlags & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0) {
+ mMaxConnectionPoolSize = SQLiteGlobal.getWALConnectionPoolSize();
+ } else {
+ // TODO: We don't actually need to restrict the connection pool size to 1
+ // for non-WAL databases. There might be reasons to use connection pooling
+ // with other journal modes. For now, enabling connection pooling and
+ // using WAL are the same thing in the API.
+ mMaxConnectionPoolSize = 1;
+ }
+ }
+
private void throwIfClosedLocked() {
if (!mIsOpen) {
throw new IllegalStateException("Cannot perform this operation "
@@ -941,7 +1000,7 @@
synchronized (mLock) {
printer.println("Connection pool for " + mConfiguration.path + ":");
printer.println(" Open: " + mIsOpen);
- printer.println(" Max connections: " + mConfiguration.maxConnectionPoolSize);
+ printer.println(" Max connections: " + mMaxConnectionPoolSize);
printer.println(" Available primary connection:");
if (mAvailablePrimaryConnection != null) {
diff --git a/core/java/android/database/sqlite/SQLiteCursor.java b/core/java/android/database/sqlite/SQLiteCursor.java
index 82bb23e..b29897e 100644
--- a/core/java/android/database/sqlite/SQLiteCursor.java
+++ b/core/java/android/database/sqlite/SQLiteCursor.java
@@ -105,12 +105,7 @@
mQuery = query;
mColumns = query.getColumnNames();
- for (int i = 0; i < mColumns.length; i++) {
- // Make note of the row ID column index for quick access to it
- if ("_id".equals(mColumns[i])) {
- mRowIdColumnIndex = i;
- }
- }
+ mRowIdColumnIndex = DatabaseUtils.findRowIdColumnIndex(mColumns);
}
/**
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index d41b484..7bd0c8d 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -127,10 +127,6 @@
// INVARIANT: Guarded by mLock.
private boolean mHasAttachedDbsLocked;
- // True if the database is in WAL mode.
- // INVARIANT: Guarded by mLock.
- private boolean mIsWALEnabledLocked;
-
/**
* When a constraint violation occurs, an immediate ROLLBACK occurs,
* thus ending the current transaction, and the command aborts with a
@@ -236,6 +232,18 @@
public static final int CREATE_IF_NECESSARY = 0x10000000; // update native code if changing
/**
+ * Open flag: Flag for {@link #openDatabase} to open the database file with
+ * write-ahead logging enabled by default. Using this flag is more efficient
+ * than calling {@link #enableWriteAheadLogging}.
+ *
+ * Write-ahead logging cannot be used with read-only databases so the value of
+ * this flag is ignored if the database is opened read-only.
+ *
+ * @see #enableWriteAheadLogging
+ */
+ public static final int ENABLE_WRITE_AHEAD_LOGGING = 0x20000000;
+
+ /**
* Absolute max value that can be set by {@link #setMaxSqlCacheSize(int)}.
*
* Each prepared-statement is between 1K - 6K, depending on the complexity of the
@@ -658,7 +666,7 @@
* @throws SQLiteException if the database cannot be opened
*/
public static SQLiteDatabase openDatabase(String path, CursorFactory factory, int flags) {
- return openDatabase(path, factory, flags, new DefaultDatabaseErrorHandler());
+ return openDatabase(path, factory, flags, null);
}
/**
@@ -698,7 +706,7 @@
* Equivalent to openDatabase(path, factory, CREATE_IF_NECESSARY).
*/
public static SQLiteDatabase openOrCreateDatabase(String path, CursorFactory factory) {
- return openDatabase(path, factory, CREATE_IF_NECESSARY);
+ return openDatabase(path, factory, CREATE_IF_NECESSARY, null);
}
/**
@@ -834,8 +842,14 @@
synchronized (mLock) {
throwIfNotOpenLocked();
+
mConfigurationLocked.customFunctions.add(wrapper);
- mConnectionPoolLocked.reconfigure(mConfigurationLocked);
+ try {
+ mConnectionPoolLocked.reconfigure(mConfigurationLocked);
+ } catch (RuntimeException ex) {
+ mConfigurationLocked.customFunctions.remove(wrapper);
+ throw ex;
+ }
}
}
@@ -1718,7 +1732,7 @@
/**
* Sets the locale for this database. Does nothing if this database has
- * the NO_LOCALIZED_COLLATORS flag set or was opened read only.
+ * the {@link #NO_LOCALIZED_COLLATORS} flag set or was opened read only.
*
* @param locale The new locale.
*
@@ -1733,8 +1747,15 @@
synchronized (mLock) {
throwIfNotOpenLocked();
+
+ final Locale oldLocale = mConfigurationLocked.locale;
mConfigurationLocked.locale = locale;
- mConnectionPoolLocked.reconfigure(mConfigurationLocked);
+ try {
+ mConnectionPoolLocked.reconfigure(mConfigurationLocked);
+ } catch (RuntimeException ex) {
+ mConfigurationLocked.locale = oldLocale;
+ throw ex;
+ }
}
}
@@ -1759,58 +1780,144 @@
synchronized (mLock) {
throwIfNotOpenLocked();
+
+ final int oldMaxSqlCacheSize = mConfigurationLocked.maxSqlCacheSize;
mConfigurationLocked.maxSqlCacheSize = cacheSize;
- mConnectionPoolLocked.reconfigure(mConfigurationLocked);
+ try {
+ mConnectionPoolLocked.reconfigure(mConfigurationLocked);
+ } catch (RuntimeException ex) {
+ mConfigurationLocked.maxSqlCacheSize = oldMaxSqlCacheSize;
+ throw ex;
+ }
}
}
/**
- * This method enables parallel execution of queries from multiple threads on the same database.
- * It does this by opening multiple handles to the database and using a different
- * database handle for each query.
+ * Sets whether foreign key constraints are enabled for the database.
* <p>
- * If a transaction is in progress on one connection handle and say, a table is updated in the
- * transaction, then query on the same table on another connection handle will block for the
- * transaction to complete. But this method enables such queries to execute by having them
- * return old version of the data from the table. Most often it is the data that existed in the
- * table prior to the above transaction updates on that table.
- * <p>
- * Maximum number of simultaneous handles used to execute queries in parallel is
- * dependent upon the device memory and possibly other properties.
- * <p>
- * After calling this method, execution of queries in parallel is enabled as long as this
- * database handle is open. To disable execution of queries in parallel, database should
- * be closed and reopened.
- * <p>
- * If a query is part of a transaction, then it is executed on the same database handle the
- * transaction was begun.
- * <p>
- * If the database has any attached databases, then execution of queries in paralel is NOT
- * possible. In such cases, a message is printed to logcat and false is returned.
- * <p>
- * This feature is not available for :memory: databases. In such cases,
- * a message is printed to logcat and false is returned.
- * <p>
- * A typical way to use this method is the following:
- * <pre>
- * SQLiteDatabase db = SQLiteDatabase.openDatabase("db_filename", cursorFactory,
- * CREATE_IF_NECESSARY, myDatabaseErrorHandler);
- * db.enableWriteAheadLogging();
- * </pre>
- * <p>
- * Writers should use {@link #beginTransactionNonExclusive()} or
- * {@link #beginTransactionWithListenerNonExclusive(SQLiteTransactionListener)}
- * to start a trsnsaction.
- * Non-exclusive mode allows database file to be in readable by threads executing queries.
+ * By default, foreign key constraints are not enforced by the database.
+ * This method allows an application to enable foreign key constraints.
+ * It must be called each time the database is opened to ensure that foreign
+ * key constraints are enabled for the session.
+ * </p><p>
+ * A good time to call this method is right after calling {@link #openOrCreateDatabase}
+ * or in the {@link SQLiteOpenHelper#onConfigure} callback.
+ * </p><p>
+ * When foreign key constraints are disabled, the database does not check whether
+ * changes to the database will violate foreign key constraints. Likewise, when
+ * foreign key constraints are disabled, the database will not execute cascade
+ * delete or update triggers. As a result, it is possible for the database
+ * state to become inconsistent. To perform a database integrity check,
+ * call {@link #isDatabaseIntegrityOk}.
+ * </p><p>
+ * This method must not be called while a transaction is in progress.
+ * </p><p>
+ * See also <a href="http://sqlite.org/foreignkeys.html">SQLite Foreign Key Constraints</a>
+ * for more details about foreign key constraint support.
* </p>
*
- * @return true if write-ahead-logging is set. false otherwise
+ * @param enable True to enable foreign key constraints, false to disable them.
+ *
+ * @throws IllegalStateException if the are transactions is in progress
+ * when this method is called.
+ */
+ public void setForeignKeyConstraintsEnabled(boolean enable) {
+ synchronized (mLock) {
+ throwIfNotOpenLocked();
+
+ if (mConfigurationLocked.foreignKeyConstraintsEnabled == enable) {
+ return;
+ }
+
+ mConfigurationLocked.foreignKeyConstraintsEnabled = enable;
+ try {
+ mConnectionPoolLocked.reconfigure(mConfigurationLocked);
+ } catch (RuntimeException ex) {
+ mConfigurationLocked.foreignKeyConstraintsEnabled = !enable;
+ throw ex;
+ }
+ }
+ }
+
+ /**
+ * This method enables parallel execution of queries from multiple threads on the
+ * same database. It does this by opening multiple connections to the database
+ * and using a different database connection for each query. The database
+ * journal mode is also changed to enable writes to proceed concurrently with reads.
+ * <p>
+ * When write-ahead logging is not enabled (the default), it is not possible for
+ * reads and writes to occur on the database at the same time. Before modifying the
+ * database, the writer implicitly acquires an exclusive lock on the database which
+ * prevents readers from accessing the database until the write is completed.
+ * </p><p>
+ * In contrast, when write-ahead logging is enabled (by calling this method), write
+ * operations occur in a separate log file which allows reads to proceed concurrently.
+ * While a write is in progress, readers on other threads will perceive the state
+ * of the database as it was before the write began. When the write completes, readers
+ * on other threads will then perceive the new state of the database.
+ * </p><p>
+ * It is a good idea to enable write-ahead logging whenever a database will be
+ * concurrently accessed and modified by multiple threads at the same time.
+ * However, write-ahead logging uses significantly more memory than ordinary
+ * journaling because there are multiple connections to the same database.
+ * So if a database will only be used by a single thread, or if optimizing
+ * concurrency is not very important, then write-ahead logging should be disabled.
+ * </p><p>
+ * After calling this method, execution of queries in parallel is enabled as long as
+ * the database remains open. To disable execution of queries in parallel, either
+ * call {@link #disableWriteAheadLogging} or close the database and reopen it.
+ * </p><p>
+ * The maximum number of connections used to execute queries in parallel is
+ * dependent upon the device memory and possibly other properties.
+ * </p><p>
+ * If a query is part of a transaction, then it is executed on the same database handle the
+ * transaction was begun.
+ * </p><p>
+ * Writers should use {@link #beginTransactionNonExclusive()} or
+ * {@link #beginTransactionWithListenerNonExclusive(SQLiteTransactionListener)}
+ * to start a transaction. Non-exclusive mode allows database file to be in readable
+ * by other threads executing queries.
+ * </p><p>
+ * If the database has any attached databases, then execution of queries in parallel is NOT
+ * possible. Likewise, write-ahead logging is not supported for read-only databases
+ * or memory databases. In such cases, {@link #enableWriteAheadLogging} returns false.
+ * </p><p>
+ * The best way to enable write-ahead logging is to pass the
+ * {@link #ENABLE_WRITE_AHEAD_LOGGING} flag to {@link #openDatabase}. This is
+ * more efficient than calling {@link #enableWriteAheadLogging}.
+ * <code><pre>
+ * SQLiteDatabase db = SQLiteDatabase.openDatabase("db_filename", cursorFactory,
+ * SQLiteDatabase.CREATE_IF_NECESSARY | SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING,
+ * myDatabaseErrorHandler);
+ * db.enableWriteAheadLogging();
+ * </pre></code>
+ * </p><p>
+ * Another way to enable write-ahead logging is to call {@link #enableWriteAheadLogging}
+ * after opening the database.
+ * <code><pre>
+ * SQLiteDatabase db = SQLiteDatabase.openDatabase("db_filename", cursorFactory,
+ * SQLiteDatabase.CREATE_IF_NECESSARY, myDatabaseErrorHandler);
+ * db.enableWriteAheadLogging();
+ * </pre></code>
+ * </p><p>
+ * See also <a href="http://sqlite.org/wal.html">SQLite Write-Ahead Logging</a> for
+ * more details about how write-ahead logging works.
+ * </p>
+ *
+ * @return True if write-ahead logging is enabled.
+ *
+ * @throws IllegalStateException if there are transactions in progress at the
+ * time this method is called. WAL mode can only be changed when there are no
+ * transactions in progress.
+ *
+ * @see #ENABLE_WRITE_AHEAD_LOGGING
+ * @see #disableWriteAheadLogging
*/
public boolean enableWriteAheadLogging() {
synchronized (mLock) {
throwIfNotOpenLocked();
- if (mIsWALEnabledLocked) {
+ if ((mConfigurationLocked.openFlags & ENABLE_WRITE_AHEAD_LOGGING) != 0) {
return true;
}
@@ -1835,32 +1942,57 @@
return false;
}
- mIsWALEnabledLocked = true;
- mConfigurationLocked.maxConnectionPoolSize = SQLiteGlobal.getWALConnectionPoolSize();
- mConfigurationLocked.syncMode = SQLiteGlobal.getWALSyncMode();
- mConfigurationLocked.journalMode = "WAL";
- mConnectionPoolLocked.reconfigure(mConfigurationLocked);
+ mConfigurationLocked.openFlags |= ENABLE_WRITE_AHEAD_LOGGING;
+ try {
+ mConnectionPoolLocked.reconfigure(mConfigurationLocked);
+ } catch (RuntimeException ex) {
+ mConfigurationLocked.openFlags &= ~ENABLE_WRITE_AHEAD_LOGGING;
+ throw ex;
+ }
}
return true;
}
/**
* This method disables the features enabled by {@link #enableWriteAheadLogging()}.
- * @hide
+ *
+ * @throws IllegalStateException if there are transactions in progress at the
+ * time this method is called. WAL mode can only be changed when there are no
+ * transactions in progress.
+ *
+ * @see #enableWriteAheadLogging
*/
public void disableWriteAheadLogging() {
synchronized (mLock) {
throwIfNotOpenLocked();
- if (!mIsWALEnabledLocked) {
+ if ((mConfigurationLocked.openFlags & ENABLE_WRITE_AHEAD_LOGGING) == 0) {
return;
}
- mIsWALEnabledLocked = false;
- mConfigurationLocked.maxConnectionPoolSize = 1;
- mConfigurationLocked.syncMode = SQLiteGlobal.getDefaultSyncMode();
- mConfigurationLocked.journalMode = SQLiteGlobal.getDefaultJournalMode();
- mConnectionPoolLocked.reconfigure(mConfigurationLocked);
+ mConfigurationLocked.openFlags &= ~ENABLE_WRITE_AHEAD_LOGGING;
+ try {
+ mConnectionPoolLocked.reconfigure(mConfigurationLocked);
+ } catch (RuntimeException ex) {
+ mConfigurationLocked.openFlags |= ENABLE_WRITE_AHEAD_LOGGING;
+ throw ex;
+ }
+ }
+ }
+
+ /**
+ * Returns true if write-ahead logging has been enabled for this database.
+ *
+ * @return True if write-ahead logging has been enabled for this database.
+ *
+ * @see #enableWriteAheadLogging
+ * @see #ENABLE_WRITE_AHEAD_LOGGING
+ */
+ public boolean isWriteAheadLoggingEnabled() {
+ synchronized (mLock) {
+ throwIfNotOpenLocked();
+
+ return (mConfigurationLocked.openFlags & ENABLE_WRITE_AHEAD_LOGGING) != 0;
}
}
diff --git a/core/java/android/database/sqlite/SQLiteDatabaseConfiguration.java b/core/java/android/database/sqlite/SQLiteDatabaseConfiguration.java
index efbcaca..549ab90 100644
--- a/core/java/android/database/sqlite/SQLiteDatabaseConfiguration.java
+++ b/core/java/android/database/sqlite/SQLiteDatabaseConfiguration.java
@@ -62,14 +62,6 @@
public int openFlags;
/**
- * The maximum number of connections to retain in the connection pool.
- * Must be at least 1.
- *
- * Default is 1.
- */
- public int maxConnectionPoolSize;
-
- /**
* The maximum size of the prepared statement cache for each database connection.
* Must be non-negative.
*
@@ -85,18 +77,11 @@
public Locale locale;
/**
- * The database synchronization mode.
+ * True if foreign key constraints are enabled.
*
- * Default is {@link SQLiteGlobal#getDefaultSyncMode()}.
+ * Default is false.
*/
- public String syncMode;
-
- /**
- * The database journal mode.
- *
- * Default is {@link SQLiteGlobal#getDefaultJournalMode()}.
- */
- public String journalMode;
+ public boolean foreignKeyConstraintsEnabled;
/**
* The custom functions to register.
@@ -121,11 +106,8 @@
this.openFlags = openFlags;
// Set default values for optional parameters.
- maxConnectionPoolSize = 1;
maxSqlCacheSize = 25;
locale = Locale.getDefault();
- syncMode = SQLiteGlobal.getDefaultSyncMode();
- journalMode = SQLiteGlobal.getDefaultJournalMode();
}
/**
@@ -159,11 +141,9 @@
}
openFlags = other.openFlags;
- maxConnectionPoolSize = other.maxConnectionPoolSize;
maxSqlCacheSize = other.maxSqlCacheSize;
locale = other.locale;
- syncMode = other.syncMode;
- journalMode = other.journalMode;
+ foreignKeyConstraintsEnabled = other.foreignKeyConstraintsEnabled;
customFunctions.clear();
customFunctions.addAll(other.customFunctions);
}
diff --git a/core/java/android/database/sqlite/SQLiteException.java b/core/java/android/database/sqlite/SQLiteException.java
index 3a97bfb..a1d9c9f 100644
--- a/core/java/android/database/sqlite/SQLiteException.java
+++ b/core/java/android/database/sqlite/SQLiteException.java
@@ -22,9 +22,14 @@
* A SQLite exception that indicates there was an error with SQL parsing or execution.
*/
public class SQLiteException extends SQLException {
- public SQLiteException() {}
+ public SQLiteException() {
+ }
public SQLiteException(String error) {
super(error);
}
+
+ public SQLiteException(String error, Throwable cause) {
+ super(error, cause);
+ }
}
diff --git a/core/java/android/database/sqlite/SQLiteOpenHelper.java b/core/java/android/database/sqlite/SQLiteOpenHelper.java
index ffa4663..431eca2 100644
--- a/core/java/android/database/sqlite/SQLiteOpenHelper.java
+++ b/core/java/android/database/sqlite/SQLiteOpenHelper.java
@@ -58,6 +58,7 @@
private SQLiteDatabase mDatabase;
private boolean mIsInitializing;
+ private boolean mEnableWriteAheadLogging;
private final DatabaseErrorHandler mErrorHandler;
/**
@@ -74,7 +75,7 @@
* newer, {@link #onDowngrade} will be used to downgrade the database
*/
public SQLiteOpenHelper(Context context, String name, CursorFactory factory, int version) {
- this(context, name, factory, version, new DefaultDatabaseErrorHandler());
+ this(context, name, factory, version, null);
}
/**
@@ -92,14 +93,11 @@
* {@link #onUpgrade} will be used to upgrade the database; if the database is
* newer, {@link #onDowngrade} will be used to downgrade the database
* @param errorHandler the {@link DatabaseErrorHandler} to be used when sqlite reports database
- * corruption.
+ * corruption, or null to use the default error handler.
*/
public SQLiteOpenHelper(Context context, String name, CursorFactory factory, int version,
DatabaseErrorHandler errorHandler) {
if (version < 1) throw new IllegalArgumentException("Version must be >= 1, was " + version);
- if (errorHandler == null) {
- throw new IllegalArgumentException("DatabaseErrorHandler param value can't be null.");
- }
mContext = context;
mName = name;
@@ -117,6 +115,32 @@
}
/**
+ * Enables or disables the use of write-ahead logging for the database.
+ *
+ * Write-ahead logging cannot be used with read-only databases so the value of
+ * this flag is ignored if the database is opened read-only.
+ *
+ * @param enabled True if write-ahead logging should be enabled, false if it
+ * should be disabled.
+ *
+ * @see SQLiteDatabase#enableWriteAheadLogging()
+ */
+ public void setWriteAheadLoggingEnabled(boolean enabled) {
+ synchronized (this) {
+ if (mEnableWriteAheadLogging != enabled) {
+ if (mDatabase != null && mDatabase.isOpen() && !mDatabase.isReadOnly()) {
+ if (enabled) {
+ mDatabase.enableWriteAheadLogging();
+ } else {
+ mDatabase.disableWriteAheadLogging();
+ }
+ }
+ mEnableWriteAheadLogging = enabled;
+ }
+ }
+ }
+
+ /**
* Create and/or open a database that will be used for reading and writing.
* The first time this is called, the database will be opened and
* {@link #onCreate}, {@link #onUpgrade} and/or {@link #onOpen} will be
@@ -197,7 +221,9 @@
db = SQLiteDatabase.openDatabase(path, mFactory,
SQLiteDatabase.OPEN_READONLY, mErrorHandler);
} else {
- db = mContext.openOrCreateDatabase(mName, 0, mFactory, mErrorHandler);
+ db = mContext.openOrCreateDatabase(mName, mEnableWriteAheadLogging ?
+ Context.MODE_ENABLE_WRITE_AHEAD_LOGGING : 0,
+ mFactory, mErrorHandler);
}
} catch (SQLiteException ex) {
if (writable) {
@@ -211,6 +237,8 @@
}
}
+ onConfigure(db);
+
final int version = db.getVersion();
if (version != mNewVersion) {
if (db.isReadOnly()) {
@@ -235,6 +263,7 @@
db.endTransaction();
}
}
+
onOpen(db);
if (db.isReadOnly()) {
@@ -264,6 +293,25 @@
}
/**
+ * Called when the database connection is being configured, to enable features
+ * such as write-ahead logging or foreign key support.
+ * <p>
+ * This method is called before {@link #onCreate}, {@link #onUpgrade},
+ * {@link #onDowngrade}, or {@link #onOpen} are called. It should not modify
+ * the database except to configure the database connection as required.
+ * </p><p>
+ * This method should only call methods that configure the parameters of the
+ * database connection, such as {@link SQLiteDatabase#enableWriteAheadLogging}
+ * {@link SQLiteDatabase#setForeignKeyConstraintsEnabled},
+ * {@link SQLiteDatabase#setLocale}, {@link SQLiteDatabase#setMaximumSize},
+ * or executing PRAGMA statements.
+ * </p>
+ *
+ * @param db The database.
+ */
+ public void onConfigure(SQLiteDatabase db) {}
+
+ /**
* Called when the database is created for the first time. This is where the
* creation of tables and the initial population of the tables should happen.
*
@@ -276,11 +324,16 @@
* should use this method to drop tables, add tables, or do anything else it
* needs to upgrade to the new schema version.
*
- * <p>The SQLite ALTER TABLE documentation can be found
+ * <p>
+ * The SQLite ALTER TABLE documentation can be found
* <a href="http://sqlite.org/lang_altertable.html">here</a>. If you add new columns
* you can use ALTER TABLE to insert them into a live table. If you rename or remove columns
* you can use ALTER TABLE to rename the old table, then create the new table and then
* populate the new table with the contents of the old table.
+ * </p><p>
+ * This method executes within a transaction. If an exception is thrown, all changes
+ * will automatically be rolled back.
+ * </p>
*
* @param db The database.
* @param oldVersion The old database version.
@@ -290,11 +343,16 @@
/**
* Called when the database needs to be downgraded. This is strictly similar to
- * onUpgrade() method, but is called whenever current version is newer than requested one.
+ * {@link #onUpgrade} method, but is called whenever current version is newer than requested one.
* However, this method is not abstract, so it is not mandatory for a customer to
* implement it. If not overridden, default implementation will reject downgrade and
* throws SQLiteException
*
+ * <p>
+ * This method executes within a transaction. If an exception is thrown, all changes
+ * will automatically be rolled back.
+ * </p>
+ *
* @param db The database.
* @param oldVersion The old database version.
* @param newVersion The new database version.
@@ -308,6 +366,12 @@
* Called when the database has been opened. The implementation
* should check {@link SQLiteDatabase#isReadOnly} before updating the
* database.
+ * <p>
+ * This method is called after the database connection has been configured
+ * and after the database schema has been created, upgraded or downgraded as necessary.
+ * If the database connection must be configured in some way before the schema
+ * is created, upgraded, or downgraded, do it in {@link #onConfigure} instead.
+ * </p>
*
* @param db The database.
*/
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index aa92efb..83b6986 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -236,6 +236,50 @@
/**
* Creates a new Camera object to access a particular hardware camera.
*
+ * <p>When <code>force</code> is set to false, this will throw an exception
+ * if the same camera is already opened by other clients. If true, the other
+ * client will be disconnected from the camera they opened. If the device
+ * can only support one camera running at a time, all camera-using clients
+ * will be disconnected from their cameras.
+ *
+ * <p>A camera being held by an application can be taken away by other
+ * applications at any time. Before the camera is taken, applications will
+ * get {@link #CAMERA_ERROR_RELEASED} and have some time to clean up. Apps
+ * receiving this callback must immediately stop video recording and then
+ * call {@link #release()} on their camera object. Otherwise, it will be
+ * released by the frameworks in a short time. After receiving
+ * CAMERA_ERROR_RELEASED, apps should not call any method except <code>
+ * release</code> and {@link #isReleased()}. After a camera is taken away,
+ * all methods will throw exceptions except <code>isReleased</code> and
+ * <code>release</code>. Apps can use <code>isReleased</code> to see if the
+ * camera has been taken away. If the camera is taken away, the apps can
+ * silently finish themselves or show a dialog.
+ *
+ * <p>Applications with android.permission.KEEP_CAMERA can request to keep
+ * the camera. That is, the camera will not be taken by other applications
+ * while it is opened. The permission can only be obtained by trusted
+ * platform applications, such as those implementing lock screen security
+ * features.
+ *
+ * @param cameraId the hardware camera to access, between 0 and
+ * {@link #getNumberOfCameras()}-1.
+ * @param force true to take the ownership from the existing client if the
+ * camera has been opened by other clients.
+ * @param keep true if the applications do not want other apps to take the
+ * camera. Only the apps with android.permission.KEEP_CAMERA can keep
+ * the camera.
+ * @return a new Camera object, connected, locked and ready for use.
+ * @hide
+ */
+ public static Camera open(int cameraId, boolean force, boolean keep) {
+ return new Camera(cameraId, force, keep);
+ }
+
+ /**
+ * Creates a new Camera object to access a particular hardware camera. If
+ * the same camera is opened by other applications, this will throw a
+ * RuntimeException.
+ *
* <p>You must call {@link #release()} when you are done using the camera,
* otherwise it will remain locked and be unavailable to other applications.
*
@@ -255,13 +299,13 @@
* @param cameraId the hardware camera to access, between 0 and
* {@link #getNumberOfCameras()}-1.
* @return a new Camera object, connected, locked and ready for use.
- * @throws RuntimeException if connection to the camera service fails (for
- * example, if the camera is in use by another process or device policy
- * manager has disabled the camera).
+ * @throws RuntimeException if opening the camera fails (for example, if the
+ * camera is in use by another process or device policy manager has
+ * disabled the camera).
* @see android.app.admin.DevicePolicyManager#getCameraDisabled(android.content.ComponentName)
*/
public static Camera open(int cameraId) {
- return new Camera(cameraId);
+ return new Camera(cameraId, false, false);
}
/**
@@ -276,13 +320,13 @@
for (int i = 0; i < numberOfCameras; i++) {
getCameraInfo(i, cameraInfo);
if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
- return new Camera(i);
+ return new Camera(i, false, false);
}
}
return null;
}
- Camera(int cameraId) {
+ Camera(int cameraId, boolean force, boolean keep) {
mShutterCallback = null;
mRawImageCallback = null;
mJpegCallback = null;
@@ -299,7 +343,7 @@
mEventHandler = null;
}
- native_setup(new WeakReference<Camera>(this), cameraId);
+ native_setup(new WeakReference<Camera>(this), cameraId, force, keep);
}
/**
@@ -312,7 +356,8 @@
release();
}
- private native final void native_setup(Object camera_this, int cameraId);
+ private native final void native_setup(Object camera_this, int cameraId,
+ boolean force, boolean keep);
private native final void native_release();
@@ -327,6 +372,18 @@
}
/**
+ * Whether the camera is released. When any camera method throws an
+ * exception, applications can use this to check whether the camera has been
+ * taken by other clients. If true, it means other clients have taken the
+ * camera. The applications can silently finish themselves or show a dialog.
+ *
+ * @return whether the camera is released.
+ * @see #open(int, boolean, boolean)
+ * @hide
+ */
+ public native final boolean isReleased();
+
+ /**
* Unlocks the camera to allow another process to access it.
* Normally, the camera is locked to the process with an active Camera
* object until {@link #release()} is called. To allow rapid handoff
@@ -1322,6 +1379,17 @@
public static final int CAMERA_ERROR_UNKNOWN = 1;
/**
+ * Camera was released because another client has opened the camera. The
+ * application should call {@link #release()} after getting this. The apps
+ * should not call any method except <code>release</code> and {@link #isReleased()}
+ * after this.
+ *
+ * @see Camera.ErrorCallback
+ * @hide
+ */
+ public static final int CAMERA_ERROR_RELEASED = 2;
+
+ /**
* Media server died. In this case, the application must release the
* Camera object and instantiate a new one.
* @see Camera.ErrorCallback
diff --git a/core/java/android/hardware/GeomagneticField.java b/core/java/android/hardware/GeomagneticField.java
index 96fbe77..0369825 100644
--- a/core/java/android/hardware/GeomagneticField.java
+++ b/core/java/android/hardware/GeomagneticField.java
@@ -19,7 +19,7 @@
import java.util.GregorianCalendar;
/**
- * This class is used to estimated estimate magnetic field at a given point on
+ * Estimates magnetic field at a given point on
* Earth, and in particular, to compute the magnetic declination from true
* north.
*
diff --git a/core/java/android/net/Downloads.java b/core/java/android/net/Downloads.java
deleted file mode 100644
index ed6d103..0000000
--- a/core/java/android/net/Downloads.java
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * Copyright (C) 2008 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.net;
-
-import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.ParcelFileDescriptor;
-import android.os.SystemClock;
-import android.provider.BaseColumns;
-import android.util.Log;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.File;
-import java.io.InputStream;
-
-/**
- * The Download Manager
- *
- * @hide
- */
-public final class Downloads {
-
-
- /**
- * Download status codes
- */
-
- /**
- * This download hasn't started yet
- */
- public static final int STATUS_PENDING = 190;
-
- /**
- * This download has started
- */
- public static final int STATUS_RUNNING = 192;
-
- /**
- * This download has successfully completed.
- * Warning: there might be other status values that indicate success
- * in the future.
- * Use isSucccess() to capture the entire category.
- */
- public static final int STATUS_SUCCESS = 200;
-
- /**
- * This download can't be performed because the content type cannot be
- * handled.
- */
- public static final int STATUS_NOT_ACCEPTABLE = 406;
-
- /**
- * This download has completed with an error.
- * Warning: there will be other status values that indicate errors in
- * the future. Use isStatusError() to capture the entire category.
- */
- public static final int STATUS_UNKNOWN_ERROR = 491;
-
- /**
- * This download couldn't be completed because of an HTTP
- * redirect response that the download manager couldn't
- * handle.
- */
- public static final int STATUS_UNHANDLED_REDIRECT = 493;
-
- /**
- * This download couldn't be completed due to insufficient storage
- * space. Typically, this is because the SD card is full.
- */
- public static final int STATUS_INSUFFICIENT_SPACE_ERROR = 498;
-
- /**
- * This download couldn't be completed because no external storage
- * device was found. Typically, this is because the SD card is not
- * mounted.
- */
- public static final int STATUS_DEVICE_NOT_FOUND_ERROR = 499;
-
- /**
- * Returns whether the status is a success (i.e. 2xx).
- */
- public static boolean isStatusSuccess(int status) {
- return (status >= 200 && status < 300);
- }
-
- /**
- * Returns whether the status is an error (i.e. 4xx or 5xx).
- */
- public static boolean isStatusError(int status) {
- return (status >= 400 && status < 600);
- }
-
- /**
- * Download destinations
- */
-
- /**
- * This download will be saved to the external storage. This is the
- * default behavior, and should be used for any file that the user
- * can freely access, copy, delete. Even with that destination,
- * unencrypted DRM files are saved in secure internal storage.
- * Downloads to the external destination only write files for which
- * there is a registered handler. The resulting files are accessible
- * by filename to all applications.
- */
- public static final int DOWNLOAD_DESTINATION_EXTERNAL = 1;
-
- /**
- * This download will be saved to the download manager's private
- * partition. This is the behavior used by applications that want to
- * download private files that are used and deleted soon after they
- * get downloaded. All file types are allowed, and only the initiating
- * application can access the file (indirectly through a content
- * provider). This requires the
- * android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED permission.
- */
- public static final int DOWNLOAD_DESTINATION_CACHE = 2;
-
- /**
- * This download will be saved to the download manager's private
- * partition and will be purged as necessary to make space. This is
- * for private files (similar to CACHE_PARTITION) that aren't deleted
- * immediately after they are used, and are kept around by the download
- * manager as long as space is available.
- */
- public static final int DOWNLOAD_DESTINATION_CACHE_PURGEABLE = 3;
-
-
- /**
- * An invalid download id
- */
- public static final long DOWNLOAD_ID_INVALID = -1;
-
-
- /**
- * Broadcast Action: this is sent by the download manager to the app
- * that had initiated a download when that download completes. The
- * download's content: uri is specified in the intent's data.
- */
- public static final String ACTION_DOWNLOAD_COMPLETED =
- "android.intent.action.DOWNLOAD_COMPLETED";
-
- /**
- * If extras are specified when requesting a download they will be provided in the intent that
- * is sent to the specified class and package when a download has finished.
- * <P>Type: TEXT</P>
- * <P>Owner can Init</P>
- */
- public static final String COLUMN_NOTIFICATION_EXTRAS = "notificationextras";
-
-
- /**
- * Status class for a download
- */
- public static final class StatusInfo {
- public boolean completed = false;
- /** The filename of the active download. */
- public String filename = null;
- /** An opaque id for the download */
- public long id = DOWNLOAD_ID_INVALID;
- /** An opaque status code for the download */
- public int statusCode = -1;
- /** Approximate number of bytes downloaded so far, for debugging purposes. */
- public long bytesSoFar = -1;
-
- /**
- * Returns whether the download is completed
- * @return a boolean whether the download is complete.
- */
- public boolean isComplete() {
- return android.provider.Downloads.Impl.isStatusCompleted(statusCode);
- }
-
- /**
- * Returns whether the download is successful
- * @return a boolean whether the download is successful.
- */
- public boolean isSuccessful() {
- return android.provider.Downloads.Impl.isStatusSuccess(statusCode);
- }
- }
-
- /**
- * Class to access initiate and query download by server uri
- */
- public static final class ByUri extends DownloadBase {
- /** @hide */
- private ByUri() {}
-
- /**
- * Query where clause by app data.
- * @hide
- */
- private static final String QUERY_WHERE_APP_DATA_CLAUSE =
- android.provider.Downloads.Impl.COLUMN_APP_DATA + "=?";
-
- /**
- * Gets a Cursor pointing to the download(s) of the current system update.
- * @hide
- */
- private static final Cursor getCurrentOtaDownloads(Context context, String url) {
- return context.getContentResolver().query(
- android.provider.Downloads.Impl.CONTENT_URI,
- DOWNLOADS_PROJECTION,
- QUERY_WHERE_APP_DATA_CLAUSE,
- new String[] {url},
- null);
- }
-
- /**
- * Returns a StatusInfo with the result of trying to download the
- * given URL. Returns null if no attempts have been made.
- */
- public static final StatusInfo getStatus(
- Context context,
- String url,
- long redownload_threshold) {
- StatusInfo result = null;
- boolean hasFailedDownload = false;
- long failedDownloadModificationTime = 0;
- Cursor c = getCurrentOtaDownloads(context, url);
- try {
- while (c != null && c.moveToNext()) {
- if (result == null) {
- result = new StatusInfo();
- }
- int status = getStatusOfDownload(c, redownload_threshold);
- if (status == STATUS_DOWNLOADING_UPDATE ||
- status == STATUS_DOWNLOADED_UPDATE) {
- result.completed = (status == STATUS_DOWNLOADED_UPDATE);
- result.filename = c.getString(DOWNLOADS_COLUMN_FILENAME);
- result.id = c.getLong(DOWNLOADS_COLUMN_ID);
- result.statusCode = c.getInt(DOWNLOADS_COLUMN_STATUS);
- result.bytesSoFar = c.getLong(DOWNLOADS_COLUMN_CURRENT_BYTES);
- return result;
- }
-
- long modTime = c.getLong(DOWNLOADS_COLUMN_LAST_MODIFICATION);
- if (hasFailedDownload &&
- modTime < failedDownloadModificationTime) {
- // older than the one already in result; skip it.
- continue;
- }
-
- hasFailedDownload = true;
- failedDownloadModificationTime = modTime;
- result.statusCode = c.getInt(DOWNLOADS_COLUMN_STATUS);
- result.bytesSoFar = c.getLong(DOWNLOADS_COLUMN_CURRENT_BYTES);
- }
- } finally {
- if (c != null) {
- c.close();
- }
- }
- return result;
- }
-
- /**
- * Query where clause for general querying.
- */
- private static final String QUERY_WHERE_CLAUSE =
- android.provider.Downloads.Impl.COLUMN_NOTIFICATION_PACKAGE + "=? AND " +
- android.provider.Downloads.Impl.COLUMN_NOTIFICATION_CLASS + "=?";
-
- /**
- * Delete all the downloads for a package/class pair.
- */
- public static final void removeAllDownloadsByPackage(
- Context context,
- String notification_package,
- String notification_class) {
- context.getContentResolver().delete(
- android.provider.Downloads.Impl.CONTENT_URI,
- QUERY_WHERE_CLAUSE,
- new String[] { notification_package, notification_class });
- }
-
- /**
- * The column for the id in the Cursor returned by
- * getProgressCursor()
- */
- public static final int getProgressColumnId() {
- return 0;
- }
-
- /**
- * The column for the current byte count in the Cursor returned by
- * getProgressCursor()
- */
- public static final int getProgressColumnCurrentBytes() {
- return 1;
- }
-
- /**
- * The column for the total byte count in the Cursor returned by
- * getProgressCursor()
- */
- public static final int getProgressColumnTotalBytes() {
- return 2;
- }
-
- /** @hide */
- private static final String[] PROJECTION = {
- BaseColumns._ID,
- android.provider.Downloads.Impl.COLUMN_CURRENT_BYTES,
- android.provider.Downloads.Impl.COLUMN_TOTAL_BYTES
- };
-
- /**
- * Returns a Cursor representing the progress of the download identified by the ID.
- */
- public static final Cursor getProgressCursor(Context context, long id) {
- Uri downloadUri = Uri.withAppendedPath(android.provider.Downloads.Impl.CONTENT_URI,
- String.valueOf(id));
- return context.getContentResolver().query(downloadUri, PROJECTION, null, null, null);
- }
- }
-
- /**
- * Class to access downloads by opaque download id
- */
- public static final class ById extends DownloadBase {
- /** @hide */
- private ById() {}
-
- /**
- * Get the mime tupe of the download specified by the download id
- */
- public static String getMimeTypeForId(Context context, long downloadId) {
- ContentResolver cr = context.getContentResolver();
-
- String mimeType = null;
- Cursor downloadCursor = null;
-
- try {
- Uri downloadUri = getDownloadUri(downloadId);
-
- downloadCursor = cr.query(
- downloadUri, new String[]{android.provider.Downloads.Impl.COLUMN_MIME_TYPE},
- null, null, null);
- if (downloadCursor.moveToNext()) {
- mimeType = downloadCursor.getString(0);
- }
- } finally {
- if (downloadCursor != null) downloadCursor.close();
- }
- return mimeType;
- }
-
- /**
- * Delete a download by Id
- */
- public static void deleteDownload(Context context, long downloadId) {
- ContentResolver cr = context.getContentResolver();
-
- String mimeType = null;
-
- Uri downloadUri = getDownloadUri(downloadId);
-
- cr.delete(downloadUri, null, null);
- }
-
- /**
- * Open a filedescriptor to a particular download
- */
- public static ParcelFileDescriptor openDownload(
- Context context, long downloadId, String mode)
- throws FileNotFoundException
- {
- ContentResolver cr = context.getContentResolver();
-
- String mimeType = null;
-
- Uri downloadUri = getDownloadUri(downloadId);
-
- return cr.openFileDescriptor(downloadUri, mode);
- }
-
- /**
- * Open a stream to a particular download
- */
- public static InputStream openDownloadStream(Context context, long downloadId)
- throws FileNotFoundException, IOException
- {
- ContentResolver cr = context.getContentResolver();
-
- String mimeType = null;
-
- Uri downloadUri = getDownloadUri(downloadId);
-
- return cr.openInputStream(downloadUri);
- }
-
- private static Uri getDownloadUri(long downloadId) {
- return Uri.parse(android.provider.Downloads.Impl.CONTENT_URI + "/" + downloadId);
- }
-
- /**
- * Returns a StatusInfo with the result of trying to download the
- * given URL. Returns null if no attempts have been made.
- */
- public static final StatusInfo getStatus(
- Context context,
- long downloadId) {
- StatusInfo result = null;
- boolean hasFailedDownload = false;
- long failedDownloadModificationTime = 0;
-
- Uri downloadUri = getDownloadUri(downloadId);
-
- ContentResolver cr = context.getContentResolver();
-
- Cursor c = cr.query(downloadUri, DOWNLOADS_PROJECTION, null /* selection */,
- null /* selection args */, null /* sort order */);
- try {
- if (c == null || !c.moveToNext()) {
- return result;
- }
-
- if (result == null) {
- result = new StatusInfo();
- }
- int status = getStatusOfDownload(c,0);
- if (status == STATUS_DOWNLOADING_UPDATE ||
- status == STATUS_DOWNLOADED_UPDATE) {
- result.completed = (status == STATUS_DOWNLOADED_UPDATE);
- result.filename = c.getString(DOWNLOADS_COLUMN_FILENAME);
- result.id = c.getLong(DOWNLOADS_COLUMN_ID);
- result.statusCode = c.getInt(DOWNLOADS_COLUMN_STATUS);
- result.bytesSoFar = c.getLong(DOWNLOADS_COLUMN_CURRENT_BYTES);
- return result;
- }
-
- long modTime = c.getLong(DOWNLOADS_COLUMN_LAST_MODIFICATION);
-
- result.statusCode = c.getInt(DOWNLOADS_COLUMN_STATUS);
- result.bytesSoFar = c.getLong(DOWNLOADS_COLUMN_CURRENT_BYTES);
- } finally {
- if (c != null) {
- c.close();
- }
- }
- return result;
- }
- }
-
-
- /**
- * Base class with common functionality for the various download classes
- */
- public static class DownloadBase {
- /** @hide */
- DownloadBase() {}
-
- /**
- * Initiate a download where the download will be tracked by its URI.
- */
- public static long startDownloadByUri(
- Context context,
- String url,
- String cookieData,
- boolean showDownload,
- int downloadDestination,
- boolean allowRoaming,
- boolean skipIntegrityCheck,
- String title,
- String notification_package,
- String notification_class,
- String notification_extras) {
- ContentResolver cr = context.getContentResolver();
-
- // Tell download manager to start downloading update.
- ContentValues values = new ContentValues();
- values.put(android.provider.Downloads.Impl.COLUMN_URI, url);
- values.put(android.provider.Downloads.Impl.COLUMN_COOKIE_DATA, cookieData);
- values.put(android.provider.Downloads.Impl.COLUMN_VISIBILITY,
- showDownload ? android.provider.Downloads.Impl.VISIBILITY_VISIBLE
- : android.provider.Downloads.Impl.VISIBILITY_HIDDEN);
- if (title != null) {
- values.put(android.provider.Downloads.Impl.COLUMN_TITLE, title);
- }
- values.put(android.provider.Downloads.Impl.COLUMN_APP_DATA, url);
-
-
- // NOTE: destination should be seperated from whether the download
- // can happen when roaming
- int destination = android.provider.Downloads.Impl.DESTINATION_EXTERNAL;
- switch (downloadDestination) {
- case DOWNLOAD_DESTINATION_EXTERNAL:
- destination = android.provider.Downloads.Impl.DESTINATION_EXTERNAL;
- break;
- case DOWNLOAD_DESTINATION_CACHE:
- if (allowRoaming) {
- destination = android.provider.Downloads.Impl.DESTINATION_CACHE_PARTITION;
- } else {
- destination =
- android.provider.Downloads.Impl.DESTINATION_CACHE_PARTITION_NOROAMING;
- }
- break;
- case DOWNLOAD_DESTINATION_CACHE_PURGEABLE:
- destination =
- android.provider.Downloads.Impl.DESTINATION_CACHE_PARTITION_PURGEABLE;
- break;
- }
- values.put(android.provider.Downloads.Impl.COLUMN_DESTINATION, destination);
- values.put(android.provider.Downloads.Impl.COLUMN_NO_INTEGRITY,
- skipIntegrityCheck); // Don't check ETag
- if (notification_package != null && notification_class != null) {
- values.put(android.provider.Downloads.Impl.COLUMN_NOTIFICATION_PACKAGE,
- notification_package);
- values.put(android.provider.Downloads.Impl.COLUMN_NOTIFICATION_CLASS,
- notification_class);
-
- if (notification_extras != null) {
- values.put(android.provider.Downloads.Impl.COLUMN_NOTIFICATION_EXTRAS,
- notification_extras);
- }
- }
-
- Uri downloadUri = cr.insert(android.provider.Downloads.Impl.CONTENT_URI, values);
-
- long downloadId = DOWNLOAD_ID_INVALID;
- if (downloadUri != null) {
- downloadId = Long.parseLong(downloadUri.getLastPathSegment());
- }
- return downloadId;
- }
- }
-
- /** @hide */
- private static final int STATUS_INVALID = 0;
- /** @hide */
- private static final int STATUS_DOWNLOADING_UPDATE = 3;
- /** @hide */
- private static final int STATUS_DOWNLOADED_UPDATE = 4;
-
- /**
- * Column projection for the query to the download manager. This must match
- * with the constants DOWNLOADS_COLUMN_*.
- * @hide
- */
- private static final String[] DOWNLOADS_PROJECTION = {
- BaseColumns._ID,
- android.provider.Downloads.Impl.COLUMN_APP_DATA,
- android.provider.Downloads.Impl.COLUMN_STATUS,
- android.provider.Downloads.Impl._DATA,
- android.provider.Downloads.Impl.COLUMN_LAST_MODIFICATION,
- android.provider.Downloads.Impl.COLUMN_CURRENT_BYTES,
- };
-
- /**
- * The column index for the ID.
- * @hide
- */
- private static final int DOWNLOADS_COLUMN_ID = 0;
- /**
- * The column index for the URI.
- * @hide
- */
- private static final int DOWNLOADS_COLUMN_URI = 1;
- /**
- * The column index for the status code.
- * @hide
- */
- private static final int DOWNLOADS_COLUMN_STATUS = 2;
- /**
- * The column index for the filename.
- * @hide
- */
- private static final int DOWNLOADS_COLUMN_FILENAME = 3;
- /**
- * The column index for the last modification time.
- * @hide
- */
- private static final int DOWNLOADS_COLUMN_LAST_MODIFICATION = 4;
- /**
- * The column index for the number of bytes downloaded so far.
- * @hide
- */
- private static final int DOWNLOADS_COLUMN_CURRENT_BYTES = 5;
-
- /**
- * Gets the status of a download.
- *
- * @param c A Cursor pointing to a download. The URL column is assumed to be valid.
- * @return The status of the download.
- * @hide
- */
- private static final int getStatusOfDownload( Cursor c, long redownload_threshold) {
- int status = c.getInt(DOWNLOADS_COLUMN_STATUS);
- long realtime = SystemClock.elapsedRealtime();
-
- // TODO(dougz): special handling of 503, 404? (eg, special
- // explanatory messages to user)
-
- if (!android.provider.Downloads.Impl.isStatusCompleted(status)) {
- // Check if it's stuck
- long modified = c.getLong(DOWNLOADS_COLUMN_LAST_MODIFICATION);
- long now = System.currentTimeMillis();
- if (now < modified || now - modified > redownload_threshold) {
- return STATUS_INVALID;
- }
-
- return STATUS_DOWNLOADING_UPDATE;
- }
-
- if (android.provider.Downloads.Impl.isStatusError(status)) {
- return STATUS_INVALID;
- }
-
- String filename = c.getString(DOWNLOADS_COLUMN_FILENAME);
- if (filename == null) {
- return STATUS_INVALID;
- }
-
- return STATUS_DOWNLOADED_UPDATE;
- }
-
-
- /**
- * @hide
- */
- private Downloads() {}
-}
diff --git a/core/java/android/net/INetworkPolicyManager.aidl b/core/java/android/net/INetworkPolicyManager.aidl
index 442535a..89c9c36 100644
--- a/core/java/android/net/INetworkPolicyManager.aidl
+++ b/core/java/android/net/INetworkPolicyManager.aidl
@@ -30,8 +30,8 @@
interface INetworkPolicyManager {
/** Control UID policies. */
- void setUidPolicy(int uid, int policy);
- int getUidPolicy(int uid);
+ void setAppPolicy(int appId, int policy);
+ int getAppPolicy(int appId);
boolean isUidForeground(int uid);
diff --git a/core/java/android/net/NetworkIdentity.java b/core/java/android/net/NetworkIdentity.java
index 1a74abf..ee12989 100644
--- a/core/java/android/net/NetworkIdentity.java
+++ b/core/java/android/net/NetworkIdentity.java
@@ -31,6 +31,14 @@
* @hide
*/
public class NetworkIdentity {
+ /**
+ * When enabled, combine all {@link #mSubType} together under
+ * {@link #SUBTYPE_COMBINED}.
+ */
+ public static final boolean COMBINE_SUBTYPE_ENABLED = true;
+
+ public static final int SUBTYPE_COMBINED = -1;
+
final int mType;
final int mSubType;
final String mSubscriberId;
@@ -38,7 +46,7 @@
public NetworkIdentity(int type, int subType, String subscriberId, boolean roaming) {
this.mType = type;
- this.mSubType = subType;
+ this.mSubType = COMBINE_SUBTYPE_ENABLED ? SUBTYPE_COMBINED : subType;
this.mSubscriberId = subscriberId;
this.mRoaming = roaming;
}
@@ -52,9 +60,8 @@
public boolean equals(Object obj) {
if (obj instanceof NetworkIdentity) {
final NetworkIdentity ident = (NetworkIdentity) obj;
- return mType == ident.mType && mSubType == ident.mSubType
- && Objects.equal(mSubscriberId, ident.mSubscriberId)
- && mRoaming == ident.mRoaming;
+ return mType == ident.mType && mSubType == ident.mSubType && mRoaming == ident.mRoaming
+ && Objects.equal(mSubscriberId, ident.mSubscriberId);
}
return false;
}
@@ -63,7 +70,9 @@
public String toString() {
final String typeName = ConnectivityManager.getNetworkTypeName(mType);
final String subTypeName;
- if (ConnectivityManager.isNetworkTypeMobile(mType)) {
+ if (COMBINE_SUBTYPE_ENABLED) {
+ subTypeName = "COMBINED";
+ } else if (ConnectivityManager.isNetworkTypeMobile(mType)) {
subTypeName = TelephonyManager.getNetworkTypeName(mSubType);
} else {
subTypeName = Integer.toString(mSubType);
@@ -130,5 +139,4 @@
}
return new NetworkIdentity(type, subType, subscriberId, roaming);
}
-
}
diff --git a/core/java/android/net/NetworkPolicy.java b/core/java/android/net/NetworkPolicy.java
index 5b94784..c1f58a3 100644
--- a/core/java/android/net/NetworkPolicy.java
+++ b/core/java/android/net/NetworkPolicy.java
@@ -42,18 +42,20 @@
public long lastWarningSnooze;
public long lastLimitSnooze;
public boolean metered;
+ public boolean inferred;
private static final long DEFAULT_MTU = 1500;
+ @Deprecated
public NetworkPolicy(NetworkTemplate template, int cycleDay, String cycleTimezone,
long warningBytes, long limitBytes, boolean metered) {
this(template, cycleDay, cycleTimezone, warningBytes, limitBytes, SNOOZE_NEVER,
- SNOOZE_NEVER, metered);
+ SNOOZE_NEVER, metered, false);
}
public NetworkPolicy(NetworkTemplate template, int cycleDay, String cycleTimezone,
long warningBytes, long limitBytes, long lastWarningSnooze, long lastLimitSnooze,
- boolean metered) {
+ boolean metered, boolean inferred) {
this.template = checkNotNull(template, "missing NetworkTemplate");
this.cycleDay = cycleDay;
this.cycleTimezone = checkNotNull(cycleTimezone, "missing cycleTimezone");
@@ -62,6 +64,7 @@
this.lastWarningSnooze = lastWarningSnooze;
this.lastLimitSnooze = lastLimitSnooze;
this.metered = metered;
+ this.inferred = inferred;
}
public NetworkPolicy(Parcel in) {
@@ -73,6 +76,7 @@
lastWarningSnooze = in.readLong();
lastLimitSnooze = in.readLong();
metered = in.readInt() != 0;
+ inferred = in.readInt() != 0;
}
@Override
@@ -85,6 +89,7 @@
dest.writeLong(lastWarningSnooze);
dest.writeLong(lastLimitSnooze);
dest.writeInt(metered ? 1 : 0);
+ dest.writeInt(inferred ? 1 : 0);
}
@Override
@@ -134,7 +139,7 @@
@Override
public int hashCode() {
return Objects.hashCode(template, cycleDay, cycleTimezone, warningBytes, limitBytes,
- lastWarningSnooze, lastLimitSnooze, metered);
+ lastWarningSnooze, lastLimitSnooze, metered, inferred);
}
@Override
@@ -145,6 +150,7 @@
&& limitBytes == other.limitBytes
&& lastWarningSnooze == other.lastWarningSnooze
&& lastLimitSnooze == other.lastLimitSnooze && metered == other.metered
+ && inferred == other.inferred
&& Objects.equal(cycleTimezone, other.cycleTimezone)
&& Objects.equal(template, other.template);
}
@@ -156,7 +162,7 @@
return "NetworkPolicy[" + template + "]: cycleDay=" + cycleDay + ", cycleTimezone="
+ cycleTimezone + ", warningBytes=" + warningBytes + ", limitBytes=" + limitBytes
+ ", lastWarningSnooze=" + lastWarningSnooze + ", lastLimitSnooze="
- + lastLimitSnooze + ", metered=" + metered;
+ + lastLimitSnooze + ", metered=" + metered + ", inferred=" + inferred;
}
public static final Creator<NetworkPolicy> CREATOR = new Creator<NetworkPolicy>() {
diff --git a/core/java/android/net/NetworkPolicyManager.java b/core/java/android/net/NetworkPolicyManager.java
index 7173751..c09c676 100644
--- a/core/java/android/net/NetworkPolicyManager.java
+++ b/core/java/android/net/NetworkPolicyManager.java
@@ -88,21 +88,21 @@
}
/**
- * Set policy flags for specific UID.
+ * Set policy flags for specific application.
*
* @param policy {@link #POLICY_NONE} or combination of flags like
* {@link #POLICY_REJECT_METERED_BACKGROUND}.
*/
- public void setUidPolicy(int uid, int policy) {
+ public void setAppPolicy(int appId, int policy) {
try {
- mService.setUidPolicy(uid, policy);
+ mService.setAppPolicy(appId, policy);
} catch (RemoteException e) {
}
}
- public int getUidPolicy(int uid) {
+ public int getAppPolicy(int appId) {
try {
- return mService.getUidPolicy(uid);
+ return mService.getAppPolicy(appId);
} catch (RemoteException e) {
return POLICY_NONE;
}
@@ -203,6 +203,7 @@
* Check if given UID can have a {@link #setUidPolicy(int, int)} defined,
* usually to protect critical system services.
*/
+ @Deprecated
public static boolean isUidValidForPolicy(Context context, int uid) {
// first, quick-reject non-applications
if (uid < android.os.Process.FIRST_APPLICATION_UID
diff --git a/core/java/android/net/NetworkTemplate.java b/core/java/android/net/NetworkTemplate.java
index 8ebfd8d..e1fbdcc 100644
--- a/core/java/android/net/NetworkTemplate.java
+++ b/core/java/android/net/NetworkTemplate.java
@@ -20,6 +20,7 @@
import static android.net.ConnectivityManager.TYPE_WIFI;
import static android.net.ConnectivityManager.TYPE_WIFI_P2P;
import static android.net.ConnectivityManager.TYPE_WIMAX;
+import static android.net.NetworkIdentity.COMBINE_SUBTYPE_ENABLED;
import static android.net.NetworkIdentity.scrubSubscriberId;
import static android.telephony.TelephonyManager.NETWORK_CLASS_2_G;
import static android.telephony.TelephonyManager.NETWORK_CLASS_3_G;
@@ -199,6 +200,7 @@
* Check if mobile network classified 3G or lower with matching IMSI.
*/
private boolean matchesMobile3gLower(NetworkIdentity ident) {
+ ensureSubtypeAvailable();
if (ident.mType == TYPE_WIMAX) {
return false;
} else if (matchesMobile(ident)) {
@@ -216,6 +218,7 @@
* Check if mobile network classified 4G with matching IMSI.
*/
private boolean matchesMobile4g(NetworkIdentity ident) {
+ ensureSubtypeAvailable();
if (ident.mType == TYPE_WIMAX) {
// TODO: consider matching against WiMAX subscriber identity
return true;
@@ -268,6 +271,13 @@
}
}
+ private static void ensureSubtypeAvailable() {
+ if (COMBINE_SUBTYPE_ENABLED) {
+ throw new IllegalArgumentException(
+ "Unable to enforce 3G_LOWER template on combined data.");
+ }
+ }
+
public static final Creator<NetworkTemplate> CREATOR = new Creator<NetworkTemplate>() {
public NetworkTemplate createFromParcel(Parcel in) {
return new NetworkTemplate(in);
diff --git a/core/java/android/net/SSLCertificateSocketFactory.java b/core/java/android/net/SSLCertificateSocketFactory.java
index 5c4b258..6a4f1f2 100644
--- a/core/java/android/net/SSLCertificateSocketFactory.java
+++ b/core/java/android/net/SSLCertificateSocketFactory.java
@@ -18,13 +18,11 @@
import android.os.SystemProperties;
import android.util.Log;
-
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.security.KeyManagementException;
import java.security.cert.X509Certificate;
-
import javax.net.SocketFactory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
@@ -36,7 +34,6 @@
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
-
import org.apache.harmony.xnet.provider.jsse.OpenSSLContextImpl;
import org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl;
import org.apache.harmony.xnet.provider.jsse.SSLClientSessionCache;
@@ -89,6 +86,7 @@
private SSLSocketFactory mSecureFactory = null;
private TrustManager[] mTrustManagers = null;
private KeyManager[] mKeyManagers = null;
+ private byte[] mNpnProtocols = null;
private final int mHandshakeTimeoutMillis;
private final SSLClientSessionCache mSessionCache;
@@ -251,6 +249,60 @@
}
/**
+ * Sets the <a href="http://technotes.googlecode.com/git/nextprotoneg.html">Next
+ * Protocol Negotiation (NPN)</a> protocols that this peer is interested in.
+ *
+ * <p>For servers this is the sequence of protocols to advertise as
+ * supported, in order of preference. This list is sent unencrypted to
+ * all clients that support NPN.
+ *
+ * <p>For clients this is a list of supported protocols to match against the
+ * server's list. If there is no protocol supported by both client and
+ * server then the first protocol in the client's list will be selected.
+ * The order of the client's protocols is otherwise insignificant.
+ *
+ * @param npnProtocols a possibly-empty list of protocol byte arrays. All
+ * arrays must be non-empty and of length less than 256.
+ */
+ public void setNpnProtocols(byte[][] npnProtocols) {
+ this.mNpnProtocols = toNpnProtocolsList(npnProtocols);
+ }
+
+ /**
+ * Returns an array containing the concatenation of length-prefixed byte
+ * strings.
+ */
+ static byte[] toNpnProtocolsList(byte[]... npnProtocols) {
+ int totalLength = 0;
+ for (byte[] s : npnProtocols) {
+ if (s.length == 0 || s.length > 255) {
+ throw new IllegalArgumentException("s.length == 0 || s.length > 255: " + s.length);
+ }
+ totalLength += 1 + s.length;
+ }
+ byte[] result = new byte[totalLength];
+ int pos = 0;
+ for (byte[] s : npnProtocols) {
+ result[pos++] = (byte) s.length;
+ for (byte b : s) {
+ result[pos++] = b;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns the <a href="http://technotes.googlecode.com/git/nextprotoneg.html">Next
+ * Protocol Negotiation (NPN)</a> protocol selected by client and server, or
+ * null if no protocol was negotiated.
+ *
+ * @param socket a socket created by this factory.
+ */
+ public byte[] getNpnSelectedProtocol(Socket socket) {
+ return ((OpenSSLSocketImpl) socket).getNpnSelectedProtocol();
+ }
+
+ /**
* Sets the {@link KeyManager}s to be used for connections made by this factory.
*/
public void setKeyManagers(KeyManager[] keyManagers) {
@@ -271,6 +323,7 @@
@Override
public Socket createSocket(Socket k, String host, int port, boolean close) throws IOException {
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(k, host, port, close);
+ s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
if (mSecure) {
verifyHostname(s, host);
@@ -289,6 +342,7 @@
@Override
public Socket createSocket() throws IOException {
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket();
+ s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
return s;
}
@@ -305,6 +359,7 @@
throws IOException {
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(
addr, port, localAddr, localPort);
+ s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
return s;
}
@@ -319,6 +374,7 @@
@Override
public Socket createSocket(InetAddress addr, int port) throws IOException {
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(addr, port);
+ s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
return s;
}
@@ -334,6 +390,7 @@
throws IOException {
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(
host, port, localAddr, localPort);
+ s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
if (mSecure) {
verifyHostname(s, host);
@@ -350,6 +407,7 @@
@Override
public Socket createSocket(String host, int port) throws IOException {
OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(host, port);
+ s.setNpnProtocols(mNpnProtocols);
s.setHandshakeTimeout(mHandshakeTimeoutMillis);
if (mSecure) {
verifyHostname(s, host);
diff --git a/core/java/android/os/Bundle.java b/core/java/android/os/Bundle.java
index 28206b7..51cb91c8 100644
--- a/core/java/android/os/Bundle.java
+++ b/core/java/android/os/Bundle.java
@@ -226,6 +226,13 @@
}
/**
+ * @hide
+ */
+ public boolean isParcelled() {
+ return mParcelledData != null;
+ }
+
+ /**
* Returns the number of mappings contained in this Bundle.
*
* @return the number of mappings as an int.
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 6139296..770bf1c 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -98,6 +98,12 @@
public static final int SDCARD_RW_GID = 1015;
/**
+ * Defines the UID/GID for the group that controls VPN services.
+ * @hide
+ */
+ public static final int VPN_UID = 1016;
+
+ /**
* Defines the UID/GID for the NFC service process.
* @hide
*/
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index 759be91..ce213fb 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -1201,7 +1201,7 @@
// throttled back to 60fps via SurfaceFlinger/View
// invalidates, _not_ by posting frame updates every 16
// milliseconds.
- threadHandler.get().post(new Runnable() {
+ threadHandler.get().postAtFrontOfQueue(new Runnable() {
public void run() {
long loopFinishTime = SystemClock.uptimeMillis();
diff --git a/core/java/android/os/UserId.java b/core/java/android/os/UserId.java
index 0da67d63..8bf6c6e 100644
--- a/core/java/android/os/UserId.java
+++ b/core/java/android/os/UserId.java
@@ -61,6 +61,15 @@
return uid >= Process.FIRST_ISOLATED_UID && uid <= Process.LAST_ISOLATED_UID;
}
+ public static boolean isApp(int uid) {
+ if (uid > 0) {
+ uid = UserId.getAppId(uid);
+ return uid >= Process.FIRST_APPLICATION_UID && uid <= Process.LAST_APPLICATION_UID;
+ } else {
+ return false;
+ }
+ }
+
/**
* Returns the user id for a given uid.
* @hide
@@ -96,4 +105,12 @@
public static final int getAppId(int uid) {
return uid % PER_USER_RANGE;
}
+
+ /**
+ * Returns the user id of the current process
+ * @return user id of the current process
+ */
+ public static final int myUserId() {
+ return getUserId(Process.myUid());
+ }
}
diff --git a/core/java/android/provider/Downloads.java b/core/java/android/provider/Downloads.java
index ba4804d..bd6170b 100644
--- a/core/java/android/provider/Downloads.java
+++ b/core/java/android/provider/Downloads.java
@@ -17,6 +17,7 @@
package android.provider;
import android.app.DownloadManager;
+import android.content.Context;
import android.net.NetworkPolicyManager;
import android.net.Uri;
@@ -742,4 +743,19 @@
public static final String INSERT_KEY_PREFIX = "http_header_";
}
}
+
+ /**
+ * Query where clause for general querying.
+ */
+ private static final String QUERY_WHERE_CLAUSE = Impl.COLUMN_NOTIFICATION_PACKAGE + "=? AND "
+ + Impl.COLUMN_NOTIFICATION_CLASS + "=?";
+
+ /**
+ * Delete all the downloads for a package/class pair.
+ */
+ public static final void removeAllDownloadsByPackage(
+ Context context, String notification_package, String notification_class) {
+ context.getContentResolver().delete(Impl.CONTENT_URI, QUERY_WHERE_CLAUSE,
+ new String[] { notification_package, notification_class });
+ }
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index fbb3273..d74ccb8 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -793,6 +793,7 @@
MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
+ MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS);
MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
@@ -2657,6 +2658,13 @@
public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
/**
+ * A flag containing settings used for biometric weak
+ * @hide
+ */
+ public static final String LOCK_BIOMETRIC_WEAK_FLAGS =
+ "lock_biometric_weak_flags";
+
+ /**
* Whether autolock is enabled (0 = false, 1 = true)
*/
public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index fecc8f9..850349b 100755
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -46,6 +46,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
+import android.content.res.Resources;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
@@ -554,12 +555,15 @@
private synchronized void updateSdpRecords() {
ArrayList<ParcelUuid> uuids = new ArrayList<ParcelUuid>();
- // Add the default records
- uuids.add(BluetoothUuid.HSP_AG);
- uuids.add(BluetoothUuid.ObexObjectPush);
+ Resources R = mContext.getResources();
- if (mContext.getResources().
- getBoolean(com.android.internal.R.bool.config_voice_capable)) {
+ // Add the default records
+ if (R.getBoolean(com.android.internal.R.bool.config_bluetooth_default_profiles)) {
+ uuids.add(BluetoothUuid.HSP_AG);
+ uuids.add(BluetoothUuid.ObexObjectPush);
+ }
+
+ if (R.getBoolean(com.android.internal.R.bool.config_voice_capable)) {
uuids.add(BluetoothUuid.Handsfree_AG);
uuids.add(BluetoothUuid.PBAP_PSE);
}
@@ -567,14 +571,16 @@
// Add SDP records for profiles maintained by Android userspace
addReservedSdpRecords(uuids);
- // Enable profiles maintained by Bluez userspace.
- setBluetoothTetheringNative(true, BluetoothPanProfileHandler.NAP_ROLE,
- BluetoothPanProfileHandler.NAP_BRIDGE);
+ if (R.getBoolean(com.android.internal.R.bool.config_bluetooth_default_profiles)) {
+ // Enable profiles maintained by Bluez userspace.
+ setBluetoothTetheringNative(true, BluetoothPanProfileHandler.NAP_ROLE,
+ BluetoothPanProfileHandler.NAP_BRIDGE);
- // Add SDP records for profiles maintained by Bluez userspace
- uuids.add(BluetoothUuid.AudioSource);
- uuids.add(BluetoothUuid.AvrcpTarget);
- uuids.add(BluetoothUuid.NAP);
+ // Add SDP records for profiles maintained by Bluez userspace
+ uuids.add(BluetoothUuid.AudioSource);
+ uuids.add(BluetoothUuid.AvrcpTarget);
+ uuids.add(BluetoothUuid.NAP);
+ }
// Cannot cast uuids.toArray directly since ParcelUuid is parcelable
mAdapterUuids = new ParcelUuid[uuids.size()];
diff --git a/core/java/android/text/DynamicLayout.java b/core/java/android/text/DynamicLayout.java
index 026af34..5f2d642 100644
--- a/core/java/android/text/DynamicLayout.java
+++ b/core/java/android/text/DynamicLayout.java
@@ -20,6 +20,8 @@
import android.text.style.UpdateLayout;
import android.text.style.WrapTogetherSpan;
+import com.android.internal.util.ArrayUtils;
+
import java.lang.ref.WeakReference;
/**
@@ -30,8 +32,7 @@
* {@link android.graphics.Canvas#drawText(java.lang.CharSequence, int, int, float, float, android.graphics.Paint)
* Canvas.drawText()} directly.</p>
*/
-public class DynamicLayout
-extends Layout
+public class DynamicLayout extends Layout
{
private static final int PRIORITY = 128;
@@ -116,6 +117,10 @@
mObjects = new PackedObjectVector<Directions>(1);
+ mBlockEnds = new int[] { 0 };
+ mBlockIndices = new int[] { INVALID_BLOCK_INDEX };
+ mNumberOfBlocks = 1;
+
mIncludePad = includepad;
/*
@@ -295,9 +300,9 @@
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
@@ -363,6 +368,124 @@
}
}
+ /**
+ * 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.
+ * When a range of lines is edited, new blocks (from 0 to 3 depending on the
+ * overlap structure) will replace the set of overlapping blocks.
+ * Blocks are listed in order and are represented by their ending line number.
+ * An index is associated to each block (which will be used by display lists),
+ * this class simply invalidates the index of blocks overlapping a modification.
+ *
+ * @param startLine the first line of the range of modified lines
+ * @param endLine the last line of the range, possibly equal to startLine, lower
+ * than getLineCount()
+ * @param newLineCount the number of lines that will replace the range, possibly 0
+ */
+ private void updateBlocks(int startLine, int endLine, int newLineCount) {
+ int firstBlock = -1;
+ int lastBlock = -1;
+ for (int i = 0; i < mNumberOfBlocks; i++) {
+ if (mBlockEnds[i] >= startLine) {
+ firstBlock = i;
+ break;
+ }
+ }
+ for (int i = firstBlock; i < mNumberOfBlocks; i++) {
+ if (mBlockEnds[i] >= endLine) {
+ lastBlock = i;
+ break;
+ }
+ }
+ final int lastBlockEndLine = mBlockEnds[lastBlock];
+
+ boolean createBlockBefore = startLine > (firstBlock == 0 ? 0 :
+ mBlockEnds[firstBlock - 1] + 1);
+ boolean createBlock = newLineCount > 0;
+ boolean createBlockAfter = endLine < mBlockEnds[lastBlock];
+
+ int numAddedBlocks = 0;
+ if (createBlockBefore) numAddedBlocks++;
+ if (createBlock) numAddedBlocks++;
+ if (createBlockAfter) numAddedBlocks++;
+
+ final int numRemovedBlocks = lastBlock - firstBlock + 1;
+ final int newNumberOfBlocks = mNumberOfBlocks + numAddedBlocks - numRemovedBlocks;
+
+ if (newNumberOfBlocks == 0) {
+ // Even when text is empty, there is actually one line and hence one block
+ mBlockEnds[0] = 0;
+ mBlockIndices[0] = INVALID_BLOCK_INDEX;
+ mNumberOfBlocks = 1;
+ return;
+ }
+
+ if (newNumberOfBlocks > mBlockEnds.length) {
+ final int newSize = ArrayUtils.idealIntArraySize(newNumberOfBlocks);
+ int[] blockEnds = new int[newSize];
+ int[] blockIndices = new int[newSize];
+ System.arraycopy(mBlockEnds, 0, blockEnds, 0, firstBlock);
+ System.arraycopy(mBlockIndices, 0, blockIndices, 0, firstBlock);
+ System.arraycopy(mBlockEnds, lastBlock + 1,
+ blockEnds, firstBlock + numAddedBlocks, mNumberOfBlocks - lastBlock - 1);
+ System.arraycopy(mBlockIndices, lastBlock + 1,
+ blockIndices, firstBlock + numAddedBlocks, mNumberOfBlocks - lastBlock - 1);
+ mBlockEnds = blockEnds;
+ mBlockIndices = blockIndices;
+ } else {
+ System.arraycopy(mBlockEnds, lastBlock + 1,
+ mBlockEnds, firstBlock + numAddedBlocks, mNumberOfBlocks - lastBlock - 1);
+ System.arraycopy(mBlockIndices, lastBlock + 1,
+ mBlockIndices, firstBlock + numAddedBlocks, mNumberOfBlocks - lastBlock - 1);
+ }
+
+ mNumberOfBlocks = newNumberOfBlocks;
+ final int deltaLines = newLineCount - (endLine - startLine + 1);
+ for (int i = firstBlock + numAddedBlocks; i < mNumberOfBlocks; i++) {
+ mBlockEnds[i] += deltaLines;
+ }
+
+ int blockIndex = firstBlock;
+ if (createBlockBefore) {
+ mBlockEnds[blockIndex] = startLine - 1;
+ mBlockIndices[blockIndex] = INVALID_BLOCK_INDEX;
+ blockIndex++;
+ }
+
+ if (createBlock) {
+ mBlockEnds[blockIndex] = startLine + newLineCount - 1;
+ mBlockIndices[blockIndex] = INVALID_BLOCK_INDEX;
+ blockIndex++;
+ }
+
+ if (createBlockAfter) {
+ mBlockEnds[blockIndex] = lastBlockEndLine + deltaLines;
+ mBlockIndices[blockIndex] = INVALID_BLOCK_INDEX;
+ }
+ }
+
+ /**
+ * @hide
+ */
+ public int[] getBlockEnds() {
+ return mBlockEnds;
+ }
+
+ /**
+ * @hide
+ */
+ public int[] getBlockIndices() {
+ return mBlockIndices;
+ }
+
+ /**
+ * @hide
+ */
+ public int getNumberOfBlocks() {
+ return mNumberOfBlocks;
+ }
+
@Override
public int getLineCount() {
return mInts.size() - 1;
@@ -428,6 +551,7 @@
}
public void beforeTextChanged(CharSequence s, int where, int before, int after) {
+ // Intentionally empty
}
public void onTextChanged(CharSequence s, int where, int before, int after) {
@@ -435,6 +559,7 @@
}
public void afterTextChanged(Editable s) {
+ // Intentionally empty
}
public void onSpanAdded(Spannable s, Object o, int start, int end) {
@@ -486,6 +611,20 @@
private PackedIntVector mInts;
private PackedObjectVector<Directions> mObjects;
+ /**
+ * Value used in mBlockIndices when a block has been created or recycled and indicating that its
+ * display list needs to be re-created.
+ * @hide
+ */
+ public static final int INVALID_BLOCK_INDEX = -1;
+ // Stores the line numbers of the last line of each block
+ private int[] mBlockEnds;
+ // The indices of this block's display list in TextView's internal display list array or
+ // INVALID_BLOCK_INDEX if this block has been invalidated during an edition
+ private int[] mBlockIndices;
+ // Number of items actually currently being used in the above 2 arrays
+ private int mNumberOfBlocks;
+
private int mTopPadding, mBottomPadding;
private static StaticLayout sStaticLayout = new StaticLayout(null);
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index bf91700..f98cfc0 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -464,8 +464,8 @@
static final Object[] sEglLock = new Object[0];
int mWidth = -1, mHeight = -1;
- static final ThreadLocal<Gl20Renderer.Gl20RendererEglContext> sEglContextStorage
- = new ThreadLocal<Gl20Renderer.Gl20RendererEglContext>();
+ static final ThreadLocal<ManagedEGLContext> sEglContextStorage
+ = new ThreadLocal<ManagedEGLContext>();
EGLContext mEglContext;
Thread mEglThread;
@@ -622,7 +622,7 @@
}
}
- abstract GLES20Canvas createCanvas();
+ abstract HardwareCanvas createCanvas();
abstract int[] getConfig(boolean dirtyRegions);
@@ -662,16 +662,18 @@
}
}
- Gl20Renderer.Gl20RendererEglContext managedContext = sEglContextStorage.get();
+ ManagedEGLContext managedContext = sEglContextStorage.get();
mEglContext = managedContext != null ? managedContext.getContext() : null;
mEglThread = Thread.currentThread();
if (mEglContext == null) {
mEglContext = createContext(sEgl, sEglDisplay, sEglConfig);
- sEglContextStorage.set(new Gl20Renderer.Gl20RendererEglContext(mEglContext));
+ sEglContextStorage.set(createManagedContext(mEglContext));
}
}
+ abstract ManagedEGLContext createManagedContext(EGLContext eglContext);
+
private EGLConfig chooseEglConfig() {
EGLConfig[] configs = new EGLConfig[1];
int[] configsCount = new int[1];
@@ -704,7 +706,7 @@
return null;
}
- private void printConfig(EGLConfig config) {
+ private static void printConfig(EGLConfig config) {
int[] value = new int[1];
Log.d(LOG_TAG, "EGL configuration " + config + ":");
@@ -960,6 +962,11 @@
Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- getDisplayList() took " +
total + "ms");
}
+ if (View.USE_DISPLAY_LIST_PROPERTIES) {
+ Log.d("DLProperties", "getDisplayList():\t" +
+ mProfileData[mProfileCurrentFrame]);
+ }
+
}
if (displayList != null) {
@@ -985,10 +992,11 @@
}
if (invalidateNeeded) {
- if (mRedrawClip.isEmpty() || view.getParent() == null) {
- view.invalidate();
+ if (mRedrawClip.isEmpty()) {
+ attachInfo.mViewRootImpl.invalidate();
} else {
- view.getParent().invalidateChild(view, mRedrawClip);
+ attachInfo.mViewRootImpl.invalidateChildInParent(
+ null, mRedrawClip);
}
mRedrawClip.setEmpty();
}
@@ -1097,7 +1105,8 @@
// Make sure we do this on the correct thread.
if (mHandler.getLooper() != Looper.myLooper()) {
mHandler.post(new Runnable() {
- @Override public void run() {
+ @Override
+ public void run() {
onTerminate(eglContext);
}
});
@@ -1112,6 +1121,7 @@
GLES20Canvas.terminateCaches();
sEgl.eglDestroyContext(sEglDisplay, eglContext);
+ sEglContextStorage.set(null);
sEglContextStorage.remove();
sEgl.eglDestroySurface(sEglDisplay, sPbuffer);
@@ -1125,7 +1135,6 @@
sEglDisplay = null;
sEglConfig = null;
sPbuffer = null;
- sEglContextStorage.set(null);
}
}
}
@@ -1136,11 +1145,16 @@
}
@Override
- GLES20Canvas createCanvas() {
+ HardwareCanvas createCanvas() {
return mGlCanvas = new GLES20Canvas(mTranslucent);
}
@Override
+ ManagedEGLContext createManagedContext(EGLContext eglContext) {
+ return new Gl20Renderer.Gl20RendererEglContext(mEglContext);
+ }
+
+ @Override
int[] getConfig(boolean dirtyRegions) {
return new int[] {
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
@@ -1224,7 +1238,7 @@
}
private static void destroyHardwareLayer(View view) {
- view.destroyLayer();
+ view.destroyLayer(true);
if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup) view;
@@ -1243,7 +1257,8 @@
if (isEnabled() && checkCurrent() != SURFACE_STATE_ERROR) needsContext = false;
if (needsContext) {
- Gl20RendererEglContext managedContext = sEglContextStorage.get();
+ Gl20RendererEglContext managedContext =
+ (Gl20RendererEglContext) sEglContextStorage.get();
if (managedContext == null) return;
usePbufferSurface(managedContext.getContext());
}
@@ -1276,7 +1291,8 @@
static void trimMemory(int level) {
if (sEgl == null || sEglConfig == null) return;
- Gl20RendererEglContext managedContext = sEglContextStorage.get();
+ Gl20RendererEglContext managedContext =
+ (Gl20RendererEglContext) sEglContextStorage.get();
// We do not have OpenGL objects
if (managedContext == null) {
return;
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index c54d09e..14cd48f 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -89,6 +89,8 @@
void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
int getPendingAppTransition();
void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim);
+ void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY,
+ IRemoteCallback startedCallback);
void executeAppTransition();
void setAppStartingWindow(IBinder token, String pkg, int theme,
in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index 92e8f4e..77fd8d2 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -1654,14 +1654,22 @@
}
}
}
-
+
/**
- * Scales down the coordination of this event by the given scale.
+ * Applies a scale factor to all points within this event.
*
+ * This method is used to adjust touch events to simulate different density
+ * displays for compatibility mode. The values returned by {@link #getRawX()},
+ * {@link #getRawY()}, {@link #getXPrecision()} and {@link #getYPrecision()}
+ * are also affected by the scale factor.
+ *
+ * @param scale The scale factor to apply.
* @hide
*/
public final void scale(float scale) {
- nativeScale(mNativePtr, scale);
+ if (scale != 1.0f) {
+ nativeScale(mNativePtr, scale);
+ }
}
/** {@inheritDoc} */
@@ -2631,7 +2639,9 @@
* @param deltaY Amount to add to the current Y coordinate of the event.
*/
public final void offsetLocation(float deltaX, float deltaY) {
- nativeOffsetLocation(mNativePtr, deltaX, deltaY);
+ if (deltaX != 0.0f || deltaY != 0.0f) {
+ nativeOffsetLocation(mNativePtr, deltaX, deltaY);
+ }
}
/**
@@ -2644,7 +2654,7 @@
public final void setLocation(float x, float y) {
float oldX = getX();
float oldY = getY();
- nativeOffsetLocation(mNativePtr, x - oldX, y - oldY);
+ offsetLocation(x - oldX, y - oldY);
}
/**
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index edaa262..eb80290d 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -20,6 +20,7 @@
import android.graphics.*;
import android.os.Parcelable;
import android.os.Parcel;
+import android.os.SystemProperties;
import android.util.Log;
/**
@@ -35,6 +36,15 @@
public static final int ROTATION_180 = 2;
public static final int ROTATION_270 = 3;
+ private static final boolean headless = "1".equals(
+ SystemProperties.get("ro.config.headless", "0"));
+
+ private static void checkHeadless() {
+ if(headless) {
+ throw new UnsupportedOperationException("Device is headless");
+ }
+ }
+
/**
* Create Surface from a {@link SurfaceTexture}.
*
@@ -46,6 +56,8 @@
* Surface.
*/
public Surface(SurfaceTexture surfaceTexture) {
+ checkHeadless();
+
if (DEBUG_RELEASE) {
mCreationStack = new Exception();
}
@@ -244,6 +256,8 @@
public Surface(SurfaceSession s,
int pid, int display, int w, int h, int format, int flags)
throws OutOfResourcesException {
+ checkHeadless();
+
if (DEBUG_RELEASE) {
mCreationStack = new Exception();
}
@@ -255,6 +269,8 @@
public Surface(SurfaceSession s,
int pid, String name, int display, int w, int h, int format, int flags)
throws OutOfResourcesException {
+ checkHeadless();
+
if (DEBUG_RELEASE) {
mCreationStack = new Exception();
}
@@ -269,6 +285,8 @@
* @hide
*/
public Surface() {
+ checkHeadless();
+
if (DEBUG_RELEASE) {
mCreationStack = new Exception();
}
diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java
index fc02cc1..83999a1 100644
--- a/core/java/android/view/TextureView.java
+++ b/core/java/android/view/TextureView.java
@@ -299,7 +299,7 @@
}
@Override
- boolean destroyLayer() {
+ boolean destroyLayer(boolean valid) {
return false;
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 1edcff6..f769e96 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -698,14 +698,14 @@
private static final int[] VISIBILITY_FLAGS = {VISIBLE, INVISIBLE, GONE};
/**
- * This view is enabled. Intrepretation varies by subclass.
+ * This view is enabled. Interpretation varies by subclass.
* Use with ENABLED_MASK when calling setFlags.
* {@hide}
*/
static final int ENABLED = 0x00000000;
/**
- * This view is disabled. Intrepretation varies by subclass.
+ * This view is disabled. Interpretation varies by subclass.
* Use with ENABLED_MASK when calling setFlags.
* {@hide}
*/
@@ -955,50 +955,6 @@
static final int PARENT_SAVE_DISABLED_MASK = 0x20000000;
/**
- * Horizontal direction of this view is from Left to Right.
- * Use with {@link #setLayoutDirection}.
- */
- public static final int LAYOUT_DIRECTION_LTR = 0x00000000;
-
- /**
- * Horizontal direction of this view is from Right to Left.
- * Use with {@link #setLayoutDirection}.
- */
- public static final int LAYOUT_DIRECTION_RTL = 0x40000000;
-
- /**
- * Horizontal direction of this view is inherited from its parent.
- * Use with {@link #setLayoutDirection}.
- */
- public static final int LAYOUT_DIRECTION_INHERIT = 0x80000000;
-
- /**
- * Horizontal direction of this view is from deduced from the default language
- * script for the locale. Use with {@link #setLayoutDirection}.
- */
- public static final int LAYOUT_DIRECTION_LOCALE = 0xC0000000;
-
- /**
- * Mask for use with setFlags indicating bits used for horizontalDirection.
- * {@hide}
- */
- static final int LAYOUT_DIRECTION_MASK = 0xC0000000;
-
- /*
- * Array of horizontal direction flags for mapping attribute "horizontalDirection" to correct
- * flag value.
- * {@hide}
- */
- private static final int[] LAYOUT_DIRECTION_FLAGS = {LAYOUT_DIRECTION_LTR,
- LAYOUT_DIRECTION_RTL, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE};
-
- /**
- * Default horizontalDirection.
- * {@hide}
- */
- private static final int LAYOUT_DIRECTION_DEFAULT = LAYOUT_DIRECTION_INHERIT;
-
- /**
* View flag indicating whether {@link #addFocusables(ArrayList, int, int)}
* should add all focusable Views regardless if they are focusable in touch mode.
*/
@@ -1503,7 +1459,7 @@
* apps.
* @hide
*/
- protected static final boolean USE_DISPLAY_LIST_PROPERTIES = false;
+ public static final boolean USE_DISPLAY_LIST_PROPERTIES = false;
/**
* Map used to store views' tags.
@@ -1748,19 +1704,77 @@
static final int DRAG_HOVERED = 0x00000002;
/**
- * Indicates whether the view layout direction has been resolved and drawn to the
- * right-to-left direction.
- *
- * @hide
+ * Horizontal layout direction of this view is from Left to Right.
+ * Use with {@link #setLayoutDirection}.
*/
- static final int LAYOUT_DIRECTION_RESOLVED_RTL = 0x00000004;
+ public static final int LAYOUT_DIRECTION_LTR = 0;
/**
- * Indicates whether the view layout direction has been resolved.
- *
+ * Horizontal layout direction of this view is from Right to Left.
+ * Use with {@link #setLayoutDirection}.
+ */
+ public static final int LAYOUT_DIRECTION_RTL = 1;
+
+ /**
+ * Horizontal layout direction of this view is inherited from its parent.
+ * Use with {@link #setLayoutDirection}.
+ */
+ public static final int LAYOUT_DIRECTION_INHERIT = 2;
+
+ /**
+ * Horizontal layout direction of this view is from deduced from the default language
+ * script for the locale. Use with {@link #setLayoutDirection}.
+ */
+ public static final int LAYOUT_DIRECTION_LOCALE = 3;
+
+ /**
+ * Bit shift to get the horizontal layout direction. (bits after DRAG_HOVERED)
* @hide
*/
- static final int LAYOUT_DIRECTION_RESOLVED = 0x00000008;
+ static final int LAYOUT_DIRECTION_MASK_SHIFT = 2;
+
+ /**
+ * Mask for use with private flags indicating bits used for horizontal layout direction.
+ * @hide
+ */
+ static final int LAYOUT_DIRECTION_MASK = 0x00000003 << LAYOUT_DIRECTION_MASK_SHIFT;
+
+ /**
+ * Indicates whether the view horizontal layout direction has been resolved and drawn to the
+ * right-to-left direction.
+ * @hide
+ */
+ static final int LAYOUT_DIRECTION_RESOLVED_RTL = 4 << LAYOUT_DIRECTION_MASK_SHIFT;
+
+ /**
+ * Indicates whether the view horizontal layout direction has been resolved.
+ * @hide
+ */
+ static final int LAYOUT_DIRECTION_RESOLVED = 8 << LAYOUT_DIRECTION_MASK_SHIFT;
+
+ /**
+ * Mask for use with private flags indicating bits used for resolved horizontal layout direction.
+ * @hide
+ */
+ static final int LAYOUT_DIRECTION_RESOLVED_MASK = 0x0000000C << LAYOUT_DIRECTION_MASK_SHIFT;
+
+ /*
+ * Array of horizontal layout direction flags for mapping attribute "layoutDirection" to correct
+ * flag value.
+ * @hide
+ */
+ private static final int[] LAYOUT_DIRECTION_FLAGS = {
+ LAYOUT_DIRECTION_LTR,
+ LAYOUT_DIRECTION_RTL,
+ LAYOUT_DIRECTION_INHERIT,
+ LAYOUT_DIRECTION_LOCALE
+ };
+
+ /**
+ * Default horizontal layout direction.
+ * @hide
+ */
+ private static final int LAYOUT_DIRECTION_DEFAULT = LAYOUT_DIRECTION_INHERIT;
/**
@@ -1770,7 +1784,98 @@
*
* @hide
*/
- static final int HAS_TRANSIENT_STATE = 0x00000010;
+ static final int HAS_TRANSIENT_STATE = 0x00000100;
+
+
+ /**
+ * Text direction is inherited thru {@link ViewGroup}
+ */
+ public static final int TEXT_DIRECTION_INHERIT = 0;
+
+ /**
+ * Text direction is using "first strong algorithm". The first strong directional character
+ * determines the paragraph direction. If there is no strong directional character, the
+ * paragraph direction is the view's resolved layout direction.
+ */
+ public static final int TEXT_DIRECTION_FIRST_STRONG = 1;
+
+ /**
+ * Text direction is using "any-RTL" algorithm. The paragraph direction is RTL if it contains
+ * any strong RTL character, otherwise it is LTR if it contains any strong LTR characters.
+ * If there are neither, the paragraph direction is the view's resolved layout direction.
+ */
+ public static final int TEXT_DIRECTION_ANY_RTL = 2;
+
+ /**
+ * Text direction is forced to LTR.
+ */
+ public static final int TEXT_DIRECTION_LTR = 3;
+
+ /**
+ * Text direction is forced to RTL.
+ */
+ public static final int TEXT_DIRECTION_RTL = 4;
+
+ /**
+ * Text direction is coming from the system Locale.
+ */
+ public static final int TEXT_DIRECTION_LOCALE = 5;
+
+ /**
+ * Bit shift to get the horizontal layout direction. (bits after LAYOUT_DIRECTION_RESOLVED)
+ * @hide
+ */
+ static final int TEXT_DIRECTION_MASK_SHIFT = 6;
+
+ /**
+ * Default text direction is inherited
+ */
+ protected static int TEXT_DIRECTION_DEFAULT = TEXT_DIRECTION_INHERIT;
+
+ /**
+ * Mask for use with private flags indicating bits used for text direction.
+ * @hide
+ */
+ static final int TEXT_DIRECTION_MASK = 0x00000007 << TEXT_DIRECTION_MASK_SHIFT;
+
+ /**
+ * Array of text direction flags for mapping attribute "textDirection" to correct
+ * flag value.
+ * @hide
+ */
+ private static final int[] TEXT_DIRECTION_FLAGS = {
+ TEXT_DIRECTION_INHERIT << TEXT_DIRECTION_MASK_SHIFT,
+ TEXT_DIRECTION_FIRST_STRONG << TEXT_DIRECTION_MASK_SHIFT,
+ TEXT_DIRECTION_ANY_RTL << TEXT_DIRECTION_MASK_SHIFT,
+ TEXT_DIRECTION_LTR << TEXT_DIRECTION_MASK_SHIFT,
+ TEXT_DIRECTION_RTL << TEXT_DIRECTION_MASK_SHIFT,
+ TEXT_DIRECTION_LOCALE << TEXT_DIRECTION_MASK_SHIFT
+ };
+
+ /**
+ * Indicates whether the view text direction has been resolved.
+ * @hide
+ */
+ static final int TEXT_DIRECTION_RESOLVED = 0x00000008 << TEXT_DIRECTION_MASK_SHIFT;
+
+ /**
+ * Bit shift to get the horizontal layout direction. (bits after DRAG_HOVERED)
+ * @hide
+ */
+ static final int TEXT_DIRECTION_RESOLVED_MASK_SHIFT = 10;
+
+ /**
+ * Mask for use with private flags indicating bits used for resolved text direction.
+ * @hide
+ */
+ static final int TEXT_DIRECTION_RESOLVED_MASK = 0x00000007 << TEXT_DIRECTION_RESOLVED_MASK_SHIFT;
+
+ /**
+ * Indicates whether the view text direction has been resolved to the "first strong" heuristic.
+ * @hide
+ */
+ static final int TEXT_DIRECTION_RESOLVED_DEFAULT =
+ TEXT_DIRECTION_FIRST_STRONG << TEXT_DIRECTION_RESOLVED_MASK_SHIFT;
/* End of masks for mPrivateFlags2 */
@@ -2647,82 +2752,6 @@
AccessibilityDelegate mAccessibilityDelegate;
/**
- * Text direction is inherited thru {@link ViewGroup}
- */
- public static final int TEXT_DIRECTION_INHERIT = 0;
-
- /**
- * Text direction is using "first strong algorithm". The first strong directional character
- * determines the paragraph direction. If there is no strong directional character, the
- * paragraph direction is the view's resolved layout direction.
- *
- */
- public static final int TEXT_DIRECTION_FIRST_STRONG = 1;
-
- /**
- * Text direction is using "any-RTL" algorithm. The paragraph direction is RTL if it contains
- * any strong RTL character, otherwise it is LTR if it contains any strong LTR characters.
- * If there are neither, the paragraph direction is the view's resolved layout direction.
- *
- */
- public static final int TEXT_DIRECTION_ANY_RTL = 2;
-
- /**
- * Text direction is forced to LTR.
- *
- */
- public static final int TEXT_DIRECTION_LTR = 3;
-
- /**
- * Text direction is forced to RTL.
- *
- */
- public static final int TEXT_DIRECTION_RTL = 4;
-
- /**
- * Text direction is coming from the system Locale.
- *
- */
- public static final int TEXT_DIRECTION_LOCALE = 5;
-
- /**
- * Default text direction is inherited
- *
- */
- protected static int DEFAULT_TEXT_DIRECTION = TEXT_DIRECTION_INHERIT;
-
- /**
- * The text direction that has been defined by {@link #setTextDirection(int)}.
- *
- */
- @ViewDebug.ExportedProperty(category = "text", mapping = {
- @ViewDebug.IntToString(from = TEXT_DIRECTION_INHERIT, to = "INHERIT"),
- @ViewDebug.IntToString(from = TEXT_DIRECTION_FIRST_STRONG, to = "FIRST_STRONG"),
- @ViewDebug.IntToString(from = TEXT_DIRECTION_ANY_RTL, to = "ANY_RTL"),
- @ViewDebug.IntToString(from = TEXT_DIRECTION_LTR, to = "LTR"),
- @ViewDebug.IntToString(from = TEXT_DIRECTION_RTL, to = "RTL"),
- @ViewDebug.IntToString(from = TEXT_DIRECTION_LOCALE, to = "LOCALE")
- })
- private int mTextDirection = DEFAULT_TEXT_DIRECTION;
-
- /**
- * The resolved text direction. This needs resolution if the value is
- * TEXT_DIRECTION_INHERIT. The resolution matches mTextDirection if it is
- * not TEXT_DIRECTION_INHERIT, otherwise resolution proceeds up the parent
- * chain of the view.
- *
- */
- @ViewDebug.ExportedProperty(category = "text", mapping = {
- @ViewDebug.IntToString(from = TEXT_DIRECTION_INHERIT, to = "INHERIT"),
- @ViewDebug.IntToString(from = TEXT_DIRECTION_FIRST_STRONG, to = "FIRST_STRONG"),
- @ViewDebug.IntToString(from = TEXT_DIRECTION_ANY_RTL, to = "ANY_RTL"),
- @ViewDebug.IntToString(from = TEXT_DIRECTION_LTR, to = "LTR"),
- @ViewDebug.IntToString(from = TEXT_DIRECTION_RTL, to = "RTL"),
- @ViewDebug.IntToString(from = TEXT_DIRECTION_LOCALE, to = "LOCALE")
- })
- private int mResolvedTextDirection = TEXT_DIRECTION_INHERIT;
-
- /**
* Consistency verifier for debugging purposes.
* @hide
*/
@@ -2739,7 +2768,10 @@
public View(Context context) {
mContext = context;
mResources = context != null ? context.getResources() : null;
- mViewFlags = SOUND_EFFECTS_ENABLED | HAPTIC_FEEDBACK_ENABLED | LAYOUT_DIRECTION_INHERIT;
+ mViewFlags = SOUND_EFFECTS_ENABLED | HAPTIC_FEEDBACK_ENABLED;
+ // Set layout and text direction defaults
+ mPrivateFlags2 = (LAYOUT_DIRECTION_DEFAULT << LAYOUT_DIRECTION_MASK_SHIFT) |
+ (TEXT_DIRECTION_DEFAULT << TEXT_DIRECTION_MASK_SHIFT);
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
setOverScrollMode(OVER_SCROLL_IF_CONTENT_SCROLLS);
mUserPaddingStart = -1;
@@ -2949,17 +2981,13 @@
}
break;
case com.android.internal.R.styleable.View_layoutDirection:
- // Clear any HORIZONTAL_DIRECTION flag already set
- viewFlagValues &= ~LAYOUT_DIRECTION_MASK;
- // Set the HORIZONTAL_DIRECTION flags depending on the value of the attribute
+ // Clear any layout direction flags (included resolved bits) already set
+ mPrivateFlags2 &= ~(LAYOUT_DIRECTION_MASK | LAYOUT_DIRECTION_RESOLVED_MASK);
+ // Set the layout direction flags depending on the value of the attribute
final int layoutDirection = a.getInt(attr, -1);
- if (layoutDirection != -1) {
- viewFlagValues |= LAYOUT_DIRECTION_FLAGS[layoutDirection];
- } else {
- // Set to default (LAYOUT_DIRECTION_INHERIT)
- viewFlagValues |= LAYOUT_DIRECTION_DEFAULT;
- }
- viewFlagMasks |= LAYOUT_DIRECTION_MASK;
+ final int value = (layoutDirection != -1) ?
+ LAYOUT_DIRECTION_FLAGS[layoutDirection] : LAYOUT_DIRECTION_DEFAULT;
+ mPrivateFlags2 |= (value << LAYOUT_DIRECTION_MASK_SHIFT);
break;
case com.android.internal.R.styleable.View_drawingCacheQuality:
final int cacheQuality = a.getInt(attr, 0);
@@ -3103,7 +3131,13 @@
setLayerType(a.getInt(attr, LAYER_TYPE_NONE), null);
break;
case R.styleable.View_textDirection:
- mTextDirection = a.getInt(attr, DEFAULT_TEXT_DIRECTION);
+ // Clear any text direction flag already set
+ mPrivateFlags2 &= ~TEXT_DIRECTION_MASK;
+ // Set the text direction flags depending on the value of the attribute
+ final int textDirection = a.getInt(attr, -1);
+ if (textDirection != -1) {
+ mPrivateFlags2 |= TEXT_DIRECTION_FLAGS[textDirection];
+ }
break;
}
}
@@ -4882,7 +4916,7 @@
@ViewDebug.IntToString(from = LAYOUT_DIRECTION_LOCALE, to = "LOCALE")
})
public int getLayoutDirection() {
- return mViewFlags & LAYOUT_DIRECTION_MASK;
+ return (mPrivateFlags2 & LAYOUT_DIRECTION_MASK) >> LAYOUT_DIRECTION_MASK_SHIFT;
}
/**
@@ -4899,9 +4933,13 @@
@RemotableViewMethod
public void setLayoutDirection(int layoutDirection) {
if (getLayoutDirection() != layoutDirection) {
+ // Reset the current layout direction and the resolved one
+ mPrivateFlags2 &= ~LAYOUT_DIRECTION_MASK;
resetResolvedLayoutDirection();
- // Setting the flag will also request a layout.
- setFlags(layoutDirection, LAYOUT_DIRECTION_MASK);
+ // Set the new layout direction (filtered) and ask for a layout pass
+ mPrivateFlags2 |=
+ ((layoutDirection << LAYOUT_DIRECTION_MASK_SHIFT) & LAYOUT_DIRECTION_MASK);
+ requestLayout();
}
}
@@ -4909,21 +4947,24 @@
* Returns the resolved layout direction for this view.
*
* @return {@link #LAYOUT_DIRECTION_RTL} if the layout direction is RTL or returns
- * {@link #LAYOUT_DIRECTION_LTR} id the layout direction is not RTL.
+ * {@link #LAYOUT_DIRECTION_LTR} if the layout direction is not RTL.
*/
@ViewDebug.ExportedProperty(category = "layout", mapping = {
- @ViewDebug.IntToString(from = LAYOUT_DIRECTION_LTR, to = "RESOLVED_DIRECTION_LTR"),
- @ViewDebug.IntToString(from = LAYOUT_DIRECTION_RTL, to = "RESOLVED_DIRECTION_RTL")
+ @ViewDebug.IntToString(from = LAYOUT_DIRECTION_LTR, to = "RESOLVED_DIRECTION_LTR"),
+ @ViewDebug.IntToString(from = LAYOUT_DIRECTION_RTL, to = "RESOLVED_DIRECTION_RTL")
})
public int getResolvedLayoutDirection() {
- resolveLayoutDirectionIfNeeded();
+ // The layout diretion will be resolved only if needed
+ if ((mPrivateFlags2 & LAYOUT_DIRECTION_RESOLVED) != LAYOUT_DIRECTION_RESOLVED) {
+ resolveLayoutDirection();
+ }
return ((mPrivateFlags2 & LAYOUT_DIRECTION_RESOLVED_RTL) == LAYOUT_DIRECTION_RESOLVED_RTL) ?
LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR;
}
/**
- * <p>Indicates whether or not this view's layout is right-to-left. This is resolved from
- * layout attribute and/or the inherited value from the parent.</p>
+ * Indicates whether or not this view's layout is right-to-left. This is resolved from
+ * layout attribute and/or the inherited value from the parent
*
* @return true if the layout is right-to-left.
*/
@@ -6940,10 +6981,6 @@
mParent.recomputeViewAttributes(this);
}
}
-
- if ((changed & LAYOUT_DIRECTION_MASK) != 0) {
- requestLayout();
- }
}
/**
@@ -7349,8 +7386,7 @@
* @see #setRotationY(float)
*/
public void setCameraDistance(float distance) {
- invalidateParentCaches();
- invalidate(false);
+ invalidateViewProperty(true, false);
ensureTransformationInfo();
final float dpi = mResources.getDisplayMetrics().densityDpi;
@@ -7363,7 +7399,7 @@
info.mCamera.setLocation(0.0f, 0.0f, -Math.abs(distance) / dpi);
info.mMatrixDirty = true;
- invalidate(false);
+ invalidateViewProperty(false, false);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setCameraDistance(distance);
}
@@ -7401,13 +7437,11 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mRotation != rotation) {
- invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mRotation = rotation;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setRotation(rotation);
}
@@ -7451,13 +7485,10 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mRotationY != rotationY) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mRotationY = rotationY;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setRotationY(rotationY);
}
@@ -7501,13 +7532,10 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mRotationX != rotationX) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mRotationX = rotationX;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setRotationX(rotationX);
}
@@ -7543,13 +7571,10 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mScaleX != scaleX) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mScaleX = scaleX;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setScaleX(scaleX);
}
@@ -7585,13 +7610,10 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mScaleY != scaleY) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mScaleY = scaleY;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setScaleY(scaleY);
}
@@ -7633,13 +7655,10 @@
mPrivateFlags |= PIVOT_EXPLICITLY_SET;
final TransformationInfo info = mTransformationInfo;
if (info.mPivotX != pivotX) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mPivotX = pivotX;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setPivotX(pivotX);
}
@@ -7680,13 +7699,10 @@
mPrivateFlags |= PIVOT_EXPLICITLY_SET;
final TransformationInfo info = mTransformationInfo;
if (info.mPivotY != pivotY) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mPivotY = pivotY;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setPivotY(pivotY);
}
@@ -7728,14 +7744,14 @@
ensureTransformationInfo();
if (mTransformationInfo.mAlpha != alpha) {
mTransformationInfo.mAlpha = alpha;
- invalidateParentCaches();
if (onSetAlpha((int) (alpha * 255))) {
mPrivateFlags |= ALPHA_SET;
// subclass is handling alpha - don't optimize rendering cache invalidation
+ invalidateParentCaches();
invalidate(true);
} else {
mPrivateFlags &= ~ALPHA_SET;
- invalidate(false);
+ invalidateViewProperty(true, false);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setAlpha(alpha);
}
@@ -8102,13 +8118,11 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mTranslationX != translationX) {
- invalidateParentCaches();
// Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mTranslationX = translationX;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setTranslationX(translationX);
}
@@ -8142,13 +8156,10 @@
ensureTransformationInfo();
final TransformationInfo info = mTransformationInfo;
if (info.mTranslationY != translationY) {
- invalidateParentCaches();
- // Double-invalidation is necessary to capture view's old and new areas
- invalidate(false);
+ invalidateViewProperty(true, false);
info.mTranslationY = translationY;
info.mMatrixDirty = true;
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
+ invalidateViewProperty(false, true);
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.setTranslationY(translationY);
}
@@ -8260,39 +8271,43 @@
final boolean matrixIsIdentity = mTransformationInfo == null
|| mTransformationInfo.mMatrixIsIdentity;
if (matrixIsIdentity) {
- final ViewParent p = mParent;
- if (p != null && mAttachInfo != null) {
- final Rect r = mAttachInfo.mTmpInvalRect;
- int minTop;
- int maxBottom;
- int yLoc;
- if (offset < 0) {
- minTop = mTop + offset;
- maxBottom = mBottom;
- yLoc = offset;
- } else {
- minTop = mTop;
- maxBottom = mBottom + offset;
- yLoc = 0;
+ if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+ invalidateViewProperty(false, false);
+ } else {
+ final ViewParent p = mParent;
+ if (p != null && mAttachInfo != null) {
+ final Rect r = mAttachInfo.mTmpInvalRect;
+ int minTop;
+ int maxBottom;
+ int yLoc;
+ if (offset < 0) {
+ minTop = mTop + offset;
+ maxBottom = mBottom;
+ yLoc = offset;
+ } else {
+ minTop = mTop;
+ maxBottom = mBottom + offset;
+ yLoc = 0;
+ }
+ r.set(0, yLoc, mRight - mLeft, maxBottom - minTop);
+ p.invalidateChild(this, r);
}
- r.set(0, yLoc, mRight - mLeft, maxBottom - minTop);
- p.invalidateChild(this, r);
}
} else {
- invalidate(false);
+ invalidateViewProperty(false, false);
}
mTop += offset;
mBottom += offset;
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.offsetTopBottom(offset);
+ invalidateViewProperty(false, false);
+ } else {
+ if (!matrixIsIdentity) {
+ invalidateViewProperty(false, true);
+ }
+ invalidateParentIfNeeded();
}
-
- if (!matrixIsIdentity) {
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
- }
- invalidateParentIfNeeded();
}
}
@@ -8307,36 +8322,40 @@
final boolean matrixIsIdentity = mTransformationInfo == null
|| mTransformationInfo.mMatrixIsIdentity;
if (matrixIsIdentity) {
- final ViewParent p = mParent;
- if (p != null && mAttachInfo != null) {
- final Rect r = mAttachInfo.mTmpInvalRect;
- int minLeft;
- int maxRight;
- if (offset < 0) {
- minLeft = mLeft + offset;
- maxRight = mRight;
- } else {
- minLeft = mLeft;
- maxRight = mRight + offset;
+ if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
+ invalidateViewProperty(false, false);
+ } else {
+ final ViewParent p = mParent;
+ if (p != null && mAttachInfo != null) {
+ final Rect r = mAttachInfo.mTmpInvalRect;
+ int minLeft;
+ int maxRight;
+ if (offset < 0) {
+ minLeft = mLeft + offset;
+ maxRight = mRight;
+ } else {
+ minLeft = mLeft;
+ maxRight = mRight + offset;
+ }
+ r.set(0, 0, maxRight - minLeft, mBottom - mTop);
+ p.invalidateChild(this, r);
}
- r.set(0, 0, maxRight - minLeft, mBottom - mTop);
- p.invalidateChild(this, r);
}
} else {
- invalidate(false);
+ invalidateViewProperty(false, false);
}
mLeft += offset;
mRight += offset;
if (USE_DISPLAY_LIST_PROPERTIES && mDisplayList != null) {
mDisplayList.offsetLeftRight(offset);
+ invalidateViewProperty(false, false);
+ } else {
+ if (!matrixIsIdentity) {
+ invalidateViewProperty(false, true);
+ }
+ invalidateParentIfNeeded();
}
-
- if (!matrixIsIdentity) {
- mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
- invalidate(false);
- }
- invalidateParentIfNeeded();
}
}
@@ -8741,6 +8760,62 @@
}
/**
+ * Quick invalidation for View property changes (alpha, translationXY, etc.). We don't want to
+ * set any flags or handle all of the cases handled by the default invalidation methods.
+ * Instead, we just want to schedule a traversal in ViewRootImpl with the appropriate
+ * dirty rect. This method calls into fast invalidation methods in ViewGroup that
+ * walk up the hierarchy, transforming the dirty rect as necessary.
+ *
+ * The method also handles normal invalidation logic if display list properties are not
+ * being used in this view. The invalidateParent and forceRedraw flags are used by that
+ * backup approach, to handle these cases used in the various property-setting methods.
+ *
+ * @param invalidateParent Force a call to invalidateParentCaches() if display list properties
+ * are not being used in this view
+ * @param forceRedraw Mark the view as DRAWN to force the invalidation to propagate, if display
+ * list properties are not being used in this view
+ */
+ void invalidateViewProperty(boolean invalidateParent, boolean forceRedraw) {
+ if (!USE_DISPLAY_LIST_PROPERTIES || mDisplayList == null ||
+ (mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION) {
+ if (invalidateParent) {
+ invalidateParentCaches();
+ }
+ if (forceRedraw) {
+ mPrivateFlags |= DRAWN; // force another invalidation with the new orientation
+ }
+ invalidate(false);
+ } else {
+ final AttachInfo ai = mAttachInfo;
+ final ViewParent p = mParent;
+ if (p != null && ai != null) {
+ final Rect r = ai.mTmpInvalRect;
+ r.set(0, 0, mRight - mLeft, mBottom - mTop);
+ if (mParent instanceof ViewGroup) {
+ ((ViewGroup) mParent).invalidateChildFast(this, r);
+ } else {
+ mParent.invalidateChild(this, r);
+ }
+ }
+ }
+ }
+
+ /**
+ * Utility method to transform a given Rect by the current matrix of this view.
+ */
+ void transformRect(final Rect rect) {
+ if (!getMatrix().isIdentity()) {
+ RectF boundingRect = mAttachInfo.mTmpTransformRect;
+ boundingRect.set(rect);
+ getMatrix().mapRect(boundingRect);
+ rect.set((int) (boundingRect.left - 0.5f),
+ (int) (boundingRect.top - 0.5f),
+ (int) (boundingRect.right + 0.5f),
+ (int) (boundingRect.bottom + 0.5f));
+ }
+ }
+
+ /**
* Used to indicate that the parent of this view should clear its caches. This functionality
* is used to force the parent to rebuild its display list (when hardware-accelerated),
* which is necessary when various parent-managed properties of the view change, such as
@@ -9759,7 +9834,7 @@
jumpDrawablesToCurrentState();
// Order is important here: LayoutDirection MUST be resolved before Padding
// and TextDirection
- resolveLayoutDirectionIfNeeded();
+ resolveLayoutDirection();
resolvePadding();
resolveTextDirection();
if (isFocused()) {
@@ -9790,31 +9865,24 @@
/**
* Resolve and cache the layout direction. LTR is set initially. This is implicitly supposing
* that the parent directionality can and will be resolved before its children.
+ * Will call {@link View#onResolvedLayoutDirectionChanged} when resolution is done.
*/
- private void resolveLayoutDirectionIfNeeded() {
- // Do not resolve if it is not needed
- if ((mPrivateFlags2 & LAYOUT_DIRECTION_RESOLVED) == LAYOUT_DIRECTION_RESOLVED) return;
-
+ public void resolveLayoutDirection() {
// Clear any previous layout direction resolution
- mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED_RTL;
+ mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED_MASK;
// Set resolved depending on layout direction
switch (getLayoutDirection()) {
case LAYOUT_DIRECTION_INHERIT:
- // We cannot do the resolution if there is no parent
- if (mParent == null) return;
-
// If this is root view, no need to look at parent's layout dir.
- if (mParent instanceof ViewGroup) {
+ if (canResolveLayoutDirection()) {
ViewGroup viewGroup = ((ViewGroup) mParent);
- // Check if the parent view group can resolve
- if (! viewGroup.canResolveLayoutDirection()) {
- return;
- }
if (viewGroup.getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) {
mPrivateFlags2 |= LAYOUT_DIRECTION_RESOLVED_RTL;
}
+ } else {
+ // Nothing to do, LTR by default
}
break;
case LAYOUT_DIRECTION_RTL:
@@ -9917,7 +9985,7 @@
public boolean canResolveLayoutDirection() {
switch (getLayoutDirection()) {
case LAYOUT_DIRECTION_INHERIT:
- return (mParent != null);
+ return (mParent != null) && (mParent instanceof ViewGroup);
default:
return true;
}
@@ -9928,8 +9996,8 @@
* when reset is done.
*/
public void resetResolvedLayoutDirection() {
- // Reset the current View resolution
- mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED;
+ // Reset the current resolved bits
+ mPrivateFlags2 &= ~LAYOUT_DIRECTION_RESOLVED_MASK;
onResolvedLayoutDirectionReset();
// Reset also the text direction
resetResolvedTextDirection();
@@ -9972,14 +10040,18 @@
destroyDrawingCache();
- destroyLayer();
-
- if (mDisplayList != null) {
- mDisplayList.invalidate();
- }
+ destroyLayer(false);
if (mAttachInfo != null) {
+ if (mDisplayList != null) {
+ mAttachInfo.mViewRootImpl.invalidateDisplayList(mDisplayList);
+ }
mAttachInfo.mViewRootImpl.cancelInvalidate(this);
+ } else {
+ if (mDisplayList != null) {
+ // Should never happen
+ mDisplayList.invalidate();
+ }
}
mCurrentAnimation = null;
@@ -10344,7 +10416,7 @@
// Destroy any previous software drawing cache if needed
switch (mLayerType) {
case LAYER_TYPE_HARDWARE:
- destroyLayer();
+ destroyLayer(false);
// fall through - non-accelerated views may use software layer mechanism instead
case LAYER_TYPE_SOFTWARE:
destroyDrawingCache();
@@ -10482,11 +10554,12 @@
* @see #setLayerType(int, android.graphics.Paint)
* @see #LAYER_TYPE_HARDWARE
*/
- boolean destroyLayer() {
+ boolean destroyLayer(boolean valid) {
if (mHardwareLayer != null) {
AttachInfo info = mAttachInfo;
if (info != null && info.mHardwareRenderer != null &&
- info.mHardwareRenderer.isEnabled() && info.mHardwareRenderer.validate()) {
+ info.mHardwareRenderer.isEnabled() &&
+ (valid || info.mHardwareRenderer.validate())) {
mHardwareLayer.destroy();
mHardwareLayer = null;
@@ -10510,7 +10583,7 @@
* @hide
*/
protected void destroyHardwareResources() {
- destroyLayer();
+ destroyLayer(true);
}
/**
@@ -11439,7 +11512,7 @@
layerType != LAYER_TYPE_HARDWARE;
int restoreTo = -1;
- if (!useDisplayListProperties) {
+ if (!useDisplayListProperties || transformToApply != null) {
restoreTo = canvas.save();
}
if (offsetForScroll) {
@@ -11473,11 +11546,9 @@
if (concatMatrix) {
// Undo the scroll translation, apply the transformation matrix,
// then redo the scroll translate to get the correct result.
- if (!hasDisplayList) {
- canvas.translate(-transX, -transY);
- canvas.concat(transformToApply.getMatrix());
- canvas.translate(transX, transY);
- }
+ canvas.translate(-transX, -transY);
+ canvas.concat(transformToApply.getMatrix());
+ canvas.translate(transX, transY);
parent.mGroupFlags |= ViewGroup.FLAG_CLEAR_TRANSFORMATION;
}
@@ -11506,12 +11577,10 @@
layerFlags |= Canvas.CLIP_TO_LAYER_SAVE_FLAG;
}
if (layerType == LAYER_TYPE_NONE) {
- if (!useDisplayListProperties) {
- final int scrollX = hasDisplayList ? 0 : sx;
- final int scrollY = hasDisplayList ? 0 : sy;
- canvas.saveLayerAlpha(scrollX, scrollY, scrollX + mRight - mLeft,
- scrollY + mBottom - mTop, multipliedAlpha, layerFlags);
- }
+ final int scrollX = hasDisplayList ? 0 : sx;
+ final int scrollY = hasDisplayList ? 0 : sy;
+ canvas.saveLayerAlpha(scrollX, scrollY, scrollX + mRight - mLeft,
+ scrollY + mBottom - mTop, multipliedAlpha, layerFlags);
}
} else {
// Alpha is handled by the child directly, clobber the layer's alpha
@@ -14445,8 +14514,16 @@
* {@link #TEXT_DIRECTION_RTL},
* {@link #TEXT_DIRECTION_LOCALE},
*/
+ @ViewDebug.ExportedProperty(category = "text", mapping = {
+ @ViewDebug.IntToString(from = TEXT_DIRECTION_INHERIT, to = "INHERIT"),
+ @ViewDebug.IntToString(from = TEXT_DIRECTION_FIRST_STRONG, to = "FIRST_STRONG"),
+ @ViewDebug.IntToString(from = TEXT_DIRECTION_ANY_RTL, to = "ANY_RTL"),
+ @ViewDebug.IntToString(from = TEXT_DIRECTION_LTR, to = "LTR"),
+ @ViewDebug.IntToString(from = TEXT_DIRECTION_RTL, to = "RTL"),
+ @ViewDebug.IntToString(from = TEXT_DIRECTION_LOCALE, to = "LOCALE")
+ })
public int getTextDirection() {
- return mTextDirection;
+ return (mPrivateFlags2 & TEXT_DIRECTION_MASK) >> TEXT_DIRECTION_MASK_SHIFT;
}
/**
@@ -14462,17 +14539,26 @@
* {@link #TEXT_DIRECTION_LOCALE},
*/
public void setTextDirection(int textDirection) {
- if (textDirection != mTextDirection) {
- mTextDirection = textDirection;
+ if (getTextDirection() != textDirection) {
+ // Reset the current text direction and the resolved one
+ mPrivateFlags2 &= ~TEXT_DIRECTION_MASK;
resetResolvedTextDirection();
+ // Set the new text direction
+ mPrivateFlags2 |= ((textDirection << TEXT_DIRECTION_MASK_SHIFT) & TEXT_DIRECTION_MASK);
requestLayout();
+ invalidate(true);
}
}
/**
* Return the resolved text direction.
*
- * @return the resolved text direction. Return one of:
+ * This needs resolution if the value is TEXT_DIRECTION_INHERIT. The resolution matches
+ * {@link #getTextDirection()}if it is not TEXT_DIRECTION_INHERIT, otherwise resolution proceeds
+ * up the parent chain of the view. if there is no parent, then it will return the default
+ * {@link #TEXT_DIRECTION_FIRST_STRONG}.
+ *
+ * @return the resolved text direction. Returns one of:
*
* {@link #TEXT_DIRECTION_FIRST_STRONG}
* {@link #TEXT_DIRECTION_ANY_RTL},
@@ -14481,10 +14567,11 @@
* {@link #TEXT_DIRECTION_LOCALE},
*/
public int getResolvedTextDirection() {
- if (mResolvedTextDirection == TEXT_DIRECTION_INHERIT) {
+ // The text direction will be resolved only if needed
+ if ((mPrivateFlags2 & TEXT_DIRECTION_RESOLVED) != TEXT_DIRECTION_RESOLVED) {
resolveTextDirection();
}
- return mResolvedTextDirection;
+ return (mPrivateFlags2 & TEXT_DIRECTION_RESOLVED_MASK) >> TEXT_DIRECTION_RESOLVED_MASK_SHIFT;
}
/**
@@ -14492,17 +14579,51 @@
* resolution is done.
*/
public void resolveTextDirection() {
- if (mResolvedTextDirection != TEXT_DIRECTION_INHERIT) {
- // Resolution has already been done.
- return;
+ // Reset any previous text direction resolution
+ mPrivateFlags2 &= ~(TEXT_DIRECTION_RESOLVED | TEXT_DIRECTION_RESOLVED_MASK);
+
+ // Set resolved text direction flag depending on text direction flag
+ final int textDirection = getTextDirection();
+ switch(textDirection) {
+ case TEXT_DIRECTION_INHERIT:
+ if (canResolveTextDirection()) {
+ ViewGroup viewGroup = ((ViewGroup) mParent);
+
+ // Set current resolved direction to the same value as the parent's one
+ final int parentResolvedDirection = viewGroup.getResolvedTextDirection();
+ switch (parentResolvedDirection) {
+ case TEXT_DIRECTION_FIRST_STRONG:
+ case TEXT_DIRECTION_ANY_RTL:
+ case TEXT_DIRECTION_LTR:
+ case TEXT_DIRECTION_RTL:
+ case TEXT_DIRECTION_LOCALE:
+ mPrivateFlags2 |=
+ (parentResolvedDirection << TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
+ break;
+ default:
+ // Default resolved direction is "first strong" heuristic
+ mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT;
+ }
+ } else {
+ // We cannot do the resolution if there is no parent, so use the default one
+ mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT;
+ }
+ break;
+ case TEXT_DIRECTION_FIRST_STRONG:
+ case TEXT_DIRECTION_ANY_RTL:
+ case TEXT_DIRECTION_LTR:
+ case TEXT_DIRECTION_RTL:
+ case TEXT_DIRECTION_LOCALE:
+ // Resolved direction is the same as text direction
+ mPrivateFlags2 |= (textDirection << TEXT_DIRECTION_RESOLVED_MASK_SHIFT);
+ break;
+ default:
+ // Default resolved direction is "first strong" heuristic
+ mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED_DEFAULT;
}
- if (mTextDirection != TEXT_DIRECTION_INHERIT) {
- mResolvedTextDirection = mTextDirection;
- } else if (mParent != null && mParent instanceof ViewGroup) {
- mResolvedTextDirection = ((ViewGroup) mParent).getResolvedTextDirection();
- } else {
- mResolvedTextDirection = TEXT_DIRECTION_FIRST_STRONG;
- }
+
+ // Set to resolved
+ mPrivateFlags2 |= TEXT_DIRECTION_RESOLVED;
onResolvedTextDirectionChanged();
}
@@ -14516,12 +14637,26 @@
}
/**
+ * Check if text direction resolution can be done.
+ *
+ * @return true if text direction resolution can be done otherwise return false.
+ */
+ public boolean canResolveTextDirection() {
+ switch (getTextDirection()) {
+ case TEXT_DIRECTION_INHERIT:
+ return (mParent != null) && (mParent instanceof ViewGroup);
+ default:
+ return true;
+ }
+ }
+
+ /**
* Reset resolved text direction. Text direction can be resolved with a call to
* getResolvedTextDirection(). Will call {@link View#onResolvedTextDirectionReset} when
* reset is done.
*/
public void resetResolvedTextDirection() {
- mResolvedTextDirection = TEXT_DIRECTION_INHERIT;
+ mPrivateFlags2 &= ~(TEXT_DIRECTION_RESOLVED | TEXT_DIRECTION_RESOLVED_MASK);
onResolvedTextDirectionReset();
}
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 1993ce6..6ccac78 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -1820,7 +1820,7 @@
* Resets the cancel next up flag.
* Returns true if the flag was previously set.
*/
- private boolean resetCancelNextUpFlag(View view) {
+ private static boolean resetCancelNextUpFlag(View view) {
if ((view.mPrivateFlags & CANCEL_NEXT_UP_EVENT) != 0) {
view.mPrivateFlags &= ~CANCEL_NEXT_UP_EVENT;
return true;
@@ -2679,15 +2679,6 @@
return child.draw(canvas, this, drawingTime);
}
- @Override
- public void requestLayout() {
- if (mChildrenCount > 0 && getAccessibilityNodeProvider() != null) {
- throw new IllegalStateException("Views with AccessibilityNodeProvider"
- + " can't have children.");
- }
- super.requestLayout();
- }
-
/**
*
* @param enabled True if children should be drawn with layers, false otherwise.
@@ -3109,11 +3100,6 @@
private void addViewInner(View child, int index, LayoutParams params,
boolean preventRequestLayout) {
- if (getAccessibilityNodeProvider() != null) {
- throw new IllegalStateException("Views with AccessibilityNodeProvider"
- + " can't have children.");
- }
-
if (mTransition != null) {
// Don't prevent other add transitions from completing, but cancel remove
// transitions to let them complete the process before we add to the container
@@ -3896,6 +3882,72 @@
}
/**
+ * Quick invalidation method called by View.invalidateViewProperty. This doesn't set the
+ * DRAWN flags and doesn't handle the Animation logic that the default invalidation methods
+ * do; all we want to do here is schedule a traversal with the appropriate dirty rect.
+ *
+ * @hide
+ */
+ public void invalidateChildFast(View child, final Rect dirty) {
+ ViewParent parent = this;
+
+ final AttachInfo attachInfo = mAttachInfo;
+ if (attachInfo != null) {
+ if (child.mLayerType != LAYER_TYPE_NONE) {
+ child.mLocalDirtyRect.union(dirty);
+ }
+
+ int left = child.mLeft;
+ int top = child.mTop;
+ if (!child.getMatrix().isIdentity()) {
+ child.transformRect(dirty);
+ }
+
+ do {
+ if (parent instanceof ViewGroup) {
+ ViewGroup parentVG = (ViewGroup) parent;
+ parent = parentVG.invalidateChildInParentFast(left, top, dirty);
+ left = parentVG.mLeft;
+ top = parentVG.mTop;
+ } else {
+ // Reached the top; this calls into the usual invalidate method in
+ // ViewRootImpl, which schedules a traversal
+ final int[] location = attachInfo.mInvalidateChildLocation;
+ location[0] = left;
+ location[1] = top;
+ parent = parent.invalidateChildInParent(location, dirty);
+ }
+ } while (parent != null);
+ }
+ }
+
+ /**
+ * Quick invalidation method that simply transforms the dirty rect into the parent's
+ * coordinate system, pruning the invalidation if the parent has already been invalidated.
+ */
+ private ViewParent invalidateChildInParentFast(int left, int top, final Rect dirty) {
+ if ((mPrivateFlags & DRAWN) == DRAWN ||
+ (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) {
+ dirty.offset(left - mScrollX, top - mScrollY);
+
+ if ((mGroupFlags & FLAG_CLIP_CHILDREN) == 0 ||
+ dirty.intersect(0, 0, mRight - mLeft, mBottom - mTop)) {
+
+ if (mLayerType != LAYER_TYPE_NONE) {
+ mLocalDirtyRect.union(dirty);
+ }
+ if (!getMatrix().isIdentity()) {
+ transformRect(dirty);
+ }
+
+ return mParent;
+ }
+ }
+
+ return null;
+ }
+
+ /**
* Offset a rectangle that is in a descendant's coordinate
* space into our coordinate space.
* @param descendant A descendant of this view
@@ -3986,6 +4038,7 @@
v.mBottom += offset;
if (USE_DISPLAY_LIST_PROPERTIES && v.mDisplayList != null) {
v.mDisplayList.offsetTopBottom(offset);
+ invalidateViewProperty(false, false);
}
}
}
diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java
index fe0e659..623b567 100644
--- a/core/java/android/view/ViewPropertyAnimator.java
+++ b/core/java/android/view/ViewPropertyAnimator.java
@@ -986,17 +986,22 @@
// Shouldn't happen, but just to play it safe
return;
}
+ boolean useDisplayListProperties = View.USE_DISPLAY_LIST_PROPERTIES &&
+ mView.mDisplayList != null;
+
// alpha requires slightly different treatment than the other (transform) properties.
// The logic in setAlpha() is not simply setting mAlpha, plus the invalidation
// logic is dependent on how the view handles an internal call to onSetAlpha().
// We track what kinds of properties are set, and how alpha is handled when it is
// set, and perform the invalidation steps appropriately.
boolean alphaHandled = false;
- mView.invalidateParentCaches();
+ if (!useDisplayListProperties) {
+ mView.invalidateParentCaches();
+ }
float fraction = animation.getAnimatedFraction();
int propertyMask = propertyBundle.mPropertyMask;
if ((propertyMask & TRANSFORM_MASK) != 0) {
- mView.invalidate(false);
+ mView.invalidateViewProperty(false, false);
}
ArrayList<NameValuesHolder> valueList = propertyBundle.mNameValuesHolder;
if (valueList != null) {
@@ -1013,11 +1018,17 @@
}
if ((propertyMask & TRANSFORM_MASK) != 0) {
mView.mTransformationInfo.mMatrixDirty = true;
- mView.mPrivateFlags |= View.DRAWN; // force another invalidation
+ if (!useDisplayListProperties) {
+ mView.mPrivateFlags |= View.DRAWN; // force another invalidation
+ }
}
// invalidate(false) in all cases except if alphaHandled gets set to true
// via the call to setAlphaNoInvalidation(), above
- mView.invalidate(alphaHandled);
+ if (alphaHandled) {
+ mView.invalidate(true);
+ } else {
+ mView.invalidateViewProperty(false, false);
+ }
}
}
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 4472f8c..befc1c6 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -117,6 +117,8 @@
private static final boolean DEBUG_CONFIGURATION = false || LOCAL_LOGV;
private static final boolean DEBUG_FPS = false;
+ private static final boolean USE_RENDER_THREAD = false;
+
/**
* Set this system property to true to force the view hierarchy to render
* at 60 Hz. This can be used to measure the potential framerate.
@@ -300,6 +302,8 @@
private long mFpsPrevTime = -1;
private int mFpsNumFrames;
+ private final ArrayList<DisplayList> mDisplayLists = new ArrayList<DisplayList>(24);
+
/**
* see {@link #playSoundEffect(int)}
*/
@@ -402,23 +406,27 @@
* false otherwise
*/
private static boolean isRenderThreadRequested(Context context) {
- synchronized (sRenderThreadQueryLock) {
- if (!sRenderThreadQueried) {
- final PackageManager packageManager = context.getPackageManager();
- final String packageName = context.getApplicationInfo().packageName;
- try {
- ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName,
- PackageManager.GET_META_DATA);
- if (applicationInfo.metaData != null) {
- sUseRenderThread = applicationInfo.metaData.getBoolean(
- "android.graphics.renderThread", false);
+ if (USE_RENDER_THREAD) {
+ synchronized (sRenderThreadQueryLock) {
+ if (!sRenderThreadQueried) {
+ final PackageManager packageManager = context.getPackageManager();
+ final String packageName = context.getApplicationInfo().packageName;
+ try {
+ ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName,
+ PackageManager.GET_META_DATA);
+ if (applicationInfo.metaData != null) {
+ sUseRenderThread = applicationInfo.metaData.getBoolean(
+ "android.graphics.renderThread", false);
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ } finally {
+ sRenderThreadQueried = true;
}
- } catch (PackageManager.NameNotFoundException e) {
- } finally {
- sRenderThreadQueried = true;
}
+ return sUseRenderThread;
}
- return sUseRenderThread;
+ } else {
+ return false;
}
}
@@ -690,7 +698,7 @@
return;
}
- boolean renderThread = isRenderThreadRequested(context);
+ final boolean renderThread = isRenderThreadRequested(context);
if (renderThread) {
Log.i(HardwareRenderer.LOG_TAG, "Render threat initiated");
}
@@ -833,7 +841,9 @@
localDirty.union(dirty.left, dirty.top, dirty.right, dirty.bottom);
// Intersect with the bounds of the window to skip
// updates that lie outside of the visible region
- localDirty.intersect(0, 0, mWidth, mHeight);
+ final float appScale = mAttachInfo.mApplicationScale;
+ localDirty.intersect(0, 0,
+ (int) (mWidth * appScale + 0.5f), (int) (mHeight * appScale + 0.5f));
if (!mWillDrawSoon) {
scheduleTraversals();
@@ -1799,7 +1809,7 @@
*
* @return The measure spec to use to measure the root view.
*/
- private int getRootMeasureSpec(int windowSize, int rootDimension) {
+ private static int getRootMeasureSpec(int windowSize, int rootDimension) {
int measureSpec;
switch (rootDimension) {
@@ -1909,7 +1919,9 @@
}
private void performDraw() {
- if (!mAttachInfo.mScreenOn) return;
+ if (!mAttachInfo.mScreenOn && !mReportNextDraw) {
+ return;
+ }
final long drawStartTime;
if (ViewDebug.DEBUG_LATENCY) {
@@ -2210,6 +2222,17 @@
}
}
+ void invalidateDisplayLists() {
+ final ArrayList<DisplayList> displayLists = mDisplayLists;
+ final int count = displayLists.size();
+
+ for (int i = 0; i < count; i++) {
+ displayLists.get(i).invalidate();
+ }
+
+ displayLists.clear();
+ }
+
boolean scrollToRectOrFocus(Rect rectangle, boolean immediate) {
final View.AttachInfo attachInfo = mAttachInfo;
final Rect ci = attachInfo.mContentInsets;
@@ -2409,12 +2432,12 @@
mAccessibilityInteractionConnectionManager);
removeSendWindowContentChangedCallback();
+ destroyHardwareRenderer();
+
mView = null;
mAttachInfo.mRootView = null;
mAttachInfo.mSurface = null;
- destroyHardwareRenderer();
-
mSurface.release();
if (mInputQueueCallback != null && mInputQueue != null) {
@@ -2516,6 +2539,7 @@
private final static int MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_TEXT = 22;
private final static int MSG_PROCESS_INPUT_EVENTS = 23;
private final static int MSG_DISPATCH_SCREEN_STATE = 24;
+ private final static int MSG_INVALIDATE_DISPLAY_LIST = 25;
final class ViewRootHandler extends Handler {
@Override
@@ -2567,6 +2591,10 @@
return "MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_TEXT";
case MSG_PROCESS_INPUT_EVENTS:
return "MSG_PROCESS_INPUT_EVENTS";
+ case MSG_DISPATCH_SCREEN_STATE:
+ return "MSG_DISPATCH_SCREEN_STATE";
+ case MSG_INVALIDATE_DISPLAY_LIST:
+ return "MSG_INVALIDATE_DISPLAY_LIST";
}
return super.getMessageName(message);
}
@@ -2777,9 +2805,13 @@
handleScreenStateChange(msg.arg1 == 1);
}
} break;
+ case MSG_INVALIDATE_DISPLAY_LIST: {
+ invalidateDisplayLists();
+ } break;
}
}
}
+
final ViewRootHandler mHandler = new ViewRootHandler();
/**
@@ -2861,7 +2893,7 @@
* @param focused The currently focused view.
* @return An appropriate view, or null if no such view exists.
*/
- private ViewGroup findAncestorToTakeFocusInTouchMode(View focused) {
+ private static ViewGroup findAncestorToTakeFocusInTouchMode(View focused) {
ViewParent parent = focused.getParent();
while (parent instanceof ViewGroup) {
final ViewGroup vgParent = (ViewGroup) parent;
@@ -3731,7 +3763,7 @@
}
}
- private void getGfxInfo(View view, int[] info) {
+ private static void getGfxInfo(View view, int[] info) {
DisplayList displayList = view.mDisplayList;
info[0]++;
if (displayList != null) {
@@ -3752,6 +3784,7 @@
if (immediate) {
doDie();
} else {
+ destroyHardwareRenderer();
mHandler.sendEmptyMessage(MSG_DIE);
}
}
@@ -3794,10 +3827,18 @@
}
private void destroyHardwareRenderer() {
- if (mAttachInfo.mHardwareRenderer != null) {
- mAttachInfo.mHardwareRenderer.destroy(true);
- mAttachInfo.mHardwareRenderer = null;
- mAttachInfo.mHardwareAccelerated = false;
+ AttachInfo attachInfo = mAttachInfo;
+ HardwareRenderer hardwareRenderer = attachInfo.mHardwareRenderer;
+
+ if (hardwareRenderer != null) {
+ if (mView != null) {
+ hardwareRenderer.destroyHardwareResources(mView);
+ }
+ hardwareRenderer.destroy(true);
+ hardwareRenderer.setRequested(false);
+
+ attachInfo.mHardwareRenderer = null;
+ attachInfo.mHardwareAccelerated = false;
}
}
@@ -4136,6 +4177,14 @@
mInvalidateOnAnimationRunnable.addViewRect(info);
}
+ public void invalidateDisplayList(DisplayList displayList) {
+ mDisplayLists.add(displayList);
+
+ mHandler.removeMessages(MSG_INVALIDATE_DISPLAY_LIST);
+ Message msg = mHandler.obtainMessage(MSG_INVALIDATE_DISPLAY_LIST);
+ mHandler.sendMessage(msg);
+ }
+
public void cancelInvalidate(View view) {
mHandler.removeMessages(MSG_INVALIDATE, view);
// fixme: might leak the AttachInfo.InvalidateInfo objects instead of returning
diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java
index 0e4a30f..f2ee9f9 100644
--- a/core/java/android/view/WindowManagerImpl.java
+++ b/core/java/android/view/WindowManagerImpl.java
@@ -354,7 +354,7 @@
View removeViewLocked(int index) {
ViewRootImpl root = mRoots[index];
View view = root.getView();
-
+
// Don't really remove until we have matched all calls to add().
root.mAddNesting--;
if (root.mAddNesting > 0) {
diff --git a/core/java/android/view/animation/Animation.java b/core/java/android/view/animation/Animation.java
index dc8c71b7..d92ebcd 100644
--- a/core/java/android/view/animation/Animation.java
+++ b/core/java/android/view/animation/Animation.java
@@ -875,7 +875,7 @@
* otherwise.
*
* @param currentTime Where we are in the animation. This is wall clock time.
- * @param outTransformation A tranformation object that is provided by the
+ * @param outTransformation A transformation object that is provided by the
* caller and will be filled in by the animation.
* @param scale Scaling factor to apply to any inputs to the transform operation, such
* pivot points being rotated or scaled around.
diff --git a/core/java/android/view/animation/Transformation.java b/core/java/android/view/animation/Transformation.java
index cf210c8..e8c1d23 100644
--- a/core/java/android/view/animation/Transformation.java
+++ b/core/java/android/view/animation/Transformation.java
@@ -112,6 +112,16 @@
}
/**
+ * Like {@link #compose(Transformation)} but does this.postConcat(t) of
+ * the transformation matrix.
+ * @hide
+ */
+ public void postCompose(Transformation t) {
+ mAlpha *= t.getAlpha();
+ mMatrix.postConcat(t.getMatrix());
+ }
+
+ /**
* @return The 3x3 Matrix representing the trnasformation to apply to the
* coordinates of the object being animated
*/
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index 0e5ff20..17dbde8 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -403,6 +403,9 @@
mIInputContext.finishComposingText();
} catch (RemoteException e) {
}
+ // Check focus again in case that "onWindowFocus" is called before
+ // handling this message.
+ checkFocus(mHasBeenInactive);
}
}
return;
@@ -1173,13 +1176,17 @@
}
}
+ private void checkFocus(boolean forceNewFocus) {
+ if (checkFocusNoStartInput(forceNewFocus)) {
+ startInputInner(null, 0, 0, 0);
+ }
+ }
+
/**
* @hide
*/
public void checkFocus() {
- if (checkFocusNoStartInput(false)) {
- startInputInner(null, 0, 0, 0);
- }
+ checkFocus(false);
}
private boolean checkFocusNoStartInput(boolean forceNewFocus) {
diff --git a/core/java/android/view/inputmethod/InputMethodSubtype.java b/core/java/android/view/inputmethod/InputMethodSubtype.java
index 18dec52..c22750e 100644
--- a/core/java/android/view/inputmethod/InputMethodSubtype.java
+++ b/core/java/android/view/inputmethod/InputMethodSubtype.java
@@ -27,6 +27,7 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.IllegalFormatException;
import java.util.List;
import java.util.Locale;
@@ -45,6 +46,9 @@
private static final String TAG = InputMethodSubtype.class.getSimpleName();
private static final String EXTRA_VALUE_PAIR_SEPARATOR = ",";
private static final String EXTRA_VALUE_KEY_VALUE_SEPARATOR = "=";
+ // TODO: remove this
+ private static final String EXTRA_KEY_UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME =
+ "UntranslatableReplacementStringInSubtypeName";
private final boolean mIsAuxiliary;
private final boolean mOverridesImplicitlyEnabledSubtype;
@@ -215,7 +219,17 @@
final CharSequence subtypeName = context.getPackageManager().getText(
packageName, mSubtypeNameResId, appInfo);
if (!TextUtils.isEmpty(subtypeName)) {
- return String.format(subtypeName.toString(), localeStr);
+ final String replacementString =
+ containsExtraValueKey(EXTRA_KEY_UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME)
+ ? getExtraValueOf(EXTRA_KEY_UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME)
+ : localeStr;
+ try {
+ return String.format(
+ subtypeName.toString(), replacementString != null ? replacementString : "");
+ } catch (IllegalFormatException e) {
+ Slog.w(TAG, "Found illegal format in subtype name("+ subtypeName + "): " + e);
+ return "";
+ }
} else {
return localeStr;
}
diff --git a/core/java/android/webkit/AutoCompletePopup.java b/core/java/android/webkit/AutoCompletePopup.java
index 674428a..b26156c 100644
--- a/core/java/android/webkit/AutoCompletePopup.java
+++ b/core/java/android/webkit/AutoCompletePopup.java
@@ -16,7 +16,6 @@
package android.webkit;
import android.content.Context;
-import android.graphics.Rect;
import android.os.Handler;
import android.os.Message;
import android.text.Editable;
@@ -41,13 +40,10 @@
private boolean mIsAutoFillProfileSet;
private Handler mHandler;
private int mQueryId;
- private Rect mNodeBounds = new Rect();
- private int mNodeLayerId;
private ListPopupWindow mPopup;
private Filter mFilter;
private CharSequence mText;
private ListAdapter mAdapter;
- private boolean mIsFocused;
private View mAnchor;
private WebViewClassic.WebViewInputConnection mInputConnection;
private WebViewClassic mWebView;
@@ -102,13 +98,6 @@
return false;
}
- public void setFocused(boolean isFocused) {
- mIsFocused = isFocused;
- if (!mIsFocused) {
- mPopup.dismiss();
- }
- }
-
public void setText(CharSequence text) {
mText = text;
if (mFilter != null) {
@@ -139,20 +128,14 @@
resetRect();
}
- public void setNodeBounds(Rect nodeBounds, int layerId) {
- mNodeBounds.set(nodeBounds);
- mNodeLayerId = layerId;
- resetRect();
- }
-
public void resetRect() {
- int left = mWebView.contentToViewX(mNodeBounds.left);
- int right = mWebView.contentToViewX(mNodeBounds.right);
+ int left = mWebView.contentToViewX(mWebView.mEditTextBounds.left);
+ int right = mWebView.contentToViewX(mWebView.mEditTextBounds.right);
int width = right - left;
mPopup.setWidth(width);
- int bottom = mWebView.contentToViewY(mNodeBounds.bottom);
- int top = mWebView.contentToViewY(mNodeBounds.top);
+ int bottom = mWebView.contentToViewY(mWebView.mEditTextBounds.bottom);
+ int top = mWebView.contentToViewY(mWebView.mEditTextBounds.top);
int height = bottom - top;
AbsoluteLayout.LayoutParams lp =
@@ -178,13 +161,6 @@
}
}
- public void scrollDelta(int layerId, int dx, int dy) {
- if (layerId == mNodeLayerId) {
- mNodeBounds.offset(dx, dy);
- resetRect();
- }
- }
-
// AdapterView.OnItemClickListener implementation
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
@@ -230,11 +206,6 @@
@Override
public void onFilterComplete(int count) {
- if (!mIsFocused) {
- mPopup.dismiss();
- return;
- }
-
boolean showDropDown = (count > 0) &&
(mInputConnection.getIsAutoFillable() || mText.length() > 0);
if (showDropDown) {
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index f09e29d..72af251 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -448,7 +448,7 @@
// loadType is not used yet
if (isMainFrame) {
mCommitted = true;
- mWebViewCore.getWebView().mViewManager.postResetStateAll();
+ mWebViewCore.getWebViewClassic().mViewManager.postResetStateAll();
}
}
@@ -742,7 +742,8 @@
url = url.replaceFirst(ANDROID_ASSET, "");
try {
AssetManager assets = mContext.getAssets();
- return assets.open(url, AssetManager.ACCESS_STREAMING);
+ Uri uri = Uri.parse(url);
+ return assets.open(uri.getPath(), AssetManager.ACCESS_STREAMING);
} catch (IOException e) {
return null;
}
@@ -909,7 +910,7 @@
* Close this frame and window.
*/
private void closeWindow(WebViewCore w) {
- mCallbackProxy.onCloseWindow(w.getWebView());
+ mCallbackProxy.onCloseWindow(w.getWebViewClassic());
}
// XXX: Must match PolicyAction in FrameLoaderTypes.h in webcore
diff --git a/core/java/android/webkit/FindActionModeCallback.java b/core/java/android/webkit/FindActionModeCallback.java
index 964cf3e..6c331ac 100644
--- a/core/java/android/webkit/FindActionModeCallback.java
+++ b/core/java/android/webkit/FindActionModeCallback.java
@@ -45,7 +45,6 @@
private int mNumberOfMatches;
private int mActiveMatchIndex;
private ActionMode mActionMode;
- private String mLastFind;
FindActionModeCallback(Context context) {
mCustomView = LayoutInflater.from(context).inflate(
@@ -134,13 +133,12 @@
mWebView.clearMatches();
mMatches.setVisibility(View.GONE);
mMatchesFound = false;
- mLastFind = null;
+ mWebView.findAll(null);
} else {
mMatchesFound = true;
mMatches.setVisibility(View.INVISIBLE);
mNumberOfMatches = 0;
- mLastFind = find.toString();
- mWebView.findAllAsync(mLastFind);
+ mWebView.findAllAsync(find.toString());
}
}
@@ -150,9 +148,8 @@
mInput.showSoftInput(mEditText, 0);
}
- public void updateMatchCount(int matchIndex, int matchCount,
- String findText) {
- if (mLastFind != null && mLastFind.equals(findText)) {
+ public void updateMatchCount(int matchIndex, int matchCount, boolean isNewFind) {
+ if (!isNewFind) {
mNumberOfMatches = matchCount;
mActiveMatchIndex = matchIndex;
updateMatchesString();
diff --git a/core/java/android/webkit/HTML5Audio.java b/core/java/android/webkit/HTML5Audio.java
index 8e1f573..689884f 100644
--- a/core/java/android/webkit/HTML5Audio.java
+++ b/core/java/android/webkit/HTML5Audio.java
@@ -183,7 +183,7 @@
resetMediaPlayer();
mContext = webViewCore.getContext();
mIsPrivateBrowsingEnabledGetter = new IsPrivateBrowsingEnabledGetter(
- webViewCore.getContext().getMainLooper(), webViewCore.getWebView());
+ webViewCore.getContext().getMainLooper(), webViewCore.getWebViewClassic());
}
private void resetMediaPlayer() {
diff --git a/core/java/android/webkit/HTML5VideoFullScreen.java b/core/java/android/webkit/HTML5VideoFullScreen.java
index fac549d..730ad08 100644
--- a/core/java/android/webkit/HTML5VideoFullScreen.java
+++ b/core/java/android/webkit/HTML5VideoFullScreen.java
@@ -112,6 +112,18 @@
}
};
+ MediaPlayer.OnVideoSizeChangedListener mSizeChangedListener =
+ new MediaPlayer.OnVideoSizeChangedListener() {
+ @Override
+ public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
+ mVideoWidth = mp.getVideoWidth();
+ mVideoHeight = mp.getVideoHeight();
+ if (mVideoWidth != 0 && mVideoHeight != 0) {
+ mVideoSurfaceView.getHolder().setFixedSize(mVideoWidth, mVideoHeight);
+ }
+ }
+ };
+
private SurfaceView getSurfaceView() {
return mVideoSurfaceView;
}
@@ -150,6 +162,7 @@
mc.setSystemUiVisibility(mLayout.getSystemUiVisibility());
setMediaController(mc);
mPlayer.setScreenOnWhilePlaying(true);
+ mPlayer.setOnVideoSizeChangedListener(mSizeChangedListener);
prepareDataAndDisplayMode(mProxy);
}
diff --git a/core/java/android/webkit/HTML5VideoViewProxy.java b/core/java/android/webkit/HTML5VideoViewProxy.java
index 1644b06..5fa4bad 100644
--- a/core/java/android/webkit/HTML5VideoViewProxy.java
+++ b/core/java/android/webkit/HTML5VideoViewProxy.java
@@ -146,6 +146,12 @@
// Save the inline video info and inherit it in the full screen
int savePosition = 0;
if (mHTML5VideoView != null) {
+ // We don't allow enter full screen mode while the previous
+ // full screen video hasn't finished yet.
+ if (!mHTML5VideoView.fullScreenExited() && mHTML5VideoView.isFullScreenMode()) {
+ Log.w(LOGTAG, "Try to reenter the full screen mode");
+ return;
+ }
// If we are playing the same video, then it is better to
// save the current position.
if (layerId == mHTML5VideoView.getVideoLayerId()) {
@@ -718,7 +724,7 @@
* @return a new HTML5VideoViewProxy object.
*/
public static HTML5VideoViewProxy getInstance(WebViewCore webViewCore, int nativePtr) {
- return new HTML5VideoViewProxy(webViewCore.getWebView(), nativePtr);
+ return new HTML5VideoViewProxy(webViewCore.getWebViewClassic(), nativePtr);
}
/* package */ WebViewClassic getWebView() {
diff --git a/core/java/android/webkit/WebSettingsClassic.java b/core/java/android/webkit/WebSettingsClassic.java
index 6850eea..c41bc00 100644
--- a/core/java/android/webkit/WebSettingsClassic.java
+++ b/core/java/android/webkit/WebSettingsClassic.java
@@ -121,9 +121,6 @@
private boolean mForceUserScalable = false;
// AutoFill Profile data
- /**
- * @hide for now, pending API council approval.
- */
public static class AutoFillProfile {
private int mUniqueId;
private String mFullName;
@@ -644,7 +641,6 @@
/**
* Set the double-tap zoom of the page in percent. Default is 100.
* @param doubleTapZoom A percent value for increasing or decreasing the double-tap zoom.
- * @hide
*/
public void setDoubleTapZoom(int doubleTapZoom) {
if (mDoubleTapZoom != doubleTapZoom) {
@@ -656,7 +652,6 @@
/**
* Get the double-tap zoom of the page in percent.
* @return A percent value describing the double-tap zoom.
- * @hide
*/
public int getDoubleTapZoom() {
return mDoubleTapZoom;
@@ -1012,7 +1007,6 @@
/**
* Set the number of pages cached by the WebKit for the history navigation.
* @param size A non-negative integer between 0 (no cache) and 20 (max).
- * @hide
*/
public synchronized void setPageCacheCapacity(int size) {
if (size < 0) size = 0;
@@ -1108,7 +1102,6 @@
/**
* Tell the WebView to use Skia's hardware accelerated rendering path
* @param flag True if the WebView should use Skia's hw-accel path
- * @hide
*/
public synchronized void setHardwareAccelSkiaEnabled(boolean flag) {
if (mHardwareAccelSkia != flag) {
@@ -1119,7 +1112,6 @@
/**
* @return True if the WebView is using hardware accelerated skia
- * @hide
*/
public synchronized boolean getHardwareAccelSkiaEnabled() {
return mHardwareAccelSkia;
@@ -1128,7 +1120,6 @@
/**
* Tell the WebView to show the visual indicator
* @param flag True if the WebView should show the visual indicator
- * @hide
*/
public synchronized void setShowVisualIndicator(boolean flag) {
if (mShowVisualIndicator != flag) {
@@ -1139,7 +1130,6 @@
/**
* @return True if the WebView is showing the visual indicator
- * @hide
*/
public synchronized boolean getShowVisualIndicator() {
return mShowVisualIndicator;
@@ -1283,7 +1273,6 @@
* @param flag True if the WebView should enable WebWorkers.
* Note that this flag only affects V8. JSC does not have
* an equivalent setting.
- * @hide
*/
public synchronized void setWorkersEnabled(boolean flag) {
if (mWorkersEnabled != flag) {
@@ -1305,8 +1294,8 @@
/**
* Sets whether XSS Auditor is enabled.
+ * Only used by LayoutTestController.
* @param flag Whether XSS Auditor should be enabled.
- * @hide Only used by LayoutTestController.
*/
public synchronized void setXSSAuditorEnabled(boolean flag) {
if (mXSSAuditorEnabled != flag) {
@@ -1507,7 +1496,6 @@
* of an HTML page to fit the screen. This conflicts with attempts by
* the UI to zoom in and out of an image, so it is set false by default.
* @param shrink Set true to let webkit shrink the standalone image to fit.
- * {@hide}
*/
public void setShrinksStandaloneImagesToFit(boolean shrink) {
if (mShrinksStandaloneImagesToFit != shrink) {
@@ -1520,7 +1508,6 @@
* Specify the maximum decoded image size. The default is
* 2 megs for small memory devices and 8 megs for large memory devices.
* @param size The maximum decoded size, or zero to set to the default.
- * @hide
*/
public void setMaximumDecodedImageSize(long size) {
if (mMaximumDecodedImageSize != size) {
@@ -1562,7 +1549,6 @@
/**
* Returns whether the viewport metatag can disable zooming
- * @hide
*/
public boolean forceUserScalable() {
return mForceUserScalable;
@@ -1571,7 +1557,6 @@
/**
* Sets whether viewport metatag can disable zooming.
* @param flag Whether or not to forceably enable user scalable.
- * @hide
*/
public synchronized void setForceUserScalable(boolean flag) {
mForceUserScalable = flag;
@@ -1584,9 +1569,6 @@
}
}
- /**
- * @hide
- */
public synchronized void setAutoFillEnabled(boolean enabled) {
// AutoFill is always disabled in private browsing mode.
boolean autoFillEnabled = enabled && !mPrivateBrowsingEnabled;
@@ -1596,16 +1578,10 @@
}
}
- /**
- * @hide
- */
public synchronized boolean getAutoFillEnabled() {
return mAutoFillEnabled;
}
- /**
- * @hide
- */
public synchronized void setAutoFillProfile(AutoFillProfile profile) {
if (mAutoFillProfile != profile) {
mAutoFillProfile = profile;
@@ -1613,9 +1589,6 @@
}
}
- /**
- * @hide
- */
public synchronized AutoFillProfile getAutoFillProfile() {
return mAutoFillProfile;
}
@@ -1633,18 +1606,12 @@
}
}
- /**
- * @hide
- */
public void setProperty(String key, String value) {
if (mWebView.nativeSetProperty(key, value)) {
- mWebView.contentInvalidateAll();
+ mWebView.invalidate();
}
}
- /**
- * @hide
- */
public String getProperty(String key) {
return mWebView.nativeGetProperty(key);
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index a561577..d225594 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -21,6 +21,7 @@
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Paint;
import android.graphics.Picture;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -311,6 +312,24 @@
public static final String SCHEME_GEO = "geo:0,0?q=";
/**
+ * Interface to listen for find results.
+ * @hide
+ */
+ public interface FindListener {
+ /**
+ * Notify the listener about progress made by a find operation.
+ *
+ * @param numberOfMatches How many matches have been found.
+ * @param activeMatchOrdinal The zero-based ordinal of the currently selected match.
+ * @param isDoneCounting Whether the find operation has actually completed. The listener
+ * may be notified multiple times while the operation is underway, and the numberOfMatches
+ * value should not be considered final unless isDoneCounting is true.
+ */
+ public void onFindResultReceived(int numberOfMatches, int activeMatchOrdinal,
+ boolean isDoneCounting);
+ }
+
+ /**
* Interface to listen for new pictures as they change.
* @deprecated This interface is now obsolete.
*/
@@ -1226,7 +1245,19 @@
}
- /*
+ /**
+ * Register the listener to be notified as find-on-page operations progress.
+ * This will replace the current listener.
+ *
+ * @param listener An implementation of {@link WebView#FindListener}.
+ * @hide
+ */
+ public void setFindListener(FindListener listener) {
+ checkThread();
+ mProvider.setFindListener(listener);
+ }
+
+ /**
* Highlight and scroll to the next occurance of String in findAll.
* Wraps the page infinitely, and scrolls. Must be called after
* calling findAll.
@@ -1238,8 +1269,9 @@
mProvider.findNext(forward);
}
- /*
+ /**
* Find all instances of find on the page and highlight them.
+ *
* @param find String to find.
* @return int The number of occurances of the String "find"
* that were found.
@@ -1250,6 +1282,18 @@
}
/**
+ * Find all instances of find on the page and highlight them,
+ * asynchronously.
+ *
+ * @param find String to find.
+ * @hide
+ */
+ public void findAllAsync(String find) {
+ checkThread();
+ mProvider.findAllAsync(find);
+ }
+
+ /**
* Start an ActionMode for finding text in this WebView. Only works if this
* WebView is attached to the view system.
* @param text If non-null, will be the initial text to search for.
@@ -1955,4 +1999,10 @@
public void setBackgroundColor(int color) {
mProvider.getViewDelegate().setBackgroundColor(color);
}
+
+ @Override
+ public void setLayerType(int layerType, Paint paint) {
+ super.setLayerType(layerType, paint);
+ mProvider.getViewDelegate().setLayerType(layerType, paint);
+ }
}
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java
index 09ce1e2..ab2db22 100644
--- a/core/java/android/webkit/WebViewClassic.java
+++ b/core/java/android/webkit/WebViewClassic.java
@@ -71,6 +71,8 @@
import android.util.EventLog;
import android.util.Log;
import android.view.Display;
+import android.view.GestureDetector;
+import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.HardwareCanvas;
@@ -114,6 +116,7 @@
import android.widget.ListView;
import android.widget.OverScroller;
import android.widget.PopupWindow;
+import android.widget.Scroller;
import android.widget.TextView;
import android.widget.Toast;
@@ -345,8 +348,6 @@
*
* @hide
*/
-// TODO: Remove duplicated API documentation and @hide from fields and methods, and
-// checkThread() call. (All left in for now to ease branch merging.)
// TODO: Check if any WebView published API methods are called from within here, and if so
// we should bounce the call out via the proxy to enable any sub-class to override it.
@Widget
@@ -802,6 +803,51 @@
}
}
+ private class TextScrollListener extends SimpleOnGestureListener {
+ @Override
+ public boolean onFling(MotionEvent e1, MotionEvent e2,
+ float velocityX, float velocityY) {
+ int maxScrollX = mEditTextContent.width() -
+ mEditTextBounds.width();
+ int maxScrollY = mEditTextContent.height() -
+ mEditTextBounds.height();
+
+ int contentVelocityX = viewToContentDimension((int)-velocityX);
+ int contentVelocityY = viewToContentDimension((int)-velocityY);
+ mEditTextScroller.fling(-mEditTextContent.left,
+ -mEditTextContent.top,
+ contentVelocityX, contentVelocityY,
+ 0, maxScrollX, 0, maxScrollY);
+ return true;
+ }
+
+ @Override
+ public boolean onScroll(MotionEvent e1, MotionEvent e2,
+ float distanceX, float distanceY) {
+ // Scrollable edit text. Scroll it.
+ int newScrollX = deltaToTextScroll(
+ -mEditTextContent.left, mEditTextContent.width(),
+ mEditTextBounds.width(),
+ (int) distanceX);
+ int newScrollY = deltaToTextScroll(
+ -mEditTextContent.top, mEditTextContent.height(),
+ mEditTextBounds.height(),
+ (int) distanceY);
+ scrollEditText(newScrollX, newScrollY);
+ return true;
+ }
+
+ private int deltaToTextScroll(int oldScroll, int contentSize,
+ int boundsSize, int delta) {
+ int newScroll = oldScroll +
+ viewToContentDimension(delta);
+ int maxScroll = contentSize - boundsSize;
+ newScroll = Math.min(maxScroll, newScroll);
+ newScroll = Math.max(0, newScroll);
+ return newScroll;
+ }
+ }
+
// The listener to capture global layout change event.
private InnerGlobalLayoutListener mGlobalLayoutListener = null;
@@ -829,7 +875,12 @@
WebViewInputConnection mInputConnection = null;
private int mFieldPointer;
private PastePopupWindow mPasteWindow;
- AutoCompletePopup mAutoCompletePopup;
+ private AutoCompletePopup mAutoCompletePopup;
+ private GestureDetector mGestureDetector;
+ Rect mEditTextBounds = new Rect();
+ Rect mEditTextContent = new Rect();
+ int mEditTextLayerId;
+ boolean mIsEditingText = false;
private static class OnTrimMemoryListener implements ComponentCallbacks2 {
private static OnTrimMemoryListener sInstance = null;
@@ -985,6 +1036,7 @@
// true when the touch movement exceeds the slop
private boolean mConfirmMove;
+ private boolean mTouchInEditText;
// if true, touch events will be first processed by WebCore, if prevent
// default is not set, the UI will continue handle them.
@@ -1033,6 +1085,9 @@
// pages with the space bar, in pixels.
private static final int PAGE_SCROLL_OVERLAP = 24;
+ // Time between successive calls to text scroll fling animation
+ private static final int TEXT_SCROLL_ANIMATION_DELAY_MS = 16;
+
/**
* These prevent calling requestLayout if either dimension is fixed. This
* depends on the layout parameters and the measure specs.
@@ -1066,6 +1121,7 @@
// Used by OverScrollGlow
OverScroller mScroller;
+ Scroller mEditTextScroller;
private boolean mInOverScrollMode = false;
private static Paint mOverScrollBackground;
@@ -1195,6 +1251,9 @@
static final int RELOCATE_AUTO_COMPLETE_POPUP = 146;
static final int FOCUS_NODE_CHANGED = 147;
static final int AUTOFILL_FORM = 148;
+ static final int ANIMATE_TEXT_SCROLL = 149;
+ static final int EDIT_TEXT_SIZE_CHANGED = 150;
+ static final int SHOW_CARET_HANDLE = 151;
private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID;
private static final int LAST_PACKAGE_MSG_ID = HIT_TEST_RESULT;
@@ -1380,6 +1439,9 @@
// Used to notify listeners of a new picture.
private PictureListener mPictureListener;
+ // Used to notify listeners about find-on-page results.
+ private WebView.FindListener mFindListener;
+
/**
* Refer to {@link WebView#requestFocusNodeHref(Message)} for more information
*/
@@ -1400,8 +1462,6 @@
*/
@Override
public void init(Map<String, Object> javaScriptInterfaces, boolean privateBrowsing) {
- checkThread();
-
Context context = mContext;
// Used by the chrome stack to find application paths
@@ -1429,10 +1489,11 @@
}
mAutoFillData = new WebViewCore.AutoFillData();
+ mGestureDetector = new GestureDetector(mContext, new TextScrollListener());
+ mEditTextScroller = new Scroller(context);
}
- // === START: WebView Proxy binding ===
- // Keep the webview proxy / SPI related stuff in this section, to minimize merge conflicts.
+ // WebViewProvider bindings
static class Factory implements WebViewFactoryProvider, WebViewFactoryProvider.Statics {
@Override
@@ -1521,8 +1582,6 @@
mWebViewPrivate.setScrollYRaw(mScrollY);
}
- // === END: WebView Proxy binding ===
-
private static class TrustStorageListener extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
@@ -1903,7 +1962,6 @@
*/
@Override
public void setHorizontalScrollbarOverlay(boolean overlay) {
- checkThread();
mOverlayHorizontalScrollbar = overlay;
}
@@ -1912,7 +1970,6 @@
*/
@Override
public void setVerticalScrollbarOverlay(boolean overlay) {
- checkThread();
mOverlayVerticalScrollbar = overlay;
}
@@ -1921,7 +1978,6 @@
*/
@Override
public boolean overlayHorizontalScrollbar() {
- checkThread();
return mOverlayHorizontalScrollbar;
}
@@ -1930,7 +1986,6 @@
*/
@Override
public boolean overlayVerticalScrollbar() {
- checkThread();
return mOverlayVerticalScrollbar;
}
@@ -1956,7 +2011,6 @@
/**
* Returns the height (in pixels) of the embedded title bar (if any). Does not care about
* scrolling
- * @hide
*/
protected int getTitleHeight() {
if (mWebView instanceof TitleBarDelegate) {
@@ -1973,7 +2027,6 @@
public int getVisibleTitleHeight() {
// Actually, this method returns the height of the embedded title bar if one is set via the
// hidden setEmbeddedTitleBar method.
- checkThread();
return getVisibleTitleHeightImpl();
}
@@ -2019,7 +2072,6 @@
*/
@Override
public SslCertificate getCertificate() {
- checkThread();
return mCertificate;
}
@@ -2028,7 +2080,6 @@
*/
@Override
public void setCertificate(SslCertificate certificate) {
- checkThread();
if (DebugFlags.WEB_VIEW) {
Log.v(LOGTAG, "setCertificate=" + certificate);
}
@@ -2045,7 +2096,6 @@
*/
@Override
public void savePassword(String host, String username, String password) {
- checkThread();
mDatabase.setUsernamePassword(host, username, password);
}
@@ -2055,7 +2105,6 @@
@Override
public void setHttpAuthUsernamePassword(String host, String realm,
String username, String password) {
- checkThread();
mDatabase.setHttpAuthUsernamePassword(host, realm, username, password);
}
@@ -2064,7 +2113,6 @@
*/
@Override
public String[] getHttpAuthUsernamePassword(String host, String realm) {
- checkThread();
return mDatabase.getHttpAuthUsernamePassword(host, realm);
}
@@ -2104,7 +2152,6 @@
*/
@Override
public void destroy() {
- checkThread();
destroyImpl();
}
@@ -2137,7 +2184,6 @@
*/
@Deprecated
public static void enablePlatformNotifications() {
- checkThread();
synchronized (WebViewClassic.class) {
sNotificationsEnabled = true;
Context context = JniUtil.getContext();
@@ -2151,7 +2197,6 @@
*/
@Deprecated
public static void disablePlatformNotifications() {
- checkThread();
synchronized (WebViewClassic.class) {
sNotificationsEnabled = false;
Context context = JniUtil.getContext();
@@ -2165,10 +2210,9 @@
*
* @param flags JS engine flags in a String
*
- * @hide This is an implementation detail.
+ * This is an implementation detail.
*/
public void setJsFlags(String flags) {
- checkThread();
mWebViewCore.sendMessage(EventHub.SET_JS_FLAGS, flags);
}
@@ -2177,17 +2221,14 @@
*/
@Override
public void setNetworkAvailable(boolean networkUp) {
- checkThread();
mWebViewCore.sendMessage(EventHub.SET_NETWORK_STATE,
networkUp ? 1 : 0, 0);
}
/**
* Inform WebView about the current network type.
- * {@hide}
*/
public void setNetworkType(String type, String subtype) {
- checkThread();
Map<String, String> map = new HashMap<String, String>();
map.put("type", type);
map.put("subtype", subtype);
@@ -2199,7 +2240,6 @@
*/
@Override
public WebBackForwardList saveState(Bundle outState) {
- checkThread();
if (outState == null) {
return null;
}
@@ -2251,7 +2291,6 @@
@Override
@Deprecated
public boolean savePicture(Bundle b, final File dest) {
- checkThread();
if (dest == null || b == null) {
return false;
}
@@ -2313,7 +2352,6 @@
@Override
@Deprecated
public boolean restorePicture(Bundle b, File src) {
- checkThread();
if (src == null || b == null) {
return false;
}
@@ -2359,7 +2397,6 @@
* of WebView.
* @param stream The {@link OutputStream} to save to
* @return True if saved successfully
- * @hide
*/
public boolean saveViewState(OutputStream stream) {
try {
@@ -2375,7 +2412,6 @@
* {@link #saveViewState(OutputStream)} for more information.
* @param stream The {@link InputStream} to load from
* @return True if loaded successfully
- * @hide
*/
public boolean loadViewState(InputStream stream) {
try {
@@ -2405,7 +2441,6 @@
*/
@Override
public WebBackForwardList restoreState(Bundle inState) {
- checkThread();
WebBackForwardList returnList = null;
if (inState == null) {
return returnList;
@@ -2462,7 +2497,6 @@
*/
@Override
public void loadUrl(String url, Map<String, String> additionalHttpHeaders) {
- checkThread();
loadUrlImpl(url, additionalHttpHeaders);
}
@@ -2480,7 +2514,6 @@
*/
@Override
public void loadUrl(String url) {
- checkThread();
loadUrlImpl(url);
}
@@ -2496,7 +2529,6 @@
*/
@Override
public void postUrl(String url, byte[] postData) {
- checkThread();
if (URLUtil.isNetworkUrl(url)) {
switchOutDrawHistory();
WebViewCore.PostUrlData arg = new WebViewCore.PostUrlData();
@@ -2514,7 +2546,6 @@
*/
@Override
public void loadData(String data, String mimeType, String encoding) {
- checkThread();
loadDataImpl(data, mimeType, encoding);
}
@@ -2535,7 +2566,6 @@
@Override
public void loadDataWithBaseURL(String baseUrl, String data,
String mimeType, String encoding, String historyUrl) {
- checkThread();
if (baseUrl != null && baseUrl.toLowerCase().startsWith("data:")) {
loadDataImpl(data, mimeType, encoding);
@@ -2557,7 +2587,6 @@
*/
@Override
public void saveWebArchive(String filename) {
- checkThread();
saveWebArchiveImpl(filename, false, null);
}
@@ -2579,7 +2608,6 @@
*/
@Override
public void saveWebArchive(String basename, boolean autoname, ValueCallback<String> callback) {
- checkThread();
saveWebArchiveImpl(basename, autoname, callback);
}
@@ -2594,7 +2622,6 @@
*/
@Override
public void stopLoading() {
- checkThread();
// TODO: should we clear all the messages in the queue before sending
// STOP_LOADING?
switchOutDrawHistory();
@@ -2606,7 +2633,6 @@
*/
@Override
public void reload() {
- checkThread();
clearHelpers();
switchOutDrawHistory();
mWebViewCore.sendMessage(EventHub.RELOAD);
@@ -2617,7 +2643,6 @@
*/
@Override
public boolean canGoBack() {
- checkThread();
WebBackForwardList l = mCallbackProxy.getBackForwardList();
synchronized (l) {
if (l.getClearPending()) {
@@ -2633,7 +2658,6 @@
*/
@Override
public void goBack() {
- checkThread();
goBackOrForwardImpl(-1);
}
@@ -2642,7 +2666,6 @@
*/
@Override
public boolean canGoForward() {
- checkThread();
WebBackForwardList l = mCallbackProxy.getBackForwardList();
synchronized (l) {
if (l.getClearPending()) {
@@ -2658,7 +2681,6 @@
*/
@Override
public void goForward() {
- checkThread();
goBackOrForwardImpl(1);
}
@@ -2667,7 +2689,6 @@
*/
@Override
public boolean canGoBackOrForward(int steps) {
- checkThread();
WebBackForwardList l = mCallbackProxy.getBackForwardList();
synchronized (l) {
if (l.getClearPending()) {
@@ -2684,7 +2705,6 @@
*/
@Override
public void goBackOrForward(int steps) {
- checkThread();
goBackOrForwardImpl(steps);
}
@@ -2705,7 +2725,6 @@
*/
@Override
public boolean isPrivateBrowsingEnabled() {
- checkThread();
return getSettings().isPrivateBrowsingEnabled();
}
@@ -2727,7 +2746,6 @@
*/
@Override
public boolean pageUp(boolean top) {
- checkThread();
if (mNativeClass == 0) {
return false;
}
@@ -2752,7 +2770,6 @@
*/
@Override
public boolean pageDown(boolean bottom) {
- checkThread();
if (mNativeClass == 0) {
return false;
}
@@ -2776,7 +2793,6 @@
*/
@Override
public void clearView() {
- checkThread();
mContentWidth = 0;
mContentHeight = 0;
setBaseLayer(0, null, false, false);
@@ -2788,7 +2804,6 @@
*/
@Override
public Picture capturePicture() {
- checkThread();
if (mNativeClass == 0) return null;
Picture result = new Picture();
nativeCopyBaseContentToPicture(result);
@@ -2800,7 +2815,6 @@
*/
@Override
public float getScale() {
- checkThread();
return mZoomManager.getScale();
}
@@ -2818,7 +2832,6 @@
*/
@Override
public void setInitialScale(int scaleInPercent) {
- checkThread();
mZoomManager.setInitialScaleInPercent(scaleInPercent);
}
@@ -2827,7 +2840,6 @@
*/
@Override
public void invokeZoomPicker() {
- checkThread();
if (!getSettings().supportZoom()) {
Log.w(LOGTAG, "This WebView doesn't support zoom.");
return;
@@ -2841,7 +2853,6 @@
*/
@Override
public HitTestResult getHitTestResult() {
- checkThread();
return mInitialHitTestResult;
}
@@ -2877,7 +2888,6 @@
*/
@Override
public void requestFocusNodeHref(Message hrefMsg) {
- checkThread();
if (hrefMsg == null) {
return;
}
@@ -2900,7 +2910,6 @@
*/
@Override
public void requestImageRef(Message msg) {
- checkThread();
if (0 == mNativeClass) return; // client isn't initialized
String url = mFocusedNode != null ? mFocusedNode.mImageUrl : null;
Bundle data = msg.getData();
@@ -2954,7 +2963,6 @@
* along with it vertically, while remaining in view horizontally. Pass
* null to remove the title bar from the WebView, and return to drawing
* the WebView normally without translating to account for the title bar.
- * @hide
*/
public void setEmbeddedTitleBar(View v) {
if (mWebView instanceof TitleBarDelegate) {
@@ -2976,7 +2984,6 @@
* Set where to render the embedded title bar
* NO_GRAVITY at the top of the page
* TOP at the top of the screen
- * @hide
*/
public void setTitleBarGravity(int gravity) {
mTitleGravity = gravity;
@@ -3356,7 +3363,6 @@
return getViewHeight();
}
- /** @hide */
@Override
public void onDrawVerticalScrollBar(Canvas canvas,
Drawable scrollBar,
@@ -3405,7 +3411,6 @@
*/
@Override
public String getUrl() {
- checkThread();
WebHistoryItem h = mCallbackProxy.getBackForwardList().getCurrentItem();
return h != null ? h.getUrl() : null;
}
@@ -3415,7 +3420,6 @@
*/
@Override
public String getOriginalUrl() {
- checkThread();
WebHistoryItem h = mCallbackProxy.getBackForwardList().getCurrentItem();
return h != null ? h.getOriginalUrl() : null;
}
@@ -3425,7 +3429,6 @@
*/
@Override
public String getTitle() {
- checkThread();
WebHistoryItem h = mCallbackProxy.getBackForwardList().getCurrentItem();
return h != null ? h.getTitle() : null;
}
@@ -3435,7 +3438,6 @@
*/
@Override
public Bitmap getFavicon() {
- checkThread();
WebHistoryItem h = mCallbackProxy.getBackForwardList().getCurrentItem();
return h != null ? h.getFavicon() : null;
}
@@ -3454,7 +3456,6 @@
*/
@Override
public int getProgress() {
- checkThread();
return mCallbackProxy.getProgress();
}
@@ -3463,7 +3464,6 @@
*/
@Override
public int getContentHeight() {
- checkThread();
return mContentHeight;
}
@@ -3475,9 +3475,6 @@
return mContentWidth;
}
- /**
- * @hide
- */
public int getPageBackgroundColor() {
return nativeGetBackgroundColor();
}
@@ -3487,7 +3484,6 @@
*/
@Override
public void pauseTimers() {
- checkThread();
mWebViewCore.sendMessage(EventHub.PAUSE_TIMERS);
}
@@ -3496,7 +3492,6 @@
*/
@Override
public void resumeTimers() {
- checkThread();
mWebViewCore.sendMessage(EventHub.RESUME_TIMERS);
}
@@ -3505,7 +3500,6 @@
*/
@Override
public void onPause() {
- checkThread();
if (!mIsPaused) {
mIsPaused = true;
mWebViewCore.sendMessage(EventHub.ON_PAUSE);
@@ -3544,7 +3538,6 @@
*/
@Override
public void onResume() {
- checkThread();
if (mIsPaused) {
mIsPaused = false;
mWebViewCore.sendMessage(EventHub.ON_RESUME);
@@ -3576,7 +3569,6 @@
*/
@Override
public void freeMemory() {
- checkThread();
mWebViewCore.sendMessage(EventHub.FREE_MEMORY);
}
@@ -3585,7 +3577,6 @@
*/
@Override
public void clearCache(boolean includeDiskFiles) {
- checkThread();
// Note: this really needs to be a static method as it clears cache for all
// WebView. But we need mWebViewCore to send message to WebCore thread, so
// we can't make this static.
@@ -3598,7 +3589,6 @@
*/
@Override
public void clearFormData() {
- checkThread();
if (mAutoCompletePopup != null) {
mAutoCompletePopup.clearAdapter();
}
@@ -3609,7 +3599,6 @@
*/
@Override
public void clearHistory() {
- checkThread();
mCallbackProxy.getBackForwardList().setClearPending();
mWebViewCore.sendMessage(EventHub.CLEAR_HISTORY);
}
@@ -3619,7 +3608,6 @@
*/
@Override
public void clearSslPreferences() {
- checkThread();
mWebViewCore.sendMessage(EventHub.CLEAR_SSL_PREF_TABLE);
}
@@ -3628,16 +3616,22 @@
*/
@Override
public WebBackForwardList copyBackForwardList() {
- checkThread();
return mCallbackProxy.getBackForwardList().clone();
}
/**
+ * See {@link WebView#setFindListener(WebView.FindListener)}.
+ * @hide
+ */
+ public void setFindListener(WebView.FindListener listener) {
+ mFindListener = listener;
+ }
+
+ /**
* See {@link WebView#findNext(boolean)}
*/
@Override
public void findNext(boolean forward) {
- checkThread();
if (0 == mNativeClass) return; // client isn't initialized
mWebViewCore.sendMessage(EventHub.FIND_NEXT, forward ? 1 : 0);
}
@@ -3650,17 +3644,14 @@
return findAllBody(find, false);
}
- /**
- * @hide
- */
public void findAllAsync(String find) {
findAllBody(find, true);
}
private int findAllBody(String find, boolean isAsync) {
- checkThread();
if (0 == mNativeClass) return 0; // client isn't initialized
mLastFind = find;
+ if (find == null) return 0;
mWebViewCore.removeMessages(EventHub.FIND_ALL);
WebViewCore.FindAllRequest request = new
WebViewCore.FindAllRequest(find);
@@ -3694,7 +3685,6 @@
* @return boolean True if the find dialog is shown, false otherwise.
*/
public boolean showFindDialog(String text, boolean showIme) {
- checkThread();
FindActionModeCallback callback = new FindActionModeCallback(mContext);
if (mWebView.getParent() == null || mWebView.startActionMode(callback) == null) {
// Could not start the action mode, so end Find on page
@@ -3763,12 +3753,10 @@
* @return the address, or if no address is found, return null.
*/
public static String findAddress(String addr) {
- checkThread();
return findAddress(addr, false);
}
/**
- * @hide
* Return the first substring consisting of the address of a physical
* location. Currently, only addresses in the United States are detected,
* and consist of:
@@ -3798,7 +3786,6 @@
*/
@Override
public void clearMatches() {
- checkThread();
if (mNativeClass == 0)
return;
mWebViewCore.removeMessages(EventHub.FIND_ALL);
@@ -3828,7 +3815,6 @@
*/
@Override
public void documentHasImages(Message response) {
- checkThread();
if (response == null) {
return;
}
@@ -3837,8 +3823,6 @@
/**
* Request the scroller to abort any ongoing animation
- *
- * @hide
*/
public void stopScroll() {
mScroller.forceFinished(true);
@@ -3915,8 +3899,10 @@
mSelectCursorExtent.offset(dx, dy);
}
}
- if (mAutoCompletePopup != null) {
- mAutoCompletePopup.scrollDelta(mCurrentScrollingLayerId, dx, dy);
+ if (mAutoCompletePopup != null &&
+ mCurrentScrollingLayerId == mEditTextLayerId) {
+ mEditTextBounds.offset(dx, dy);
+ mAutoCompletePopup.resetRect();
}
nativeScrollLayer(mCurrentScrollingLayerId, x, y);
mScrollingLayerRect.left = x;
@@ -4260,7 +4246,6 @@
*/
@Override
public void setWebViewClient(WebViewClient client) {
- checkThread();
mCallbackProxy.setWebViewClient(client);
}
@@ -4268,7 +4253,7 @@
* Gets the WebViewClient
* @return the current WebViewClient instance.
*
- * @hide This is an implementation detail.
+ * This is an implementation detail.
*/
public WebViewClient getWebViewClient() {
return mCallbackProxy.getWebViewClient();
@@ -4279,7 +4264,6 @@
*/
@Override
public void setDownloadListener(DownloadListener listener) {
- checkThread();
mCallbackProxy.setDownloadListener(listener);
}
@@ -4288,7 +4272,6 @@
*/
@Override
public void setWebChromeClient(WebChromeClient client) {
- checkThread();
mCallbackProxy.setWebChromeClient(client);
}
@@ -4296,7 +4279,7 @@
* Gets the chrome handler.
* @return the current WebChromeClient instance.
*
- * @hide This is an implementation detail.
+ * This is an implementation detail.
*/
public WebChromeClient getWebChromeClient() {
return mCallbackProxy.getWebChromeClient();
@@ -4307,7 +4290,6 @@
* WebBackForwardListClient for handling new items and changes in the
* history index.
* @param client An implementation of WebBackForwardListClient.
- * {@hide}
*/
public void setWebBackForwardListClient(WebBackForwardListClient client) {
mCallbackProxy.setWebBackForwardListClient(client);
@@ -4315,7 +4297,6 @@
/**
* Gets the WebBackForwardListClient.
- * {@hide}
*/
public WebBackForwardListClient getWebBackForwardListClient() {
return mCallbackProxy.getWebBackForwardListClient();
@@ -4327,21 +4308,14 @@
@Override
@Deprecated
public void setPictureListener(PictureListener listener) {
- checkThread();
mPictureListener = listener;
}
- /**
- * {@hide}
- */
/* FIXME: Debug only! Remove for SDK! */
public void externalRepresentation(Message callback) {
mWebViewCore.sendMessage(EventHub.REQUEST_EXT_REPRESENTATION, callback);
}
- /**
- * {@hide}
- */
/* FIXME: Debug only! Remove for SDK! */
public void documentAsText(Message callback) {
mWebViewCore.sendMessage(EventHub.REQUEST_DOC_AS_TEXT, callback);
@@ -4352,7 +4326,6 @@
*/
@Override
public void addJavascriptInterface(Object object, String name) {
- checkThread();
if (object == null) {
return;
}
@@ -4367,7 +4340,6 @@
*/
@Override
public void removeJavascriptInterface(String interfaceName) {
- checkThread();
if (mWebViewCore != null) {
WebViewCore.JSInterfaceData arg = new WebViewCore.JSInterfaceData();
arg.mInterfaceName = interfaceName;
@@ -4382,7 +4354,6 @@
*/
@Override
public WebSettingsClassic getSettings() {
- checkThread();
return (mWebViewCore != null) ? mWebViewCore.getSettings() : null;
}
@@ -4391,7 +4362,6 @@
*/
@Deprecated
public static synchronized PluginList getPluginList() {
- checkThread();
return new PluginList();
}
@@ -4400,7 +4370,6 @@
*/
@Deprecated
public void refreshPlugins(boolean reloadOpenPages) {
- checkThread();
}
//-------------------------------------------------------------------------
@@ -4704,7 +4673,7 @@
/**
* Select the word at the last click point.
*
- * @hide This is an implementation detail.
+ * This is an implementation detail.
*/
public boolean selectText() {
int x = viewToContentX(mLastTouchX + getScrollX());
@@ -4844,12 +4813,10 @@
* startX, startY, endX, endY
*/
private void getSelectionHandles(int[] handles) {
- handles[0] = mSelectCursorBase.right;
- handles[1] = mSelectCursorBase.bottom -
- (mSelectCursorBase.height() / 4);
+ handles[0] = mSelectCursorBase.left;
+ handles[1] = mSelectCursorBase.bottom;
handles[2] = mSelectCursorExtent.left;
- handles[3] = mSelectCursorExtent.bottom
- - (mSelectCursorExtent.height() / 4);
+ handles[3] = mSelectCursorExtent.bottom;
if (!nativeIsBaseFirst(mNativeClass)) {
int swap = handles[0];
handles[0] = handles[2];
@@ -5057,7 +5024,7 @@
/**
* Dump the display tree to "/sdcard/displayTree.txt"
*
- * @hide debug only
+ * debug only
*/
public void dumpDisplayTree() {
nativeDumpDisplayTree(getUrl());
@@ -5067,7 +5034,7 @@
* Dump the dom tree to adb shell if "toFile" is False, otherwise dump it to
* "/sdcard/domTree.txt"
*
- * @hide debug only
+ * debug only
*/
public void dumpDomTree(boolean toFile) {
mWebViewCore.sendMessage(EventHub.DUMP_DOMTREE, toFile ? 1 : 0, 0);
@@ -5077,7 +5044,7 @@
* Dump the render tree to adb shell if "toFile" is False, otherwise dump it
* to "/sdcard/renderTree.txt"
*
- * @hide debug only
+ * debug only
*/
public void dumpRenderTree(boolean toFile) {
mWebViewCore.sendMessage(EventHub.DUMP_RENDERTREE, toFile ? 1 : 0, 0);
@@ -5086,7 +5053,7 @@
/**
* Called by DRT on UI thread, need to proxy to WebCore thread.
*
- * @hide debug only
+ * debug only
*/
public void useMockDeviceOrientation() {
mWebViewCore.sendMessage(EventHub.USE_MOCK_DEVICE_ORIENTATION);
@@ -5095,7 +5062,7 @@
/**
* Called by DRT on WebCore thread.
*
- * @hide debug only
+ * debug only
*/
public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha,
boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) {
@@ -5391,9 +5358,7 @@
private boolean setupWebkitSelect() {
syncSelectionCursors();
- if (mIsCaretSelection) {
- showPasteWindow();
- } else if (!startSelectActionMode()) {
+ if (!mIsCaretSelection && !startSelectActionMode()) {
selectionDone();
return false;
}
@@ -5434,13 +5399,12 @@
@Override
@Deprecated
public void emulateShiftHeld() {
- checkThread();
}
/**
* Select all of the text in this WebView.
*
- * @hide This is an implementation detail.
+ * This is an implementation detail.
*/
public void selectAll() {
mWebViewCore.sendMessage(EventHub.SELECT_ALL);
@@ -5462,7 +5426,6 @@
if (!mIsCaretSelection) {
updateWebkitSelection();
}
- mIsCaretSelection = false;
invalidate(); // redraw without selection
mAutoScrollX = 0;
mAutoScrollY = 0;
@@ -5473,7 +5436,7 @@
/**
* Copy the selection to the clipboard
*
- * @hide This is an implementation detail.
+ * This is an implementation detail.
*/
public boolean copySelection() {
boolean copiedSomething = false;
@@ -5500,7 +5463,7 @@
/**
* Cut the selected text into the clipboard
*
- * @hide This is an implementation detail
+ * This is an implementation detail
*/
public void cutSelection() {
copySelection();
@@ -5512,7 +5475,7 @@
/**
* Paste text from the clipboard to the cursor position.
*
- * @hide This is an implementation detail
+ * This is an implementation detail
*/
public void pasteFromClipboard() {
ClipboardManager cm = (ClipboardManager)mContext
@@ -5528,7 +5491,7 @@
}
/**
- * @hide This is an implementation detail.
+ * This is an implementation detail.
*/
public SearchBox getSearchBox() {
if ((mWebViewCore == null) || (mWebViewCore.getBrowserFrame() == null)) {
@@ -5561,6 +5524,7 @@
addAccessibilityApisToJavaScript();
mTouchEventQueue.reset();
+ updateHwAccelerated();
}
@Override
@@ -5580,6 +5544,7 @@
}
removeAccessibilityApisFromJavaScript();
+ updateHwAccelerated();
}
@Override
@@ -5702,9 +5667,6 @@
mVisibleContentRect, getScale());
}
- /**
- * @hide
- */
@Override
public boolean setFrame(int left, int top, int right, int bottom) {
boolean changed = mWebViewPrivate.super_setFrame(left, top, right, bottom);
@@ -5943,6 +5905,9 @@
mPreventDefault = PREVENT_DEFAULT_NO;
mConfirmMove = false;
mInitialHitTestResult = null;
+ if (!mEditTextScroller.isFinished()) {
+ mEditTextScroller.abortAnimation();
+ }
if (!mScroller.isFinished()) {
// stop the current scroll animation, but if this is
// the start of a fling, allow it to add to the current
@@ -6080,6 +6045,10 @@
}
}
startTouch(x, y, eventTime);
+ if (mIsEditingText) {
+ mTouchInEditText = mEditTextBounds.contains(contentX, contentY);
+ mGestureDetector.onTouchEvent(ev);
+ }
break;
}
case MotionEvent.ACTION_MOVE: {
@@ -6113,6 +6082,13 @@
invalidate();
}
break;
+ } else if (mConfirmMove && mTouchInEditText) {
+ ViewParent parent = mWebView.getParent();
+ if (parent != null) {
+ parent.requestDisallowInterceptTouchEvent(true);
+ }
+ mGestureDetector.onTouchEvent(ev);
+ break;
}
// pass the touch events from UI thread to WebCore thread
@@ -6130,6 +6106,7 @@
ted.mReprocess = mDeferTouchProcess;
ted.mNativeLayer = mCurrentScrollingLayerId;
ted.mNativeLayerRect.set(mScrollingLayerRect);
+ ted.mMotionEvent = MotionEvent.obtain(ev);
ted.mSequence = mTouchEventQueue.nextTouchSequence();
mTouchEventQueue.preQueueTouchEventData(ted);
mWebViewCore.sendMessage(EventHub.TOUCH_EVENT, ted);
@@ -6282,6 +6259,17 @@
break;
}
case MotionEvent.ACTION_UP: {
+ mGestureDetector.onTouchEvent(ev);
+ if (mTouchInEditText && mConfirmMove) {
+ stopTouch();
+ break; // We've been scrolling the edit text.
+ }
+ if (!mConfirmMove && mIsEditingText && mSelectionStarted &&
+ mIsCaretSelection) {
+ showPasteWindow();
+ stopTouch();
+ break;
+ }
// pass the touch events from UI thread to WebCore thread
if (shouldForwardTouchEvent()) {
TouchEventData ted = new TouchEventData();
@@ -6667,7 +6655,6 @@
syncSelectionCursors();
if (mIsCaretSelection) {
resetCaretTimer();
- showPasteWindow();
}
invalidate();
}
@@ -6759,7 +6746,6 @@
private DrawData mLoadedPicture;
public void setMapTrackballToArrowKeys(boolean setMap) {
- checkThread();
mMapTrackballToArrowKeys = setMap;
}
@@ -6986,7 +6972,6 @@
}
public void flingScroll(int vx, int vy) {
- checkThread();
mScroller.fling(getScrollX(), getScrollY(), vx, vy, 0, computeMaxScrollX(), 0,
computeMaxScrollY(), mOverflingDistance, mOverflingDistance);
invalidate();
@@ -7108,7 +7093,6 @@
@Override
@Deprecated
public View getZoomControls() {
- checkThread();
if (!getSettings().supportZoom()) {
Log.w(LOGTAG, "This WebView doesn't support zoom.");
return null;
@@ -7137,7 +7121,6 @@
*/
@Override
public boolean canZoomIn() {
- checkThread();
return mZoomManager.canZoomIn();
}
@@ -7146,7 +7129,6 @@
*/
@Override
public boolean canZoomOut() {
- checkThread();
return mZoomManager.canZoomOut();
}
@@ -7155,7 +7137,6 @@
*/
@Override
public boolean zoomIn() {
- checkThread();
return mZoomManager.zoomIn();
}
@@ -7164,7 +7145,6 @@
*/
@Override
public boolean zoomOut() {
- checkThread();
return mZoomManager.zoomOut();
}
@@ -7201,10 +7181,6 @@
}
}
- void sendPluginDrawMsg() {
- mWebViewCore.sendMessage(EventHub.PLUGIN_SURFACE_READY);
- }
-
/*
* Return true if the rect (e.g. plugin) is fully visible and maximized
* inside the WebView.
@@ -7458,9 +7434,6 @@
mWebViewCore.sendMessageDelayed(EventHub.SAVE_DOCUMENT_STATE, null, 1000);
}
- /**
- * @hide
- */
public synchronized WebViewCore getWebViewCore() {
return mWebViewCore;
}
@@ -8328,8 +8301,9 @@
break;
case FOCUS_NODE_CHANGED:
- if (mAutoCompletePopup != null) {
- mAutoCompletePopup.setFocused(msg.arg1 == mFieldPointer);
+ mIsEditingText = (msg.arg1 == mFieldPointer);
+ if (mAutoCompletePopup != null && !mIsEditingText) {
+ mAutoCompletePopup.clearAdapter();
}
// fall through to HIT_TEST_RESULT
case HIT_TEST_RESULT:
@@ -8375,11 +8349,12 @@
mFieldPointer = initData.mFieldPointer;
mInputConnection.initEditorInfo(initData);
mInputConnection.setTextAndKeepSelection(initData.mText);
- nativeMapLayerRect(mNativeClass, initData.mNodeLayerId,
- initData.mNodeBounds);
- mAutoCompletePopup.setNodeBounds(initData.mNodeBounds,
- initData.mNodeLayerId);
- mAutoCompletePopup.setText(mInputConnection.getEditable());
+ mEditTextBounds.set(initData.mNodeBounds);
+ mEditTextLayerId = initData.mNodeLayerId;
+ nativeMapLayerRect(mNativeClass, mEditTextLayerId,
+ mEditTextBounds);
+ mEditTextContent.set(initData.mContentRect);
+ relocateAutoCompletePopup();
}
break;
@@ -8394,10 +8369,11 @@
}
case UPDATE_MATCH_COUNT: {
- if (mFindCallback != null) {
- mFindCallback.updateMatchCount(msg.arg1, msg.arg2,
- (String) msg.obj);
- }
+ boolean isNewFind = mLastFind == null || !mLastFind.equals(msg.obj);
+ if (mFindCallback != null)
+ mFindCallback.updateMatchCount(msg.arg1, msg.arg2, isNewFind);
+ if (mFindListener != null)
+ mFindListener.onFindResultReceived(msg.arg1, msg.arg2, true);
break;
}
case CLEAR_CARET_HANDLE:
@@ -8417,6 +8393,24 @@
msg.arg1, /* unused */0);
break;
+ case ANIMATE_TEXT_SCROLL:
+ computeEditTextScroll();
+ break;
+
+ case EDIT_TEXT_SIZE_CHANGED:
+ if (msg.arg1 == mFieldPointer) {
+ mEditTextContent.set((Rect)msg.obj);
+ }
+ break;
+
+ case SHOW_CARET_HANDLE:
+ if (!mSelectingText && mIsEditingText && mIsCaretSelection) {
+ setupWebkitSelect();
+ resetCaretTimer();
+ showPasteWindow();
+ }
+ break;
+
default:
super.handleMessage(msg);
break;
@@ -8621,7 +8615,7 @@
void onPageSwapOccurred(boolean notifyAnimationStarted);
}
- /** @hide Called by JNI when pages are swapped (only occurs with hardware
+ /** Called by JNI when pages are swapped (only occurs with hardware
* acceleration) */
protected void pageSwapCallback(boolean notifyAnimationStarted) {
mWebViewCore.resumeWebKitDraw();
@@ -8716,13 +8710,20 @@
(data.mStart != data.mEnd ||
(mFieldPointer == nodePointer && mFieldPointer != 0))) {
mIsCaretSelection = (data.mStart == data.mEnd);
- if (!mSelectingText) {
- setupWebkitSelect();
- } else if (!mSelectionStarted) {
- syncSelectionCursors();
- }
- if (mIsCaretSelection) {
- resetCaretTimer();
+ if (mIsCaretSelection &&
+ (mInputConnection == null ||
+ mInputConnection.getEditable().length() == 0)) {
+ // There's no text, don't show caret handle.
+ selectionDone();
+ } else {
+ if (!mSelectingText) {
+ setupWebkitSelect();
+ } else if (!mSelectionStarted) {
+ syncSelectionCursors();
+ }
+ if (mIsCaretSelection) {
+ resetCaretTimer();
+ }
}
} else {
selectionDone();
@@ -8730,6 +8731,25 @@
invalidate();
}
+ private void computeEditTextScroll() {
+ if (mEditTextScroller.computeScrollOffset()) {
+ scrollEditText(mEditTextScroller.getCurrX(),
+ mEditTextScroller.getCurrY());
+ }
+ }
+
+ private void scrollEditText(int scrollX, int scrollY) {
+ // Scrollable edit text. Scroll it.
+ float maxScrollX = (float)(mEditTextContent.width() -
+ mEditTextBounds.width());
+ float scrollPercentX = ((float)scrollX)/maxScrollX;
+ mEditTextContent.offsetTo(-scrollX, -scrollY);
+ mWebViewCore.sendMessageAtFrontOfQueue(EventHub.SCROLL_TEXT_INPUT, 0,
+ scrollY, (Float)scrollPercentX);
+ mPrivateHandler.sendEmptyMessageDelayed(ANIMATE_TEXT_SCROLL,
+ TEXT_SCROLL_ANIMATION_DELAY_MS);
+ }
+
// Class used to use a dropdown for a <select> element
private class InvokeListBox implements Runnable {
// Whether the listbox allows multiple selection.
@@ -8985,8 +9005,10 @@
// after the page regains focus.
mListBoxMessage = Message.obtain(null,
EventHub.SINGLE_LISTBOX_CHOICE, (int) id, 0);
- mListBoxDialog.dismiss();
- mListBoxDialog = null;
+ if (mListBoxDialog != null) {
+ mListBoxDialog.dismiss();
+ mListBoxDialog = null;
+ }
}
});
if (mSelection != -1) {
@@ -9161,7 +9183,7 @@
* view-specific zoom, scroll offset, or other changes. It does not draw
* any view-specific chrome, such as progress or URL bars.
*
- * @hide only needs to be accessible to Browser and testing
+ * only needs to be accessible to Browser and testing
*/
public void drawPage(Canvas canvas) {
calcOurContentVisibleRectF(mVisibleContentRect);
@@ -9171,7 +9193,7 @@
/**
* Enable the communication b/t the webView and VideoViewProxy
*
- * @hide only used by the Browser
+ * only used by the Browser
*/
public void setHTML5VideoViewProxy(HTML5VideoViewProxy proxy) {
mHTML5VideoViewProxy = proxy;
@@ -9181,7 +9203,7 @@
* Set the time to wait between passing touches to WebCore. See also the
* TOUCH_SENT_INTERVAL member for further discussion.
*
- * @hide This is only used by the DRT test application.
+ * This is only used by the DRT test application.
*/
public void setTouchInterval(int interval) {
mCurrentTouchInterval = interval;
@@ -9208,34 +9230,46 @@
return mViewManager;
}
- private static void checkThread() {
- if (Looper.myLooper() != Looper.getMainLooper()) {
- Throwable throwable = new Throwable(
- "Warning: A WebView method was called on thread '" +
- Thread.currentThread().getName() + "'. " +
- "All WebView methods must be called on the UI thread. " +
- "Future versions of WebView may not support use on other threads.");
- Log.w(LOGTAG, Log.getStackTraceString(throwable));
- StrictMode.onWebViewMethodCalledOnWrongThread(throwable);
- }
- }
-
- /** @hide send content invalidate */
+ /** send content invalidate */
protected void contentInvalidateAll() {
if (mWebViewCore != null && !mBlockWebkitViewMessages) {
mWebViewCore.sendMessage(EventHub.CONTENT_INVALIDATE_ALL);
}
}
- /** @hide discard all textures from tiles. Used in Profiled WebView */
+ /** discard all textures from tiles. Used in Profiled WebView */
public void discardAllTextures() {
nativeDiscardAllTextures();
}
+ @Override
+ public void setLayerType(int layerType, Paint paint) {
+ updateHwAccelerated();
+ }
+
+ private void updateHwAccelerated() {
+ if (mNativeClass == 0) {
+ return;
+ }
+ boolean hwAccelerated = false;
+ if (mWebView.isHardwareAccelerated()
+ && mWebView.getLayerType() != View.LAYER_TYPE_SOFTWARE) {
+ hwAccelerated = true;
+ }
+ int result = nativeSetHwAccelerated(mNativeClass, hwAccelerated);
+ if (mWebViewCore == null || mBlockWebkitViewMessages) {
+ return;
+ }
+ if (result == 1) {
+ // Sync layers
+ mWebViewCore.layersDraw();
+ }
+ }
+
/**
* Begin collecting per-tile profiling data
*
- * @hide only used by profiling tests
+ * only used by profiling tests
*/
public void tileProfilingStart() {
nativeTileProfilingStart();
@@ -9243,29 +9277,29 @@
/**
* Return per-tile profiling data
*
- * @hide only used by profiling tests
+ * only used by profiling tests
*/
public float tileProfilingStop() {
return nativeTileProfilingStop();
}
- /** @hide only used by profiling tests */
+ /** only used by profiling tests */
public void tileProfilingClear() {
nativeTileProfilingClear();
}
- /** @hide only used by profiling tests */
+ /** only used by profiling tests */
public int tileProfilingNumFrames() {
return nativeTileProfilingNumFrames();
}
- /** @hide only used by profiling tests */
+ /** only used by profiling tests */
public int tileProfilingNumTilesInFrame(int frame) {
return nativeTileProfilingNumTilesInFrame(frame);
}
- /** @hide only used by profiling tests */
+ /** only used by profiling tests */
public int tileProfilingGetInt(int frame, int tile, String key) {
return nativeTileProfilingGetInt(frame, tile, key);
}
- /** @hide only used by profiling tests */
+ /** only used by profiling tests */
public float tileProfilingGetFloat(int frame, int tile, String key) {
return nativeTileProfilingGetFloat(frame, tile, key);
}
@@ -9353,4 +9387,6 @@
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
+ private static native int nativeSetHwAccelerated(int instance, boolean hwAccelerated);
}
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 77d2641..b47f71d 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -71,9 +71,8 @@
* WebViewCore always executes in the same thread as the native webkit.
*/
- // The WebView that corresponds to this WebViewCore.
- // TODO: rename this field (and its getter) to mWebViewClassic or mWebViewImpl.
- private WebViewClassic mWebView;
+ // The WebViewClassic that corresponds to this WebViewCore.
+ private WebViewClassic mWebViewClassic;
// Proxy for handling callbacks from native code
private final CallbackProxy mCallbackProxy;
// Settings object for maintaining all settings
@@ -149,7 +148,7 @@
Map<String, Object> javascriptInterfaces) {
// No need to assign this in the WebCore thread.
mCallbackProxy = proxy;
- mWebView = w;
+ mWebViewClassic = w;
mJavascriptInterfaces = javascriptInterfaces;
// This context object is used to initialize the WebViewCore during
// subwindow creation.
@@ -182,7 +181,7 @@
// ready.
mEventHub = new EventHub();
// Create a WebSettings object for maintaining all settings
- mSettings = new WebSettingsClassic(mContext, mWebView);
+ mSettings = new WebSettingsClassic(mContext, mWebViewClassic);
// The WebIconDatabase needs to be initialized within the UI thread so
// just request the instance here.
WebIconDatabase.getInstance();
@@ -235,8 +234,8 @@
// Send a message back to WebView to tell it that we have set up the
// WebCore thread.
- if (mWebView != null) {
- Message.obtain(mWebView.mPrivateHandler,
+ if (mWebViewClassic != null) {
+ Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.WEBCORE_INITIALIZED_MSG_ID,
mNativeClass, 0).sendToTarget();
}
@@ -331,8 +330,8 @@
* @param nodePointer The node which just blurred.
*/
private void formDidBlur(int nodePointer) {
- if (mWebView == null) return;
- Message.obtain(mWebView.mPrivateHandler, WebViewClassic.FORM_DID_BLUR,
+ if (mWebViewClassic == null) return;
+ Message.obtain(mWebViewClassic.mPrivateHandler, WebViewClassic.FORM_DID_BLUR,
nodePointer, 0).sendToTarget();
}
@@ -340,8 +339,8 @@
* Called by JNI when the focus node changed.
*/
private void focusNodeChanged(int nodePointer, WebKitHitTest hitTest) {
- if (mWebView == null) return;
- mWebView.mPrivateHandler.obtainMessage(WebViewClassic.FOCUS_NODE_CHANGED,
+ if (mWebViewClassic == null) return;
+ mWebViewClassic.mPrivateHandler.obtainMessage(WebViewClassic.FOCUS_NODE_CHANGED,
nodePointer, 0, hitTest).sendToTarget();
}
@@ -349,8 +348,8 @@
* Called by JNI to advance focus to the next view.
*/
private void chromeTakeFocus(int webkitDirection) {
- if (mWebView == null) return;
- Message m = mWebView.mPrivateHandler.obtainMessage(
+ if (mWebViewClassic == null) return;
+ Message m = mWebViewClassic.mPrivateHandler.obtainMessage(
WebViewClassic.TAKE_FOCUS);
m.arg1 = mapDirection(webkitDirection);
m.sendToTarget();
@@ -561,8 +560,8 @@
* Notify the webview that we want to display the video layer fullscreen.
*/
protected void enterFullscreenForVideoLayer(int layerId, String url) {
- if (mWebView == null) return;
- Message message = Message.obtain(mWebView.mPrivateHandler,
+ if (mWebViewClassic == null) return;
+ Message message = Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.ENTER_FULLSCREEN_VIDEO, layerId, 0);
message.obj = url;
message.sendToTarget();
@@ -573,8 +572,8 @@
* This is called through JNI by webcore.
*/
protected void exitFullscreenVideo() {
- if (mWebView == null) return;
- Message message = Message.obtain(mWebView.mPrivateHandler,
+ if (mWebViewClassic == null) return;
+ Message message = Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.EXIT_FULLSCREEN_VIDEO);
message.sendToTarget();
}
@@ -951,36 +950,19 @@
}
static class TextFieldInitData {
- public TextFieldInitData(int fieldPointer,
- String text, int type, boolean isSpellCheckEnabled,
- boolean autoComplete, boolean isTextFieldNext,
- boolean isTextFieldPrev, String name, String label,
- int maxLength, Rect nodeBounds, int nodeLayerId) {
- mFieldPointer = fieldPointer;
- mText = text;
- mType = type;
- mIsAutoCompleteEnabled = autoComplete;
- mIsSpellCheckEnabled = isSpellCheckEnabled;
- mIsTextFieldNext = isTextFieldNext;
- mIsTextFieldPrev = isTextFieldPrev;
- mName = name;
- mLabel = label;
- mMaxLength = maxLength;
- mNodeBounds = nodeBounds;
- mNodeLayerId = nodeLayerId;
- }
- int mFieldPointer;
- String mText;
- int mType;
- boolean mIsSpellCheckEnabled;
- boolean mIsTextFieldNext;
- boolean mIsTextFieldPrev;
- boolean mIsAutoCompleteEnabled;
- String mName;
- String mLabel;
- int mMaxLength;
- Rect mNodeBounds;
- int mNodeLayerId;
+ public int mFieldPointer;
+ public String mText;
+ public int mType;
+ public boolean mIsSpellCheckEnabled;
+ public boolean mIsTextFieldNext;
+ public boolean mIsTextFieldPrev;
+ public boolean mIsAutoCompleteEnabled;
+ public String mName;
+ public String mLabel;
+ public int mMaxLength;
+ public Rect mNodeBounds;
+ public int mNodeLayerId;
+ public Rect mContentRect;
}
// mAction of TouchEventData can be MotionEvent.getAction() which uses the
@@ -1273,7 +1255,7 @@
return;
}
- if (mWebView == null || mNativeClass == 0) {
+ if (mWebViewClassic == null || mNativeClass == 0) {
if (DebugFlags.WEB_VIEW_CORE) {
Log.w(LOGTAG, "Rejecting message " + msg.what
+ " because we are destroyed");
@@ -1311,7 +1293,7 @@
mBrowserFrame = null;
mSettings.onDestroyed();
mNativeClass = 0;
- mWebView = null;
+ mWebViewClassic = null;
}
break;
@@ -1554,7 +1536,7 @@
yArray, count, ted.mActionIndex,
ted.mMetaState);
Message.obtain(
- mWebView.mPrivateHandler,
+ mWebViewClassic.mPrivateHandler,
WebViewClassic.PREVENT_TOUCH_ID,
ted.mAction,
ted.mNativeResult ? 1 : 0,
@@ -1624,7 +1606,7 @@
String modifiedSelectionString =
nativeModifySelection(mNativeClass, msg.arg1,
msg.arg2);
- mWebView.mPrivateHandler.obtainMessage(
+ mWebViewClassic.mPrivateHandler.obtainMessage(
WebViewClassic.SELECTION_STRING_CHANGED,
modifiedSelectionString).sendToTarget();
break;
@@ -1670,7 +1652,7 @@
(WebViewClassic.SaveWebArchiveMessage)msg.obj;
saveMessage.mResultFile =
saveWebArchive(saveMessage.mBasename, saveMessage.mAutoname);
- mWebView.mPrivateHandler.obtainMessage(
+ mWebViewClassic.mPrivateHandler.obtainMessage(
WebViewClassic.SAVE_WEBARCHIVE_FINISHED, saveMessage).sendToTarget();
break;
@@ -1683,7 +1665,7 @@
case SPLIT_PICTURE_SET:
nativeSplitContent(mNativeClass, msg.arg1);
- mWebView.mPrivateHandler.obtainMessage(
+ mWebViewClassic.mPrivateHandler.obtainMessage(
WebViewClassic.REPLACE_BASE_CONTENT, msg.arg1, 0);
mSplitPictureIsScheduled = false;
break;
@@ -1731,7 +1713,7 @@
d.mNativeLayer, d.mNativeLayerRect);
}
WebKitHitTest hit = performHitTest(d.mX, d.mY, d.mSlop, true);
- mWebView.mPrivateHandler.obtainMessage(
+ mWebViewClassic.mPrivateHandler.obtainMessage(
WebViewClassic.HIT_TEST_RESULT, hit)
.sendToTarget();
break;
@@ -1742,8 +1724,8 @@
case AUTOFILL_FORM:
nativeAutoFillForm(mNativeClass, msg.arg1);
- mWebView.mPrivateHandler.obtainMessage(WebViewClassic.AUTOFILL_COMPLETE, null)
- .sendToTarget();
+ mWebViewClassic.mPrivateHandler.obtainMessage(
+ WebViewClassic.AUTOFILL_COMPLETE, null).sendToTarget();
break;
case EXECUTE_JS:
@@ -1751,7 +1733,8 @@
if (DebugFlags.WEB_VIEW_CORE) {
Log.d(LOGTAG, "Executing JS : " + msg.obj);
}
- mBrowserFrame.stringByEvaluatingJavaScriptFromString((String) msg.obj);
+ mBrowserFrame.stringByEvaluatingJavaScriptFromString(
+ (String) msg.obj);
}
break;
case SCROLL_LAYER:
@@ -1773,7 +1756,8 @@
handles[0], handles[1], handles[2],
handles[3]);
if (copiedText != null) {
- mWebView.mPrivateHandler.obtainMessage(WebViewClassic.COPY_TO_CLIPBOARD, copiedText)
+ mWebViewClassic.mPrivateHandler.obtainMessage(
+ WebViewClassic.COPY_TO_CLIPBOARD, copiedText)
.sendToTarget();
}
break;
@@ -1794,7 +1778,10 @@
case SELECT_WORD_AT: {
int x = msg.arg1;
int y = msg.arg2;
- nativeSelectWordAt(mNativeClass, x, y);
+ if (!nativeSelectWordAt(mNativeClass, x, y)) {
+ mWebViewClassic.mPrivateHandler.obtainMessage(WebViewClassic.SHOW_CARET_HANDLE)
+ .sendToTarget();
+ }
break;
}
case SELECT_ALL:
@@ -1931,6 +1918,11 @@
mEventHub.sendMessage(Message.obtain(null, what));
}
+ void sendMessageAtFrontOfQueue(int what, int arg1, int arg2, Object obj) {
+ mEventHub.sendMessageAtFrontOfQueue(Message.obtain(
+ null, what, arg1, arg2, obj));
+ }
+
void sendMessage(int what, Object obj) {
mEventHub.sendMessage(Message.obtain(null, what, obj));
}
@@ -2040,7 +2032,7 @@
if (keyCode >= KeyEvent.KEYCODE_DPAD_UP
&& keyCode <= KeyEvent.KEYCODE_DPAD_RIGHT) {
if (canTakeFocusDirection != 0 && isDown) {
- Message m = mWebView.mPrivateHandler.obtainMessage(
+ Message m = mWebViewClassic.mPrivateHandler.obtainMessage(
WebViewClassic.TAKE_FOCUS);
m.arg1 = canTakeFocusDirection;
m.sendToTarget();
@@ -2113,7 +2105,8 @@
width = mViewportWidth;
} else {
// For mobile web site.
- width = Math.round(mWebView.getViewWidth() / mWebView.getDefaultZoomScale());
+ width = Math.round(mWebViewClassic.getViewWidth() /
+ mWebViewClassic.getDefaultZoomScale());
}
}
return width;
@@ -2205,8 +2198,8 @@
// If anything more complex than position has been touched, let's do a full draw
webkitDraw();
}
- mWebView.mPrivateHandler.removeMessages(WebViewClassic.INVAL_RECT_MSG_ID);
- mWebView.mPrivateHandler.sendMessageAtFrontOfQueue(mWebView.mPrivateHandler
+ mWebViewClassic.mPrivateHandler.removeMessages(WebViewClassic.INVAL_RECT_MSG_ID);
+ mWebViewClassic.mPrivateHandler.sendMessageAtFrontOfQueue(mWebViewClassic.mPrivateHandler
.obtainMessage(WebViewClassic.INVAL_RECT_MSG_ID));
}
@@ -2246,7 +2239,7 @@
draw.mBaseLayer = nativeRecordContent(mNativeClass, draw.mInvalRegion,
draw.mContentSize);
if (draw.mBaseLayer == 0) {
- if (mWebView != null && !mWebView.isPaused()) {
+ if (mWebViewClassic != null && !mWebViewClassic.isPaused()) {
if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw abort, resending draw message");
mEventHub.sendMessageDelayed(Message.obtain(null, EventHub.WEBKIT_DRAW), 10);
} else {
@@ -2259,7 +2252,7 @@
}
private void webkitDraw(DrawData draw) {
- if (mWebView != null) {
+ if (mWebViewClassic != null) {
draw.mFocusSizeChanged = nativeFocusBoundsChanged(mNativeClass);
draw.mViewSize = new Point(mCurrentViewWidth, mCurrentViewHeight);
if (mSettings.getUseWideViewPort()) {
@@ -2278,7 +2271,7 @@
mFirstLayoutForNonStandardLoad = false;
}
if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw NEW_PICTURE_MSG_ID");
- Message.obtain(mWebView.mPrivateHandler,
+ Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.NEW_PICTURE_MSG_ID, draw).sendToTarget();
}
}
@@ -2368,7 +2361,7 @@
// called from JNI or WebView thread
/* package */ void contentDraw() {
synchronized (this) {
- if (mWebView == null || mBrowserFrame == null) {
+ if (mWebViewClassic == null || mBrowserFrame == null) {
// We were destroyed
return;
}
@@ -2406,8 +2399,8 @@
mRestoredY = y;
return;
}
- if (mWebView != null) {
- Message msg = Message.obtain(mWebView.mPrivateHandler,
+ if (mWebViewClassic != null) {
+ Message msg = Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.SCROLL_TO_MSG_ID, animate ? 1 : 0,
onlyIfImeIsShowing ? 1 : 0, new Point(x, y));
if (mDrawIsScheduled) {
@@ -2429,8 +2422,8 @@
in WebView since it (and its thread) know the current scale factor.
*/
private void sendViewInvalidate(int left, int top, int right, int bottom) {
- if (mWebView != null) {
- Message.obtain(mWebView.mPrivateHandler,
+ if (mWebViewClassic != null) {
+ Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.INVAL_RECT_MSG_ID,
new Rect(left, top, right, bottom)).sendToTarget();
}
@@ -2445,10 +2438,20 @@
mRepaintScheduled = false;
}
- // Gets the WebView corresponding to this WebViewCore. Note that the
- // WebView object must only be used on the UI thread.
- /* package */ WebViewClassic getWebView() {
- return mWebView;
+ // Gets the WebViewClassic corresponding to this WebViewCore. Note that the
+ // WebViewClassic object must only be used on the UI thread.
+ /* package */ WebViewClassic getWebViewClassic() {
+ return mWebViewClassic;
+ }
+
+ // Called by JNI
+ private WebView getWebView() {
+ return mWebViewClassic.getWebView();
+ }
+
+ // Called by JNI
+ private void sendPluginDrawMsg() {
+ sendMessage(EventHub.PLUGIN_SURFACE_READY);
}
private native void setViewportSettingsFromNative(int nativeClass);
@@ -2461,7 +2464,7 @@
mBrowserFrame.didFirstLayout();
- if (mWebView == null) return;
+ if (mWebViewClassic == null) return;
boolean updateViewState = standardLoad || mIsRestored;
setupViewport(updateViewState);
@@ -2469,11 +2472,11 @@
// be called after the WebView updates its state. If updateRestoreState
// is false, start to draw now as it is ready.
if (!updateViewState) {
- mWebView.mViewManager.postReadyToDrawAll();
+ mWebViewClassic.mViewManager.postReadyToDrawAll();
}
// remove the touch highlight when moving to a new page
- mWebView.mPrivateHandler.sendEmptyMessage(
+ mWebViewClassic.mPrivateHandler.sendEmptyMessage(
WebViewClassic.HIT_TEST_RESULT);
// reset the scroll position, the restored offset and scales
@@ -2489,7 +2492,7 @@
}
private void setupViewport(boolean updateViewState) {
- if (mWebView == null || mSettings == null) {
+ if (mWebViewClassic == null || mSettings == null) {
// We've been destroyed or are being destroyed, return early
return;
}
@@ -2537,8 +2540,8 @@
adjust = (float) mContext.getResources().getDisplayMetrics().densityDpi
/ mViewportDensityDpi;
}
- if (adjust != mWebView.getDefaultZoomScale()) {
- Message.obtain(mWebView.mPrivateHandler,
+ if (adjust != mWebViewClassic.getDefaultZoomScale()) {
+ Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.UPDATE_ZOOM_DENSITY, adjust).sendToTarget();
}
int defaultScale = (int) (adjust * 100);
@@ -2589,7 +2592,7 @@
// for non-mobile site, we don't need minPrefWidth, set it as 0
viewState.mScrollX = 0;
viewState.mShouldStartScrolledRight = false;
- Message.obtain(mWebView.mPrivateHandler,
+ Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.UPDATE_ZOOM_RANGE, viewState).sendToTarget();
return;
}
@@ -2603,7 +2606,7 @@
// this may happen when WebView just starts. This is not perfect as
// we call WebView method from WebCore thread. But not perfect
// reference is better than no reference.
- webViewWidth = mWebView.getViewWidth();
+ webViewWidth = mWebViewClassic.getViewWidth();
viewportWidth = (int) (webViewWidth / adjust);
if (viewportWidth == 0) {
if (DebugFlags.WEB_VIEW_CORE) {
@@ -2652,17 +2655,17 @@
}
}
- if (mWebView.mHeightCanMeasure) {
+ if (mWebViewClassic.mHeightCanMeasure) {
// Trick to ensure that the Picture has the exact height for the
// content by forcing to layout with 0 height after the page is
// ready, which is indicated by didFirstLayout. This is essential to
// get rid of the white space in the GMail which uses WebView for
// message view.
- mWebView.mLastHeightSent = 0;
+ mWebViewClassic.mLastHeightSent = 0;
// Send a negative scale to indicate that WebCore should reuse
// the current scale
WebViewClassic.ViewSizeData data = new WebViewClassic.ViewSizeData();
- data.mWidth = mWebView.mLastWidthSent;
+ data.mWidth = mWebViewClassic.mLastWidthSent;
data.mHeight = 0;
// if mHeightCanMeasure is true, getUseWideViewPort() can't be
// true. It is safe to use mWidth for mTextWrapWidth.
@@ -2683,7 +2686,7 @@
if (viewportWidth == 0) {
// Trick to ensure VIEW_SIZE_CHANGED will be sent from WebView
// to WebViewCore
- mWebView.mLastWidthSent = 0;
+ mWebViewClassic.mLastWidthSent = 0;
} else {
WebViewClassic.ViewSizeData data = new WebViewClassic.ViewSizeData();
// mViewScale as 0 means it is in zoom overview mode. So we don't
@@ -2711,7 +2714,7 @@
if (mSettings.isNarrowColumnLayout()) {
// In case of automatic text reflow in fixed view port mode.
mInitialViewState.mTextWrapScale =
- mWebView.computeReadingLevelScale(data.mScale);
+ mWebViewClassic.computeReadingLevelScale(data.mScale);
}
} else {
// Scale is given such as when page is restored, use it.
@@ -2732,7 +2735,7 @@
// are calling a WebView method from the WebCore thread. But this is preferable
// to syncing an incorrect height.
data.mHeight = mCurrentViewHeight == 0 ?
- Math.round(mWebView.getViewHeight() / data.mScale)
+ Math.round(mWebViewClassic.getViewHeight() / data.mScale)
: Math.round((float) mCurrentViewHeight * data.mWidth / viewportWidth);
data.mTextWrapWidth = Math.round(webViewWidth
/ mInitialViewState.mTextWrapScale);
@@ -2761,8 +2764,8 @@
// called by JNI
private void needTouchEvents(boolean need) {
- if (mWebView != null) {
- Message.obtain(mWebView.mPrivateHandler,
+ if (mWebViewClassic != null) {
+ Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.WEBCORE_NEED_TOUCH_EVENTS, need ? 1 : 0, 0)
.sendToTarget();
}
@@ -2771,8 +2774,8 @@
// called by JNI
private void updateTextfield(int ptr, boolean changeToPassword,
String text, int textGeneration) {
- if (mWebView != null) {
- Message msg = Message.obtain(mWebView.mPrivateHandler,
+ if (mWebViewClassic != null) {
+ Message msg = Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.UPDATE_TEXTFIELD_TEXT_MSG_ID, ptr,
textGeneration, text);
msg.getData().putBoolean("password", changeToPassword);
@@ -2783,48 +2786,54 @@
// called by JNI
private void updateTextSelection(int pointer, int start, int end,
int textGeneration, int selectionPtr) {
- if (mWebView != null) {
- Message.obtain(mWebView.mPrivateHandler,
+ if (mWebViewClassic != null) {
+ Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.UPDATE_TEXT_SELECTION_MSG_ID, pointer, textGeneration,
new TextSelectionData(start, end, selectionPtr)).sendToTarget();
}
}
// called by JNI
+ private void updateTextSizeAndScroll(int pointer, int width, int height,
+ int scrollX, int scrollY) {
+ if (mWebViewClassic != null) {
+ Rect rect = new Rect(-scrollX, -scrollY, width - scrollX,
+ height - scrollY);
+ Message.obtain(mWebViewClassic.mPrivateHandler,
+ WebViewClassic.EDIT_TEXT_SIZE_CHANGED, pointer, 0, rect)
+ .sendToTarget();
+ }
+ }
+
+ // called by JNI
private void clearTextEntry() {
- if (mWebView == null) return;
- Message.obtain(mWebView.mPrivateHandler,
+ if (mWebViewClassic == null) return;
+ Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.CLEAR_TEXT_ENTRY).sendToTarget();
}
// called by JNI
- private void initEditField(int pointer, String text, int inputType,
- boolean isSpellCheckEnabled, boolean isAutoCompleteEnabled,
- boolean nextFieldIsText, boolean prevFieldIsText, String name,
- String label, int start, int end, int selectionPtr, int maxLength,
- Rect nodeRect, int nodeLayer) {
- if (mWebView == null) {
+ private void initEditField(int start, int end, int selectionPtr,
+ TextFieldInitData initData) {
+ if (mWebViewClassic == null) {
return;
}
- TextFieldInitData initData = new TextFieldInitData(pointer,
- text, inputType, isSpellCheckEnabled, isAutoCompleteEnabled,
- nextFieldIsText, prevFieldIsText, name, label, maxLength,
- nodeRect, nodeLayer);
- Message.obtain(mWebView.mPrivateHandler,
+ Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.INIT_EDIT_FIELD, initData).sendToTarget();
- Message.obtain(mWebView.mPrivateHandler,
- WebViewClassic.REQUEST_KEYBOARD_WITH_SELECTION_MSG_ID, pointer,
- 0, new TextSelectionData(start, end, selectionPtr))
+ Message.obtain(mWebViewClassic.mPrivateHandler,
+ WebViewClassic.REQUEST_KEYBOARD_WITH_SELECTION_MSG_ID,
+ initData.mFieldPointer, 0,
+ new TextSelectionData(start, end, selectionPtr))
.sendToTarget();
}
// called by JNI
private void updateMatchCount(int matchIndex, int matchCount,
String findText) {
- if (mWebView == null) {
+ if (mWebViewClassic == null) {
return;
}
- Message.obtain(mWebView.mPrivateHandler,
+ Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.UPDATE_MATCH_COUNT, matchIndex, matchCount,
findText).sendToTarget();
}
@@ -2848,32 +2857,32 @@
// called by JNI
private void requestListBox(String[] array, int[] enabledArray,
int[] selectedArray) {
- if (mWebView != null) {
- mWebView.requestListBox(array, enabledArray, selectedArray);
+ if (mWebViewClassic != null) {
+ mWebViewClassic.requestListBox(array, enabledArray, selectedArray);
}
}
// called by JNI
private void requestListBox(String[] array, int[] enabledArray,
int selection) {
- if (mWebView != null) {
- mWebView.requestListBox(array, enabledArray, selection);
+ if (mWebViewClassic != null) {
+ mWebViewClassic.requestListBox(array, enabledArray, selection);
}
}
// called by JNI
private void requestKeyboard(boolean showKeyboard) {
- if (mWebView != null) {
- Message.obtain(mWebView.mPrivateHandler,
+ if (mWebViewClassic != null) {
+ Message.obtain(mWebViewClassic.mPrivateHandler,
WebViewClassic.REQUEST_KEYBOARD, showKeyboard ? 1 : 0, 0)
.sendToTarget();
}
}
private void setWebTextViewAutoFillable(int queryId, String preview) {
- if (mWebView != null) {
- Message.obtain(mWebView.mPrivateHandler, WebViewClassic.SET_AUTOFILLABLE,
+ if (mWebViewClassic != null) {
+ Message.obtain(mWebViewClassic.mPrivateHandler, WebViewClassic.SET_AUTOFILLABLE,
new AutoFillData(queryId, preview))
.sendToTarget();
}
@@ -2885,8 +2894,9 @@
// called by JNI
private void keepScreenOn(boolean screenOn) {
- if (mWebView != null) {
- Message message = mWebView.mPrivateHandler.obtainMessage(WebViewClassic.SCREEN_ON);
+ if (mWebViewClassic != null) {
+ Message message = mWebViewClassic.mPrivateHandler.obtainMessage(
+ WebViewClassic.SCREEN_ON);
message.arg1 = screenOn ? 1 : 0;
message.sendToTarget();
}
@@ -2895,7 +2905,7 @@
// called by JNI
private Class<?> getPluginClass(String libName, String clsName) {
- if (mWebView == null) {
+ if (mWebViewClassic == null) {
return null;
}
@@ -2922,11 +2932,12 @@
// called by JNI. PluginWidget function to launch a full-screen view using a
// View object provided by the plugin class.
private void showFullScreenPlugin(ViewManager.ChildView childView, int orientation, int npp) {
- if (mWebView == null) {
+ if (mWebViewClassic == null) {
return;
}
- Message message = mWebView.mPrivateHandler.obtainMessage(WebViewClassic.SHOW_FULLSCREEN);
+ Message message = mWebViewClassic.mPrivateHandler.obtainMessage(
+ WebViewClassic.SHOW_FULLSCREEN);
message.obj = childView.mView;
message.arg1 = orientation;
message.arg2 = npp;
@@ -2935,15 +2946,15 @@
// called by JNI
private void hideFullScreenPlugin() {
- if (mWebView == null) {
+ if (mWebViewClassic == null) {
return;
}
- mWebView.mPrivateHandler.obtainMessage(WebViewClassic.HIDE_FULLSCREEN)
+ mWebViewClassic.mPrivateHandler.obtainMessage(WebViewClassic.HIDE_FULLSCREEN)
.sendToTarget();
}
private ViewManager.ChildView createSurface(View pluginView) {
- if (mWebView == null) {
+ if (mWebViewClassic == null) {
return null;
}
@@ -2958,7 +2969,7 @@
if(pluginView instanceof SurfaceView)
((SurfaceView)pluginView).setZOrderOnTop(true);
- ViewManager.ChildView view = mWebView.mViewManager.createView();
+ ViewManager.ChildView view = mWebViewClassic.mViewManager.createView();
view.mView = pluginView;
return view;
}
@@ -2998,7 +3009,7 @@
private void showRect(int left, int top, int width, int height,
int contentWidth, int contentHeight, float xPercentInDoc,
float xPercentInView, float yPercentInDoc, float yPercentInView) {
- if (mWebView != null) {
+ if (mWebViewClassic != null) {
ShowRectData data = new ShowRectData();
data.mLeft = left;
data.mTop = top;
@@ -3010,26 +3021,26 @@
data.mXPercentInView = xPercentInView;
data.mYPercentInDoc = yPercentInDoc;
data.mYPercentInView = yPercentInView;
- Message.obtain(mWebView.mPrivateHandler, WebViewClassic.SHOW_RECT_MSG_ID,
+ Message.obtain(mWebViewClassic.mPrivateHandler, WebViewClassic.SHOW_RECT_MSG_ID,
data).sendToTarget();
}
}
// called by JNI
private void centerFitRect(int x, int y, int width, int height) {
- if (mWebView == null) {
+ if (mWebViewClassic == null) {
return;
}
- mWebView.mPrivateHandler.obtainMessage(WebViewClassic.CENTER_FIT_RECT,
+ mWebViewClassic.mPrivateHandler.obtainMessage(WebViewClassic.CENTER_FIT_RECT,
new Rect(x, y, x + width, y + height)).sendToTarget();
}
// called by JNI
private void setScrollbarModes(int hMode, int vMode) {
- if (mWebView == null) {
+ if (mWebViewClassic == null) {
return;
}
- mWebView.mPrivateHandler.obtainMessage(WebViewClassic.SET_SCROLLBAR_MODES,
+ mWebViewClassic.mPrivateHandler.obtainMessage(WebViewClassic.SET_SCROLLBAR_MODES,
hMode, vMode).sendToTarget();
}
@@ -3112,7 +3123,7 @@
private native void nativeSelectText(int nativeClass,
int startX, int startY, int endX, int endY);
private native void nativeClearTextSelection(int nativeClass);
- private native void nativeSelectWordAt(int nativeClass, int x, int y);
+ private native boolean nativeSelectWordAt(int nativeClass, int x, int y);
private native void nativeSelectAll(int nativeClass);
private static native void nativeCertTrustChanged();
diff --git a/core/java/android/webkit/WebViewDatabase.java b/core/java/android/webkit/WebViewDatabase.java
index 757a619..6c35f19 100644
--- a/core/java/android/webkit/WebViewDatabase.java
+++ b/core/java/android/webkit/WebViewDatabase.java
@@ -144,7 +144,6 @@
null);
}
}
- mDatabase.enableWriteAheadLogging();
// mDatabase should not be null,
// the only case is RequestAPI test has problem to create db
@@ -163,11 +162,6 @@
mDatabase.endTransaction();
}
}
-
- // use per table Mutex lock, turn off database lock, this
- // improves performance as database's ReentrantLock is
- // expansive
- mDatabase.setLockingEnabled(false);
}
private static void upgradeDatabase() {
diff --git a/core/java/android/webkit/WebViewProvider.java b/core/java/android/webkit/WebViewProvider.java
index 2e8ad6d..f049198 100644
--- a/core/java/android/webkit/WebViewProvider.java
+++ b/core/java/android/webkit/WebViewProvider.java
@@ -19,6 +19,7 @@
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Paint;
import android.graphics.Picture;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -191,10 +192,14 @@
public WebBackForwardList copyBackForwardList();
+ public void setFindListener(WebView.FindListener listener);
+
public void findNext(boolean forward);
public int findAll(String find);
+ public void findAllAsync(String find);
+
public boolean showFindDialog(String text, boolean showIme);
public void clearMatches();
@@ -333,6 +338,8 @@
public boolean requestChildRectangleOnScreen(View child, Rect rect, boolean immediate);
public void setBackgroundColor(int color);
+
+ public void setLayerType(int layerType, Paint paint);
}
interface ScrollDelegate {
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 5774440..057aabe 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -88,6 +88,7 @@
ViewTreeObserver.OnTouchModeChangeListener,
RemoteViewsAdapter.RemoteAdapterConnectionCallback {
+ @SuppressWarnings("UnusedDeclaration")
private static final String TAG = "AbsListView";
/**
@@ -2429,7 +2430,7 @@
final ViewTreeObserver treeObserver = getViewTreeObserver();
treeObserver.removeOnTouchModeChangeListener(this);
if (mTextFilterEnabled && mPopup != null) {
- treeObserver.removeGlobalOnLayoutListener(this);
+ treeObserver.removeOnGlobalLayoutListener(this);
mGlobalLayoutListenerAddedFilter = false;
}
@@ -2947,16 +2948,17 @@
if (!mEdgeGlowBottom.isFinished()) {
mEdgeGlowBottom.onRelease();
}
+ invalidate(mEdgeGlowTop.getBounds(false));
} else if (rawDeltaY < 0) {
mEdgeGlowBottom.onPull((float) overscroll / getHeight());
if (!mEdgeGlowTop.isFinished()) {
mEdgeGlowTop.onRelease();
}
+ invalidate(mEdgeGlowBottom.getBounds(true));
}
}
}
mMotionY = y;
- invalidate();
}
mLastY = y;
}
@@ -2990,26 +2992,26 @@
if (!mEdgeGlowBottom.isFinished()) {
mEdgeGlowBottom.onRelease();
}
+ invalidate(mEdgeGlowTop.getBounds(false));
} else if (rawDeltaY < 0) {
mEdgeGlowBottom.onPull((float) overScrollDistance / getHeight());
if (!mEdgeGlowTop.isFinished()) {
mEdgeGlowTop.onRelease();
}
+ invalidate(mEdgeGlowBottom.getBounds(true));
}
- invalidate();
}
}
if (incrementalDeltaY != 0) {
// Coming back to 'real' list scrolling
- mScrollY = 0;
- invalidateParentIfNeeded();
-
- // No need to do all this work if we're not going to move anyway
- if (incrementalDeltaY != 0) {
- trackMotionScroll(incrementalDeltaY, incrementalDeltaY);
+ if (mScrollY != 0) {
+ mScrollY = 0;
+ invalidateParentIfNeeded();
}
+ trackMotionScroll(incrementalDeltaY, incrementalDeltaY);
+
mTouchMode = TOUCH_MODE_SCROLL;
// We did not scroll the full amount. Treat this essentially like the
@@ -3468,11 +3470,12 @@
final int rightPadding = mListPadding.right + mGlowPaddingRight;
final int width = getWidth() - leftPadding - rightPadding;
- canvas.translate(leftPadding,
- Math.min(0, scrollY + mFirstPositionDistanceGuess));
+ int edgeY = Math.min(0, scrollY + mFirstPositionDistanceGuess);
+ canvas.translate(leftPadding, edgeY);
mEdgeGlowTop.setSize(width, getHeight());
if (mEdgeGlowTop.draw(canvas)) {
- invalidate();
+ mEdgeGlowTop.setPosition(leftPadding, edgeY);
+ invalidate(mEdgeGlowTop.getBounds(false));
}
canvas.restoreToCount(restoreCount);
}
@@ -3483,12 +3486,15 @@
final int width = getWidth() - leftPadding - rightPadding;
final int height = getHeight();
- canvas.translate(-width + leftPadding,
- Math.max(height, scrollY + mLastPositionDistanceGuess));
+ int edgeX = -width + leftPadding;
+ int edgeY = Math.max(height, scrollY + mLastPositionDistanceGuess);
+ canvas.translate(edgeX, edgeY);
canvas.rotate(180, width, 0);
mEdgeGlowBottom.setSize(width, height);
if (mEdgeGlowBottom.draw(canvas)) {
- invalidate();
+ // Account for the rotation
+ mEdgeGlowBottom.setPosition(edgeX + width, edgeY);
+ invalidate(mEdgeGlowBottom.getBounds(true));
}
canvas.restoreToCount(restoreCount);
}
@@ -3874,7 +3880,8 @@
}
// Don't stop just because delta is zero (it could have been rounded)
- final boolean atEnd = trackMotionScroll(delta, delta) && (delta != 0);
+ final boolean atEdge = trackMotionScroll(delta, delta);
+ final boolean atEnd = atEdge && (delta != 0);
if (atEnd) {
if (motionView != null) {
// Tweak the scroll for how far we overshot
@@ -3889,7 +3896,7 @@
}
if (more && !atEnd) {
- invalidate();
+ if (atEdge) invalidate();
mLastFlingY = y;
post(this);
} else {
@@ -4431,7 +4438,7 @@
}
private void createScrollingCache() {
- if (mScrollingCacheEnabled && !mCachingStarted) {
+ if (mScrollingCacheEnabled && !mCachingStarted && !isHardwareAccelerated()) {
setChildrenDrawnWithCacheEnabled(true);
setChildrenDrawingCacheEnabled(true);
mCachingStarted = mCachingActive = true;
@@ -4439,23 +4446,25 @@
}
private void clearScrollingCache() {
- if (mClearScrollingCache == null) {
- mClearScrollingCache = new Runnable() {
- public void run() {
- if (mCachingStarted) {
- mCachingStarted = mCachingActive = false;
- setChildrenDrawnWithCacheEnabled(false);
- if ((mPersistentDrawingCache & PERSISTENT_SCROLLING_CACHE) == 0) {
- setChildrenDrawingCacheEnabled(false);
- }
- if (!isAlwaysDrawnWithCacheEnabled()) {
- invalidate();
+ if (!isHardwareAccelerated()) {
+ if (mClearScrollingCache == null) {
+ mClearScrollingCache = new Runnable() {
+ public void run() {
+ if (mCachingStarted) {
+ mCachingStarted = mCachingActive = false;
+ setChildrenDrawnWithCacheEnabled(false);
+ if ((mPersistentDrawingCache & PERSISTENT_SCROLLING_CACHE) == 0) {
+ setChildrenDrawingCacheEnabled(false);
+ }
+ if (!isAlwaysDrawnWithCacheEnabled()) {
+ invalidate();
+ }
}
}
- }
- };
+ };
+ }
+ post(mClearScrollingCache);
}
- post(mClearScrollingCache);
}
/**
@@ -4599,14 +4608,18 @@
mRecycler.removeSkippedScrap();
}
+ // invalidate before moving the children to avoid unnecessary invalidate
+ // calls to bubble up from the children all the way to the top
+ if (!awakenScrollBars()) {
+ invalidate();
+ }
+
offsetChildrenTopAndBottom(incrementalDeltaY);
if (down) {
mFirstPosition += count;
}
- invalidate();
-
final int absIncrementalDeltaY = Math.abs(incrementalDeltaY);
if (spaceAbove < absIncrementalDeltaY || spaceBelow < absIncrementalDeltaY) {
fillGap(down);
@@ -4629,7 +4642,6 @@
mBlockLayoutRequests = false;
invokeOnItemScrollListener();
- awakenScrollBars();
return false;
}
diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java
index e36afa3..ca5648a 100644
--- a/core/java/android/widget/AbsSeekBar.java
+++ b/core/java/android/widget/AbsSeekBar.java
@@ -133,6 +133,16 @@
}
/**
+ * Return the drawable used to represent the scroll thumb - the component that
+ * the user can drag back and forth indicating the current value by its position.
+ *
+ * @return The current thumb drawable
+ */
+ public Drawable getThumb() {
+ return mThumb;
+ }
+
+ /**
* @see #setThumbOffset(int)
*/
public int getThumbOffset() {
diff --git a/core/java/android/widget/AdapterViewFlipper.java b/core/java/android/widget/AdapterViewFlipper.java
index 5096227..aea029b 100644
--- a/core/java/android/widget/AdapterViewFlipper.java
+++ b/core/java/android/widget/AdapterViewFlipper.java
@@ -127,13 +127,29 @@
}
/**
- * How long to wait before flipping to the next view
+ * Returns the flip interval, in milliseconds.
*
- * @param milliseconds
- * time in milliseconds
+ * @return the flip interval in milliseconds
+ *
+ * @see #setFlipInterval(int)
+ *
+ * @attr ref android.R.styleable#AdapterViewFlipper_flipInterval
*/
- public void setFlipInterval(int milliseconds) {
- mFlipInterval = milliseconds;
+ public int getFlipInterval() {
+ return mFlipInterval;
+ }
+
+ /**
+ * How long to wait before flipping to the next view.
+ *
+ * @param flipInterval flip interval in milliseconds
+ *
+ * @see #getFlipInterval()
+ *
+ * @attr ref android.R.styleable#AdapterViewFlipper_flipInterval
+ */
+ public void setFlipInterval(int flipInterval) {
+ mFlipInterval = flipInterval;
}
/**
diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java
index fd93980..c5066b6 100644
--- a/core/java/android/widget/DatePicker.java
+++ b/core/java/android/widget/DatePicker.java
@@ -29,8 +29,8 @@
import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
+import android.view.View;
import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
@@ -280,9 +280,7 @@
reorderSpinners();
// set content descriptions
- if (AccessibilityManager.getInstance(mContext).isEnabled()) {
- setContentDescriptions();
- }
+ setContentDescriptions();
}
/**
@@ -717,20 +715,27 @@
private void setContentDescriptions() {
// Day
- String text = mContext.getString(R.string.date_picker_increment_day_button);
- mDaySpinner.findViewById(R.id.increment).setContentDescription(text);
- text = mContext.getString(R.string.date_picker_decrement_day_button);
- mDaySpinner.findViewById(R.id.decrement).setContentDescription(text);
+ trySetContentDescription(mDaySpinner, R.id.increment,
+ R.string.date_picker_increment_day_button);
+ trySetContentDescription(mDaySpinner, R.id.decrement,
+ R.string.date_picker_decrement_day_button);
// Month
- text = mContext.getString(R.string.date_picker_increment_month_button);
- mMonthSpinner.findViewById(R.id.increment).setContentDescription(text);
- text = mContext.getString(R.string.date_picker_decrement_month_button);
- mMonthSpinner.findViewById(R.id.decrement).setContentDescription(text);
+ trySetContentDescription(mMonthSpinner, R.id.increment,
+ R.string.date_picker_increment_month_button);
+ trySetContentDescription(mMonthSpinner, R.id.decrement,
+ R.string.date_picker_decrement_month_button);
// Year
- text = mContext.getString(R.string.date_picker_increment_year_button);
- mYearSpinner.findViewById(R.id.increment).setContentDescription(text);
- text = mContext.getString(R.string.date_picker_decrement_year_button);
- mYearSpinner.findViewById(R.id.decrement).setContentDescription(text);
+ trySetContentDescription(mYearSpinner, R.id.increment,
+ R.string.date_picker_increment_year_button);
+ trySetContentDescription(mYearSpinner, R.id.decrement,
+ R.string.date_picker_decrement_year_button);
+ }
+
+ private void trySetContentDescription(View root, int viewId, int contDescResId) {
+ View target = root.findViewById(viewId);
+ if (target != null) {
+ target.setContentDescription(mContext.getString(contDescResId));
+ }
}
private void updateInputState() {
diff --git a/core/java/android/widget/EdgeEffect.java b/core/java/android/widget/EdgeEffect.java
index 83aa8ba..bb4a4cf 100644
--- a/core/java/android/widget/EdgeEffect.java
+++ b/core/java/android/widget/EdgeEffect.java
@@ -16,6 +16,7 @@
package android.widget;
+import android.graphics.Rect;
import com.android.internal.R;
import android.content.Context;
@@ -45,6 +46,7 @@
* {@link #draw(Canvas)} method.</p>
*/
public class EdgeEffect {
+ @SuppressWarnings("UnusedDeclaration")
private static final String TAG = "EdgeEffect";
// Time it will take the effect to fully recede in ms
@@ -57,10 +59,7 @@
private static final int PULL_DECAY_TIME = 1000;
private static final float MAX_ALPHA = 1.f;
- private static final float HELD_EDGE_ALPHA = 0.7f;
private static final float HELD_EDGE_SCALE_Y = 0.5f;
- private static final float HELD_GLOW_ALPHA = 0.5f;
- private static final float HELD_GLOW_SCALE_Y = 0.5f;
private static final float MAX_GLOW_HEIGHT = 4.f;
@@ -76,7 +75,9 @@
private final Drawable mGlow;
private int mWidth;
private int mHeight;
- private final int MIN_WIDTH = 300;
+ private int mX;
+ private int mY;
+ private static final int MIN_WIDTH = 300;
private final int mMinWidth;
private float mEdgeAlpha;
@@ -119,6 +120,13 @@
private int mState = STATE_IDLE;
private float mPullDistance;
+
+ private final Rect mBounds = new Rect();
+
+ private final int mEdgeHeight;
+ private final int mGlowHeight;
+ private final int mGlowWidth;
+ private final int mMaxEffectHeight;
/**
* Construct a new EdgeEffect with a theme appropriate for the provided context.
@@ -129,6 +137,14 @@
mEdge = res.getDrawable(R.drawable.overscroll_edge);
mGlow = res.getDrawable(R.drawable.overscroll_glow);
+ mEdgeHeight = mEdge.getIntrinsicHeight();
+ mGlowHeight = mGlow.getIntrinsicHeight();
+ mGlowWidth = mGlow.getIntrinsicWidth();
+
+ mMaxEffectHeight = (int) (Math.min(
+ mGlowHeight * MAX_GLOW_HEIGHT * mGlowHeight / mGlowWidth * 0.6f,
+ mGlowHeight * MAX_GLOW_HEIGHT) + 0.5f);
+
mMinWidth = (int) (res.getDisplayMetrics().density * MIN_WIDTH + 0.5f);
mInterpolator = new DecelerateInterpolator();
}
@@ -145,6 +161,18 @@
}
/**
+ * Set the position of this edge effect in pixels. This position is
+ * only used by {@link #getBounds(boolean)}.
+ *
+ * @param x The position of the edge effect on the X axis
+ * @param y The position of the edge effect on the Y axis
+ */
+ void setPosition(int x, int y) {
+ mX = x;
+ mY = y;
+ }
+
+ /**
* Reports if this EdgeEffect's animation is finished. If this method returns false
* after a call to {@link #draw(Canvas)} the host widget should schedule another
* drawing pass to continue the animation.
@@ -300,16 +328,11 @@
public boolean draw(Canvas canvas) {
update();
- final int edgeHeight = mEdge.getIntrinsicHeight();
- final int edgeWidth = mEdge.getIntrinsicWidth();
- final int glowHeight = mGlow.getIntrinsicHeight();
- final int glowWidth = mGlow.getIntrinsicWidth();
-
mGlow.setAlpha((int) (Math.max(0, Math.min(mGlowAlpha, 1)) * 255));
int glowBottom = (int) Math.min(
- glowHeight * mGlowScaleY * glowHeight/ glowWidth * 0.6f,
- glowHeight * MAX_GLOW_HEIGHT);
+ mGlowHeight * mGlowScaleY * mGlowHeight / mGlowWidth * 0.6f,
+ mGlowHeight * MAX_GLOW_HEIGHT);
if (mWidth < mMinWidth) {
// Center the glow and clip it.
int glowLeft = (mWidth - mMinWidth)/2;
@@ -323,7 +346,7 @@
mEdge.setAlpha((int) (Math.max(0, Math.min(mEdgeAlpha, 1)) * 255));
- int edgeBottom = (int) (edgeHeight * mEdgeScaleY);
+ int edgeBottom = (int) (mEdgeHeight * mEdgeScaleY);
if (mWidth < mMinWidth) {
// Center the edge and clip it.
int edgeLeft = (mWidth - mMinWidth)/2;
@@ -334,9 +357,25 @@
}
mEdge.draw(canvas);
+ if (mState == STATE_RECEDE && glowBottom == 0 && edgeBottom == 0) {
+ mState = STATE_IDLE;
+ }
+
return mState != STATE_IDLE;
}
+ /**
+ * Returns the bounds of the edge effect.
+ *
+ * @hide
+ */
+ public Rect getBounds(boolean reverse) {
+ mBounds.set(0, 0, mWidth, mMaxEffectHeight);
+ mBounds.offset(mX, mY - (reverse ? mMaxEffectHeight : 0));
+
+ return mBounds;
+ }
+
private void update() {
final long time = AnimationUtils.currentAnimationTimeMillis();
final float t = Math.min((time - mStartTime) / mDuration, 1.f);
diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java
index fc08cc5..60dd55c 100644
--- a/core/java/android/widget/GridLayout.java
+++ b/core/java/android/widget/GridLayout.java
@@ -29,8 +29,8 @@
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
-
import com.android.internal.R;
+import android.widget.RemoteViews.RemoteView;
import java.lang.reflect.Array;
import java.util.ArrayList;
@@ -146,6 +146,7 @@
* @attr ref android.R.styleable#GridLayout_rowOrderPreserved
* @attr ref android.R.styleable#GridLayout_columnOrderPreserved
*/
+@RemoteView
public class GridLayout extends ViewGroup {
// Public constants
@@ -234,7 +235,6 @@
final Axis horizontalAxis = new Axis(true);
final Axis verticalAxis = new Axis(false);
- boolean layoutParamsValid = false;
int orientation = DEFAULT_ORIENTATION;
boolean useDefaultMargins = DEFAULT_USE_DEFAULT_MARGINS;
int alignmentMode = DEFAULT_ALIGNMENT_MODE;
@@ -713,12 +713,10 @@
minor = minor + minorSpan;
}
- lastLayoutParamsHashCode = computeLayoutParamsHashCode();
- invalidateStructure();
}
private void invalidateStructure() {
- layoutParamsValid = false;
+ lastLayoutParamsHashCode = UNINITIALIZED_HASH;
horizontalAxis.invalidateStructure();
verticalAxis.invalidateStructure();
// This can end up being done twice. Better twice than not at all.
@@ -742,10 +740,6 @@
}
final LayoutParams getLayoutParams(View c) {
- if (!layoutParamsValid) {
- validateLayoutParams();
- layoutParamsValid = true;
- }
return (LayoutParams) c.getLayoutParams();
}
@@ -874,20 +868,22 @@
return result;
}
- private void checkForLayoutParamsModification() {
- int layoutParamsHashCode = computeLayoutParamsHashCode();
- if (lastLayoutParamsHashCode != UNINITIALIZED_HASH &&
- lastLayoutParamsHashCode != layoutParamsHashCode) {
- invalidateStructure();
+ private void consistencyCheck() {
+ if (lastLayoutParamsHashCode == UNINITIALIZED_HASH) {
+ validateLayoutParams();
+ lastLayoutParamsHashCode = computeLayoutParamsHashCode();
+ } else if (lastLayoutParamsHashCode != computeLayoutParamsHashCode()) {
Log.w(TAG, "The fields of some layout parameters were modified in between layout " +
"operations. Check the javadoc for GridLayout.LayoutParams#rowSpec.");
+ invalidateStructure();
+ consistencyCheck();
}
}
// Measurement
private void measureChildWithMargins2(View child, int parentWidthSpec, int parentHeightSpec,
- int childWidth, int childHeight) {
+ int childWidth, int childHeight) {
int childWidthSpec = getChildMeasureSpec(parentWidthSpec,
mPaddingLeft + mPaddingRight + getTotalMargin(child, true), childWidth);
int childHeightSpec = getChildMeasureSpec(parentHeightSpec,
@@ -923,7 +919,7 @@
@Override
protected void onMeasure(int widthSpec, int heightSpec) {
- checkForLayoutParamsModification();
+ consistencyCheck();
/** If we have been called by {@link View#measure(int, int)}, one of width or height
* is likely to have changed. We must invalidate if so. */
@@ -993,7 +989,7 @@
*/
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- checkForLayoutParamsModification();
+ consistencyCheck();
int targetWidth = right - left;
int targetHeight = bottom - top;
@@ -1250,7 +1246,7 @@
}
private void include(List<Arc> arcs, Interval key, MutableInt size,
- boolean ignoreIfAlreadyPresent) {
+ boolean ignoreIfAlreadyPresent) {
/*
Remove self referential links.
These appear:
@@ -1429,8 +1425,8 @@
int dst = arc.span.max;
int value = arc.value.value;
result.append((src < dst) ?
- var + dst + " - " + var + src + " > " + value :
- var + src + " - " + var + dst + " < " + -value);
+ var + dst + "-" + var + src + ">=" + value :
+ var + src + "-" + var + dst + "<=" + -value);
}
return result.toString();
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java
index 739bcce..0f1dab5 100644
--- a/core/java/android/widget/GridView.java
+++ b/core/java/android/widget/GridView.java
@@ -1908,7 +1908,8 @@
}
/**
- * Describes how the child views are horizontally aligned. Defaults to Gravity.LEFT
+ * Set the gravity for this grid. Gravity describes how the child views
+ * are horizontally aligned. Defaults to Gravity.LEFT
*
* @param gravity the gravity to apply to this grid's children
*
@@ -1922,6 +1923,17 @@
}
/**
+ * Describes how the child views are horizontally aligned. Defaults to Gravity.LEFT
+ *
+ * @return the gravity that will be applied to this grid's children
+ *
+ * @attr ref android.R.styleable#GridView_gravity
+ */
+ public int getGravity() {
+ return mGravity;
+ }
+
+ /**
* Set the amount of horizontal (x) spacing to place between each item
* in the grid.
*
@@ -1937,6 +1949,44 @@
}
}
+ /**
+ * Returns the amount of horizontal spacing currently used between each item in the grid.
+ *
+ * <p>This is only accurate for the current layout. If {@link #setHorizontalSpacing(int)}
+ * has been called but layout is not yet complete, this method may return a stale value.
+ * To get the horizontal spacing that was explicitly requested use
+ * {@link #getRequestedHorizontalSpacing()}.</p>
+ *
+ * @return Current horizontal spacing between each item in pixels
+ *
+ * @see #setHorizontalSpacing(int)
+ * @see #getRequestedHorizontalSpacing()
+ *
+ * @attr ref android.R.styleable#GridView_horizontalSpacing
+ */
+ public int getHorizontalSpacing() {
+ return mHorizontalSpacing;
+ }
+
+ /**
+ * Returns the requested amount of horizontal spacing between each item in the grid.
+ *
+ * <p>The value returned may have been supplied during inflation as part of a style,
+ * the default GridView style, or by a call to {@link #setHorizontalSpacing(int)}.
+ * If layout is not yet complete or if GridView calculated a different horizontal spacing
+ * from what was requested, this may return a different value from
+ * {@link #getHorizontalSpacing()}.</p>
+ *
+ * @return The currently requested horizontal spacing between items, in pixels
+ *
+ * @see #setHorizontalSpacing(int)
+ * @see #getHorizontalSpacing()
+ *
+ * @attr ref android.R.styleable#GridView_horizontalSpacing
+ */
+ public int getRequestedHorizontalSpacing() {
+ return mRequestedHorizontalSpacing;
+ }
/**
* Set the amount of vertical (y) spacing to place between each item
@@ -1945,6 +1995,8 @@
* @param verticalSpacing The amount of vertical space between items,
* in pixels.
*
+ * @see #getVerticalSpacing()
+ *
* @attr ref android.R.styleable#GridView_verticalSpacing
*/
public void setVerticalSpacing(int verticalSpacing) {
@@ -1955,6 +2007,19 @@
}
/**
+ * Returns the amount of vertical spacing between each item in the grid.
+ *
+ * @return The vertical spacing between items in pixels
+ *
+ * @see #setVerticalSpacing(int)
+ *
+ * @attr ref android.R.styleable#GridView_verticalSpacing
+ */
+ public int getVerticalSpacing() {
+ return mVerticalSpacing;
+ }
+
+ /**
* Control how items are stretched to fill their space.
*
* @param stretchMode Either {@link #NO_STRETCH},
@@ -1988,6 +2053,39 @@
}
/**
+ * Return the width of a column in the grid.
+ *
+ * <p>This may not be valid yet if a layout is pending.</p>
+ *
+ * @return The column width in pixels
+ *
+ * @see #setColumnWidth(int)
+ * @see #getRequestedColumnWidth()
+ *
+ * @attr ref android.R.styleable#GridView_columnWidth
+ */
+ public int getColumnWidth() {
+ return mColumnWidth;
+ }
+
+ /**
+ * Return the requested width of a column in the grid.
+ *
+ * <p>This may not be the actual column width used. Use {@link #getColumnWidth()}
+ * to retrieve the current real width of a column.</p>
+ *
+ * @return The requested column width in pixels
+ *
+ * @see #setColumnWidth(int)
+ * @see #getColumnWidth()
+ *
+ * @attr ref android.R.styleable#GridView_columnWidth
+ */
+ public int getRequestedColumnWidth() {
+ return mRequestedColumnWidth;
+ }
+
+ /**
* Set the number of columns in the grid
*
* @param numColumns The desired number of columns.
diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java
index 0db6ef2..4e13ea1 100644
--- a/core/java/android/widget/HorizontalScrollView.java
+++ b/core/java/android/widget/HorizontalScrollView.java
@@ -715,6 +715,7 @@
} else {
super.scrollTo(scrollX, scrollY);
}
+
awakenScrollBars();
}
@@ -1204,10 +1205,9 @@
}
}
- awakenScrollBars();
-
- // Keep on drawing until the animation has finished.
- postInvalidate();
+ if (!awakenScrollBars()) {
+ invalidate();
+ }
}
}
@@ -1414,7 +1414,7 @@
/**
* Return true if child is a descendant of parent, (or equal to the parent).
*/
- private boolean isViewDescendantOf(View child, View parent) {
+ private static boolean isViewDescendantOf(View child, View parent) {
if (child == parent) {
return true;
}
@@ -1524,7 +1524,7 @@
}
}
- private int clamp(int n, int my, int child) {
+ private static int clamp(int n, int my, int child) {
if (my >= child || n < 0) {
return 0;
}
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java
index 3001ea1..b1a75e1 100644
--- a/core/java/android/widget/ImageView.java
+++ b/core/java/android/widget/ImageView.java
@@ -223,11 +223,28 @@
}
/**
+ * True when ImageView is adjusting its bounds
+ * to preserve the aspect ratio of its drawable
+ *
+ * @return whether to adjust the bounds of this view
+ * to presrve the original aspect ratio of the drawable
+ *
+ * @see #setAdjustViewBounds(boolean)
+ *
+ * @attr ref android.R.styleable#ImageView_adjustViewBounds
+ */
+ public boolean getAdjustViewBounds() {
+ return mAdjustViewBounds;
+ }
+
+ /**
* Set this to true if you want the ImageView to adjust its bounds
* to preserve the aspect ratio of its drawable.
* @param adjustViewBounds Whether to adjust the bounds of this view
* to presrve the original aspect ratio of the drawable
*
+ * @see #getAdjustViewBounds()
+ *
* @attr ref android.R.styleable#ImageView_adjustViewBounds
*/
@android.view.RemotableViewMethod
@@ -237,7 +254,20 @@
setScaleType(ScaleType.FIT_CENTER);
}
}
-
+
+ /**
+ * The maximum width of this view.
+ *
+ * @return The maximum width of this view
+ *
+ * @see #setMaxWidth(int)
+ *
+ * @attr ref android.R.styleable#ImageView_maxWidth
+ */
+ public int getMaxWidth() {
+ return mMaxWidth;
+ }
+
/**
* An optional argument to supply a maximum width for this view. Only valid if
* {@link #setAdjustViewBounds(boolean)} has been set to true. To set an image to be a maximum
@@ -253,14 +283,29 @@
* </p>
*
* @param maxWidth maximum width for this view
- *
+ *
+ * @see #getMaxWidth()
+ *
* @attr ref android.R.styleable#ImageView_maxWidth
*/
@android.view.RemotableViewMethod
public void setMaxWidth(int maxWidth) {
mMaxWidth = maxWidth;
}
-
+
+ /**
+ * The maximum height of this view.
+ *
+ * @return The maximum height of this view
+ *
+ * @see #setMaxHeight(int)
+ *
+ * @attr ref android.R.styleable#ImageView_maxHeight
+ */
+ public int getMaxHeight() {
+ return mMaxHeight;
+ }
+
/**
* An optional argument to supply a maximum height for this view. Only valid if
* {@link #setAdjustViewBounds(boolean)} has been set to true. To set an image to be a
@@ -276,7 +321,9 @@
* </p>
*
* @param maxHeight maximum height for this view
- *
+ *
+ * @see #getMaxHeight()
+ *
* @attr ref android.R.styleable#ImageView_maxHeight
*/
@android.view.RemotableViewMethod
@@ -522,7 +569,37 @@
invalidate();
}
}
-
+
+ /**
+ * Return whether this ImageView crops to padding.
+ *
+ * @return whether this ImageView crops to padding
+ *
+ * @see #setCropToPadding(boolean)
+ *
+ * @attr ref android.R.styleable#ImageView_cropToPadding
+ */
+ public boolean getCropToPadding() {
+ return mCropToPadding;
+ }
+
+ /**
+ * Sets whether this ImageView will crop to padding.
+ *
+ * @param cropToPadding whether this ImageView will crop to padding
+ *
+ * @see #getCropToPadding()
+ *
+ * @attr ref android.R.styleable#ImageView_cropToPadding
+ */
+ public void setCropToPadding(boolean cropToPadding) {
+ if (mCropToPadding != cropToPadding) {
+ mCropToPadding = cropToPadding;
+ requestLayout();
+ invalidate();
+ }
+ }
+
private void resolveUri() {
if (mDrawable != null) {
return;
@@ -997,11 +1074,24 @@
public final void clearColorFilter() {
setColorFilter(null);
}
-
+
+ /**
+ * Returns the active color filter for this ImageView.
+ *
+ * @return the active color filter for this ImageView
+ *
+ * @see #setColorFilter(android.graphics.ColorFilter)
+ */
+ public ColorFilter getColorFilter() {
+ return mColorFilter;
+ }
+
/**
* Apply an arbitrary colorfilter to the image.
*
* @param cf the colorfilter to apply (may be null)
+ *
+ * @see #getColorFilter()
*/
public void setColorFilter(ColorFilter cf) {
if (mColorFilter != cf) {
@@ -1012,6 +1102,37 @@
}
}
+ /**
+ * Returns the alpha that will be applied to the drawable of this ImageView.
+ *
+ * @return the alpha that will be applied to the drawable of this ImageView
+ *
+ * @see #setImageAlpha(int)
+ */
+ public int getImageAlpha() {
+ return mAlpha;
+ }
+
+ /**
+ * Sets the alpha value that should be applied to the image.
+ *
+ * @param alpha the alpha value that should be applied to the image
+ *
+ * @see #getImageAlpha()
+ */
+ @RemotableViewMethod
+ public void setImageAlpha(int alpha) {
+ setAlpha(alpha);
+ }
+
+ /**
+ * Sets the alpha value that should be applied to the image.
+ *
+ * @param alpha the alpha value that should be applied to the image
+ *
+ * @deprecated use #setImageAlpha(int) instead
+ */
+ @Deprecated
@RemotableViewMethod
public void setAlpha(int alpha) {
alpha &= 0xFF; // keep it legal
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index 3335da0..4e56cd6 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -16,10 +16,6 @@
package android.widget;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
import android.annotation.Widget;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -48,22 +44,41 @@
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.accessibility.AccessibilityNodeProvider;
import android.view.animation.DecelerateInterpolator;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import com.android.internal.R;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
/**
* A widget that enables the user to select a number form a predefined range.
- * The widget presents an input field and up and down buttons for selecting the
- * current value. Pressing/long-pressing the up and down buttons increments and
- * decrements the current value respectively. Touching the input field shows a
- * scroll wheel, which when touched allows direct edit
- * of the current value. Sliding gestures up or down hide the buttons and the
- * input filed, show and rotate the scroll wheel. Flinging is
- * also supported. The widget enables mapping from positions to strings such
- * that, instead of the position index, the corresponding string is displayed.
+ * There are two flavors of this widget and which one is presented to the user
+ * depends on the current theme.
+ * <ul>
+ * <li>
+ * If the current theme is derived from {@link android.R.style#Theme} the widget
+ * presents the current value as an editable input field with an increment button
+ * above and a decrement button below. Long pressing the buttons allows for a quick
+ * change of the current value. Tapping on the input field allows to type in
+ * a desired value.
+ * </li>
+ * <li>
+ * If the current theme is derived from {@link android.R.style#Theme_Holo} or
+ * {@link android.R.style#Theme_Holo_Light} the widget presents the current
+ * value as an editable input field with a lesser value above and a greater
+ * value below. Tapping on the lesser or greater value selects it by animating
+ * the number axis up or down to make the chosen value current. Flinging up
+ * or down allows for multiple increments or decrements of the current value.
+ * Long pressing on the lesser and greater values also allows for a quick change
+ * of the current value. Tapping on the current value allows to type in a
+ * desired value.
+ * </li>
+ * </ul>
* <p>
* For an example of using this widget, see {@link android.widget.TimePicker}.
* </p>
@@ -74,7 +89,7 @@
/**
* The number of items show in the selector wheel.
*/
- public static final int SELECTOR_WHEEL_ITEM_COUNT = 5;
+ private static final int SELECTOR_WHEEL_ITEM_COUNT = 3;
/**
* The default update interval during long press.
@@ -84,7 +99,7 @@
/**
* The index of the middle selector item.
*/
- private static final int SELECTOR_MIDDLE_ITEM_INDEX = 2;
+ private static final int SELECTOR_MIDDLE_ITEM_INDEX = SELECTOR_WHEEL_ITEM_COUNT / 2;
/**
* The coefficient by which to adjust (divide) the max fling velocity.
@@ -97,19 +112,12 @@
private static final int SELECTOR_ADJUSTMENT_DURATION_MILLIS = 800;
/**
- * The duration of scrolling to the next/previous value while changing
- * the current value by one, i.e. increment or decrement.
+ * The duration of scrolling to the next/previous value while changing the
+ * current value by one, i.e. increment or decrement.
*/
private static final int CHANGE_CURRENT_BY_ONE_SCROLL_DURATION = 300;
/**
- * The the delay for showing the input controls after a single tap on the
- * input text.
- */
- private static final int SHOW_INPUT_CONTROLS_DELAY_MILLIS = ViewConfiguration
- .getDoubleTapTimeout();
-
- /**
* The strength of fading in the top and bottom while drawing the selector.
*/
private static final float TOP_AND_BOTTOM_FADING_EDGE_STRENGTH = 0.9f;
@@ -120,56 +128,31 @@
private static final int UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT = 2;
/**
- * In this state the selector wheel is not shown.
+ * The default unscaled distance between the selection dividers.
*/
- private static final int SELECTOR_WHEEL_STATE_NONE = 0;
+ private static final int UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE = 48;
/**
- * In this state the selector wheel is small.
+ * The default unscaled minimal distance for a swipe to be considered a fling.
*/
- private static final int SELECTOR_WHEEL_STATE_SMALL = 1;
+ private static final int UNSCALED_DEFAULT_MIN_FLING_DISTANCE = 150;
/**
- * In this state the selector wheel is large.
+ * Coefficient for adjusting touch scroll distance.
*/
- private static final int SELECTOR_WHEEL_STATE_LARGE = 2;
+ private static final float TOUCH_SCROLL_DECELERATION_COEFFICIENT = 2.5f;
/**
- * The alpha of the selector wheel when it is bright.
+ * The resource id for the default layout.
*/
- private static final int SELECTOR_WHEEL_BRIGHT_ALPHA = 255;
-
- /**
- * The alpha of the selector wheel when it is dimmed.
- */
- private static final int SELECTOR_WHEEL_DIM_ALPHA = 60;
-
- /**
- * The alpha for the increment/decrement button when it is transparent.
- */
- private static final int BUTTON_ALPHA_TRANSPARENT = 0;
-
- /**
- * The alpha for the increment/decrement button when it is opaque.
- */
- private static final int BUTTON_ALPHA_OPAQUE = 1;
-
- /**
- * The property for setting the selector paint.
- */
- private static final String PROPERTY_SELECTOR_PAINT_ALPHA = "selectorPaintAlpha";
-
- /**
- * The property for setting the increment/decrement button alpha.
- */
- private static final String PROPERTY_BUTTON_ALPHA = "alpha";
+ private static final int DEFAULT_LAYOUT_RESOURCE_ID = R.layout.number_picker;
/**
* The numbers accepted by the input text's {@link Filter}
*/
private static final char[] DIGIT_CHARACTERS = new char[] {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
- };
+ };
/**
* Constant for unspecified size.
@@ -215,6 +198,11 @@
private final EditText mInputText;
/**
+ * The distance between the two selection dividers.
+ */
+ private final int mSelectionDividersDistance;
+
+ /**
* The min height of this widget.
*/
private final int mMinHeight;
@@ -245,6 +233,11 @@
private final int mTextSize;
/**
+ * The minimal distance for a swipe to be considered a fling.
+ */
+ private final int mMinFlingDistance;
+
+ /**
* The height of the gap between text elements if the selector wheel.
*/
private int mSelectorTextGapHeight;
@@ -297,10 +290,7 @@
/**
* The selector indices whose value are show by the selector.
*/
- private final int[] mSelectorIndices = new int[] {
- Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE,
- Integer.MIN_VALUE
- };
+ private final int[] mSelectorIndices = new int[SELECTOR_WHEEL_ITEM_COUNT];
/**
* The {@link Paint} for drawing the selector.
@@ -343,25 +333,15 @@
private SetSelectionCommand mSetSelectionCommand;
/**
- * Handle to the reusable command for adjusting the scroller.
- */
- private AdjustScrollerCommand mAdjustScrollerCommand;
-
- /**
* Handle to the reusable command for changing the current value from long
* press by one.
*/
private ChangeCurrentByOneFromLongPressCommand mChangeCurrentByOneFromLongPressCommand;
/**
- * {@link Animator} for showing the up/down arrows.
+ * Command for beginning an edit of the current value via IME on long press.
*/
- private final AnimatorSet mShowInputControlsAnimator;
-
- /**
- * {@link Animator} for dimming the selector wheel.
- */
- private final Animator mDimSelectorWheelAnimator;
+ private BeginSoftInputOnLongPressCommand mBeginSoftInputOnLongPressCommand;
/**
* The Y position of the last down event.
@@ -369,24 +349,14 @@
private float mLastDownEventY;
/**
- * The Y position of the last motion event.
+ * The time of the last down event.
*/
- private float mLastMotionEventY;
+ private long mLastDownEventTime;
/**
- * Flag if to check for double tap and potentially start edit.
+ * The Y position of the last down or move event.
*/
- private boolean mCheckBeginEditOnUpEvent;
-
- /**
- * Flag if to adjust the selector wheel on next up event.
- */
- private boolean mAdjustScrollerOnUpEvent;
-
- /**
- * The state of the selector wheel.
- */
- private int mSelectorWheelState;
+ private float mLastDownOrMoveEventY;
/**
* Determines speed during touch scrolling.
@@ -419,9 +389,9 @@
private final int mSolidColor;
/**
- * Flag indicating if this widget supports flinging.
+ * Flag whether this widget has a selector wheel.
*/
- private final boolean mFlingable;
+ private final boolean mHasSelectorWheel;
/**
* Divider for showing item to be selected while scrolling
@@ -434,29 +404,40 @@
private final int mSelectionDividerHeight;
/**
- * Reusable {@link Rect} instance.
- */
- private final Rect mTempRect = new Rect();
-
- /**
* The current scroll state of the number picker.
*/
private int mScrollState = OnScrollListener.SCROLL_STATE_IDLE;
/**
- * The duration of the animation for showing the input controls.
+ * Flag whether to ignore move events - we ignore such when we show in IME
+ * to prevent the content from scrolling.
*/
- private final long mShowInputControlsAnimimationDuration;
+ private boolean mIngonreMoveEvents;
/**
- * Flag whether the scoll wheel and the fading edges have been initialized.
+ * Flag whether to show soft input on tap.
*/
- private boolean mScrollWheelAndFadingEdgesInitialized;
+ private boolean mShowSoftInputOnTap;
/**
- * The time of the last up event.
+ * The top of the top selection divider.
*/
- private long mLastUpEventTimeMillis;
+ private int mTopSelectionDividerTop;
+
+ /**
+ * The bottom of the bottom selection divider.
+ */
+ private int mBottomSelectionDividerBottom;
+
+ /**
+ * The virtual id of the last hovered child.
+ */
+ private int mLastHoveredChildVirtualViewId;
+
+ /**
+ * Provider to report to clients the semantic structure of this widget.
+ */
+ private AccessibilityNodeProviderImpl mAccessibilityNodeProvider;
/**
* Interface to listen for changes of the current value.
@@ -484,7 +465,7 @@
public static int SCROLL_STATE_IDLE = 0;
/**
- * The user is scrolling using touch, and their finger is still on the screen.
+ * The user is scrolling using touch, and his finger is still on the screen.
*/
public static int SCROLL_STATE_TOUCH_SCROLL = 1;
@@ -549,58 +530,78 @@
super(context, attrs, defStyle);
// process style attributes
- TypedArray attributesArray = context.obtainStyledAttributes(attrs,
- R.styleable.NumberPicker, defStyle, 0);
+ TypedArray attributesArray = context.obtainStyledAttributes(
+ attrs, R.styleable.NumberPicker, defStyle, 0);
+ final int layoutResId = attributesArray.getResourceId(
+ R.styleable.NumberPicker_internalLayout, DEFAULT_LAYOUT_RESOURCE_ID);
+
+ mHasSelectorWheel = (layoutResId != DEFAULT_LAYOUT_RESOURCE_ID);
+
mSolidColor = attributesArray.getColor(R.styleable.NumberPicker_solidColor, 0);
- mFlingable = attributesArray.getBoolean(R.styleable.NumberPicker_flingable, true);
+
mSelectionDivider = attributesArray.getDrawable(R.styleable.NumberPicker_selectionDivider);
- int defSelectionDividerHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
- UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT,
+
+ final int defSelectionDividerHeight = (int) TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT,
getResources().getDisplayMetrics());
mSelectionDividerHeight = attributesArray.getDimensionPixelSize(
R.styleable.NumberPicker_selectionDividerHeight, defSelectionDividerHeight);
+
+ final int defSelectionDividerDistance = (int) TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE,
+ getResources().getDisplayMetrics());
+ mSelectionDividersDistance = attributesArray.getDimensionPixelSize(
+ R.styleable.NumberPicker_selectionDividersDistance, defSelectionDividerDistance);
+
+ final int defMinFlingDistance = (int) TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_MIN_FLING_DISTANCE,
+ getResources().getDisplayMetrics());
+ mMinFlingDistance = attributesArray.getDimensionPixelSize(
+ R.styleable.NumberPicker_minFlingDistance, defMinFlingDistance);
+
mMinHeight = attributesArray.getDimensionPixelSize(
R.styleable.NumberPicker_internalMinHeight, SIZE_UNSPECIFIED);
+
mMaxHeight = attributesArray.getDimensionPixelSize(
R.styleable.NumberPicker_internalMaxHeight, SIZE_UNSPECIFIED);
if (mMinHeight != SIZE_UNSPECIFIED && mMaxHeight != SIZE_UNSPECIFIED
&& mMinHeight > mMaxHeight) {
throw new IllegalArgumentException("minHeight > maxHeight");
}
- mMinWidth = attributesArray.getDimensionPixelSize(R.styleable.NumberPicker_internalMinWidth,
- SIZE_UNSPECIFIED);
- mMaxWidth = attributesArray.getDimensionPixelSize(R.styleable.NumberPicker_internalMaxWidth,
- SIZE_UNSPECIFIED);
+
+ mMinWidth = attributesArray.getDimensionPixelSize(
+ R.styleable.NumberPicker_internalMinWidth, SIZE_UNSPECIFIED);
+
+ mMaxWidth = attributesArray.getDimensionPixelSize(
+ R.styleable.NumberPicker_internalMaxWidth, SIZE_UNSPECIFIED);
if (mMinWidth != SIZE_UNSPECIFIED && mMaxWidth != SIZE_UNSPECIFIED
&& mMinWidth > mMaxWidth) {
throw new IllegalArgumentException("minWidth > maxWidth");
}
- mComputeMaxWidth = (mMaxWidth == Integer.MAX_VALUE);
- attributesArray.recycle();
- mShowInputControlsAnimimationDuration = getResources().getInteger(
- R.integer.config_longAnimTime);
+ mComputeMaxWidth = (mMaxWidth == Integer.MAX_VALUE);
+
+ attributesArray.recycle();
// By default Linearlayout that we extend is not drawn. This is
// its draw() method is not called but dispatchDraw() is called
// directly (see ViewGroup.drawChild()). However, this class uses
// the fading edge effect implemented by View and we need our
// draw() method to be called. Therefore, we declare we will draw.
- setWillNotDraw(false);
- setSelectorWheelState(SELECTOR_WHEEL_STATE_NONE);
+ setWillNotDraw(!mHasSelectorWheel);
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
- inflater.inflate(R.layout.number_picker, this, true);
+ inflater.inflate(layoutResId, this, true);
OnClickListener onClickListener = new OnClickListener() {
public void onClick(View v) {
hideSoftInput();
mInputText.clearFocus();
if (v.getId() == R.id.increment) {
- changeCurrentByOne(true);
+ changeValueByOne(true);
} else {
- changeCurrentByOne(false);
+ changeValueByOne(false);
}
}
};
@@ -610,23 +611,31 @@
hideSoftInput();
mInputText.clearFocus();
if (v.getId() == R.id.increment) {
- postChangeCurrentByOneFromLongPress(true);
+ postChangeCurrentByOneFromLongPress(true, 0);
} else {
- postChangeCurrentByOneFromLongPress(false);
+ postChangeCurrentByOneFromLongPress(false, 0);
}
return true;
}
};
// increment button
- mIncrementButton = (ImageButton) findViewById(R.id.increment);
- mIncrementButton.setOnClickListener(onClickListener);
- mIncrementButton.setOnLongClickListener(onLongClickListener);
+ if (!mHasSelectorWheel) {
+ mIncrementButton = (ImageButton) findViewById(R.id.increment);
+ mIncrementButton.setOnClickListener(onClickListener);
+ mIncrementButton.setOnLongClickListener(onLongClickListener);
+ } else {
+ mIncrementButton = null;
+ }
// decrement button
- mDecrementButton = (ImageButton) findViewById(R.id.decrement);
- mDecrementButton.setOnClickListener(onClickListener);
- mDecrementButton.setOnLongClickListener(onLongClickListener);
+ if (!mHasSelectorWheel) {
+ mDecrementButton = (ImageButton) findViewById(R.id.decrement);
+ mDecrementButton.setOnClickListener(onClickListener);
+ mDecrementButton.setOnLongClickListener(onLongClickListener);
+ } else {
+ mDecrementButton = null;
+ }
// input text
mInputText = (EditText) findViewById(R.id.numberpicker_input);
@@ -648,7 +657,6 @@
mInputText.setImeOptions(EditorInfo.IME_ACTION_DONE);
// initialize constants
- mTouchSlop = ViewConfiguration.getTapTimeout();
ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = configuration.getScaledTouchSlop();
mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
@@ -667,69 +675,22 @@
paint.setColor(color);
mSelectorWheelPaint = paint;
- // create the animator for showing the input controls
- mDimSelectorWheelAnimator = ObjectAnimator.ofInt(this, PROPERTY_SELECTOR_PAINT_ALPHA,
- SELECTOR_WHEEL_BRIGHT_ALPHA, SELECTOR_WHEEL_DIM_ALPHA);
- final ObjectAnimator showIncrementButton = ObjectAnimator.ofFloat(mIncrementButton,
- PROPERTY_BUTTON_ALPHA, BUTTON_ALPHA_TRANSPARENT, BUTTON_ALPHA_OPAQUE);
- final ObjectAnimator showDecrementButton = ObjectAnimator.ofFloat(mDecrementButton,
- PROPERTY_BUTTON_ALPHA, BUTTON_ALPHA_TRANSPARENT, BUTTON_ALPHA_OPAQUE);
- mShowInputControlsAnimator = new AnimatorSet();
- mShowInputControlsAnimator.playTogether(mDimSelectorWheelAnimator, showIncrementButton,
- showDecrementButton);
- mShowInputControlsAnimator.addListener(new AnimatorListenerAdapter() {
- private boolean mCanceled = false;
-
- @Override
- public void onAnimationEnd(Animator animation) {
- if (!mCanceled) {
- // if canceled => we still want the wheel drawn
- setSelectorWheelState(SELECTOR_WHEEL_STATE_SMALL);
- }
- mCanceled = false;
- }
-
- @Override
- public void onAnimationCancel(Animator animation) {
- if (mShowInputControlsAnimator.isRunning()) {
- mCanceled = true;
- }
- }
- });
-
// create the fling and adjust scrollers
mFlingScroller = new Scroller(getContext(), null, true);
mAdjustScroller = new Scroller(getContext(), new DecelerateInterpolator(2.5f));
updateInputTextView();
- updateIncrementAndDecrementButtonsVisibilityState();
-
- if (mFlingable) {
- if (isInEditMode()) {
- setSelectorWheelState(SELECTOR_WHEEL_STATE_SMALL);
- } else {
- // Start with shown selector wheel and hidden controls. When made
- // visible hide the selector and fade-in the controls to suggest
- // fling interaction.
- setSelectorWheelState(SELECTOR_WHEEL_STATE_LARGE);
- hideInputControls();
- }
- }
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ if (!mHasSelectorWheel) {
+ super.onLayout(changed, left, top, right, bottom);
+ return;
+ }
final int msrdWdth = getMeasuredWidth();
final int msrdHght = getMeasuredHeight();
- // Increment button at the top.
- final int inctBtnMsrdWdth = mIncrementButton.getMeasuredWidth();
- final int incrBtnLeft = (msrdWdth - inctBtnMsrdWdth) / 2;
- final int incrBtnTop = 0;
- final int incrBtnRight = incrBtnLeft + inctBtnMsrdWdth;
- final int incrBtnBottom = incrBtnTop + mIncrementButton.getMeasuredHeight();
- mIncrementButton.layout(incrBtnLeft, incrBtnTop, incrBtnRight, incrBtnBottom);
-
// Input text centered horizontally.
final int inptTxtMsrdWdth = mInputText.getMeasuredWidth();
final int inptTxtMsrdHght = mInputText.getMeasuredHeight();
@@ -739,24 +700,23 @@
final int inptTxtBottom = inptTxtTop + inptTxtMsrdHght;
mInputText.layout(inptTxtLeft, inptTxtTop, inptTxtRight, inptTxtBottom);
- // Decrement button at the top.
- final int decrBtnMsrdWdth = mIncrementButton.getMeasuredWidth();
- final int decrBtnLeft = (msrdWdth - decrBtnMsrdWdth) / 2;
- final int decrBtnTop = msrdHght - mDecrementButton.getMeasuredHeight();
- final int decrBtnRight = decrBtnLeft + decrBtnMsrdWdth;
- final int decrBtnBottom = msrdHght;
- mDecrementButton.layout(decrBtnLeft, decrBtnTop, decrBtnRight, decrBtnBottom);
-
- if (!mScrollWheelAndFadingEdgesInitialized) {
- mScrollWheelAndFadingEdgesInitialized = true;
+ if (changed) {
// need to do all this when we know our size
initializeSelectorWheel();
initializeFadingEdges();
+ mTopSelectionDividerTop = (getHeight() - mSelectionDividersDistance) / 2
+ - mSelectionDividerHeight;
+ mBottomSelectionDividerBottom = mTopSelectionDividerTop + 2 * mSelectionDividerHeight
+ + mSelectionDividersDistance;
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ if (!mHasSelectorWheel) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ return;
+ }
// Try greedily to fit the max width and height.
final int newWidthMeasureSpec = makeMeasureSpec(widthMeasureSpec, mMaxWidth);
final int newHeightMeasureSpec = makeMeasureSpec(heightMeasureSpec, mMaxHeight);
@@ -769,120 +729,143 @@
setMeasuredDimension(widthSize, heightSize);
}
- @Override
- public boolean onInterceptTouchEvent(MotionEvent event) {
- if (!isEnabled() || !mFlingable) {
- return false;
- }
- switch (event.getActionMasked()) {
- case MotionEvent.ACTION_DOWN:
- mLastMotionEventY = mLastDownEventY = event.getY();
- removeAllCallbacks();
- mShowInputControlsAnimator.cancel();
- mDimSelectorWheelAnimator.cancel();
- mCheckBeginEditOnUpEvent = false;
- mAdjustScrollerOnUpEvent = true;
- if (mSelectorWheelState == SELECTOR_WHEEL_STATE_LARGE) {
- mSelectorWheelPaint.setAlpha(SELECTOR_WHEEL_BRIGHT_ALPHA);
- boolean scrollersFinished = mFlingScroller.isFinished()
- && mAdjustScroller.isFinished();
- if (!scrollersFinished) {
- mFlingScroller.forceFinished(true);
- mAdjustScroller.forceFinished(true);
- onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
- }
- mCheckBeginEditOnUpEvent = scrollersFinished;
- mAdjustScrollerOnUpEvent = true;
- hideSoftInput();
- hideInputControls();
- return true;
+ /**
+ * Move to the final position of a scroller. Ensures to force finish the scroller
+ * and if it is not at its final position a scroll of the selector wheel is
+ * performed to fast forward to the final position.
+ *
+ * @param scroller The scroller to whose final position to get.
+ * @return True of the a move was performed, i.e. the scroller was not in final position.
+ */
+ private boolean moveToFinalScrollerPosition(Scroller scroller) {
+ scroller.forceFinished(true);
+ int amountToScroll = scroller.getFinalY() - scroller.getCurrY();
+ int futureScrollOffset = (mCurrentScrollOffset + amountToScroll) % mSelectorElementHeight;
+ int overshootAdjustment = mInitialScrollOffset - futureScrollOffset;
+ if (overshootAdjustment != 0) {
+ if (Math.abs(overshootAdjustment) > mSelectorElementHeight / 2) {
+ if (overshootAdjustment > 0) {
+ overshootAdjustment -= mSelectorElementHeight;
+ } else {
+ overshootAdjustment += mSelectorElementHeight;
}
- if (isEventInVisibleViewHitRect(event, mIncrementButton)
- || isEventInVisibleViewHitRect(event, mDecrementButton)) {
- return false;
- }
- mAdjustScrollerOnUpEvent = false;
- setSelectorWheelState(SELECTOR_WHEEL_STATE_LARGE);
- hideSoftInput();
- hideInputControls();
- return true;
- case MotionEvent.ACTION_MOVE:
- float currentMoveY = event.getY();
- int deltaDownY = (int) Math.abs(currentMoveY - mLastDownEventY);
- if (deltaDownY > mTouchSlop) {
- mCheckBeginEditOnUpEvent = false;
- onScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
- setSelectorWheelState(SELECTOR_WHEEL_STATE_LARGE);
- hideSoftInput();
- hideInputControls();
- return true;
- }
- break;
+ }
+ amountToScroll += overshootAdjustment;
+ scrollBy(0, amountToScroll);
+ return true;
}
return false;
}
@Override
- public boolean onTouchEvent(MotionEvent ev) {
- if (!isEnabled()) {
+ public boolean onInterceptTouchEvent(MotionEvent event) {
+ if (!mHasSelectorWheel || !isEnabled()) {
+ return false;
+ }
+ final int action = event.getActionMasked();
+ switch (action) {
+ case MotionEvent.ACTION_DOWN: {
+ removeAllCallbacks();
+ mInputText.setVisibility(View.INVISIBLE);
+ mLastDownOrMoveEventY = mLastDownEventY = event.getY();
+ mLastDownEventTime = event.getEventTime();
+ mIngonreMoveEvents = false;
+ mShowSoftInputOnTap = false;
+ if (!mFlingScroller.isFinished()) {
+ mFlingScroller.forceFinished(true);
+ mAdjustScroller.forceFinished(true);
+ onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
+ } else if (!mAdjustScroller.isFinished()) {
+ mFlingScroller.forceFinished(true);
+ mAdjustScroller.forceFinished(true);
+ } else if (mLastDownEventY < mTopSelectionDividerTop) {
+ hideSoftInput();
+ postChangeCurrentByOneFromLongPress(
+ false, ViewConfiguration.getLongPressTimeout());
+ } else if (mLastDownEventY > mBottomSelectionDividerBottom) {
+ hideSoftInput();
+ postChangeCurrentByOneFromLongPress(
+ true, ViewConfiguration.getLongPressTimeout());
+ } else {
+ mShowSoftInputOnTap = true;
+ postBeginSoftInputOnLongPressCommand();
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (!isEnabled() || !mHasSelectorWheel) {
return false;
}
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
}
- mVelocityTracker.addMovement(ev);
- int action = ev.getActionMasked();
+ mVelocityTracker.addMovement(event);
+ int action = event.getActionMasked();
switch (action) {
- case MotionEvent.ACTION_MOVE:
- float currentMoveY = ev.getY();
- if (mCheckBeginEditOnUpEvent
- || mScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
+ case MotionEvent.ACTION_MOVE: {
+ if (mIngonreMoveEvents) {
+ break;
+ }
+ float currentMoveY = event.getY();
+ if (mScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
int deltaDownY = (int) Math.abs(currentMoveY - mLastDownEventY);
if (deltaDownY > mTouchSlop) {
- mCheckBeginEditOnUpEvent = false;
+ removeAllCallbacks();
onScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
}
+ } else {
+ int deltaMoveY = (int) ((currentMoveY - mLastDownOrMoveEventY)
+ / TOUCH_SCROLL_DECELERATION_COEFFICIENT);
+ scrollBy(0, deltaMoveY);
+ invalidate();
}
- int deltaMoveY = (int) (currentMoveY - mLastMotionEventY);
- scrollBy(0, deltaMoveY);
- invalidate();
- mLastMotionEventY = currentMoveY;
- break;
- case MotionEvent.ACTION_UP:
- if (mCheckBeginEditOnUpEvent) {
- mCheckBeginEditOnUpEvent = false;
- final long deltaTapTimeMillis = ev.getEventTime() - mLastUpEventTimeMillis;
- if (deltaTapTimeMillis < ViewConfiguration.getDoubleTapTimeout()) {
- setSelectorWheelState(SELECTOR_WHEEL_STATE_SMALL);
- showInputControls(mShowInputControlsAnimimationDuration);
- mInputText.requestFocus();
- InputMethodManager inputMethodManager = InputMethodManager.peekInstance();
- if (inputMethodManager != null) {
- inputMethodManager.showSoftInput(mInputText, 0);
- }
- mLastUpEventTimeMillis = ev.getEventTime();
- return true;
- }
- }
+ mLastDownOrMoveEventY = currentMoveY;
+ } break;
+ case MotionEvent.ACTION_UP: {
+ removeBeginSoftInputCommand();
+ removeChangeCurrentByOneFromLongPress();
VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity);
int initialVelocity = (int) velocityTracker.getYVelocity();
if (Math.abs(initialVelocity) > mMinimumFlingVelocity) {
- fling(initialVelocity);
+ int deltaMove = (int) (event.getY() - mLastDownEventY);
+ int absDeltaMoveY = Math.abs(deltaMove);
+ if (absDeltaMoveY > mMinFlingDistance) {
+ fling(initialVelocity);
+ } else {
+ changeValueByOne(deltaMove < 0);
+ }
onScrollStateChange(OnScrollListener.SCROLL_STATE_FLING);
} else {
- if (mAdjustScrollerOnUpEvent) {
- if (mFlingScroller.isFinished() && mAdjustScroller.isFinished()) {
- postAdjustScrollerCommand(0);
+ int eventY = (int) event.getY();
+ int deltaMoveY = (int) Math.abs(eventY - mLastDownEventY);
+ long deltaTime = event.getEventTime() - mLastDownEventTime;
+ if (deltaMoveY <= mTouchSlop && deltaTime < ViewConfiguration.getTapTimeout()) {
+ if (mShowSoftInputOnTap) {
+ mShowSoftInputOnTap = false;
+ showSoftInput();
+ } else {
+ int selectorIndexOffset = (eventY / mSelectorElementHeight)
+ - SELECTOR_MIDDLE_ITEM_INDEX;
+ if (selectorIndexOffset > 0) {
+ changeValueByOne(true);
+ } else if (selectorIndexOffset < 0) {
+ changeValueByOne(false);
+ }
}
} else {
- postAdjustScrollerCommand(SHOW_INPUT_CONTROLS_DELAY_MILLIS);
+ ensureScrollWheelAdjusted();
}
+ onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
}
mVelocityTracker.recycle();
mVelocityTracker = null;
- mLastUpEventTimeMillis = ev.getEventTime();
- break;
+ } break;
}
return true;
}
@@ -891,12 +874,6 @@
public boolean dispatchTouchEvent(MotionEvent event) {
final int action = event.getActionMasked();
switch (action) {
- case MotionEvent.ACTION_MOVE:
- if (mSelectorWheelState == SELECTOR_WHEEL_STATE_LARGE) {
- removeAllCallbacks();
- forceCompleteChangeCurrentByOneViaScroll();
- }
- break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
removeAllCallbacks();
@@ -907,27 +884,75 @@
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
- int keyCode = event.getKeyCode();
- if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_ENTER) {
- removeAllCallbacks();
+ final int keyCode = event.getKeyCode();
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_DPAD_CENTER:
+ case KeyEvent.KEYCODE_ENTER:
+ removeAllCallbacks();
+ break;
}
return super.dispatchKeyEvent(event);
}
@Override
public boolean dispatchTrackballEvent(MotionEvent event) {
- int action = event.getActionMasked();
- if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {
- removeAllCallbacks();
+ final int action = event.getActionMasked();
+ switch (action) {
+ case MotionEvent.ACTION_CANCEL:
+ case MotionEvent.ACTION_UP:
+ removeAllCallbacks();
+ break;
}
return super.dispatchTrackballEvent(event);
}
@Override
- public void computeScroll() {
- if (mSelectorWheelState == SELECTOR_WHEEL_STATE_NONE) {
- return;
+ protected boolean dispatchHoverEvent(MotionEvent event) {
+ if (!mHasSelectorWheel) {
+ return super.dispatchHoverEvent(event);
}
+ if (AccessibilityManager.getInstance(mContext).isEnabled()) {
+ final int eventY = (int) event.getY();
+ final int hoveredVirtualViewId;
+ if (eventY < mTopSelectionDividerTop) {
+ hoveredVirtualViewId = AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_DECREMENT;
+ } else if (eventY > mBottomSelectionDividerBottom) {
+ hoveredVirtualViewId = AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_INCREMENT;
+ } else {
+ hoveredVirtualViewId = AccessibilityNodeProviderImpl.VIRTUAL_VIEW_ID_INPUT;
+ }
+ final int action = event.getActionMasked();
+ AccessibilityNodeProviderImpl provider =
+ (AccessibilityNodeProviderImpl) getAccessibilityNodeProvider();
+ switch (action) {
+ case MotionEvent.ACTION_HOVER_ENTER: {
+ provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
+ AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
+ mLastHoveredChildVirtualViewId = hoveredVirtualViewId;
+ } break;
+ case MotionEvent.ACTION_HOVER_MOVE: {
+ if (mLastHoveredChildVirtualViewId != hoveredVirtualViewId
+ && mLastHoveredChildVirtualViewId != View.NO_ID) {
+ provider.sendAccessibilityEventForVirtualView(
+ mLastHoveredChildVirtualViewId,
+ AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
+ provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
+ AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
+ mLastHoveredChildVirtualViewId = hoveredVirtualViewId;
+ }
+ } break;
+ case MotionEvent.ACTION_HOVER_EXIT: {
+ provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
+ AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
+ mLastHoveredChildVirtualViewId = View.NO_ID;
+ } break;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void computeScroll() {
Scroller scroller = mFlingScroller;
if (scroller.isFinished()) {
scroller = mAdjustScroller;
@@ -952,16 +977,17 @@
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
- mIncrementButton.setEnabled(enabled);
- mDecrementButton.setEnabled(enabled);
+ if (!mHasSelectorWheel) {
+ mIncrementButton.setEnabled(enabled);
+ }
+ if (!mHasSelectorWheel) {
+ mDecrementButton.setEnabled(enabled);
+ }
mInputText.setEnabled(enabled);
}
@Override
public void scrollBy(int x, int y) {
- if (mSelectorWheelState == SELECTOR_WHEEL_STATE_NONE) {
- return;
- }
int[] selectorIndices = mSelectorIndices;
if (!mWrapSelectorWheel && y > 0
&& selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] <= mMinValue) {
@@ -977,7 +1003,7 @@
while (mCurrentScrollOffset - mInitialScrollOffset > mSelectorTextGapHeight) {
mCurrentScrollOffset -= mSelectorElementHeight;
decrementSelectorIndices(selectorIndices);
- changeCurrent(selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX]);
+ setValueInternal(selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX], true);
if (!mWrapSelectorWheel && selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] <= mMinValue) {
mCurrentScrollOffset = mInitialScrollOffset;
}
@@ -985,7 +1011,7 @@
while (mCurrentScrollOffset - mInitialScrollOffset < -mSelectorTextGapHeight) {
mCurrentScrollOffset += mSelectorElementHeight;
incrementSelectorIndices(selectorIndices);
- changeCurrent(selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX]);
+ setValueInternal(selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX], true);
if (!mWrapSelectorWheel && selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX] >= mMaxValue) {
mCurrentScrollOffset = mInitialScrollOffset;
}
@@ -1024,8 +1050,7 @@
*
* @param formatter The formatter object. If formatter is <code>null</code>,
* {@link String#valueOf(int)} will be used.
- *
- * @see #setDisplayedValues(String[])
+ *@see #setDisplayedValues(String[])
*/
public void setFormatter(Formatter formatter) {
if (formatter == mFormatter) {
@@ -1068,26 +1093,35 @@
if (mValue == value) {
return;
}
- if (value < mMinValue) {
- value = mWrapSelectorWheel ? mMaxValue : mMinValue;
- }
- if (value > mMaxValue) {
- value = mWrapSelectorWheel ? mMinValue : mMaxValue;
- }
- mValue = value;
+ setValueInternal(value, false);
initializeSelectorWheelIndices();
- updateInputTextView();
- updateIncrementAndDecrementButtonsVisibilityState();
invalidate();
}
/**
- * Hides the soft input of it is active for the input text.
+ * Shows the soft input for its input text.
+ */
+ private void showSoftInput() {
+ InputMethodManager inputMethodManager = InputMethodManager.peekInstance();
+ if (inputMethodManager != null) {
+ if (mHasSelectorWheel) {
+ mInputText.setVisibility(View.VISIBLE);
+ }
+ mInputText.requestFocus();
+ inputMethodManager.showSoftInput(mInputText, 0);
+ }
+ }
+
+ /**
+ * Hides the soft input if it is active for the input text.
*/
private void hideSoftInput() {
InputMethodManager inputMethodManager = InputMethodManager.peekInstance();
if (inputMethodManager != null && inputMethodManager.isActive(mInputText)) {
inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0);
+ if (mHasSelectorWheel) {
+ mInputText.setVisibility(View.INVISIBLE);
+ }
}
}
@@ -1151,23 +1185,22 @@
* wrap around the {@link NumberPicker#getMinValue()} and
* {@link NumberPicker#getMaxValue()} values.
* <p>
- * By default if the range (max - min) is more than five (the number of
- * items shown on the selector wheel) the selector wheel wrapping is
- * enabled.
+ * By default if the range (max - min) is more than the number of items shown
+ * on the selector wheel the selector wheel wrapping is enabled.
* </p>
* <p>
- * <strong>Note:</strong> If the number of items, i.e. the range
- * ({@link #getMaxValue()} - {@link #getMinValue()}) is less than
- * {@link #SELECTOR_WHEEL_ITEM_COUNT}, the selector wheel will not
- * wrap. Hence, in such a case calling this method is a NOP.
+ * <strong>Note:</strong> If the number of items, i.e. the range (
+ * {@link #getMaxValue()} - {@link #getMinValue()}) is less than
+ * the number of items shown on the selector wheel, the selector wheel will
+ * not wrap. Hence, in such a case calling this method is a NOP.
* </p>
+ *
* @param wrapSelectorWheel Whether to wrap.
*/
public void setWrapSelectorWheel(boolean wrapSelectorWheel) {
final boolean wrappingAllowed = (mMaxValue - mMinValue) >= mSelectorIndices.length;
if ((!wrapSelectorWheel || wrappingAllowed) && wrapSelectorWheel != mWrapSelectorWheel) {
mWrapSelectorWheel = wrapSelectorWheel;
- updateIncrementAndDecrementButtonsVisibilityState();
}
}
@@ -1224,6 +1257,7 @@
initializeSelectorWheelIndices();
updateInputTextView();
tryComputeMaxWidth();
+ invalidate();
}
/**
@@ -1256,6 +1290,7 @@
initializeSelectorWheelIndices();
updateInputTextView();
tryComputeMaxWidth();
+ invalidate();
}
/**
@@ -1300,102 +1335,49 @@
}
@Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- // make sure we show the controls only the very
- // first time the user sees this widget
- if (mFlingable && !isInEditMode()) {
- // animate a bit slower the very first time
- showInputControls(mShowInputControlsAnimimationDuration * 2);
- }
- }
-
- @Override
protected void onDetachedFromWindow() {
removeAllCallbacks();
}
@Override
- protected void dispatchDraw(Canvas canvas) {
- // There is a good reason for doing this. See comments in draw().
- }
-
- @Override
- public void draw(Canvas canvas) {
- // Dispatch draw to our children only if we are not currently running
- // the animation for simultaneously dimming the scroll wheel and
- // showing in the buttons. This class takes advantage of the View
- // implementation of fading edges effect to draw the selector wheel.
- // However, in View.draw(), the fading is applied after all the children
- // have been drawn and we do not want this fading to be applied to the
- // buttons. Therefore, we draw our children after we have completed
- // drawing ourselves.
- super.draw(canvas);
-
- // Draw our children if we are not showing the selector wheel of fading
- // it out
- if (mShowInputControlsAnimator.isRunning()
- || mSelectorWheelState != SELECTOR_WHEEL_STATE_LARGE) {
- long drawTime = getDrawingTime();
- for (int i = 0, count = getChildCount(); i < count; i++) {
- View child = getChildAt(i);
- if (!child.isShown()) {
- continue;
- }
- drawChild(canvas, getChildAt(i), drawTime);
- }
- }
- }
-
- @Override
protected void onDraw(Canvas canvas) {
- if (mSelectorWheelState == SELECTOR_WHEEL_STATE_NONE) {
+ if (!mHasSelectorWheel) {
+ super.onDraw(canvas);
return;
}
-
float x = (mRight - mLeft) / 2;
float y = mCurrentScrollOffset;
- final int restoreCount = canvas.save();
-
- if (mSelectorWheelState == SELECTOR_WHEEL_STATE_SMALL) {
- Rect clipBounds = canvas.getClipBounds();
- clipBounds.inset(0, mSelectorElementHeight);
- canvas.clipRect(clipBounds);
- }
-
// draw the selector wheel
int[] selectorIndices = mSelectorIndices;
for (int i = 0; i < selectorIndices.length; i++) {
int selectorIndex = selectorIndices[i];
String scrollSelectorValue = mSelectorIndexToStringCache.get(selectorIndex);
- // Do not draw the middle item if input is visible since the input is shown only
- // if the wheel is static and it covers the middle item. Otherwise, if the user
- // starts editing the text via the IME he may see a dimmed version of the old
- // value intermixed with the new one.
+ // Do not draw the middle item if input is visible since the input
+ // is shown only if the wheel is static and it covers the middle
+ // item. Otherwise, if the user starts editing the text via the
+ // IME he may see a dimmed version of the old value intermixed
+ // with the new one.
if (i != SELECTOR_MIDDLE_ITEM_INDEX || mInputText.getVisibility() != VISIBLE) {
canvas.drawText(scrollSelectorValue, x, y, mSelectorWheelPaint);
}
y += mSelectorElementHeight;
}
- // draw the selection dividers (only if scrolling and drawable specified)
+ // draw the selection dividers
if (mSelectionDivider != null) {
// draw the top divider
- int topOfTopDivider =
- (getHeight() - mSelectorElementHeight - mSelectionDividerHeight) / 2;
+ int topOfTopDivider = mTopSelectionDividerTop;
int bottomOfTopDivider = topOfTopDivider + mSelectionDividerHeight;
mSelectionDivider.setBounds(0, topOfTopDivider, mRight, bottomOfTopDivider);
mSelectionDivider.draw(canvas);
// draw the bottom divider
- int topOfBottomDivider = topOfTopDivider + mSelectorElementHeight;
- int bottomOfBottomDivider = bottomOfTopDivider + mSelectorElementHeight;
+ int bottomOfBottomDivider = mBottomSelectionDividerBottom;
+ int topOfBottomDivider = bottomOfBottomDivider - mSelectionDividerHeight;
mSelectionDivider.setBounds(0, topOfBottomDivider, mRight, bottomOfBottomDivider);
mSelectionDivider.draw(canvas);
}
-
- canvas.restoreToCount(restoreCount);
}
@Override
@@ -1408,12 +1390,20 @@
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
event.setClassName(NumberPicker.class.getName());
+ event.setScrollable(true);
+ event.setScrollY((mMinValue + mValue) * mSelectorElementHeight);
+ event.setMaxScrollY((mMaxValue - mMinValue) * mSelectorElementHeight);
}
@Override
- public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
- super.onInitializeAccessibilityNodeInfo(info);
- info.setClassName(NumberPicker.class.getName());
+ public AccessibilityNodeProvider getAccessibilityNodeProvider() {
+ if (!mHasSelectorWheel) {
+ return super.getAccessibilityNodeProvider();
+ }
+ if (mAccessibilityNodeProvider == null) {
+ mAccessibilityNodeProvider = new AccessibilityNodeProviderImpl();
+ }
+ return mAccessibilityNodeProvider;
}
/**
@@ -1442,17 +1432,17 @@
}
/**
- * Utility to reconcile a desired size and state, with constraints imposed by
- * a MeasureSpec. Tries to respect the min size, unless a different size is
- * imposed by the constraints.
+ * Utility to reconcile a desired size and state, with constraints imposed
+ * by a MeasureSpec. Tries to respect the min size, unless a different size
+ * is imposed by the constraints.
*
* @param minSize The minimal desired size.
* @param measuredSize The currently measured size.
* @param measureSpec The current measure spec.
* @return The resolved size and state.
*/
- private int resolveSizeAndStateRespectingMinSize(int minSize, int measuredSize,
- int measureSpec) {
+ private int resolveSizeAndStateRespectingMinSize(
+ int minSize, int measuredSize, int measureSpec) {
if (minSize != SIZE_UNSPECIFIED) {
final int desiredWidth = Math.max(minSize, measuredSize);
return resolveSizeAndState(desiredWidth, measureSpec, 0);
@@ -1462,8 +1452,8 @@
}
/**
- * Resets the selector indices and clear the cached
- * string representation of these indices.
+ * Resets the selector indices and clear the cached string representation of
+ * these indices.
*/
private void initializeSelectorWheelIndices() {
mSelectorIndexToStringCache.clear();
@@ -1480,39 +1470,44 @@
}
/**
- * Sets the current value of this NumberPicker, and sets mPrevious to the
- * previous value. If current is greater than mEnd less than mStart, the
- * value of mCurrent is wrapped around. Subclasses can override this to
- * change the wrapping behavior
+ * Sets the current value of this NumberPicker.
*
- * @param current the new value of the NumberPicker
+ * @param current The new value of the NumberPicker.
+ * @param notifyChange Whether to notify if the current value changed.
*/
- private void changeCurrent(int current) {
+ private void setValueInternal(int current, boolean notifyChange) {
if (mValue == current) {
return;
}
// Wrap around the values if we go past the start or end
if (mWrapSelectorWheel) {
current = getWrappedSelectorIndex(current);
+ } else {
+ current = Math.max(current, mMinValue);
+ current = Math.min(current, mMaxValue);
}
int previous = mValue;
- setValue(current);
- notifyChange(previous, current);
+ mValue = current;
+ updateInputTextView();
+ if (notifyChange) {
+ notifyChange(previous, current);
+ }
}
/**
* Changes the current value by one which is increment or
* decrement based on the passes argument.
+ * decrement the current value.
*
* @param increment True to increment, false to decrement.
*/
- private void changeCurrentByOne(boolean increment) {
- if (mFlingable) {
- mDimSelectorWheelAnimator.cancel();
+ private void changeValueByOne(boolean increment) {
+ if (mHasSelectorWheel) {
mInputText.setVisibility(View.INVISIBLE);
- mSelectorWheelPaint.setAlpha(SELECTOR_WHEEL_BRIGHT_ALPHA);
+ if (!moveToFinalScrollerPosition(mFlingScroller)) {
+ moveToFinalScrollerPosition(mAdjustScroller);
+ }
mPreviousScrollerY = 0;
- forceCompleteChangeCurrentByOneViaScroll();
if (increment) {
mFlingScroller.startScroll(0, 0, 0, -mSelectorElementHeight,
CHANGE_CURRENT_BY_ONE_SCROLL_DURATION);
@@ -1523,81 +1518,26 @@
invalidate();
} else {
if (increment) {
- changeCurrent(mValue + 1);
+ setValueInternal(mValue + 1, true);
} else {
- changeCurrent(mValue - 1);
+ setValueInternal(mValue - 1, true);
}
}
}
- /**
- * Ensures that if we are in the process of changing the current value
- * by one via scrolling the scroller gets to its final state and the
- * value is updated.
- */
- private void forceCompleteChangeCurrentByOneViaScroll() {
- Scroller scroller = mFlingScroller;
- if (!scroller.isFinished()) {
- final int yBeforeAbort = scroller.getCurrY();
- scroller.abortAnimation();
- final int yDelta = scroller.getCurrY() - yBeforeAbort;
- scrollBy(0, yDelta);
- }
- }
-
- /**
- * Sets the <code>alpha</code> of the {@link Paint} for drawing the selector
- * wheel.
- */
- @SuppressWarnings("unused")
- // Called via reflection
- private void setSelectorPaintAlpha(int alpha) {
- mSelectorWheelPaint.setAlpha(alpha);
- invalidate();
- }
-
- /**
- * @return If the <code>event</code> is in the visible <code>view</code>.
- */
- private boolean isEventInVisibleViewHitRect(MotionEvent event, View view) {
- if (view.getVisibility() == VISIBLE) {
- view.getHitRect(mTempRect);
- return mTempRect.contains((int) event.getX(), (int) event.getY());
- }
- return false;
- }
-
- /**
- * Sets the <code>selectorWheelState</code>.
- */
- private void setSelectorWheelState(int selectorWheelState) {
- mSelectorWheelState = selectorWheelState;
- if (selectorWheelState == SELECTOR_WHEEL_STATE_LARGE) {
- mSelectorWheelPaint.setAlpha(SELECTOR_WHEEL_BRIGHT_ALPHA);
- }
-
- if (mFlingable && selectorWheelState == SELECTOR_WHEEL_STATE_LARGE
- && AccessibilityManager.getInstance(mContext).isEnabled()) {
- AccessibilityManager.getInstance(mContext).interrupt();
- String text = mContext.getString(R.string.number_picker_increment_scroll_action);
- mInputText.setContentDescription(text);
- mInputText.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
- mInputText.setContentDescription(null);
- }
- }
-
private void initializeSelectorWheel() {
initializeSelectorWheelIndices();
int[] selectorIndices = mSelectorIndices;
int totalTextHeight = selectorIndices.length * mTextSize;
float totalTextGapHeight = (mBottom - mTop) - totalTextHeight;
- float textGapCount = selectorIndices.length - 1;
+ float textGapCount = selectorIndices.length;
mSelectorTextGapHeight = (int) (totalTextGapHeight / textGapCount + 0.5f);
mSelectorElementHeight = mTextSize + mSelectorTextGapHeight;
- // Ensure that the middle item is positioned the same as the text in mInputText
+ // Ensure that the middle item is positioned the same as the text in
+ // mInputText
int editTextTextPosition = mInputText.getBaseline() + mInputText.getTop();
- mInitialScrollOffset = editTextTextPosition -
- (mSelectorElementHeight * SELECTOR_MIDDLE_ITEM_INDEX);
+ mInitialScrollOffset = editTextTextPosition
+ - (mSelectorElementHeight * SELECTOR_MIDDLE_ITEM_INDEX);
mCurrentScrollOffset = mInitialScrollOffset;
updateInputTextView();
}
@@ -1612,16 +1552,14 @@
*/
private void onScrollerFinished(Scroller scroller) {
if (scroller == mFlingScroller) {
- if (mSelectorWheelState == SELECTOR_WHEEL_STATE_LARGE) {
- postAdjustScrollerCommand(0);
- onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
- } else {
+ if (!ensureScrollWheelAdjusted()) {
updateInputTextView();
- fadeSelectorWheel(mShowInputControlsAnimimationDuration);
}
+ onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
} else {
- updateInputTextView();
- showInputControls(mShowInputControlsAnimimationDuration);
+ if (mScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
+ updateInputTextView();
+ }
}
}
@@ -1654,56 +1592,6 @@
}
/**
- * Hides the input controls which is the up/down arrows and the text field.
- */
- private void hideInputControls() {
- mShowInputControlsAnimator.cancel();
- mIncrementButton.setVisibility(INVISIBLE);
- mDecrementButton.setVisibility(INVISIBLE);
- mInputText.setVisibility(INVISIBLE);
- }
-
- /**
- * Show the input controls by making them visible and animating the alpha
- * property up/down arrows.
- *
- * @param animationDuration The duration of the animation.
- */
- private void showInputControls(long animationDuration) {
- updateIncrementAndDecrementButtonsVisibilityState();
- mInputText.setVisibility(VISIBLE);
- mShowInputControlsAnimator.setDuration(animationDuration);
- mShowInputControlsAnimator.start();
- }
-
- /**
- * Fade the selector wheel via an animation.
- *
- * @param animationDuration The duration of the animation.
- */
- private void fadeSelectorWheel(long animationDuration) {
- mInputText.setVisibility(VISIBLE);
- mDimSelectorWheelAnimator.setDuration(animationDuration);
- mDimSelectorWheelAnimator.start();
- }
-
- /**
- * Updates the visibility state of the increment and decrement buttons.
- */
- private void updateIncrementAndDecrementButtonsVisibilityState() {
- if (mWrapSelectorWheel || mValue < mMaxValue) {
- mIncrementButton.setVisibility(VISIBLE);
- } else {
- mIncrementButton.setVisibility(INVISIBLE);
- }
- if (mWrapSelectorWheel || mValue > mMinValue) {
- mDecrementButton.setVisibility(VISIBLE);
- } else {
- mDecrementButton.setVisibility(INVISIBLE);
- }
- }
-
- /**
* @return The wrapped index <code>selectorIndex</code> value.
*/
private int getWrappedSelectorIndex(int selectorIndex) {
@@ -1749,8 +1637,7 @@
/**
* Ensures we have a cached string representation of the given <code>
- * selectorIndex</code>
- * to avoid multiple instantiations of the same string.
+ * selectorIndex</code> to avoid multiple instantiations of the same string.
*/
private void ensureCachedScrollSelectorValue(int selectorIndex) {
SparseArray<String> cache = mSelectorIndexToStringCache;
@@ -1783,7 +1670,7 @@
} else {
// Check the new value and ensure it's in range
int current = getSelectedPos(str.toString());
- changeCurrent(current);
+ setValueInternal(current, true);
}
}
@@ -1792,25 +1679,23 @@
* the string corresponding to the index specified by the current value will
* be returned. Otherwise, the formatter specified in {@link #setFormatter}
* will be used to format the number.
+ *
+ * @return Whether the text was updated.
*/
- private void updateInputTextView() {
+ private boolean updateInputTextView() {
/*
* If we don't have displayed values then use the current number else
* find the correct value in the displayed values for the current
* number.
*/
- if (mDisplayedValues == null) {
- mInputText.setText(formatNumber(mValue));
- } else {
- mInputText.setText(mDisplayedValues[mValue - mMinValue]);
+ String text = (mDisplayedValues == null) ? formatNumber(mValue)
+ : mDisplayedValues[mValue - mMinValue];
+ if (!TextUtils.isEmpty(text) && !text.equals(mInputText.getText().toString())) {
+ mInputText.setText(text);
+ return true;
}
- mInputText.setSelection(mInputText.getText().length());
- if (mFlingable && AccessibilityManager.getInstance(mContext).isEnabled()) {
- String text = mContext.getString(R.string.number_picker_increment_scroll_mode,
- mInputText.getText());
- mInputText.setContentDescription(text);
- }
+ return false;
}
/**
@@ -1828,14 +1713,45 @@
*
* @param increment Whether to increment or decrement the value.
*/
- private void postChangeCurrentByOneFromLongPress(boolean increment) {
- mInputText.clearFocus();
- removeAllCallbacks();
+ private void postChangeCurrentByOneFromLongPress(boolean increment, long delayMillis) {
if (mChangeCurrentByOneFromLongPressCommand == null) {
mChangeCurrentByOneFromLongPressCommand = new ChangeCurrentByOneFromLongPressCommand();
+ } else {
+ removeCallbacks(mChangeCurrentByOneFromLongPressCommand);
}
- mChangeCurrentByOneFromLongPressCommand.setIncrement(increment);
- post(mChangeCurrentByOneFromLongPressCommand);
+ mChangeCurrentByOneFromLongPressCommand.setStep(increment);
+ postDelayed(mChangeCurrentByOneFromLongPressCommand, delayMillis);
+ }
+
+ /**
+ * Removes the command for changing the current value by one.
+ */
+ private void removeChangeCurrentByOneFromLongPress() {
+ if (mChangeCurrentByOneFromLongPressCommand != null) {
+ removeCallbacks(mChangeCurrentByOneFromLongPressCommand);
+ }
+ }
+
+ /**
+ * Posts a command for beginning an edit of the current value via IME on
+ * long press.
+ */
+ private void postBeginSoftInputOnLongPressCommand() {
+ if (mBeginSoftInputOnLongPressCommand == null) {
+ mBeginSoftInputOnLongPressCommand = new BeginSoftInputOnLongPressCommand();
+ } else {
+ removeCallbacks(mBeginSoftInputOnLongPressCommand);
+ }
+ postDelayed(mBeginSoftInputOnLongPressCommand, ViewConfiguration.getLongPressTimeout());
+ }
+
+ /**
+ * Removes the command for beginning an edit of the current value via IME.
+ */
+ private void removeBeginSoftInputCommand() {
+ if (mBeginSoftInputOnLongPressCommand != null) {
+ removeCallbacks(mBeginSoftInputOnLongPressCommand);
+ }
}
/**
@@ -1845,12 +1761,12 @@
if (mChangeCurrentByOneFromLongPressCommand != null) {
removeCallbacks(mChangeCurrentByOneFromLongPressCommand);
}
- if (mAdjustScrollerCommand != null) {
- removeCallbacks(mAdjustScrollerCommand);
- }
if (mSetSelectionCommand != null) {
removeCallbacks(mSetSelectionCommand);
}
+ if (mBeginSoftInputOnLongPressCommand != null) {
+ removeCallbacks(mBeginSoftInputOnLongPressCommand);
+ }
}
/**
@@ -1888,8 +1804,7 @@
/**
* Posts an {@link SetSelectionCommand} from the given <code>selectionStart
- * </code> to
- * <code>selectionEnd</code>.
+ * </code> to <code>selectionEnd</code>.
*/
private void postSetSelectionCommand(int selectionStart, int selectionEnd) {
if (mSetSelectionCommand == null) {
@@ -1903,20 +1818,6 @@
}
/**
- * Posts an {@link AdjustScrollerCommand} within the given <code>
- * delayMillis</code>
- * .
- */
- private void postAdjustScrollerCommand(int delayMillis) {
- if (mAdjustScrollerCommand == null) {
- mAdjustScrollerCommand = new AdjustScrollerCommand();
- } else {
- removeCallbacks(mAdjustScrollerCommand);
- }
- postDelayed(mAdjustScrollerCommand, delayMillis);
- }
-
- /**
* Filter for accepting only valid indices or prefixes of the string
* representation of valid indices.
*/
@@ -1934,8 +1835,8 @@
}
@Override
- public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
- int dstart, int dend) {
+ public CharSequence filter(
+ CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
if (mDisplayedValues == null) {
CharSequence filtered = super.filter(source, start, end, dest, dstart, dend);
if (filtered == null) {
@@ -1981,6 +1882,27 @@
}
/**
+ * Ensures that the scroll wheel is adjusted i.e. there is no offset and the
+ * middle element is in the middle of the widget.
+ *
+ * @return Whether an adjustment has been made.
+ */
+ private boolean ensureScrollWheelAdjusted() {
+ // adjust to the closest value
+ int deltaY = mInitialScrollOffset - mCurrentScrollOffset;
+ if (deltaY != 0) {
+ mPreviousScrollerY = 0;
+ if (Math.abs(deltaY) > mSelectorElementHeight / 2) {
+ deltaY += (deltaY > 0) ? -mSelectorElementHeight : mSelectorElementHeight;
+ }
+ mAdjustScroller.startScroll(0, 0, 0, deltaY, SELECTOR_ADJUSTMENT_DURATION_MILLIS);
+ invalidate();
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Command for setting the input text selection.
*/
class SetSelectionCommand implements Runnable {
@@ -1994,39 +1916,18 @@
}
/**
- * Command for adjusting the scroller to show in its center the closest of
- * the displayed items.
- */
- class AdjustScrollerCommand implements Runnable {
- public void run() {
- mPreviousScrollerY = 0;
- if (mInitialScrollOffset == mCurrentScrollOffset) {
- updateInputTextView();
- showInputControls(mShowInputControlsAnimimationDuration);
- return;
- }
- // adjust to the closest value
- int deltaY = mInitialScrollOffset - mCurrentScrollOffset;
- if (Math.abs(deltaY) > mSelectorElementHeight / 2) {
- deltaY += (deltaY > 0) ? -mSelectorElementHeight : mSelectorElementHeight;
- }
- mAdjustScroller.startScroll(0, 0, 0, deltaY, SELECTOR_ADJUSTMENT_DURATION_MILLIS);
- invalidate();
- }
- }
-
- /**
* Command for changing the current value from a long press by one.
*/
class ChangeCurrentByOneFromLongPressCommand implements Runnable {
private boolean mIncrement;
- private void setIncrement(boolean increment) {
+ private void setStep(boolean increment) {
mIncrement = increment;
}
+ @Override
public void run() {
- changeCurrentByOne(mIncrement);
+ changeValueByOne(mIncrement);
postDelayed(this, mLongPressUpdateInterval);
}
}
@@ -2048,4 +1949,248 @@
}
}
}
+
+ /**
+ * Command for beginning soft input on long press.
+ */
+ class BeginSoftInputOnLongPressCommand implements Runnable {
+
+ @Override
+ public void run() {
+ showSoftInput();
+ mIngonreMoveEvents = true;
+ }
+ }
+
+ class AccessibilityNodeProviderImpl extends AccessibilityNodeProvider {
+ private static final int VIRTUAL_VIEW_ID_INCREMENT = 1;
+
+ private static final int VIRTUAL_VIEW_ID_INPUT = 2;
+
+ private static final int VIRTUAL_VIEW_ID_DECREMENT = 3;
+
+ private final Rect mTempRect = new Rect();
+
+ private final int[] mTempArray = new int[2];
+
+ @Override
+ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
+ switch (virtualViewId) {
+ case View.NO_ID:
+ return createAccessibilityNodeInfoForNumberPicker( mScrollX, mScrollY,
+ mScrollX + (mRight - mLeft), mScrollY + (mBottom - mTop));
+ case VIRTUAL_VIEW_ID_DECREMENT:
+ return createAccessibilityNodeInfoForVirtualButton(VIRTUAL_VIEW_ID_DECREMENT,
+ getVirtualDecrementButtonText(), mScrollX, mScrollY,
+ mScrollX + (mRight - mLeft),
+ mTopSelectionDividerTop + mSelectionDividerHeight);
+ case VIRTUAL_VIEW_ID_INPUT:
+ return createAccessibiltyNodeInfoForInputText();
+ case VIRTUAL_VIEW_ID_INCREMENT:
+ return createAccessibilityNodeInfoForVirtualButton(VIRTUAL_VIEW_ID_INCREMENT,
+ getVirtualIncrementButtonText(), mScrollX,
+ mBottomSelectionDividerBottom - mSelectionDividerHeight,
+ mScrollX + (mRight - mLeft), mScrollY + (mBottom - mTop));
+ }
+ return super.createAccessibilityNodeInfo(virtualViewId);
+ }
+
+ @Override
+ public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(String searched,
+ int virtualViewId) {
+ if (TextUtils.isEmpty(searched)) {
+ return Collections.emptyList();
+ }
+ String searchedLowerCase = searched.toLowerCase();
+ List<AccessibilityNodeInfo> result = new ArrayList<AccessibilityNodeInfo>();
+ switch (virtualViewId) {
+ case View.NO_ID: {
+ findAccessibilityNodeInfosByTextInChild(searchedLowerCase,
+ VIRTUAL_VIEW_ID_DECREMENT, result);
+ findAccessibilityNodeInfosByTextInChild(searchedLowerCase,
+ VIRTUAL_VIEW_ID_INPUT, result);
+ findAccessibilityNodeInfosByTextInChild(searchedLowerCase,
+ VIRTUAL_VIEW_ID_INCREMENT, result);
+ return result;
+ }
+ case VIRTUAL_VIEW_ID_DECREMENT:
+ case VIRTUAL_VIEW_ID_INCREMENT:
+ case VIRTUAL_VIEW_ID_INPUT: {
+ findAccessibilityNodeInfosByTextInChild(searchedLowerCase, virtualViewId,
+ result);
+ return result;
+ }
+ }
+ return super.findAccessibilityNodeInfosByText(searched, virtualViewId);
+ }
+
+ @Override
+ public boolean performAccessibilityAction(int action, int virtualViewId) {
+ switch (virtualViewId) {
+ case VIRTUAL_VIEW_ID_INPUT: {
+ switch (action) {
+ case AccessibilityNodeInfo.ACTION_FOCUS: {
+ if (!mInputText.isFocused()) {
+ return mInputText.requestFocus();
+ }
+ } break;
+ case AccessibilityNodeInfo.ACTION_CLEAR_FOCUS: {
+ if (mInputText.isFocused()) {
+ mInputText.clearFocus();
+ return true;
+ }
+ } break;
+ }
+ } break;
+ }
+ return super.performAccessibilityAction(action, virtualViewId);
+ }
+
+ public void sendAccessibilityEventForVirtualView(int virtualViewId, int eventType) {
+ switch (virtualViewId) {
+ case VIRTUAL_VIEW_ID_DECREMENT: {
+ sendAccessibilityEventForVirtualButton(virtualViewId, eventType,
+ getVirtualDecrementButtonText());
+ } break;
+ case VIRTUAL_VIEW_ID_INPUT: {
+ sendAccessibilityEventForVirtualText(eventType);
+ } break;
+ case VIRTUAL_VIEW_ID_INCREMENT: {
+ sendAccessibilityEventForVirtualButton(virtualViewId, eventType,
+ getVirtualIncrementButtonText());
+ } break;
+ }
+ }
+
+ private void sendAccessibilityEventForVirtualText(int eventType) {
+ AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
+ mInputText.onInitializeAccessibilityEvent(event);
+ mInputText.onPopulateAccessibilityEvent(event);
+ event.setSource(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT);
+ requestSendAccessibilityEvent(NumberPicker.this, event);
+ }
+
+ private void sendAccessibilityEventForVirtualButton(int virtualViewId, int eventType,
+ String text) {
+ AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
+ event.setClassName(Button.class.getName());
+ event.setPackageName(mContext.getPackageName());
+ event.getText().add(text);
+ event.setEnabled(NumberPicker.this.isEnabled());
+ event.setSource(NumberPicker.this, virtualViewId);
+ requestSendAccessibilityEvent(NumberPicker.this, event);
+ }
+
+ private void findAccessibilityNodeInfosByTextInChild(String searchedLowerCase,
+ int virtualViewId, List<AccessibilityNodeInfo> outResult) {
+ switch (virtualViewId) {
+ case VIRTUAL_VIEW_ID_DECREMENT: {
+ String text = getVirtualDecrementButtonText();
+ if (!TextUtils.isEmpty(text)
+ && text.toString().toLowerCase().contains(searchedLowerCase)) {
+ outResult.add(createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_DECREMENT));
+ }
+ } return;
+ case VIRTUAL_VIEW_ID_INPUT: {
+ CharSequence text = mInputText.getText();
+ if (!TextUtils.isEmpty(text) &&
+ text.toString().toLowerCase().contains(searchedLowerCase)) {
+ outResult.add(createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INPUT));
+ return;
+ }
+ CharSequence contentDesc = mInputText.getText();
+ if (!TextUtils.isEmpty(contentDesc) &&
+ contentDesc.toString().toLowerCase().contains(searchedLowerCase)) {
+ outResult.add(createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INPUT));
+ return;
+ }
+ } break;
+ case VIRTUAL_VIEW_ID_INCREMENT: {
+ String text = getVirtualIncrementButtonText();
+ if (!TextUtils.isEmpty(text)
+ && text.toString().toLowerCase().contains(searchedLowerCase)) {
+ outResult.add(createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INCREMENT));
+ }
+ } return;
+ }
+ }
+
+ private AccessibilityNodeInfo createAccessibiltyNodeInfoForInputText() {
+ AccessibilityNodeInfo info = mInputText.createAccessibilityNodeInfo();
+ info.setLongClickable(true);
+ info.setSource(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT);
+ return info;
+ }
+
+ private AccessibilityNodeInfo createAccessibilityNodeInfoForVirtualButton(int virtualViewId,
+ String text, int left, int top, int right, int bottom) {
+ AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain();
+ info.setClassName(Button.class.getName());
+ 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.setBoundsInParent(boundsInParent);
+ Rect boundsInScreen = boundsInParent;
+ int[] locationOnScreen = mTempArray;
+ getLocationOnScreen(locationOnScreen);
+ boundsInScreen.offsetTo(0, 0);
+ boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]);
+ info.setBoundsInScreen(boundsInScreen);
+ return info;
+ }
+
+ private AccessibilityNodeInfo createAccessibilityNodeInfoForNumberPicker(int left, int top,
+ int right, int bottom) {
+ AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain();
+ info.setClassName(Button.class.getName());
+ info.setPackageName(mContext.getPackageName());
+ info.setSource(NumberPicker.this);
+ info.setParent((View) getParent());
+ info.setEnabled(NumberPicker.this.isEnabled());
+ info.setScrollable(true);
+ Rect boundsInParent = mTempRect;
+ boundsInParent.set(left, top, right, bottom);
+ info.setBoundsInParent(boundsInParent);
+ Rect boundsInScreen = boundsInParent;
+ int[] locationOnScreen = mTempArray;
+ getLocationOnScreen(locationOnScreen);
+ boundsInScreen.offsetTo(0, 0);
+ boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]);
+ info.setBoundsInScreen(boundsInScreen);
+ return info;
+ }
+
+ private String getVirtualDecrementButtonText() {
+ int value = mValue - 1;
+ if (mWrapSelectorWheel) {
+ value = getWrappedSelectorIndex(value);
+ }
+ if (value >= mMinValue) {
+ return (mDisplayedValues == null) ? formatNumber(value)
+ : mDisplayedValues[value - mMinValue];
+ }
+ return null;
+ }
+
+ private String getVirtualIncrementButtonText() {
+ int value = mValue + 1;
+ if (mWrapSelectorWheel) {
+ value = getWrappedSelectorIndex(value);
+ }
+ if (value <= mMaxValue) {
+ return (mDisplayedValues == null) ? formatNumber(value)
+ : mDisplayedValues[value - mMinValue];
+ }
+ return null;
+ }
+ }
}
diff --git a/core/java/android/widget/RadioGroup.java b/core/java/android/widget/RadioGroup.java
index 7f53ffd..f217c9c 100644
--- a/core/java/android/widget/RadioGroup.java
+++ b/core/java/android/widget/RadioGroup.java
@@ -190,6 +190,8 @@
*
* @see #check(int)
* @see #clearCheck()
+ *
+ * @attr ref android.R.styleable#RadioGroup_checkedButton
*/
public int getCheckedRadioButtonId() {
return mCheckedId;
diff --git a/core/java/android/widget/RatingBar.java b/core/java/android/widget/RatingBar.java
index e69577b..524d272 100644
--- a/core/java/android/widget/RatingBar.java
+++ b/core/java/android/widget/RatingBar.java
@@ -145,6 +145,8 @@
* by the user).
*
* @param isIndicator Whether it should be an indicator.
+ *
+ * @attr ref android.R.styleable#RatingBar_isIndicator
*/
public void setIsIndicator(boolean isIndicator) {
mIsUserSeekable = !isIndicator;
@@ -153,6 +155,8 @@
/**
* @return Whether this rating bar is only an indicator.
+ *
+ * @attr ref android.R.styleable#RatingBar_isIndicator
*/
public boolean isIndicator() {
return !mIsUserSeekable;
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 55acb74..2f72e4a 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -965,6 +965,58 @@
}
/**
+ * Helper action to set compound drawables on a TextView. Supports relative
+ * (s/t/e/b) or cardinal (l/t/r/b) arrangement.
+ */
+ private class TextViewDrawableAction extends Action {
+ public TextViewDrawableAction(int viewId, boolean isRelative, int d1, int d2, int d3, int d4) {
+ this.viewId = viewId;
+ this.isRelative = isRelative;
+ this.d1 = d1;
+ this.d2 = d2;
+ this.d3 = d3;
+ this.d4 = d4;
+ }
+
+ public TextViewDrawableAction(Parcel parcel) {
+ viewId = parcel.readInt();
+ isRelative = (parcel.readInt() != 0);
+ d1 = parcel.readInt();
+ d2 = parcel.readInt();
+ d3 = parcel.readInt();
+ d4 = parcel.readInt();
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(TAG);
+ dest.writeInt(viewId);
+ dest.writeInt(isRelative ? 1 : 0);
+ dest.writeInt(d1);
+ dest.writeInt(d2);
+ dest.writeInt(d3);
+ dest.writeInt(d4);
+ }
+
+ @Override
+ public void apply(View root, ViewGroup rootParent) {
+ final Context context = root.getContext();
+ final TextView target = (TextView) root.findViewById(viewId);
+ if (target == null) return;
+ if (isRelative) {
+ target.setCompoundDrawablesRelativeWithIntrinsicBounds(d1, d2, d3, d4);
+ } else {
+ target.setCompoundDrawablesWithIntrinsicBounds(d1, d2, d3, d4);
+ }
+ }
+
+ int viewId;
+ boolean isRelative = false;
+ int d1, d2, d3, d4;
+
+ public final static int TAG = 11;
+ }
+
+ /**
* Simple class used to keep track of memory usage in a RemoteViews.
*
*/
@@ -1043,6 +1095,9 @@
case SetRemoteViewsAdapterIntent.TAG:
mActions.add(new SetRemoteViewsAdapterIntent(parcel));
break;
+ case TextViewDrawableAction.TAG:
+ mActions.add(new TextViewDrawableAction(parcel));
+ break;
default:
throw new ActionException("Tag " + tag + " not found");
}
@@ -1195,6 +1250,35 @@
}
/**
+ * Equivalent to calling
+ * {@link TextView#setCompoundDrawablesWithIntrinsicBounds(int, int, int, int)}.
+ *
+ * @param viewId The id of the view whose text should change
+ * @param left The id of a drawable to place to the left of the text, or 0
+ * @param top The id of a drawable to place above the text, or 0
+ * @param right The id of a drawable to place to the right of the text, or 0
+ * @param bottom The id of a drawable to place below the text, or 0
+ */
+ public void setTextViewCompoundDrawables(int viewId, int left, int top, int right, int bottom) {
+ addAction(new TextViewDrawableAction(viewId, false, left, top, right, bottom));
+ }
+
+ /**
+ * Equivalent to calling {@link
+ * TextView#setCompoundDrawablesRelativeWithIntrinsicBounds(int, int, int, int)}.
+ *
+ * @param viewId The id of the view whose text should change
+ * @param start The id of a drawable to place before the text (relative to the
+ * layout direction), or 0
+ * @param top The id of a drawable to place above the text, or 0
+ * @param end The id of a drawable to place after the text, or 0
+ * @param bottom The id of a drawable to place below the text, or 0
+ */
+ public void setTextViewCompoundDrawablesRelative(int viewId, int start, int top, int end, int bottom) {
+ addAction(new TextViewDrawableAction(viewId, true, start, top, end, bottom));
+ }
+
+ /**
* Equivalent to calling ImageView.setImageResource
*
* @param viewId The id of the view whose drawable should change
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index 25dd438..e0e3e93 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -642,8 +642,7 @@
break;
case MotionEvent.ACTION_POINTER_DOWN: {
final int index = ev.getActionIndex();
- final float y = ev.getY(index);
- mLastMotionY = y;
+ mLastMotionY = ev.getY(index);
mActivePointerId = ev.getPointerId(index);
break;
}
@@ -715,6 +714,7 @@
} else {
super.scrollTo(scrollX, scrollY);
}
+
awakenScrollBars();
}
@@ -749,42 +749,6 @@
/**
* <p>
- * Finds the next focusable component that fits in this View's bounds
- * (excluding fading edges) pretending that this View's top is located at
- * the parameter top.
- * </p>
- *
- * @param topFocus look for a candidate at the top of the bounds if topFocus is true,
- * or at the bottom of the bounds if topFocus is false
- * @param top the top offset of the bounds in which a focusable must be
- * found (the fading edge is assumed to start at this position)
- * @param preferredFocusable the View that has highest priority and will be
- * returned if it is within my bounds (null is valid)
- * @return the next focusable component in the bounds or null if none can be found
- */
- private View findFocusableViewInMyBounds(final boolean topFocus,
- final int top, View preferredFocusable) {
- /*
- * The fading edge's transparent side should be considered for focus
- * since it's mostly visible, so we divide the actual fading edge length
- * by 2.
- */
- final int fadingEdgeLength = getVerticalFadingEdgeLength() / 2;
- final int topWithoutFadingEdge = top + fadingEdgeLength;
- final int bottomWithoutFadingEdge = top + getHeight() - fadingEdgeLength;
-
- if ((preferredFocusable != null)
- && (preferredFocusable.getTop() < bottomWithoutFadingEdge)
- && (preferredFocusable.getBottom() > topWithoutFadingEdge)) {
- return preferredFocusable;
- }
-
- return findFocusableViewInBounds(topFocus, topWithoutFadingEdge,
- bottomWithoutFadingEdge);
- }
-
- /**
- * <p>
* Finds the next focusable component that fits in the specified bounds.
* </p>
*
@@ -1208,10 +1172,10 @@
}
}
- awakenScrollBars();
-
- // Keep on drawing until the animation has finished.
- postInvalidate();
+ if (!awakenScrollBars()) {
+ // Keep on drawing until the animation has finished.
+ invalidate();
+ }
} else {
if (mFlingStrictSpan != null) {
mFlingStrictSpan.finish();
@@ -1438,7 +1402,7 @@
/**
* Return true if child is a descendant of parent, (or equal to the parent).
*/
- private boolean isViewDescendantOf(View child, View parent) {
+ private static boolean isViewDescendantOf(View child, View parent) {
if (child == parent) {
return true;
}
@@ -1462,8 +1426,6 @@
mScroller.fling(mScrollX, mScrollY, 0, velocityY, 0, 0, 0,
Math.max(0, bottom - height), 0, height/2);
- final boolean movingDown = velocityY > 0;
-
if (mFlingStrictSpan == null) {
mFlingStrictSpan = StrictMode.enterCriticalSpan("ScrollView-fling");
}
@@ -1554,7 +1516,7 @@
}
}
- private int clamp(int n, int my, int child) {
+ private static int clamp(int n, int my, int child) {
if (my >= child || n < 0) {
/* my >= child is this case:
* |--------------- me ---------------|
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index ae06ac7..5c9dc88 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -139,6 +139,7 @@
import android.widget.AdapterView.OnItemClickListener;
import android.widget.RemoteViews.RemoteView;
+import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FastMath;
import com.android.internal.widget.EditableInputConnection;
@@ -1214,6 +1215,7 @@
if (imm != null) imm.restartInput(this);
}
+ // Will change text color
if (mEditor != null) getEditor().invalidateTextDisplayList();
prepareCursorControllers();
@@ -1796,6 +1798,7 @@
* @attr ref android.R.styleable#TextView_drawableRight
* @attr ref android.R.styleable#TextView_drawableBottom
*/
+ @android.view.RemotableViewMethod
public void setCompoundDrawablesWithIntrinsicBounds(int left, int top, int right, int bottom) {
final Resources resources = getContext().getResources();
setCompoundDrawablesWithIntrinsicBounds(left != 0 ? resources.getDrawable(left) : null,
@@ -1965,6 +1968,7 @@
* @attr ref android.R.styleable#TextView_drawableEnd
* @attr ref android.R.styleable#TextView_drawableBottom
*/
+ @android.view.RemotableViewMethod
public void setCompoundDrawablesRelativeWithIntrinsicBounds(int start, int top, int end,
int bottom) {
resetResolvedDrawables();
@@ -2040,6 +2044,7 @@
*
* @attr ref android.R.styleable#TextView_drawablePadding
*/
+ @android.view.RemotableViewMethod
public void setCompoundDrawablePadding(int pad) {
Drawables dr = mDrawables;
if (pad == 0) {
@@ -2328,7 +2333,6 @@
public void setHighlightColor(int color) {
if (mHighlightColor != color) {
mHighlightColor = color;
- if (mEditor != null) getEditor().invalidateTextDisplayList();
invalidate();
}
}
@@ -2349,6 +2353,7 @@
mShadowDx = dx;
mShadowDy = dy;
+ // Will change text clip region
if (mEditor != null) getEditor().invalidateTextDisplayList();
invalidate();
}
@@ -2841,6 +2846,7 @@
}
}
if (inval) {
+ // Text needs to be redrawn with the new color
if (mEditor != null) getEditor().invalidateTextDisplayList();
invalidate();
}
@@ -3332,7 +3338,7 @@
invalidate();
}
- // Invalidate display list if hint will be used
+ // Invalidate display list if hint is currently used
if (mEditor != null && mText.length() == 0 && mHint != null) {
getEditor().invalidateTextDisplayList();
}
@@ -8274,6 +8280,7 @@
if (getEditor().mPositionListener != null) {
getEditor().mPositionListener.onScrollChanged();
}
+ // Internal scroll affects the clip boundaries
getEditor().invalidateTextDisplayList();
}
}
@@ -11299,7 +11306,7 @@
InputContentType mInputContentType;
InputMethodState mInputMethodState;
- DisplayList mTextDisplayList;
+ DisplayList[] mTextDisplayLists;
boolean mFrozenWithFocus;
boolean mSelectionMoved;
@@ -11545,7 +11552,6 @@
void sendOnTextChanged(int start, int after) {
updateSpellCheckSpans(start, start + after, false);
- invalidateTextDisplayList();
// Hide the controllers as soon as text is modified (typing, procedural...)
// We do not hide the span controllers, since they can be added when a new text is
@@ -11677,7 +11683,7 @@
highlight = null;
}
- if (canHaveDisplayList() && canvas.isHardwareAccelerated()) {
+ if (false /* TEMP patch for bugs 6198276 & 6193544 */ && canHaveDisplayList() && canvas.isHardwareAccelerated()) {
drawHardwareAccelerated(canvas, layout, highlight, cursorOffsetVertical);
} else {
layout.draw(canvas, highlight, mHighlightPaint, cursorOffsetVertical);
@@ -11702,36 +11708,91 @@
layout.drawBackground(canvas, highlight, mHighlightPaint, cursorOffsetVertical,
firstLine, lastLine);
- if (mTextDisplayList == null || !mTextDisplayList.isValid()) {
- boolean displayListCreated = false;
- if (mTextDisplayList == null) {
- mTextDisplayList = getHardwareRenderer().createDisplayList("Text");
- displayListCreated = true;
+ if (mTextDisplayLists == null) {
+ mTextDisplayLists = new DisplayList[ArrayUtils.idealObjectArraySize(0)];
+ }
+ if (! (layout instanceof DynamicLayout)) {
+ Log.e(LOG_TAG, "Editable TextView is not using a DynamicLayout");
+ return;
+ }
+
+ DynamicLayout dynamicLayout = (DynamicLayout) layout;
+ int[] blockEnds = dynamicLayout.getBlockEnds();
+ int[] blockIndices = dynamicLayout.getBlockIndices();
+ final int numberOfBlocks = dynamicLayout.getNumberOfBlocks();
+
+ canvas.translate(mScrollX, mScrollY);
+ int endOfPreviousBlock = -1;
+ int searchStartIndex = 0;
+ for (int i = 0; i < numberOfBlocks; i++) {
+ int blockEnd = blockEnds[i];
+ int blockIndex = blockIndices[i];
+
+ final boolean blockIsInvalid = blockIndex == DynamicLayout.INVALID_BLOCK_INDEX;
+ if (blockIsInvalid) {
+ blockIndex = getAvailableDisplayListIndex(blockIndices, numberOfBlocks,
+ searchStartIndex);
+ // Dynamic layout internal block indices structure is updated from Editor
+ blockIndices[i] = blockIndex;
+ searchStartIndex = blockIndex + 1;
}
- final HardwareCanvas hardwareCanvas = mTextDisplayList.start();
- try {
- hardwareCanvas.setViewport(width, height);
- // The dirty rect should always be null for a display list
- hardwareCanvas.onPreDraw(null);
- hardwareCanvas.translate(-mScrollX, -mScrollY);
- layout.drawText(hardwareCanvas, firstLine, lastLine);
- //layout.draw(hardwareCanvas, highlight, mHighlightPaint, cursorOffsetVertical);
- hardwareCanvas.translate(mScrollX, mScrollY);
- } finally {
- hardwareCanvas.onPostDraw();
- mTextDisplayList.end();
- if (displayListCreated && USE_DISPLAY_LIST_PROPERTIES) {
- mTextDisplayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
+ DisplayList blockDisplayList = mTextDisplayLists[blockIndex];
+ if (blockDisplayList == null) {
+ blockDisplayList = mTextDisplayLists[blockIndex] =
+ getHardwareRenderer().createDisplayList("Text " + blockIndex);
+ } else {
+ if (blockIsInvalid) blockDisplayList.invalidate();
+ }
+
+ if (!blockDisplayList.isValid()) {
+ final HardwareCanvas hardwareCanvas = blockDisplayList.start();
+ try {
+ hardwareCanvas.setViewport(width, height);
+ // The dirty rect should always be null for a display list
+ hardwareCanvas.onPreDraw(null);
+ hardwareCanvas.translate(-mScrollX, -mScrollY);
+ layout.drawText(hardwareCanvas, endOfPreviousBlock + 1, blockEnd);
+ hardwareCanvas.translate(mScrollX, mScrollY);
+ } finally {
+ hardwareCanvas.onPostDraw();
+ blockDisplayList.end();
+ if (USE_DISPLAY_LIST_PROPERTIES) {
+ blockDisplayList.setLeftTopRightBottom(mLeft, mTop, mRight, mBottom);
+ }
}
}
+
+ ((HardwareCanvas) canvas).drawDisplayList(blockDisplayList, width, height, null,
+ DisplayList.FLAG_CLIP_CHILDREN);
+ endOfPreviousBlock = blockEnd;
}
- canvas.translate(mScrollX, mScrollY);
- ((HardwareCanvas) canvas).drawDisplayList(mTextDisplayList, width, height, null,
- DisplayList.FLAG_CLIP_CHILDREN);
canvas.translate(-mScrollX, -mScrollY);
}
+ private int getAvailableDisplayListIndex(int[] blockIndices, int numberOfBlocks,
+ int searchStartIndex) {
+ int length = mTextDisplayLists.length;
+ for (int i = searchStartIndex; i < length; i++) {
+ boolean blockIndexFound = false;
+ for (int j = 0; j < numberOfBlocks; j++) {
+ if (blockIndices[j] == i) {
+ blockIndexFound = true;
+ break;
+ }
+ }
+ if (blockIndexFound) continue;
+ return i;
+ }
+
+ // No available index found, the pool has to grow
+ int newSize = ArrayUtils.idealIntArraySize(length + 1);
+ DisplayList[] displayLists = new DisplayList[newSize];
+ System.arraycopy(mTextDisplayLists, 0, displayLists, 0, length);
+ mTextDisplayLists = displayLists;
+ return length;
+ }
+
private void drawCursor(Canvas canvas, int cursorOffsetVertical) {
final boolean translate = cursorOffsetVertical != 0;
if (translate) canvas.translate(0, cursorOffsetVertical);
@@ -11742,7 +11803,11 @@
}
private void invalidateTextDisplayList() {
- if (mTextDisplayList != null) mTextDisplayList.invalidate();
+ if (mTextDisplayLists != null) {
+ for (int i = 0; i < mTextDisplayLists.length; i++) {
+ if (mTextDisplayLists[i] != null) mTextDisplayLists[i].invalidate();
+ }
+ }
}
private void updateCursorsPositions() {
diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java
index 7eff1aa..bc88b62 100644
--- a/core/java/android/widget/TimePicker.java
+++ b/core/java/android/widget/TimePicker.java
@@ -532,21 +532,28 @@
private void setContentDescriptions() {
// Minute
- String text = mContext.getString(R.string.time_picker_increment_minute_button);
- mMinuteSpinner.findViewById(R.id.increment).setContentDescription(text);
- text = mContext.getString(R.string.time_picker_decrement_minute_button);
- mMinuteSpinner.findViewById(R.id.decrement).setContentDescription(text);
+ trySetContentDescription(mMinuteSpinner, R.id.increment,
+ R.string.time_picker_increment_minute_button);
+ trySetContentDescription(mMinuteSpinner, R.id.decrement,
+ R.string.time_picker_decrement_minute_button);
// Hour
- text = mContext.getString(R.string.time_picker_increment_hour_button);
- mHourSpinner.findViewById(R.id.increment).setContentDescription(text);
- text = mContext.getString(R.string.time_picker_decrement_hour_button);
- mHourSpinner.findViewById(R.id.decrement).setContentDescription(text);
+ trySetContentDescription(mHourSpinner, R.id.increment,
+ R.string.time_picker_increment_hour_button);
+ trySetContentDescription(mHourSpinner, R.id.decrement,
+ R.string.time_picker_decrement_hour_button);
// AM/PM
if (mAmPmSpinner != null) {
- text = mContext.getString(R.string.time_picker_increment_set_pm_button);
- mAmPmSpinner.findViewById(R.id.increment).setContentDescription(text);
- text = mContext.getString(R.string.time_picker_decrement_set_am_button);
- mAmPmSpinner.findViewById(R.id.decrement).setContentDescription(text);
+ trySetContentDescription(mAmPmSpinner, R.id.increment,
+ R.string.time_picker_increment_set_pm_button);
+ trySetContentDescription(mAmPmSpinner, R.id.decrement,
+ R.string.time_picker_decrement_set_am_button);
+ }
+ }
+
+ private void trySetContentDescription(View root, int viewId, int contDescResId) {
+ View target = root.findViewById(viewId);
+ if (target != null) {
+ target.setContentDescription(mContext.getString(contDescResId));
}
}
diff --git a/core/java/com/android/internal/app/HeavyWeightSwitcherActivity.java b/core/java/com/android/internal/app/HeavyWeightSwitcherActivity.java
index ef7e651..3d46cdd 100644
--- a/core/java/com/android/internal/app/HeavyWeightSwitcherActivity.java
+++ b/core/java/com/android/internal/app/HeavyWeightSwitcherActivity.java
@@ -123,7 +123,7 @@
private OnClickListener mSwitchOldListener = new OnClickListener() {
public void onClick(View v) {
try {
- ActivityManagerNative.getDefault().moveTaskToFront(mCurTask, 0);
+ ActivityManagerNative.getDefault().moveTaskToFront(mCurTask, 0, null);
} catch (RemoteException e) {
}
finish();
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 0563846..af722a8 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -33,14 +33,17 @@
import android.os.Bundle;
import android.os.PatternMatcher;
import android.util.Log;
+import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.view.LayoutInflater;
+import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
+import android.widget.ListView;
import android.widget.TextView;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -122,6 +125,11 @@
}
setupAlert();
+
+ ListView lv = mAlert.getListView();
+ if (lv != null) {
+ lv.setOnItemLongClickListener(new ItemLongClickListener());
+ }
}
@Override
@@ -489,5 +497,18 @@
mClearDefaultHint.setVisibility(View.GONE);
}
}
+
+ class ItemLongClickListener implements AdapterView.OnItemLongClickListener {
+
+ @Override
+ public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
+ ResolveInfo ri = mAdapter.resolveInfoForPosition(position);
+ Intent in = new Intent().setAction("android.settings.APPLICATION_DETAILS_SETTINGS")
+ .setData(Uri.fromParts("package", ri.activityInfo.packageName, null));
+ startActivity(in);
+ return true;
+ }
+
+ }
}
diff --git a/core/java/com/android/internal/backup/LocalTransport.java b/core/java/com/android/internal/backup/LocalTransport.java
index e7c3948..eed3e67 100644
--- a/core/java/com/android/internal/backup/LocalTransport.java
+++ b/core/java/com/android/internal/backup/LocalTransport.java
@@ -166,10 +166,13 @@
if (DEBUG) Log.v(TAG, "clearBackupData() pkg=" + packageInfo.packageName);
File packageDir = new File(mDataDir, packageInfo.packageName);
- for (File f : packageDir.listFiles()) {
- f.delete();
+ final File[] fileset = packageDir.listFiles();
+ if (fileset != null) {
+ for (File f : fileset) {
+ f.delete();
+ }
+ packageDir.delete();
}
- packageDir.delete();
return BackupConstants.TRANSPORT_OK;
}
diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java
index 53516c0..cdd2ad1 100644
--- a/core/java/com/android/internal/os/RuntimeInit.java
+++ b/core/java/com/android/internal/os/RuntimeInit.java
@@ -50,6 +50,10 @@
private static volatile boolean mCrashing = false;
+ private static final native void nativeZygoteInit();
+ private static final native void nativeFinishInit();
+ private static final native void nativeSetExitWithoutCleanup(boolean exitWithoutCleanup);
+
/**
* Use this to log a message when a thread exits due to an uncaught
* exception. The framework catches these for the main threads, so
@@ -91,13 +95,6 @@
/* set default handler; this applies to all threads in the VM */
Thread.setDefaultUncaughtExceptionHandler(new UncaughtHandler());
- int hasQwerty = getQwertyKeyboard();
-
- if (DEBUG) Slog.d(TAG, ">>>>> qwerty keyboard = " + hasQwerty);
- if (hasQwerty == 1) {
- System.setProperty("qwerty", "1");
- }
-
/*
* Install a TimezoneGetter subclass for ZoneInfo.db
*/
@@ -235,16 +232,14 @@
* Now that we're running in interpreted code, call back into native code
* to run the system.
*/
- finishInit();
+ nativeFinishInit();
if (DEBUG) Slog.d(TAG, "Leaving RuntimeInit!");
}
- public static final native void finishInit();
-
/**
* The main function called when started through the zygote process. This
- * could be unified with main(), if the native code in finishInit()
+ * could be unified with main(), if the native code in nativeFinishInit()
* were rationalized with Zygote startup.<p>
*
* Current recognized args:
@@ -262,7 +257,7 @@
redirectLogStreams();
commonInit();
- zygoteInitNative();
+ nativeZygoteInit();
applicationInit(targetSdkVersion, argv);
}
@@ -287,6 +282,13 @@
private static void applicationInit(int targetSdkVersion, String[] argv)
throws ZygoteInit.MethodAndArgsCaller {
+ // If the application calls System.exit(), terminate the process
+ // immediately without running any shutdown hooks. It is not possible to
+ // shutdown an Android application gracefully. Among other things, the
+ // Android runtime shutdown hooks close the Binder driver, which can cause
+ // leftover running threads to crash before the process actually exits.
+ nativeSetExitWithoutCleanup(true);
+
// We want to be fairly aggressive about heap utilization, to avoid
// holding on to a lot of memory that isn't needed.
VMRuntime.getRuntime().setTargetHeapUtilization(0.75f);
@@ -315,24 +317,6 @@
System.setErr(new AndroidPrintStream(Log.WARN, "System.err"));
}
- public static final native void zygoteInitNative();
-
- /**
- * Returns 1 if the computer is on. If the computer isn't on, the value returned by this method is undefined.
- */
- public static final native int isComputerOn();
-
- /**
- * Turns the computer on if the computer is off. If the computer is on, the behavior of this method is undefined.
- */
- public static final native void turnComputerOn();
-
- /**
- *
- * @return 1 if the device has a qwerty keyboard
- */
- public static native int getQwertyKeyboard();
-
/**
* Report a serious error in the current process. May or may not cause
* the process to terminate (depends on system settings).
diff --git a/core/java/com/android/internal/view/menu/MenuItemImpl.java b/core/java/com/android/internal/view/menu/MenuItemImpl.java
index 04147ab..2564921 100644
--- a/core/java/com/android/internal/view/menu/MenuItemImpl.java
+++ b/core/java/com/android/internal/view/menu/MenuItemImpl.java
@@ -382,7 +382,10 @@
}
if (mIconResId != NO_ICON) {
- return mMenu.getResources().getDrawable(mIconResId);
+ Drawable icon = mMenu.getResources().getDrawable(mIconResId);
+ mIconResId = NO_ICON;
+ mIconDrawable = icon;
+ return icon;
}
return null;
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index acc3c1c..5a7d519 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -105,6 +105,12 @@
*/
public static final int MIN_PATTERN_REGISTER_FAIL = MIN_LOCK_PATTERN_SIZE;
+ /**
+ * The bit in LOCK_BIOMETRIC_WEAK_FLAGS to be used to indicate whether liveliness should
+ * be used
+ */
+ public static final int FLAG_BIOMETRIC_WEAK_LIVELINESS = 0x1;
+
private final static String LOCKOUT_PERMANENT_KEY = "lockscreen.lockedoutpermanently";
private final static String LOCKOUT_ATTEMPT_DEADLINE = "lockscreen.lockoutattemptdeadline";
private final static String PATTERN_EVER_CHOSEN_KEY = "lockscreen.patterneverchosen";
@@ -878,6 +884,28 @@
}
/**
+ * Set whether biometric weak liveliness is enabled.
+ */
+ public void setBiometricWeakLivelinessEnabled(boolean enabled) {
+ long currentFlag = getLong(Settings.Secure.LOCK_BIOMETRIC_WEAK_FLAGS, 0L);
+ long newFlag;
+ if (enabled) {
+ newFlag = currentFlag | FLAG_BIOMETRIC_WEAK_LIVELINESS;
+ } else {
+ newFlag = currentFlag & ~FLAG_BIOMETRIC_WEAK_LIVELINESS;
+ }
+ setLong(Settings.Secure.LOCK_BIOMETRIC_WEAK_FLAGS, newFlag);
+ }
+
+ /**
+ * @return Whether the biometric weak liveliness is enabled.
+ */
+ public boolean isBiometricWeakLivelinessEnabled() {
+ long currentFlag = getLong(Settings.Secure.LOCK_BIOMETRIC_WEAK_FLAGS, 0L);
+ return ((currentFlag & FLAG_BIOMETRIC_WEAK_LIVELINESS) != 0);
+ }
+
+ /**
* Set whether the lock pattern is enabled.
*/
public void setLockPatternEnabled(boolean enabled) {
diff --git a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
index d51ced11..f2b6e45 100644
--- a/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java
@@ -164,9 +164,10 @@
mFeedbackCount = a.getInt(R.styleable.MultiWaveView_feedbackCount,
mFeedbackCount);
mHandleDrawable = new TargetDrawable(res,
- a.getDrawable(R.styleable.MultiWaveView_handleDrawable));
+ a.peekValue(R.styleable.MultiWaveView_handleDrawable).resourceId);
mTapRadius = mHandleDrawable.getWidth()/2;
- mOuterRing = new TargetDrawable(res, a.getDrawable(R.styleable.MultiWaveView_waveDrawable));
+ mOuterRing = new TargetDrawable(res,
+ a.peekValue(R.styleable.MultiWaveView_waveDrawable).resourceId);
// Read chevron animation drawables
final int chevrons[] = { R.styleable.MultiWaveView_leftChevronDrawable,
@@ -174,11 +175,12 @@
R.styleable.MultiWaveView_topChevronDrawable,
R.styleable.MultiWaveView_bottomChevronDrawable
};
+
for (int chevron : chevrons) {
- Drawable chevronDrawable = a.getDrawable(chevron);
+ TypedValue typedValue = a.peekValue(chevron);
for (int i = 0; i < mFeedbackCount; i++) {
mChevronDrawables.add(
- chevronDrawable != null ? new TargetDrawable(res, chevronDrawable) : null);
+ typedValue != null ? new TargetDrawable(res, typedValue.resourceId) : null);
}
}
@@ -519,8 +521,8 @@
int count = array.length();
ArrayList<TargetDrawable> targetDrawables = new ArrayList<TargetDrawable>(count);
for (int i = 0; i < count; i++) {
- Drawable drawable = array.getDrawable(i);
- targetDrawables.add(new TargetDrawable(res, drawable));
+ TypedValue value = array.peekValue(i);
+ targetDrawables.add(new TargetDrawable(res, value != null ? value.resourceId : 0));
}
array.recycle();
mTargetResourceId = resourceId;
@@ -679,7 +681,7 @@
if (DEBUG && mDragging) Log.v(TAG, "** Handle RELEASE");
switchToState(STATE_FINISH, event.getX(), event.getY());
}
-
+
private void handleCancel(MotionEvent event) {
if (DEBUG && mDragging) Log.v(TAG, "** Handle CANCEL");
mActiveTarget = -1; // Drop the active target if canceled.
@@ -723,7 +725,7 @@
float dx = limitX - target.getX();
float dy = limitY - target.getY();
float dist2 = dx*dx + dy*dy;
- if (target.isValid() && dist2 < hitRadius2 && dist2 < best) {
+ if (target.isEnabled() && dist2 < hitRadius2 && dist2 < best) {
activeTarget = i;
best = dist2;
}
@@ -968,4 +970,34 @@
array.recycle();
return targetContentDescriptions;
}
+
+ public int getResourceIdForTarget(int index) {
+ final TargetDrawable drawable = mTargetDrawables.get(index);
+ return drawable == null ? 0 : drawable.getResourceId();
+ }
+
+ public void setEnableTarget(int resourceId, boolean enabled) {
+ for (int i = 0; i < mTargetDrawables.size(); i++) {
+ final TargetDrawable target = mTargetDrawables.get(i);
+ if (target.getResourceId() == resourceId) {
+ target.setEnabled(enabled);
+ break; // should never be more than one match
+ }
+ }
+ }
+
+ /**
+ * Gets the position of a target in the array that matches the given resource.
+ * @param resourceId
+ * @return the index or -1 if not found
+ */
+ public int getTargetPosition(int resourceId) {
+ for (int i = 0; i < mTargetDrawables.size(); i++) {
+ final TargetDrawable target = mTargetDrawables.get(i);
+ if (target.getResourceId() == resourceId) {
+ return i; // should never be more than one match
+ }
+ }
+ return -1;
+ }
}
diff --git a/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java b/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java
index aa9fa45..ec2c945 100644
--- a/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java
+++ b/core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java
@@ -40,6 +40,8 @@
private float mScaleY = 1.0f;
private float mAlpha = 1.0f;
private Drawable mDrawable;
+ private boolean mEnabled = true;
+ private int mResourceId;
/* package */ static class DrawableWithAlpha extends Drawable {
private float mAlpha = 1.0f;
@@ -72,10 +74,8 @@
}
public TargetDrawable(Resources res, int resId) {
- this(res, resId == 0 ? null : res.getDrawable(resId));
- }
-
- public TargetDrawable(Resources res, Drawable drawable) {
+ mResourceId = resId;
+ Drawable drawable = resId == 0 ? null : res.getDrawable(resId);
// Mutate the drawable so we can animate shared drawable properties.
mDrawable = drawable != null ? drawable.mutate() : null;
resizeDrawables();
@@ -122,8 +122,8 @@
*
* @return
*/
- public boolean isValid() {
- return mDrawable != null;
+ public boolean isEnabled() {
+ return mDrawable != null && mEnabled;
}
/**
@@ -205,7 +205,7 @@
}
public void draw(Canvas canvas) {
- if (mDrawable == null) {
+ if (mDrawable == null || !mEnabled) {
return;
}
canvas.save(Canvas.MATRIX_SAVE_FLAG);
@@ -216,4 +216,12 @@
mDrawable.draw(canvas);
canvas.restore();
}
+
+ public void setEnabled(boolean enabled) {
+ mEnabled = enabled;
+ }
+
+ public int getResourceId() {
+ return mResourceId;
+ }
}
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 92b07b3..5650d68 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -211,6 +211,7 @@
libicuuc \
libicui18n \
libmedia \
+ libmedia_native \
libwpa_client \
libjpeg \
libusbhost \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 92ff8da..e705c47 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -189,49 +189,32 @@
/*
* Code written in the Java Programming Language calls here from main().
*/
-static void com_android_internal_os_RuntimeInit_finishInit(JNIEnv* env, jobject clazz)
+static void com_android_internal_os_RuntimeInit_nativeFinishInit(JNIEnv* env, jobject clazz)
{
gCurRuntime->onStarted();
}
-static void com_android_internal_os_RuntimeInit_zygoteInit(JNIEnv* env, jobject clazz)
+static void com_android_internal_os_RuntimeInit_nativeZygoteInit(JNIEnv* env, jobject clazz)
{
gCurRuntime->onZygoteInit();
}
-static jint com_android_internal_os_RuntimeInit_isComputerOn(JNIEnv* env, jobject clazz)
+static void com_android_internal_os_RuntimeInit_nativeSetExitWithoutCleanup(JNIEnv* env,
+ jobject clazz, jboolean exitWithoutCleanup)
{
- return 1;
-}
-
-static void com_android_internal_os_RuntimeInit_turnComputerOn(JNIEnv* env, jobject clazz)
-{
-}
-
-static jint com_android_internal_os_RuntimeInit_getQwertyKeyboard(JNIEnv* env, jobject clazz)
-{
- char* value = getenv("qwerty");
- if (value != NULL && strcmp(value, "true") == 0) {
- return 1;
- }
-
- return 0;
+ gCurRuntime->setExitWithoutCleanup(exitWithoutCleanup);
}
/*
* JNI registration.
*/
static JNINativeMethod gMethods[] = {
- { "finishInit", "()V",
- (void*) com_android_internal_os_RuntimeInit_finishInit },
- { "zygoteInitNative", "()V",
- (void*) com_android_internal_os_RuntimeInit_zygoteInit },
- { "isComputerOn", "()I",
- (void*) com_android_internal_os_RuntimeInit_isComputerOn },
- { "turnComputerOn", "()V",
- (void*) com_android_internal_os_RuntimeInit_turnComputerOn },
- { "getQwertyKeyboard", "()I",
- (void*) com_android_internal_os_RuntimeInit_getQwertyKeyboard },
+ { "nativeFinishInit", "()V",
+ (void*) com_android_internal_os_RuntimeInit_nativeFinishInit },
+ { "nativeZygoteInit", "()V",
+ (void*) com_android_internal_os_RuntimeInit_nativeZygoteInit },
+ { "nativeSetExitWithoutCleanup", "(Z)V",
+ (void*) com_android_internal_os_RuntimeInit_nativeSetExitWithoutCleanup },
};
int register_com_android_internal_os_RuntimeInit(JNIEnv* env)
@@ -245,7 +228,8 @@
/*static*/ JavaVM* AndroidRuntime::mJavaVM = NULL;
-AndroidRuntime::AndroidRuntime()
+AndroidRuntime::AndroidRuntime() :
+ mExitWithoutCleanup(false)
{
SkGraphics::Init();
// this sets our preference for 16bit images during decode
@@ -323,8 +307,7 @@
*/
static void runtime_exit(int code)
{
- gCurRuntime->onExit(code);
- exit(code);
+ gCurRuntime->exit(code);
}
/*
@@ -895,10 +878,16 @@
ALOGW("Warning: VM did not shut down cleanly\n");
}
-void AndroidRuntime::onExit(int code)
+void AndroidRuntime::exit(int code)
{
- ALOGV("AndroidRuntime onExit calling exit(%d)", code);
- exit(code);
+ if (mExitWithoutCleanup) {
+ ALOGI("VM exiting with result code %d, cleanup skipped.", code);
+ ::_exit(code);
+ } else {
+ ALOGI("VM exiting with result code %d.", code);
+ onExit(code);
+ ::exit(code);
+ }
}
void AndroidRuntime::onVmCreated(JNIEnv* env)
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index 4b64bf3..dcd1d28 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -79,22 +79,65 @@
}
static bool optionsPurgeable(JNIEnv* env, jobject options) {
- return options != NULL &&
- env->GetBooleanField(options, gOptions_purgeableFieldID);
+ return options != NULL && env->GetBooleanField(options, gOptions_purgeableFieldID);
}
static bool optionsShareable(JNIEnv* env, jobject options) {
- return options != NULL &&
- env->GetBooleanField(options, gOptions_shareableFieldID);
+ return options != NULL && env->GetBooleanField(options, gOptions_shareableFieldID);
}
static bool optionsJustBounds(JNIEnv* env, jobject options) {
- return options != NULL &&
- env->GetBooleanField(options, gOptions_justBoundsFieldID);
+ return options != NULL && env->GetBooleanField(options, gOptions_justBoundsFieldID);
+}
+
+static void scaleNinePatchChunk(android::Res_png_9patch* chunk, float scale) {
+ chunk->paddingLeft = int(chunk->paddingLeft * scale + 0.5f);
+ chunk->paddingTop = int(chunk->paddingTop * scale + 0.5f);
+ chunk->paddingRight = int(chunk->paddingRight * scale + 0.5f);
+ chunk->paddingBottom = int(chunk->paddingBottom * scale + 0.5f);
+
+ for (int i = 0; i < chunk->numXDivs; i++) {
+ chunk->xDivs[i] = int(chunk->xDivs[i] * scale + 0.5f);
+ if (i > 0 && chunk->xDivs[i] == chunk->xDivs[i - 1]) {
+ chunk->xDivs[i]++;
+ }
+ }
+
+ for (int i = 0; i < chunk->numYDivs; i++) {
+ chunk->yDivs[i] = int(chunk->yDivs[i] * scale + 0.5f);
+ if (i > 0 && chunk->yDivs[i] == chunk->yDivs[i - 1]) {
+ chunk->yDivs[i]++;
+ }
+ }
+}
+
+static jbyteArray nativeScaleNinePatch(JNIEnv* env, jobject, jbyteArray chunkObject, jfloat scale,
+ jobject padding) {
+
+ jbyte* array = env->GetByteArrayElements(chunkObject, 0);
+ if (array != NULL) {
+ size_t chunkSize = env->GetArrayLength(chunkObject);
+ void* storage = alloca(chunkSize);
+ android::Res_png_9patch* chunk = static_cast<android::Res_png_9patch*>(storage);
+ memcpy(chunk, array, chunkSize);
+ android::Res_png_9patch::deserialize(chunk);
+
+ scaleNinePatchChunk(chunk, scale);
+ memcpy(array, chunk, chunkSize);
+
+ if (padding) {
+ GraphicsJNI::set_jrect(env, padding, chunk->paddingLeft, chunk->paddingTop,
+ chunk->paddingRight, chunk->paddingBottom);
+ }
+
+ env->ReleaseByteArrayElements(chunkObject, array, 0);
+ }
+ return chunkObject;
}
static SkPixelRef* installPixelRef(SkBitmap* bitmap, SkStream* stream,
- int sampleSize, bool ditherImage) {
+ int sampleSize, bool ditherImage) {
+
SkImageRef* pr;
// only use ashmem for large images, since mmaps come at a price
if (bitmap->getSize() >= 32 * 1024) {
@@ -112,23 +155,29 @@
// i.e. dynamically allocated, since its lifetime may exceed the current stack
// frame.
static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,
- jobject options, bool allowPurgeable,
- bool forcePurgeable = false) {
+ jobject options, bool allowPurgeable, bool forcePurgeable = false,
+ bool applyScale = false, float scale = 1.0f) {
+
int sampleSize = 1;
+
SkImageDecoder::Mode mode = SkImageDecoder::kDecodePixels_Mode;
SkBitmap::Config prefConfig = SkBitmap::kARGB_8888_Config;
+
bool doDither = true;
bool isMutable = false;
- bool isPurgeable = forcePurgeable ||
- (allowPurgeable && optionsPurgeable(env, options));
+ bool willScale = applyScale && scale != 1.0f;
+ bool isPurgeable = !willScale &&
+ (forcePurgeable || (allowPurgeable && optionsPurgeable(env, options)));
bool preferQualityOverSpeed = false;
+
jobject javaBitmap = NULL;
- if (NULL != options) {
+ if (options != NULL) {
sampleSize = env->GetIntField(options, gOptions_sampleSizeFieldID);
if (optionsJustBounds(env, options)) {
mode = SkImageDecoder::kDecodeBounds_Mode;
}
+
// initialize these, in case we fail later on
env->SetIntField(options, gOptions_widthFieldID, -1);
env->SetIntField(options, gOptions_heightFieldID, -1);
@@ -143,8 +192,12 @@
javaBitmap = env->GetObjectField(options, gOptions_bitmapFieldID);
}
+ if (willScale && javaBitmap != NULL) {
+ return nullObjectReturn("Cannot pre-scale a reused bitmap");
+ }
+
SkImageDecoder* decoder = SkImageDecoder::Factory(stream);
- if (NULL == decoder) {
+ if (decoder == NULL) {
return nullObjectReturn("SkImageDecoder::Factory returned null");
}
@@ -152,35 +205,35 @@
decoder->setDitherImage(doDither);
decoder->setPreferQualityOverSpeed(preferQualityOverSpeed);
- NinePatchPeeker peeker(decoder);
- JavaPixelAllocator javaAllocator(env);
- SkBitmap* bitmap;
+ NinePatchPeeker peeker(decoder);
+ JavaPixelAllocator javaAllocator(env);
+
+ SkBitmap* bitmap;
if (javaBitmap == NULL) {
bitmap = new SkBitmap;
} else {
if (sampleSize != 1) {
return nullObjectReturn("SkImageDecoder: Cannot reuse bitmap with sampleSize != 1");
}
- bitmap = (SkBitmap *) env->GetIntField(javaBitmap, gBitmap_nativeBitmapFieldID);
+ bitmap = (SkBitmap*) env->GetIntField(javaBitmap, gBitmap_nativeBitmapFieldID);
// config of supplied bitmap overrules config set in options
prefConfig = bitmap->getConfig();
}
- Res_png_9patch dummy9Patch;
- SkAutoTDelete<SkImageDecoder> add(decoder);
- SkAutoTDelete<SkBitmap> adb(bitmap, (javaBitmap == NULL));
+ SkAutoTDelete<SkImageDecoder> add(decoder);
+ SkAutoTDelete<SkBitmap> adb(bitmap, javaBitmap == NULL);
decoder->setPeeker(&peeker);
if (!isPurgeable) {
decoder->setAllocator(&javaAllocator);
}
- AutoDecoderCancel adc(options, decoder);
+ AutoDecoderCancel adc(options, decoder);
// To fix the race condition in case "requestCancelDecode"
// happens earlier than AutoDecoderCancel object is added
// to the gAutoDecoderCancelMutex linked list.
- if (NULL != options && env->GetBooleanField(options, gOptions_mCancelID)) {
+ if (options != NULL && env->GetBooleanField(options, gOptions_mCancelID)) {
return nullObjectReturn("gOptions_mCancelID");
}
@@ -188,38 +241,57 @@
if (isPurgeable) {
decodeMode = SkImageDecoder::kDecodeBounds_Mode;
}
- if (!decoder->decode(stream, bitmap, prefConfig, decodeMode, javaBitmap != NULL)) {
+
+ SkBitmap* decoded;
+ if (willScale) {
+ decoded = new SkBitmap;
+ } else {
+ decoded = bitmap;
+ }
+ SkAutoTDelete<SkBitmap> adb2(willScale ? decoded : NULL);
+
+ if (!decoder->decode(stream, decoded, prefConfig, decodeMode, javaBitmap != NULL)) {
return nullObjectReturn("decoder->decode returned false");
}
+ int scaledWidth = decoded->width();
+ int scaledHeight = decoded->height();
+
+ if (willScale && mode != SkImageDecoder::kDecodeBounds_Mode) {
+ scaledWidth = int(scaledWidth * scale + 0.5f);
+ scaledHeight = int(scaledHeight * scale + 0.5f);
+ }
+
// update options (if any)
- if (NULL != options) {
- env->SetIntField(options, gOptions_widthFieldID, bitmap->width());
- env->SetIntField(options, gOptions_heightFieldID, bitmap->height());
- // TODO: set the mimeType field with the data from the codec.
- // but how to reuse a set of strings, rather than allocating new one
- // each time?
+ if (options != NULL) {
+ env->SetIntField(options, gOptions_widthFieldID, scaledWidth);
+ env->SetIntField(options, gOptions_heightFieldID, scaledHeight);
env->SetObjectField(options, gOptions_mimeFieldID,
- getMimeTypeString(env, decoder->getFormat()));
+ getMimeTypeString(env, decoder->getFormat()));
}
// if we're in justBounds mode, return now (skip the java bitmap)
- if (SkImageDecoder::kDecodeBounds_Mode == mode) {
+ if (mode == SkImageDecoder::kDecodeBounds_Mode) {
return NULL;
}
jbyteArray ninePatchChunk = NULL;
if (peeker.fPatchIsValid) {
+ if (willScale) {
+ scaleNinePatchChunk(peeker.fPatch, scale);
+ }
+
size_t ninePatchArraySize = peeker.fPatch->serializedSize();
ninePatchChunk = env->NewByteArray(ninePatchArraySize);
- if (NULL == ninePatchChunk) {
+ if (ninePatchChunk == NULL) {
return nullObjectReturn("ninePatchChunk == null");
}
- jbyte* array = (jbyte*)env->GetPrimitiveArrayCritical(ninePatchChunk,
- NULL);
- if (NULL == array) {
+
+ jbyte* array = (jbyte*) env->GetPrimitiveArrayCritical(ninePatchChunk, NULL);
+ if (array == NULL) {
return nullObjectReturn("primitive array == null");
}
+
peeker.fPatch->serialize(array);
env->ReleasePrimitiveArrayCritical(ninePatchChunk, array, 0);
}
@@ -227,13 +299,32 @@
// detach bitmap from its autodeleter, since we want to own it now
adb.detach();
+ if (willScale) {
+ // This is weird so let me explain: we could use the scale parameter
+ // directly, but for historical reasons this is how the corresponding
+ // Dalvik code has always behaved. We simply recreate the behavior here.
+ // The result is slightly different from simply using scale because of
+ // the 0.5f rounding bias applied when computing the target image size
+ const float sx = scaledWidth / float(decoded->width());
+ const float sy = scaledHeight / float(decoded->height());
+
+ bitmap->setConfig(decoded->getConfig(), scaledWidth, scaledHeight);
+ bitmap->allocPixels(&javaAllocator, NULL);
+ bitmap->eraseColor(0);
+
+ SkPaint paint;
+ paint.setFilterBitmap(true);
+
+ SkCanvas canvas(*bitmap);
+ canvas.scale(sx, sy);
+ canvas.drawBitmap(*decoded, 0.0f, 0.0f, &paint);
+ }
+
if (padding) {
if (peeker.fPatchIsValid) {
GraphicsJNI::set_jrect(env, padding,
- peeker.fPatch->paddingLeft,
- peeker.fPatch->paddingTop,
- peeker.fPatch->paddingRight,
- peeker.fPatch->paddingBottom);
+ peeker.fPatch->paddingLeft, peeker.fPatch->paddingTop,
+ peeker.fPatch->paddingRight, peeker.fPatch->paddingBottom);
} else {
GraphicsJNI::set_jrect(env, padding, -1, -1, -1, -1);
}
@@ -262,22 +353,26 @@
isMutable, ninePatchChunk);
}
-static jobject nativeDecodeStream(JNIEnv* env, jobject clazz,
- jobject is, // InputStream
- jbyteArray storage, // byte[]
- jobject padding,
- jobject options) { // BitmapFactory$Options
+static jobject nativeDecodeStreamScaled(JNIEnv* env, jobject clazz, jobject is, jbyteArray storage,
+ jobject padding, jobject options, jboolean applyScale, jfloat scale) {
+
jobject bitmap = NULL;
SkStream* stream = CreateJavaInputStreamAdaptor(env, is, storage, 0);
if (stream) {
// for now we don't allow purgeable with java inputstreams
- bitmap = doDecode(env, stream, padding, options, false);
+ bitmap = doDecode(env, stream, padding, options, false, false, applyScale, scale);
stream->unref();
}
return bitmap;
}
+static jobject nativeDecodeStream(JNIEnv* env, jobject clazz, jobject is, jbyteArray storage,
+ jobject padding, jobject options) {
+
+ return nativeDecodeStreamScaled(env, clazz, is, storage, padding, options, false, 1.0f);
+}
+
static ssize_t getFDSize(int fd) {
off64_t curr = ::lseek64(fd, 0, SEEK_CUR);
if (curr < 0) {
@@ -288,10 +383,9 @@
return size;
}
-static jobject nativeDecodeFileDescriptor(JNIEnv* env, jobject clazz,
- jobject fileDescriptor,
- jobject padding,
- jobject bitmapFactoryOptions) {
+static jobject nativeDecodeFileDescriptor(JNIEnv* env, jobject clazz, jobject fileDescriptor,
+ jobject padding, jobject bitmapFactoryOptions) {
+
NPE_CHECK_RETURN_ZERO(env, fileDescriptor);
jint descriptor = jniGetFDFromFileDescriptor(env, fileDescriptor);
@@ -353,10 +447,9 @@
return stream;
}
-static jobject nativeDecodeAsset(JNIEnv* env, jobject clazz,
- jint native_asset, // Asset
- jobject padding, // Rect
- jobject options) { // BitmapFactory$Options
+static jobject nativeDecodeAssetScaled(JNIEnv* env, jobject clazz, jint native_asset,
+ jobject padding, jobject options, jboolean applyScale, jfloat scale) {
+
SkStream* stream;
Asset* asset = reinterpret_cast<Asset*>(native_asset);
bool forcePurgeable = optionsPurgeable(env, options);
@@ -364,7 +457,7 @@
// if we could "ref/reopen" the asset, we may not need to copy it here
// and we could assume optionsShareable, since assets are always RO
stream = copyAssetToStream(asset);
- if (NULL == stream) {
+ if (stream == NULL) {
return NULL;
}
} else {
@@ -373,18 +466,24 @@
stream = new AssetStreamAdaptor(asset);
}
SkAutoUnref aur(stream);
- return doDecode(env, stream, padding, options, true, forcePurgeable);
+ return doDecode(env, stream, padding, options, true, forcePurgeable, applyScale, scale);
+}
+
+static jobject nativeDecodeAsset(JNIEnv* env, jobject clazz, jint native_asset,
+ jobject padding, jobject options) {
+
+ return nativeDecodeAssetScaled(env, clazz, native_asset, padding, options, false, 1.0f);
}
static jobject nativeDecodeByteArray(JNIEnv* env, jobject, jbyteArray byteArray,
- int offset, int length, jobject options) {
+ int offset, int length, jobject options) {
+
/* If optionsShareable() we could decide to just wrap the java array and
share it, but that means adding a globalref to the java array object
and managing its lifetime. For now we just always copy the array's data
if optionsPurgeable(), unless we're just decoding bounds.
*/
- bool purgeable = optionsPurgeable(env, options)
- && !optionsJustBounds(env, options);
+ bool purgeable = optionsPurgeable(env, options) && !optionsJustBounds(env, options);
AutoJavaByteArray ar(env, byteArray);
SkStream* stream = new SkMemoryStream(ar.ptr() + offset, length, purgeable);
SkAutoUnref aur(stream);
@@ -395,65 +494,6 @@
(void)AutoDecoderCancel::RequestCancel(joptions);
}
-static jbyteArray nativeScaleNinePatch(JNIEnv* env, jobject, jbyteArray chunkObject, jfloat scale,
- jobject padding) {
-
- jbyte* array = env->GetByteArrayElements(chunkObject, 0);
- if (array != NULL) {
- size_t chunkSize = env->GetArrayLength(chunkObject);
- void* storage = alloca(chunkSize);
- android::Res_png_9patch* chunk = static_cast<android::Res_png_9patch*>(storage);
- memcpy(chunk, array, chunkSize);
- android::Res_png_9patch::deserialize(chunk);
-
- chunk->paddingLeft = int(chunk->paddingLeft * scale + 0.5f);
- chunk->paddingTop = int(chunk->paddingTop * scale + 0.5f);
- chunk->paddingRight = int(chunk->paddingRight * scale + 0.5f);
- chunk->paddingBottom = int(chunk->paddingBottom * scale + 0.5f);
-
- for (int i = 0; i < chunk->numXDivs; i++) {
- chunk->xDivs[i] = int(chunk->xDivs[i] * scale + 0.5f);
- if (i > 0 && chunk->xDivs[i] == chunk->xDivs[i - 1]) {
- chunk->xDivs[i]++;
- }
- }
-
- for (int i = 0; i < chunk->numYDivs; i++) {
- chunk->yDivs[i] = int(chunk->yDivs[i] * scale + 0.5f);
- if (i > 0 && chunk->yDivs[i] == chunk->yDivs[i - 1]) {
- chunk->yDivs[i]++;
- }
- }
-
- memcpy(array, chunk, chunkSize);
-
- if (padding) {
- GraphicsJNI::set_jrect(env, padding, chunk->paddingLeft, chunk->paddingTop,
- chunk->paddingRight, chunk->paddingBottom);
- }
-
- env->ReleaseByteArrayElements(chunkObject, array, 0);
- }
- return chunkObject;
-}
-
-static void nativeSetDefaultConfig(JNIEnv* env, jobject, int nativeConfig) {
- SkBitmap::Config config = static_cast<SkBitmap::Config>(nativeConfig);
-
- // these are the only default configs that make sense for codecs right now
- static const SkBitmap::Config gValidDefConfig[] = {
- SkBitmap::kRGB_565_Config,
- SkBitmap::kARGB_8888_Config,
- };
-
- for (size_t i = 0; i < SK_ARRAY_COUNT(gValidDefConfig); i++) {
- if (config == gValidDefConfig[i]) {
- SkImageDecoder::SetDeviceConfig(config);
- break;
- }
- }
-}
-
static jboolean nativeIsSeekable(JNIEnv* env, jobject, jobject fileDescriptor) {
jint descriptor = jniGetFDFromFileDescriptor(env, fileDescriptor);
return ::lseek64(descriptor, 0, SEEK_CUR) != -1 ? JNI_TRUE : JNI_FALSE;
@@ -466,6 +506,10 @@
"(Ljava/io/InputStream;[BLandroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;",
(void*)nativeDecodeStream
},
+ { "nativeDecodeStream",
+ "(Ljava/io/InputStream;[BLandroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;ZF)Landroid/graphics/Bitmap;",
+ (void*)nativeDecodeStreamScaled
+ },
{ "nativeDecodeFileDescriptor",
"(Ljava/io/FileDescriptor;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;",
@@ -477,6 +521,11 @@
(void*)nativeDecodeAsset
},
+ { "nativeDecodeAsset",
+ "(ILandroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;ZF)Landroid/graphics/Bitmap;",
+ (void*)nativeDecodeAssetScaled
+ },
+
{ "nativeDecodeByteArray",
"([BIILandroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;",
(void*)nativeDecodeByteArray
@@ -487,8 +536,6 @@
(void*)nativeScaleNinePatch
},
- { "nativeSetDefaultConfig", "(I)V", (void*)nativeSetDefaultConfig },
-
{ "nativeIsSeekable",
"(Ljava/io/FileDescriptor;)Z",
(void*)nativeIsSeekable
diff --git a/core/jni/android_bluetooth_BluetoothAudioGateway.cpp b/core/jni/android_bluetooth_BluetoothAudioGateway.cpp
index 3b8fb79..294c626 100644
--- a/core/jni/android_bluetooth_BluetoothAudioGateway.cpp
+++ b/core/jni/android_bluetooth_BluetoothAudioGateway.cpp
@@ -196,7 +196,7 @@
struct sockaddr_rc raddr;
int alen = sizeof(raddr);
- int nsk = accept(ag_fd, (struct sockaddr *) &raddr, &alen);
+ int nsk = TEMP_FAILURE_RETRY(accept(ag_fd, (struct sockaddr *) &raddr, &alen));
if (nsk < 0) {
ALOGE("Error on accept from socket fd %d: %s (%d).",
ag_fd,
@@ -331,12 +331,12 @@
to.tv_sec = timeout_ms / 1000;
to.tv_usec = 1000 * (timeout_ms % 1000);
}
- n = select(MAX(nat->hf_ag_rfcomm_sock,
- nat->hs_ag_rfcomm_sock) + 1,
+ n = TEMP_FAILURE_RETRY(select(
+ MAX(nat->hf_ag_rfcomm_sock, nat->hs_ag_rfcomm_sock) + 1,
&rset,
NULL,
NULL,
- (timeout_ms < 0 ? NULL : &to));
+ (timeout_ms < 0 ? NULL : &to)));
if (timeout_ms > 0) {
jint remaining = to.tv_sec*1000 + to.tv_usec/1000;
ALOGI("Remaining time %ldms", (long)remaining);
@@ -391,7 +391,7 @@
ALOGE("Neither HF nor HS listening sockets are open!");
return JNI_FALSE;
}
- n = poll(fds, cnt, timeout_ms);
+ n = TEMP_FAILURE_RETRY(poll(fds, cnt, timeout_ms));
if (n <= 0) {
if (n < 0) {
ALOGE("listening poll() on RFCOMM sockets: %s (%d)",
diff --git a/core/jni/android_database_SQLiteConnection.cpp b/core/jni/android_database_SQLiteConnection.cpp
index c8f911f..fca5f20 100644
--- a/core/jni/android_database_SQLiteConnection.cpp
+++ b/core/jni/android_database_SQLiteConnection.cpp
@@ -36,8 +36,8 @@
#include "android_database_SQLiteCommon.h"
+// Set to 1 to use UTF16 storage for localized indexes.
#define UTF16_STORAGE 0
-#define ANDROID_TABLE "android_metadata"
namespace android {
@@ -245,139 +245,16 @@
}
}
-// Set locale in the android_metadata table, install localized collators, and rebuild indexes
-static void nativeSetLocale(JNIEnv* env, jclass clazz, jint connectionPtr, jstring localeStr) {
+static void nativeRegisterLocalizedCollators(JNIEnv* env, jclass clazz, jint connectionPtr,
+ jstring localeStr) {
SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
- if (connection->openFlags & SQLiteConnection::NO_LOCALIZED_COLLATORS) {
- // We should probably throw IllegalStateException but the contract for
- // setLocale says that we just do nothing. Oh well.
- return;
- }
+ const char* locale = env->GetStringUTFChars(localeStr, NULL);
+ int err = register_localized_collators(connection->db, locale, UTF16_STORAGE);
+ env->ReleaseStringUTFChars(localeStr, locale);
- int err;
- char const* locale = env->GetStringUTFChars(localeStr, NULL);
- sqlite3_stmt* stmt = NULL;
- char** meta = NULL;
- int rowCount, colCount;
- char* dbLocale = NULL;
-
- // create the table, if necessary and possible
- if (!(connection->openFlags & SQLiteConnection::OPEN_READONLY)) {
- err = sqlite3_exec(connection->db,
- "CREATE TABLE IF NOT EXISTS " ANDROID_TABLE " (locale TEXT)",
- NULL, NULL, NULL);
- if (err != SQLITE_OK) {
- ALOGE("CREATE TABLE " ANDROID_TABLE " failed");
- throw_sqlite3_exception(env, connection->db);
- goto done;
- }
- }
-
- // try to read from the table
- err = sqlite3_get_table(connection->db,
- "SELECT locale FROM " ANDROID_TABLE " LIMIT 1",
- &meta, &rowCount, &colCount, NULL);
if (err != SQLITE_OK) {
- ALOGE("SELECT locale FROM " ANDROID_TABLE " failed");
throw_sqlite3_exception(env, connection->db);
- goto done;
- }
-
- dbLocale = (rowCount >= 1) ? meta[colCount] : NULL;
-
- if (dbLocale != NULL && !strcmp(dbLocale, locale)) {
- // database locale is the same as the desired locale; set up the collators and go
- err = register_localized_collators(connection->db, locale, UTF16_STORAGE);
- if (err != SQLITE_OK) {
- throw_sqlite3_exception(env, connection->db);
- }
- goto done; // no database changes needed
- }
-
- if (connection->openFlags & SQLiteConnection::OPEN_READONLY) {
- // read-only database, so we're going to have to put up with whatever we got
- // For registering new index. Not for modifing the read-only database.
- err = register_localized_collators(connection->db, locale, UTF16_STORAGE);
- if (err != SQLITE_OK) {
- throw_sqlite3_exception(env, connection->db);
- }
- goto done;
- }
-
- // need to update android_metadata and indexes atomically, so use a transaction...
- err = sqlite3_exec(connection->db, "BEGIN TRANSACTION", NULL, NULL, NULL);
- if (err != SQLITE_OK) {
- ALOGE("BEGIN TRANSACTION failed setting locale");
- throw_sqlite3_exception(env, connection->db);
- goto done;
- }
-
- err = register_localized_collators(connection->db, locale, UTF16_STORAGE);
- if (err != SQLITE_OK) {
- ALOGE("register_localized_collators() failed setting locale");
- throw_sqlite3_exception(env, connection->db);
- goto rollback;
- }
-
- err = sqlite3_exec(connection->db, "DELETE FROM " ANDROID_TABLE, NULL, NULL, NULL);
- if (err != SQLITE_OK) {
- ALOGE("DELETE failed setting locale");
- throw_sqlite3_exception(env, connection->db);
- goto rollback;
- }
-
- static const char *sql = "INSERT INTO " ANDROID_TABLE " (locale) VALUES(?);";
- err = sqlite3_prepare_v2(connection->db, sql, -1, &stmt, NULL);
- if (err != SQLITE_OK) {
- ALOGE("sqlite3_prepare_v2(\"%s\") failed", sql);
- throw_sqlite3_exception(env, connection->db);
- goto rollback;
- }
-
- err = sqlite3_bind_text(stmt, 1, locale, -1, SQLITE_TRANSIENT);
- if (err != SQLITE_OK) {
- ALOGE("sqlite3_bind_text() failed setting locale");
- throw_sqlite3_exception(env, connection->db);
- goto rollback;
- }
-
- err = sqlite3_step(stmt);
- if (err != SQLITE_OK && err != SQLITE_DONE) {
- ALOGE("sqlite3_step(\"%s\") failed setting locale", sql);
- throw_sqlite3_exception(env, connection->db);
- goto rollback;
- }
-
- err = sqlite3_exec(connection->db, "REINDEX LOCALIZED", NULL, NULL, NULL);
- if (err != SQLITE_OK) {
- ALOGE("REINDEX LOCALIZED failed");
- throw_sqlite3_exception(env, connection->db);
- goto rollback;
- }
-
- // all done, yay!
- err = sqlite3_exec(connection->db, "COMMIT TRANSACTION", NULL, NULL, NULL);
- if (err != SQLITE_OK) {
- ALOGE("COMMIT TRANSACTION failed setting locale");
- throw_sqlite3_exception(env, connection->db);
- goto done;
- }
-
-rollback:
- if (err != SQLITE_OK) {
- sqlite3_exec(connection->db, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
- }
-
-done:
- if (stmt) {
- sqlite3_finalize(stmt);
- }
- if (meta) {
- sqlite3_free_table(meta);
- }
- if (locale) {
- env->ReleaseStringUTFChars(localeStr, locale);
}
}
@@ -898,8 +775,8 @@
(void*)nativeClose },
{ "nativeRegisterCustomFunction", "(ILandroid/database/sqlite/SQLiteCustomFunction;)V",
(void*)nativeRegisterCustomFunction },
- { "nativeSetLocale", "(ILjava/lang/String;)V",
- (void*)nativeSetLocale },
+ { "nativeRegisterLocalizedCollators", "(ILjava/lang/String;)V",
+ (void*)nativeRegisterLocalizedCollators },
{ "nativePrepareStatement", "(ILjava/lang/String;)I",
(void*)nativePrepareStatement },
{ "nativeFinalizeStatement", "(II)V",
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index 0c66b86..36b4b45 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -457,9 +457,9 @@
// connect to camera service
static void android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz,
- jobject weak_this, jint cameraId)
+ jobject weak_this, jint cameraId, jboolean force, jboolean keep)
{
- sp<Camera> camera = Camera::connect(cameraId);
+ sp<Camera> camera = Camera::connect(cameraId, force, keep);
if (camera == NULL) {
jniThrowRuntimeException(env, "Fail to connect to camera service");
@@ -700,7 +700,12 @@
sp<Camera> camera = get_native_camera(env, thiz, NULL);
if (camera == 0) return 0;
- return env->NewStringUTF(camera->getParameters().string());
+ String8 params8 = camera->getParameters();
+ if (params8.isEmpty()) {
+ jniThrowRuntimeException(env, "getParameters failed (empty parameters)");
+ return 0;
+ }
+ return env->NewStringUTF(params8.string());
}
static void android_hardware_Camera_reconnect(JNIEnv *env, jobject thiz)
@@ -816,6 +821,15 @@
}
}
+static bool android_hardware_Camera_isReleased(JNIEnv *env, jobject thiz)
+{
+ ALOGV("isReleased");
+ sp<Camera> camera = get_native_camera(env, thiz, NULL);
+ if (camera == 0) return true;
+
+ return (camera->sendCommand(CAMERA_CMD_PING, 0, 0) != NO_ERROR);
+}
+
//-------------------------------------------------
static JNINativeMethod camMethods[] = {
@@ -826,7 +840,7 @@
"(ILandroid/hardware/Camera$CameraInfo;)V",
(void*)android_hardware_Camera_getCameraInfo },
{ "native_setup",
- "(Ljava/lang/Object;I)V",
+ "(Ljava/lang/Object;IZZ)V",
(void*)android_hardware_Camera_native_setup },
{ "native_release",
"()V",
@@ -894,6 +908,9 @@
{ "enableFocusMoveCallback",
"(I)V",
(void *)android_hardware_Camera_enableFocusMoveCallback},
+ { "isReleased",
+ "()Z",
+ (void *)android_hardware_Camera_isReleased},
};
struct field {
diff --git a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
index afbcfc2..8d6fab4 100644
--- a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
+++ b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
@@ -20,8 +20,8 @@
#include <android_runtime/AndroidRuntime.h>
#include <utils/Log.h>
+#include <utils/ZipFileRO.h>
#include <ScopedUtfChars.h>
-#include <androidfw/ZipFileRO.h>
#include <zlib.h>
diff --git a/core/res/res/anim/screen_rotate_finish_exit.xml b/core/res/res/anim/screen_rotate_finish_exit.xml
index 3d9c569..003940e 100644
--- a/core/res/res/anim/screen_rotate_finish_exit.xml
+++ b/core/res/res/anim/screen_rotate_finish_exit.xml
@@ -24,12 +24,14 @@
android:pivotX="50%" android:pivotY="50%"
android:interpolator="@interpolator/accelerate_decelerate"
android:fillEnabled="true"
- android:fillBefore="false" android:fillAfter="true"
+ android:fillBefore="true" android:fillAfter="true"
android:duration="@android:integer/config_shortAnimTime"/>
<scale android:fromXScale="100%" android:toXScale="100%p"
android:fromYScale="100%" android:toYScale="100%p"
android:pivotX="50%" android:pivotY="50%"
android:interpolator="@interpolator/accelerate_decelerate"
+ android:fillEnabled="true"
+ android:fillBefore="true" android:fillAfter="true"
android:duration="@android:integer/config_mediumAnimTime" />
<alpha android:fromAlpha="1.0" android:toAlpha="0"
android:interpolator="@interpolator/accelerate_decelerate"
diff --git a/core/res/res/drawable-hdpi/ic_facial_backup.png b/core/res/res/drawable-hdpi/ic_facial_backup.png
new file mode 100644
index 0000000..2956109
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_facial_backup.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/intro_bg.png b/core/res/res/drawable-hdpi/intro_bg.png
new file mode 100644
index 0000000..a758e7d
--- /dev/null
+++ b/core/res/res/drawable-hdpi/intro_bg.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_down_disabled_focused_holo_dark.png b/core/res/res/drawable-hdpi/numberpicker_down_disabled_focused_holo_dark.png
deleted file mode 100644
index 9584649..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_down_disabled_focused_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_down_disabled_focused_holo_light.png b/core/res/res/drawable-hdpi/numberpicker_down_disabled_focused_holo_light.png
deleted file mode 100644
index 5c37873..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_down_disabled_focused_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_down_disabled_holo_dark.png b/core/res/res/drawable-hdpi/numberpicker_down_disabled_holo_dark.png
deleted file mode 100644
index b5faf6f..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_down_disabled_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_down_disabled_holo_light.png b/core/res/res/drawable-hdpi/numberpicker_down_disabled_holo_light.png
deleted file mode 100644
index 041412b..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_down_disabled_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_down_focused_holo_dark.png b/core/res/res/drawable-hdpi/numberpicker_down_focused_holo_dark.png
deleted file mode 100644
index 5717bee..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_down_focused_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_down_focused_holo_light.png b/core/res/res/drawable-hdpi/numberpicker_down_focused_holo_light.png
deleted file mode 100644
index e874330..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_down_focused_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_down_longpressed_holo_dark.png b/core/res/res/drawable-hdpi/numberpicker_down_longpressed_holo_dark.png
deleted file mode 100644
index 96a6c8a..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_down_longpressed_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_down_longpressed_holo_light.png b/core/res/res/drawable-hdpi/numberpicker_down_longpressed_holo_light.png
deleted file mode 100644
index 96a6c8a..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_down_longpressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_down_normal_holo_dark.png b/core/res/res/drawable-hdpi/numberpicker_down_normal_holo_dark.png
deleted file mode 100644
index 4631d85..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_down_normal_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_down_normal_holo_light.png b/core/res/res/drawable-hdpi/numberpicker_down_normal_holo_light.png
deleted file mode 100644
index 39c7af4..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_down_normal_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_down_pressed_holo_dark.png b/core/res/res/drawable-hdpi/numberpicker_down_pressed_holo_dark.png
deleted file mode 100644
index 9c23a18..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_down_pressed_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_down_pressed_holo_light.png b/core/res/res/drawable-hdpi/numberpicker_down_pressed_holo_light.png
deleted file mode 100644
index 9c23a18..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_down_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_up_disabled_focused_holo_dark.png b/core/res/res/drawable-hdpi/numberpicker_up_disabled_focused_holo_dark.png
deleted file mode 100644
index 159913c..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_up_disabled_focused_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_up_disabled_focused_holo_light.png b/core/res/res/drawable-hdpi/numberpicker_up_disabled_focused_holo_light.png
deleted file mode 100644
index cfee4b7..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_up_disabled_focused_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_up_disabled_holo_dark.png b/core/res/res/drawable-hdpi/numberpicker_up_disabled_holo_dark.png
deleted file mode 100644
index e5f0430..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_up_disabled_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_up_disabled_holo_light.png b/core/res/res/drawable-hdpi/numberpicker_up_disabled_holo_light.png
deleted file mode 100644
index 7e4ec4a..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_up_disabled_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_up_focused_holo_dark.png b/core/res/res/drawable-hdpi/numberpicker_up_focused_holo_dark.png
deleted file mode 100644
index b06017e..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_up_focused_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_up_focused_holo_light.png b/core/res/res/drawable-hdpi/numberpicker_up_focused_holo_light.png
deleted file mode 100644
index a1000f8..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_up_focused_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_up_longpressed_holo_dark.png b/core/res/res/drawable-hdpi/numberpicker_up_longpressed_holo_dark.png
deleted file mode 100644
index b3d6706..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_up_longpressed_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_up_longpressed_holo_light.png b/core/res/res/drawable-hdpi/numberpicker_up_longpressed_holo_light.png
deleted file mode 100644
index b3d6706..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_up_longpressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_up_normal_holo_dark.png b/core/res/res/drawable-hdpi/numberpicker_up_normal_holo_dark.png
deleted file mode 100644
index 9ee35c7..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_up_normal_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_up_normal_holo_light.png b/core/res/res/drawable-hdpi/numberpicker_up_normal_holo_light.png
deleted file mode 100644
index 4da4fa7..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_up_normal_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_up_pressed_holo_dark.png b/core/res/res/drawable-hdpi/numberpicker_up_pressed_holo_dark.png
deleted file mode 100644
index 358a13f..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_up_pressed_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/numberpicker_up_pressed_holo_light.png b/core/res/res/drawable-hdpi/numberpicker_up_pressed_holo_light.png
deleted file mode 100644
index 358a13f..0000000
--- a/core/res/res/drawable-hdpi/numberpicker_up_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_facial_backup.png b/core/res/res/drawable-mdpi/ic_facial_backup.png
new file mode 100644
index 0000000..6ed1327
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_facial_backup.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/intro_bg.png b/core/res/res/drawable-mdpi/intro_bg.png
new file mode 100644
index 0000000..540da31
--- /dev/null
+++ b/core/res/res/drawable-mdpi/intro_bg.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_down_disabled_focused_holo_dark.png b/core/res/res/drawable-mdpi/numberpicker_down_disabled_focused_holo_dark.png
deleted file mode 100644
index 50f6e98..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_down_disabled_focused_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_down_disabled_focused_holo_light.png b/core/res/res/drawable-mdpi/numberpicker_down_disabled_focused_holo_light.png
deleted file mode 100644
index 67434f6..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_down_disabled_focused_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_down_disabled_holo_dark.png b/core/res/res/drawable-mdpi/numberpicker_down_disabled_holo_dark.png
deleted file mode 100644
index 9c2b833..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_down_disabled_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_down_disabled_holo_light.png b/core/res/res/drawable-mdpi/numberpicker_down_disabled_holo_light.png
deleted file mode 100644
index dcf2fb7..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_down_disabled_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_down_focused_holo_dark.png b/core/res/res/drawable-mdpi/numberpicker_down_focused_holo_dark.png
deleted file mode 100644
index b63c510d..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_down_focused_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_down_focused_holo_light.png b/core/res/res/drawable-mdpi/numberpicker_down_focused_holo_light.png
deleted file mode 100644
index 55312a1..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_down_focused_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_down_longpressed_holo_dark.png b/core/res/res/drawable-mdpi/numberpicker_down_longpressed_holo_dark.png
deleted file mode 100644
index 48e300c..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_down_longpressed_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_down_longpressed_holo_light.png b/core/res/res/drawable-mdpi/numberpicker_down_longpressed_holo_light.png
deleted file mode 100644
index 48e300c..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_down_longpressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_down_normal_holo_dark.png b/core/res/res/drawable-mdpi/numberpicker_down_normal_holo_dark.png
deleted file mode 100644
index 1558d3d..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_down_normal_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_down_normal_holo_light.png b/core/res/res/drawable-mdpi/numberpicker_down_normal_holo_light.png
deleted file mode 100644
index 6b6e7e1..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_down_normal_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_down_pressed_holo_dark.png b/core/res/res/drawable-mdpi/numberpicker_down_pressed_holo_dark.png
deleted file mode 100644
index eb16f8d..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_down_pressed_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_down_pressed_holo_light.png b/core/res/res/drawable-mdpi/numberpicker_down_pressed_holo_light.png
deleted file mode 100644
index eb16f8d..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_down_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_up_disabled_focused_holo_dark.png b/core/res/res/drawable-mdpi/numberpicker_up_disabled_focused_holo_dark.png
deleted file mode 100644
index 58a3b64..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_up_disabled_focused_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_up_disabled_focused_holo_light.png b/core/res/res/drawable-mdpi/numberpicker_up_disabled_focused_holo_light.png
deleted file mode 100644
index 382943b..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_up_disabled_focused_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_up_disabled_holo_dark.png b/core/res/res/drawable-mdpi/numberpicker_up_disabled_holo_dark.png
deleted file mode 100644
index cf856a1..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_up_disabled_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_up_disabled_holo_light.png b/core/res/res/drawable-mdpi/numberpicker_up_disabled_holo_light.png
deleted file mode 100644
index 6665953..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_up_disabled_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_up_focused_holo_dark.png b/core/res/res/drawable-mdpi/numberpicker_up_focused_holo_dark.png
deleted file mode 100644
index d63d797..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_up_focused_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_up_focused_holo_light.png b/core/res/res/drawable-mdpi/numberpicker_up_focused_holo_light.png
deleted file mode 100644
index 22b6dbd..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_up_focused_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_up_longpressed_holo_dark.png b/core/res/res/drawable-mdpi/numberpicker_up_longpressed_holo_dark.png
deleted file mode 100644
index 4bcce98..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_up_longpressed_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_up_longpressed_holo_light.png b/core/res/res/drawable-mdpi/numberpicker_up_longpressed_holo_light.png
deleted file mode 100644
index 4bcce98..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_up_longpressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_up_normal_holo_dark.png b/core/res/res/drawable-mdpi/numberpicker_up_normal_holo_dark.png
deleted file mode 100644
index 12ba823..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_up_normal_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_up_normal_holo_light.png b/core/res/res/drawable-mdpi/numberpicker_up_normal_holo_light.png
deleted file mode 100644
index d841f5a..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_up_normal_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_up_pressed_holo_dark.png b/core/res/res/drawable-mdpi/numberpicker_up_pressed_holo_dark.png
deleted file mode 100644
index bc5e3fa..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_up_pressed_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/numberpicker_up_pressed_holo_light.png b/core/res/res/drawable-mdpi/numberpicker_up_pressed_holo_light.png
deleted file mode 100644
index bc5e3fa..0000000
--- a/core/res/res/drawable-mdpi/numberpicker_up_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_facial_backup.png b/core/res/res/drawable-xhdpi/ic_facial_backup.png
new file mode 100644
index 0000000..942cf23
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/ic_facial_backup.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/intro_bg.png b/core/res/res/drawable-xhdpi/intro_bg.png
new file mode 100644
index 0000000..00466c5
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/intro_bg.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_down_disabled_focused_holo_dark.png b/core/res/res/drawable-xhdpi/numberpicker_down_disabled_focused_holo_dark.png
deleted file mode 100644
index 111f57e..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_down_disabled_focused_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_down_disabled_focused_holo_light.png b/core/res/res/drawable-xhdpi/numberpicker_down_disabled_focused_holo_light.png
deleted file mode 100644
index d0ef05b..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_down_disabled_focused_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_down_disabled_holo_dark.png b/core/res/res/drawable-xhdpi/numberpicker_down_disabled_holo_dark.png
deleted file mode 100644
index ff21941..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_down_disabled_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_down_disabled_holo_light.png b/core/res/res/drawable-xhdpi/numberpicker_down_disabled_holo_light.png
deleted file mode 100644
index 3e9bdda..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_down_disabled_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_down_focused_holo_dark.png b/core/res/res/drawable-xhdpi/numberpicker_down_focused_holo_dark.png
deleted file mode 100644
index 0462fca..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_down_focused_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_down_focused_holo_light.png b/core/res/res/drawable-xhdpi/numberpicker_down_focused_holo_light.png
deleted file mode 100644
index a488e8e..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_down_focused_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_down_longpressed_holo_dark.png b/core/res/res/drawable-xhdpi/numberpicker_down_longpressed_holo_dark.png
deleted file mode 100644
index f61b076..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_down_longpressed_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_down_longpressed_holo_light.png b/core/res/res/drawable-xhdpi/numberpicker_down_longpressed_holo_light.png
deleted file mode 100644
index f61b076..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_down_longpressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_down_normal_holo_dark.png b/core/res/res/drawable-xhdpi/numberpicker_down_normal_holo_dark.png
deleted file mode 100644
index 211944e..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_down_normal_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_down_normal_holo_light.png b/core/res/res/drawable-xhdpi/numberpicker_down_normal_holo_light.png
deleted file mode 100644
index 12bc11a..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_down_normal_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_down_pressed_holo_dark.png b/core/res/res/drawable-xhdpi/numberpicker_down_pressed_holo_dark.png
deleted file mode 100644
index 635184c..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_down_pressed_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_down_pressed_holo_light.png b/core/res/res/drawable-xhdpi/numberpicker_down_pressed_holo_light.png
deleted file mode 100644
index 635184c..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_down_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_up_disabled_focused_holo_dark.png b/core/res/res/drawable-xhdpi/numberpicker_up_disabled_focused_holo_dark.png
deleted file mode 100644
index 470e569..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_up_disabled_focused_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_up_disabled_focused_holo_light.png b/core/res/res/drawable-xhdpi/numberpicker_up_disabled_focused_holo_light.png
deleted file mode 100644
index 16df74d..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_up_disabled_focused_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_up_disabled_holo_dark.png b/core/res/res/drawable-xhdpi/numberpicker_up_disabled_holo_dark.png
deleted file mode 100644
index edd4c04..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_up_disabled_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_up_disabled_holo_light.png b/core/res/res/drawable-xhdpi/numberpicker_up_disabled_holo_light.png
deleted file mode 100644
index d8f459a..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_up_disabled_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_up_focused_holo_dark.png b/core/res/res/drawable-xhdpi/numberpicker_up_focused_holo_dark.png
deleted file mode 100644
index 08bf241..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_up_focused_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_up_focused_holo_light.png b/core/res/res/drawable-xhdpi/numberpicker_up_focused_holo_light.png
deleted file mode 100644
index b2c40f1..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_up_focused_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_up_longpressed_holo_dark.png b/core/res/res/drawable-xhdpi/numberpicker_up_longpressed_holo_dark.png
deleted file mode 100644
index f4f7331..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_up_longpressed_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_up_longpressed_holo_light.png b/core/res/res/drawable-xhdpi/numberpicker_up_longpressed_holo_light.png
deleted file mode 100644
index f4f7331..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_up_longpressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_up_normal_holo_dark.png b/core/res/res/drawable-xhdpi/numberpicker_up_normal_holo_dark.png
deleted file mode 100644
index 83650b1..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_up_normal_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_up_normal_holo_light.png b/core/res/res/drawable-xhdpi/numberpicker_up_normal_holo_light.png
deleted file mode 100644
index 78085d3..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_up_normal_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_up_pressed_holo_dark.png b/core/res/res/drawable-xhdpi/numberpicker_up_pressed_holo_dark.png
deleted file mode 100644
index b8f6849..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_up_pressed_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/numberpicker_up_pressed_holo_light.png b/core/res/res/drawable-xhdpi/numberpicker_up_pressed_holo_light.png
deleted file mode 100644
index b8f6849..0000000
--- a/core/res/res/drawable-xhdpi/numberpicker_up_pressed_holo_light.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable/activated_background.xml b/core/res/res/drawable/activated_background.xml
index 1047e5b..d92fba1 100644
--- a/core/res/res/drawable/activated_background.xml
+++ b/core/res/res/drawable/activated_background.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="@android:drawable/list_selector_background_selected" />
<item android:drawable="@color/transparent" />
</selector>
diff --git a/core/res/res/drawable/activated_background_holo_dark.xml b/core/res/res/drawable/activated_background_holo_dark.xml
index a29bcb9..febf2c4 100644
--- a/core/res/res/drawable/activated_background_holo_dark.xml
+++ b/core/res/res/drawable/activated_background_holo_dark.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="@android:drawable/list_activated_holo" />
<item android:drawable="@color/transparent" />
</selector>
diff --git a/core/res/res/drawable/activated_background_holo_light.xml b/core/res/res/drawable/activated_background_holo_light.xml
index a29bcb9..febf2c4 100644
--- a/core/res/res/drawable/activated_background_holo_light.xml
+++ b/core/res/res/drawable/activated_background_holo_light.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="@android:drawable/list_activated_holo" />
<item android:drawable="@color/transparent" />
</selector>
diff --git a/core/res/res/drawable/activated_background_light.xml b/core/res/res/drawable/activated_background_light.xml
index 7d737db..5d5681d 100644
--- a/core/res/res/drawable/activated_background_light.xml
+++ b/core/res/res/drawable/activated_background_light.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="@drawable/list_selector_background_selected_light" />
<item android:drawable="@color/transparent" />
</selector>
diff --git a/core/res/res/drawable/btn_cab_done_holo_dark.xml b/core/res/res/drawable/btn_cab_done_holo_dark.xml
index 65d3496..fe42951 100644
--- a/core/res/res/drawable/btn_cab_done_holo_dark.xml
+++ b/core/res/res/drawable/btn_cab_done_holo_dark.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/btn_cab_done_pressed_holo_dark" />
<item android:state_focused="true" android:state_enabled="true"
diff --git a/core/res/res/drawable/btn_cab_done_holo_light.xml b/core/res/res/drawable/btn_cab_done_holo_light.xml
index f6a63f4..f362774 100644
--- a/core/res/res/drawable/btn_cab_done_holo_light.xml
+++ b/core/res/res/drawable/btn_cab_done_holo_light.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/btn_cab_done_pressed_holo_light" />
<item android:state_focused="true" android:state_enabled="true"
diff --git a/core/res/res/drawable/item_background.xml b/core/res/res/drawable/item_background.xml
index f7fef82..a1c9ff8 100644
--- a/core/res/res/drawable/item_background.xml
+++ b/core/res/res/drawable/item_background.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@color/transparent" />
diff --git a/core/res/res/drawable/item_background_holo_dark.xml b/core/res/res/drawable/item_background_holo_dark.xml
index f188df7..7c8590c 100644
--- a/core/res/res/drawable/item_background_holo_dark.xml
+++ b/core/res/res/drawable/item_background_holo_dark.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_dark" />
diff --git a/core/res/res/drawable/item_background_holo_light.xml b/core/res/res/drawable/item_background_holo_light.xml
index ee3f4d8..99b5ac2 100644
--- a/core/res/res/drawable/item_background_holo_light.xml
+++ b/core/res/res/drawable/item_background_holo_light.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_light" />
diff --git a/core/res/res/drawable/list_selector_background.xml b/core/res/res/drawable/list_selector_background.xml
index 1222155..eaf86ca 100644
--- a/core/res/res/drawable/list_selector_background.xml
+++ b/core/res/res/drawable/list_selector_background.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@color/transparent" />
diff --git a/core/res/res/drawable/list_selector_background_light.xml b/core/res/res/drawable/list_selector_background_light.xml
index 50a821b..4da7e21 100644
--- a/core/res/res/drawable/list_selector_background_light.xml
+++ b/core/res/res/drawable/list_selector_background_light.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@color/transparent" />
diff --git a/core/res/res/drawable/list_selector_holo_dark.xml b/core/res/res/drawable/list_selector_holo_dark.xml
index 9a6cb89..e4c5c524 100644
--- a/core/res/res/drawable/list_selector_holo_dark.xml
+++ b/core/res/res/drawable/list_selector_holo_dark.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@color/transparent" />
diff --git a/core/res/res/drawable/list_selector_holo_light.xml b/core/res/res/drawable/list_selector_holo_light.xml
index 844259e..17631bd 100644
--- a/core/res/res/drawable/list_selector_holo_light.xml
+++ b/core/res/res/drawable/list_selector_holo_light.xml
@@ -14,8 +14,7 @@
limitations under the License.
-->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@color/transparent" />
diff --git a/core/res/res/drawable/numberpicker_down_btn_holo_dark.xml b/core/res/res/drawable/numberpicker_down_btn_holo_dark.xml
deleted file mode 100644
index dd6332d..0000000
--- a/core/res/res/drawable/numberpicker_down_btn_holo_dark.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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_pressed="false"
- android:state_enabled="true"
- android:state_focused="false"
- android:drawable="@drawable/numberpicker_down_normal_holo_dark" />
-
- <item android:state_pressed="true"
- android:state_enabled="true"
- android:drawable="@drawable/numberpicker_down_pressed_holo_dark" />
-
- <item android:state_pressed="false"
- android:state_enabled="true"
- android:state_focused="true"
- android:drawable="@drawable/numberpicker_down_focused_holo_dark" />
-
- <item android:state_pressed="false"
- android:state_enabled="false"
- android:state_focused="false"
- android:drawable="@drawable/numberpicker_down_disabled_holo_dark" />
-
- <item android:state_pressed="false"
- android:state_enabled="false"
- android:state_focused="true"
- android:drawable="@drawable/numberpicker_down_disabled_focused_holo_dark" />
-
-</selector>
diff --git a/core/res/res/drawable/numberpicker_down_btn_holo_light.xml b/core/res/res/drawable/numberpicker_down_btn_holo_light.xml
deleted file mode 100644
index 565fd86..0000000
--- a/core/res/res/drawable/numberpicker_down_btn_holo_light.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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_pressed="false"
- android:state_enabled="true"
- android:state_focused="false"
- android:drawable="@drawable/numberpicker_down_normal_holo_light" />
-
- <item android:state_pressed="true"
- android:state_enabled="true"
- android:drawable="@drawable/numberpicker_down_pressed_holo_light" />
-
- <item android:state_pressed="false"
- android:state_enabled="true"
- android:state_focused="true"
- android:drawable="@drawable/numberpicker_down_focused_holo_light" />
-
- <item android:state_pressed="false"
- android:state_enabled="false"
- android:state_focused="false"
- android:drawable="@drawable/numberpicker_down_disabled_holo_light" />
-
- <item android:state_pressed="false"
- android:state_enabled="false"
- android:state_focused="true"
- android:drawable="@drawable/numberpicker_down_disabled_focused_holo_light" />
-
-</selector>
diff --git a/core/res/res/drawable/numberpicker_up_btn_holo_dark.xml b/core/res/res/drawable/numberpicker_up_btn_holo_dark.xml
deleted file mode 100644
index 7af3ee4..0000000
--- a/core/res/res/drawable/numberpicker_up_btn_holo_dark.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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_pressed="false"
- android:state_enabled="true"
- android:state_focused="false"
- android:drawable="@drawable/numberpicker_up_normal_holo_dark" />
-
- <item android:state_pressed="true"
- android:state_enabled="true"
- android:drawable="@drawable/numberpicker_up_pressed_holo_dark" />
-
- <item android:state_pressed="false"
- android:state_enabled="true"
- android:state_focused="true"
- android:drawable="@drawable/numberpicker_up_focused_holo_dark" />
-
- <item android:state_pressed="false"
- android:state_enabled="false"
- android:state_focused="false"
- android:drawable="@drawable/numberpicker_up_disabled_holo_dark" />
-
- <item android:state_pressed="false"
- android:state_enabled="false"
- android:state_focused="true"
- android:drawable="@drawable/numberpicker_up_disabled_focused_holo_dark" />
-
-</selector>
diff --git a/core/res/res/drawable/numberpicker_up_btn_holo_light.xml b/core/res/res/drawable/numberpicker_up_btn_holo_light.xml
deleted file mode 100644
index cbcbb07..0000000
--- a/core/res/res/drawable/numberpicker_up_btn_holo_light.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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_pressed="false"
- android:state_enabled="true"
- android:state_focused="false"
- android:drawable="@drawable/numberpicker_up_normal_holo_light" />
-
- <item android:state_pressed="true"
- android:state_enabled="true"
- android:drawable="@drawable/numberpicker_up_pressed_holo_light" />
-
- <item android:state_pressed="false"
- android:state_enabled="true"
- android:state_focused="true"
- android:drawable="@drawable/numberpicker_up_focused_holo_light" />
-
- <item android:state_pressed="false"
- android:state_enabled="false"
- android:state_focused="false"
- android:drawable="@drawable/numberpicker_up_focused_holo_light" />
-
- <item android:state_pressed="false"
- android:state_enabled="false"
- android:state_focused="true"
- android:drawable="@drawable/numberpicker_up_disabled_focused_holo_light" />
-
-</selector>
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml b/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml
index 43d0a2c..2495b67 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_password_landscape.xml
@@ -153,13 +153,32 @@
</LinearLayout>
<!-- Area to overlay FaceLock -->
- <View android:id="@+id/faceLockAreaView"
+ <RelativeLayout
+ android:id="@+id/faceLockAreaView"
android:visibility="invisible"
android:layout_width="512dip"
android:layout_height="512dip"
android:layout_centerInParent="true"
- android:background="@color/facelock_color_background"
- />
+ android:background="@drawable/intro_bg">
+
+ <View
+ android:id="@+id/spotlightMask"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/facelock_spotlight_mask"
+ />
+
+ <ImageView
+ android:id="@+id/cancel_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="5dip"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentRight="true"
+ android:src="@drawable/ic_facial_backup"
+ />
+
+ </RelativeLayout>
</RelativeLayout>
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml b/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
index 8c02888..fb62eb6 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_password_portrait.xml
@@ -156,13 +156,32 @@
</LinearLayout>
<!-- Area to overlay FaceLock -->
- <View android:id="@+id/faceLockAreaView"
+ <RelativeLayout
+ android:id="@+id/faceLockAreaView"
android:visibility="invisible"
android:layout_width="512dip"
android:layout_height="512dip"
android:layout_centerInParent="true"
- android:background="@color/facelock_color_background"
- />
+ android:background="@drawable/intro_bg">
+
+ <View
+ android:id="@+id/spotlightMask"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/facelock_spotlight_mask"
+ />
+
+ <ImageView
+ android:id="@+id/cancel_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="5dip"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentRight="true"
+ android:src="@drawable/ic_facial_backup"
+ />
+
+ </RelativeLayout>
</RelativeLayout>
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_unlock_landscape.xml b/core/res/res/layout-sw600dp/keyguard_screen_unlock_landscape.xml
index 802ef82..53ecbac 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_unlock_landscape.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_unlock_landscape.xml
@@ -124,13 +124,32 @@
</RelativeLayout>
<!-- Area to overlay FaceLock -->
- <View android:id="@+id/faceLockAreaView"
+ <RelativeLayout
+ android:id="@+id/faceLockAreaView"
android:visibility="invisible"
android:layout_width="512dip"
android:layout_height="512dip"
android:layout_centerInParent="true"
- android:background="@color/facelock_color_background"
- />
+ android:background="@drawable/intro_bg">
+
+ <View
+ android:id="@+id/spotlightMask"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/facelock_spotlight_mask"
+ />
+
+ <ImageView
+ android:id="@+id/cancel_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="5dip"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentRight="true"
+ android:src="@drawable/ic_facial_backup"
+ />
+
+ </RelativeLayout>
</RelativeLayout>
diff --git a/core/res/res/layout-sw600dp/keyguard_screen_unlock_portrait.xml b/core/res/res/layout-sw600dp/keyguard_screen_unlock_portrait.xml
index 40f2492..577668f 100644
--- a/core/res/res/layout-sw600dp/keyguard_screen_unlock_portrait.xml
+++ b/core/res/res/layout-sw600dp/keyguard_screen_unlock_portrait.xml
@@ -119,13 +119,32 @@
</RelativeLayout>
<!-- Area to overlay FaceLock -->
- <View android:id="@+id/faceLockAreaView"
+ <RelativeLayout
+ android:id="@+id/faceLockAreaView"
android:visibility="invisible"
android:layout_width="512dip"
android:layout_height="512dip"
android:layout_centerInParent="true"
- android:background="@color/facelock_color_background"
- />
+ android:background="@drawable/intro_bg">
+
+ <View
+ android:id="@+id/spotlightMask"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/facelock_spotlight_mask"
+ />
+
+ <ImageView
+ android:id="@+id/cancel_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="5dip"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentRight="true"
+ android:src="@drawable/ic_facial_backup"
+ />
+
+ </RelativeLayout>
</RelativeLayout>
diff --git a/core/res/res/layout/keyguard_screen_password_landscape.xml b/core/res/res/layout/keyguard_screen_password_landscape.xml
index 66d7fd7..3bea16c 100644
--- a/core/res/res/layout/keyguard_screen_password_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_password_landscape.xml
@@ -208,7 +208,8 @@
/>
<!-- Area to overlay FaceLock -->
- <TextView android:id="@+id/faceLockAreaView"
+ <RelativeLayout
+ android:id="@+id/faceLockAreaView"
android:visibility="invisible"
android:layout_row="0"
android:layout_column="2"
@@ -217,7 +218,25 @@
android:layout_gravity="fill"
android:layout_width="0dip"
android:layout_height="0dip"
- android:background="@color/facelock_color_background"
- />
+ android:background="@drawable/intro_bg">
+
+ <View
+ android:id="@+id/spotlightMask"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/facelock_spotlight_mask"
+ />
+
+ <ImageView
+ android:id="@+id/cancel_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="5dip"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentRight="true"
+ android:src="@drawable/ic_facial_backup"
+ />
+
+ </RelativeLayout>
</GridLayout>
diff --git a/core/res/res/layout/keyguard_screen_password_portrait.xml b/core/res/res/layout/keyguard_screen_password_portrait.xml
index 426b2f7..6b409aa 100644
--- a/core/res/res/layout/keyguard_screen_password_portrait.xml
+++ b/core/res/res/layout/keyguard_screen_password_portrait.xml
@@ -199,7 +199,8 @@
/>
<!-- Area to overlay FaceLock -->
- <TextView android:id="@+id/faceLockAreaView"
+ <RelativeLayout
+ android:id="@+id/faceLockAreaView"
android:visibility="invisible"
android:layout_row="3"
android:layout_column="0"
@@ -208,7 +209,25 @@
android:layout_gravity="fill"
android:layout_width="0dip"
android:layout_height="0dip"
- android:background="@color/facelock_color_background"
- />
+ android:background="@drawable/intro_bg">
+
+ <View
+ android:id="@+id/spotlightMask"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/facelock_spotlight_mask"
+ />
+
+ <ImageView
+ android:id="@+id/cancel_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="5dip"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentRight="true"
+ android:src="@drawable/ic_facial_backup"
+ />
+
+ </RelativeLayout>
</GridLayout>
diff --git a/core/res/res/layout/keyguard_screen_unlock_landscape.xml b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
index 1038657..7f9aaa0 100644
--- a/core/res/res/layout/keyguard_screen_unlock_landscape.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_landscape.xml
@@ -161,7 +161,8 @@
/>
<!-- Area to overlay FaceLock -->
- <TextView android:id="@+id/faceLockAreaView"
+ <RelativeLayout
+ android:id="@+id/faceLockAreaView"
android:visibility="invisible"
android:layout_row="0"
android:layout_column="1"
@@ -171,7 +172,25 @@
android:layout_marginLeft="8dip"
android:layout_width="0dip"
android:layout_height="0dip"
- android:background="@color/facelock_color_background"
- />
+ android:background="@drawable/intro_bg">
+
+ <View
+ android:id="@+id/spotlightMask"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/facelock_spotlight_mask"
+ />
+
+ <ImageView
+ android:id="@+id/cancel_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="5dip"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentRight="true"
+ android:src="@drawable/ic_facial_backup"
+ />
+
+ </RelativeLayout>
</GridLayout>
diff --git a/core/res/res/layout/keyguard_screen_unlock_portrait.xml b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
index 336faa1..9a2e024 100644
--- a/core/res/res/layout/keyguard_screen_unlock_portrait.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
@@ -170,7 +170,8 @@
/>
<!-- Area to overlay FaceLock -->
- <TextView android:id="@+id/faceLockAreaView"
+ <RelativeLayout
+ android:id="@+id/faceLockAreaView"
android:visibility="invisible"
android:layout_row="4"
android:layout_column="0"
@@ -181,7 +182,25 @@
android:layout_marginBottom="8dip"
android:layout_width="0dip"
android:layout_height="0dip"
- android:background="@color/facelock_color_background"
- />
+ android:background="@drawable/intro_bg">
+
+ <View
+ android:id="@+id/spotlightMask"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/facelock_spotlight_mask"
+ />
+
+ <ImageView
+ android:id="@+id/cancel_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="5dip"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentRight="true"
+ android:src="@drawable/ic_facial_backup"
+ />
+
+ </RelativeLayout>
</GridLayout>
diff --git a/core/res/res/layout/notification_intruder_content.xml b/core/res/res/layout/notification_intruder_content.xml
new file mode 100644
index 0000000..61be5f5
--- /dev/null
+++ b/core/res/res/layout/notification_intruder_content.xml
@@ -0,0 +1,69 @@
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:background="#FF333333"
+ android:padding="4dp"
+ >
+ <ImageView android:id="@+id/icon"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:scaleType="center"
+ android:padding="4dp"
+ />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:layout_marginLeft="40dp"
+ android:orientation="vertical"
+ >
+ <TextView android:id="@+id/title"
+ android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"
+ />
+ <TextView android:id="@+id/text"
+ android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginTop="-4dp"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:fadingEdge="horizontal"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:id="@+id/actions"
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:layout_marginTop="48dp"
+ android:orientation="horizontal"
+ android:visibility="gone"
+ >
+ <ImageView
+ android:id="@+id/action0"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:visibility="gone"
+ />
+ <ImageView
+ android:id="@+id/action1"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:visibility="gone"
+ />
+ <ImageView
+ android:id="@+id/action2"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:visibility="gone"
+ />
+ </LinearLayout>
+</FrameLayout>
diff --git a/core/res/res/layout/number_picker.xml b/core/res/res/layout/number_picker.xml
index 2967696..b7e7ae1 100644
--- a/core/res/res/layout/number_picker.xml
+++ b/core/res/res/layout/number_picker.xml
@@ -22,19 +22,26 @@
<ImageButton android:id="@+id/increment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- style="?android:attr/numberPickerUpButtonStyle"
+ android:background="@android:drawable/numberpicker_up_btn"
+ android:paddingTop="22dip"
+ android:paddingBottom="22dip"
android:contentDescription="@string/number_picker_increment_button" />
- <view class="android.widget.NumberPicker$CustomEditText"
+ <EditText
android:id="@+id/numberpicker_input"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- style="?android:attr/numberPickerInputTextStyle" />
+ android:textAppearance="@style/TextAppearance.Large.Inverse.NumberPickerInputText"
+ android:gravity="center"
+ android:singleLine="true"
+ android:background="@drawable/numberpicker_input" />
<ImageButton android:id="@+id/decrement"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- style="?android:attr/numberPickerDownButtonStyle"
+ android:background="@android:drawable/numberpicker_down_btn"
+ android:paddingTop="22dip"
+ android:paddingBottom="22dip"
android:contentDescription="@string/number_picker_decrement_button" />
</merge>
diff --git a/core/res/res/layout/number_picker_with_selector_wheel.xml b/core/res/res/layout/number_picker_with_selector_wheel.xml
new file mode 100644
index 0000000..c8fa0f7
--- /dev/null
+++ b/core/res/res/layout/number_picker_with_selector_wheel.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+**
+** 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.
+*/
+-->
+
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <view class="android.widget.NumberPicker$CustomEditText"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:id="@+id/numberpicker_input"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:singleLine="true"
+ android:background="@null" />
+
+</merge>
diff --git a/core/res/res/layout/preference_child_holo.xml b/core/res/res/layout/preference_child_holo.xml
index 3c6a12e..4167862 100644
--- a/core/res/res/layout/preference_child_holo.xml
+++ b/core/res/res/layout/preference_child_holo.xml
@@ -60,7 +60,7 @@
android:layout_alignLeft="@android:id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
- android:maxLines="4" />
+ android:maxLines="10" />
</RelativeLayout>
diff --git a/core/res/res/layout/preference_holo.xml b/core/res/res/layout/preference_holo.xml
index 48f483d..e574219 100644
--- a/core/res/res/layout/preference_holo.xml
+++ b/core/res/res/layout/preference_holo.xml
@@ -63,7 +63,7 @@
android:layout_alignLeft="@android:id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
- android:maxLines="4" />
+ android:maxLines="10" />
</RelativeLayout>
diff --git a/core/res/res/layout/preference_information_holo.xml b/core/res/res/layout/preference_information_holo.xml
index e29ed03..5e03cfb 100644
--- a/core/res/res/layout/preference_information_holo.xml
+++ b/core/res/res/layout/preference_information_holo.xml
@@ -61,7 +61,7 @@
android:layout_alignLeft="@android:id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
- android:maxLines="2" />
+ android:maxLines="10" />
</RelativeLayout>
diff --git a/core/res/res/values-af-rZA/arrays.xml b/core/res/res/values-af-rZA/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-af-rZA/arrays.xml
rename to core/res/res/values-af-rZA/donottranslate-maps.xml
diff --git a/core/res/res/values-af/strings.xml b/core/res/res/values-af/strings.xml
index 49b31b4..f020f5d 100644
--- a/core/res/res/values-af/strings.xml
+++ b/core/res/res/values-af/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"skryf kontakdata"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Laat die program toe om die kontakdata (adresse) wat op jou tablet gestoor is, te verander. Kwaadwillige programme kan dit dalk gebruik om jou kontakdata uit te vee of te verander."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Laat die program toe om die kontakdata (adresse) wat op jou foon gestoor is, te verander. Kwaadwillige programme kan dit dalk gebruik om jou kontakdata uit te vee of te verander."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"lees oproeprekord"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Laat die program toe om jou tablet se oproeprekord, insluitende data oor inkomende en uitgaande oproepe, te lees. Kwaadwillige programme kan dit gebruik om jou data na ander mense te stuur."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Laat die program toe om jou foon se oproeprekord, insluitende data oor inkomende en uitgaande oproepe, te lees. Kwaadwillige programme kan dit gebruik om jou data na ander mense te stuur."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"skryf oproeprekord"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Laat die program toe om jou tablet se oproeprekord, insluitende data oor inkomende en uitgaande oproepe, te verander. Kwaadwillige programme kan dit gebruik om jou oproeprekord uit te vee of te verander."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Laat die program toe om jou foon se oproeprekord, insluitende data oor inkomende en uitgaande oproepe, te verander. Kwaadwillige programme kan dit gebruik om jou oproeprekord uit te vee of te verander."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"lees jou profieldata"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Laat die program toe om persoonlike profielinligting te lees wat op jou toestel gestoor is, soos jou naam en kontakbesonderhede. Dit beteken dat die program jou kan identifiseer en jou profielinligting aan ander mense kan stuur."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"skryf na jou profieldata"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Laat die program toe om enige private woorde, name en frases te lees wat die gebruiker in die gebruikerwoordeboek gestoor het."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"skryf na gebruikergedefinieerde woordeboek"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Laat die program toe om nuwe woorde in die gebruikerwoordeboek te skryf."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"lees USB-geheue se inhoud"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"lees SD-kaart se inhoud"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Laat die program toe om die USB-geheue se inhoud te lees."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Laat die program toe om die SD-kaart se inhoud te lees."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"verander/vee uit USB-berging se inhoud"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"wysig/vee uit SD-kaart se inhoud"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Laat die program toe om die USB-geheue te skryf."</string>
diff --git a/core/res/res/values-am-rET/arrays.xml b/core/res/res/values-am-rET/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-am-rET/arrays.xml
rename to core/res/res/values-am-rET/donottranslate-maps.xml
diff --git a/core/res/res/values-am/strings.xml b/core/res/res/values-am/strings.xml
index d1e9122..f1379f7 100644
--- a/core/res/res/values-am/strings.xml
+++ b/core/res/res/values-am/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"የእውቂያ ውሂብ ፃፍ"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"በጡባዊ ተኮህ ላይ የተከማቹ የእውቂያ(አድራሻ) ውሂብ ለመቀየር ለመተግበሪያው ይፈቅዳሉ፡፡ የእውቅያ ውሂብህን ለመደምሰስ ወይም ለመቀየር ተንኮል አዘል መተግበሪያዎች ሊጠቀሙት ይችላሉ፡፡"</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"በስልክህ ላይ የተከማቹ የእውቂያ(አድራሻ) ውሂብ ለመቀየር ለመተግበሪያው ይፈቅዳሉ፡፡ የእውቅያ ውሂብህን ለመደምሰስ ወይም ለመቀየር ተንኮል አዘል መተግበሪያዎች ሊጠቀሙት ይችላሉ፡፡"</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"የጥሪ ምዝግብ ማስታወሻን አንብብ"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"ስለ ገቢ እና ወጪ ጥሪዎችን ውሂብ ጨምሮ፣ የጡባዊ ተኮህን ምዝግብ ማስታወሻ እንዲያነብ ለመተግበሪያው ይፈቅዳል። ይሄንን ተንኮል አዘል መተግበሪያዎች ለሌሎች ሰዎች ውሂብህን ለመላክ ሊጠቀሙበት ይችላሉ።"</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"ስለ ገቢ እና ወጪ ጥሪዎችን ውሂብ ጨምሮ፣ የስልክ ጥሪህን ምዝግብ ማስታወሻ እንዲያነብ ለመተግበሪያው ይፈቅዳል። ይሄንን ተንኮል አዘል መተግበሪያዎች ለሌሎች ሰዎች ውሂብህን ለመላክ ሊጠቀሙበት ይችላሉ።"</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"የጥሪ ምዝግብ ማስታወሻን ፃፍ"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"ስለ ገቢ እና ወጪ ጥሪዎችን ውሂብ ጨምሮ፣ የጡባዊተኮህን ምዝግብ ማስታወሻ ለመቀየር ለመተግበሪያው ይፈቅዳል። ይሄንን ተንኮል አዘል መተግበሪያዎች የስልክህን ምዝግብ ማስታወሻ ለመሰረዝ ወይም ለመለወጥ ሊጠቀሙበት ይችላሉ።"</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"ስለ ገቢ እና ወጪ ጥሪዎችን ውሂብ ጨምሮ፣ የስልክህን ምዝግብ ማስታወሻ ለመቀየር ለመተግበሪያው ይፈቅዳል። ይሄንን ተንኮል አዘል መተግበሪያዎች የስልክህን ምዝግብ ማስታወሻ ለመሰረዝ ወይም ለመለወጥ ሊጠቀሙበት ይችላሉ።"</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"የመገለጫ ውሂብዎን ያንብቡ"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"ልክ እንደ አንተ ስም እና የዕውቂያ መረጃ ፣ ባንተ መሳሪያ ወስጥ የተከማቹ የግል መገለጫ መረጃ ለማንበብ ለመተግበሪያው ይፈቅዳሉ፡፡ይሄም ማለት ሌሎች መተግበሪያዎች ሊለዩህ ይችላሉ እና ለሌሎች የመገለጫ መረጃህን ይልካሉ፡፡"</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"የአርስዎ መገለጫ ውሂብ ላይ ይፃፉ"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">" ተጠቃሚው በተጠቃሚ መዝገበ ቃላት ሊያከማች የቻለውን ማንኛውም የግል ቃላት፣ ስሞች፣እና ሀረጎች ለማንበብ ለመተግበሪያው ይፈቅዳሉ፡፡"</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"በተጠቃሚ በተወሰነ መዝገበ ቃላት ፃፍ"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"በተጠቃሚ መዝገበ ቃላት ውስጥ አዲስ ቃል እንዲጽፍ ለመተግበሪያው ይፈቅዳሉ፡፡"</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"የUSB ካርድ ይዘቶችን አንብብ"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"የSD ካርድ ይዘቶችን አንብብ"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"መተግበሪያው ከUSB ካርድ ላይ ያሉ ይዘቶችን እንዲያነብ ይፈቅድለታል።"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"መተግበሪያው ከSD ካርድ ላይ ያሉ ይዘቶችን እንዲያነብ ይፈቅድለታል።"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"የUSB ማከማቻ ይዘቶችን ቀይር/ሰርዝ"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"የSD ካርድ ይዘትንቀይር/ሰርዝ"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"ወደ USB ማህደረ ትውስታው ለመፃፍ ለመተግበሪያው ይፈቅዳሉ፡፡"</string>
diff --git a/core/res/res/values-ar-rEG/arrays.xml b/core/res/res/values-ar-rEG/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ar-rEG/arrays.xml
rename to core/res/res/values-ar-rEG/donottranslate-maps.xml
diff --git a/core/res/res/values-ar-rIL/arrays.xml b/core/res/res/values-ar-rIL/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ar-rIL/arrays.xml
rename to core/res/res/values-ar-rIL/donottranslate-maps.xml
diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml
index 8775505..a156e64 100644
--- a/core/res/res/values-ar/strings.xml
+++ b/core/res/res/values-ar/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"كتابة بيانات جهة الاتصال"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"للسماح للتطبيق بتعديل بيانات (عنوان) جهة الاتصال المخزّنة على الجهاز اللوحي. يمكن أن تستخدم التطبيقات الضارة ذلك لمسح بيانات جهات الاتصال أو تعديلها."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"للسماح للتطبيق بتعديل بيانات (عنوان) جهة الاتصال المخزّنة على هاتفك. يمكن أن تستخدم التطبيقات الضارة ذلك لمسح بيانات جهات الاتصال أو تعديلها."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"قراءة سجل المكالمات"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"للسماح للتطبيق بقراءة سجل المكالمات، بما في ذلك البيانات عن المكالمات الواردة والصادرة. وربما تستخدم التطبيقات الضارة هذا لإرسال بياناتك إلى أشخاص آخرين."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"للسماح للتطبيق بقراءة سجل مكالمات الهاتف، بما في ذلك البيانات عن المكالمات الواردة والصادرة. وربما تستخدم التطبيقات الضارة هذا لإرسال بياناتك إلى أشخاص آخرين."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"كتابة سجل المكالمات"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"للسماح للتطبيق بتعديل سجل مكالمات الجهاز اللوحي، بما في ذلك البيانات عن المكالمات الواردة والصادرة. وربما تستخدم التطبيقات الضارة هذا لمسح سجل المكالمات أو تعديله."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"للسماح للتطبيق بتعديل سجل مكالمات الهاتف، بما في ذلك البيانات عن المكالمات الواردة والصادرة. وربما تستخدم التطبيقات الضارة هذا لمحو سجل المكالمات أو تعديله."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"قراءة بيانات ملفك الشخصي"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"للسماح للتطبيق بقراءة معلومات الملف الشخصي الشخصية المخزنة على الجهاز، مثل اسمك ومعلومات جهات الاتصال. يعني ذلك أنه يمكن للتطبيق التعرف عليك وإرسال معلومات ملفك الشخصي إلى الآخرين."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"الكتابة إلى بيانات ملفك الشخصي"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"للسماح للتطبيق بقراءة أي كلمات وأسماء وعبارات خاصة ربما خزنها المستخدم في قاموس المستخدم."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"كتابة إلى القاموس المعرّف بواسطة المستخدم"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"للسماح للتطبيق بكتابة كلمات جديدة في قاموس المستخدم."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"قراءة محتويات وحدة تخزين USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"قراءة محتويات بطاقة SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"للسماح للتطبيق بقراءة محتويات وحدة تخزين USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"للسماح للتطبيق بقراءة محتويات بطاقة SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"تعديل/حذف محتويات وحدة تخزين USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"تعديل/حذف محتويات بطاقة SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"للسماح للتطبيق بالكتابة إلى وحدة تخزين USB."</string>
diff --git a/core/res/res/values-be/strings.xml b/core/res/res/values-be/strings.xml
index eebf04e..0178764 100644
--- a/core/res/res/values-be/strings.xml
+++ b/core/res/res/values-be/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"запісваць кантактныя дадзеныя"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Дазваляе прыкладанням змяняць кантакты (адрасы), якія захоўваюцца на планшэце. Шкоднасныя прыкладанні могуць выкарыстоўваць гэтую магчымасць для выдалення або змены кантактных дадзеных."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Дазваляе прыкладанням змяняць кантакты (адрасы), якія захоўваюцца на вашым тэлефоне. Шкоднасныя прыкладанні могуць выкарыстоўваць гэту магчымасць для выдалення або змены кантактных дадзеных."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"чытанне гiсторыi выклікаў"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Дазваляе прыкладанню чытаць гiсторыю выклiкаў планшэту, у тым лiку дадзеныя пра ўваходныя і зыходныя выклiкi. Шкоднасныя прыкладаннi могуць выкарыстоўваць гэта, каб адпраўляць вашы дадзеныя іншым людзям."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Дазваляе прыкладанню чытаць гiсторыю выклiкаў, у тым лiку ўваходныя і зыходныя выклiкi. Шкоднасныя праграмы могуць выкарыстоўваць гэта, каб адпраўляць вашы дадзеныя іншым людзям."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"запіс гiсторыi выклікаў"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Дазваляе прыкладанню змяняць гiсторыю выклiкаў планшэта, у тым лiку дадзеныя пра ўваходныя i зыходныя выклiкi. Шкоднасныя прыкладаннi могуць выкарыстоўваць гэта, каб выдаляць або змяняць гiсторыю выклікаў."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Дазваляе прыкладанням змяняць гiсторыю выклiкаў тэлефону, у тым лiку дадзеныя пра ўваходныя і зыходныя выклiкi. Шкоднасныя прыкладаннi могуць выкарыстоўваць гэта, каб выдаляць або змяняць гiсторыю выклікаў."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"чытаць дадзеныя вашага профілю"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Дазваляе прыкладанням счытваць асабістую інфармацыю ў профілях, якая захоўваецца на вашай прыладзе, напрыклад, ваша імя і кантактную інфармацыю. Гэта азначае, што прыкладанне можа ідэнтыфікаваць вас і адправіць інфармацыю вашага профілю трэцім асобам."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"увядзіце дадзеныя вашага профілю"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Дазваляе прыкладанню счытваць любыя прыватныя словы, імёны і фразы, якія карыстальнік можа захоўваць у карыстальніцкім слоўніку."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"запісаць у карыстальніцкі слоўнік"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Дазваляе прыкладанням запісваць новыя словы ў карыстальніцкі слоўнік."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"чытанне змесціва USB-назапашвальнiка"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"чытанне змесціва SD-карты"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Дазваляе прыкладаню счытваць змесцiва USB-назапашвальніка."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Дазваляе прыкладанню счытваць змесціва SD-карты."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"змяніць/выдаліць змесціва USB-назапашвальнiка"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"змяняць/выдаляць змесціва SD-карты"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Дазваляе прыкладаням выконваць запіс ва USB-назапашвальнік."</string>
diff --git a/core/res/res/values-bg-rBG/arrays.xml b/core/res/res/values-bg-rBG/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-bg-rBG/arrays.xml
rename to core/res/res/values-bg-rBG/donottranslate-maps.xml
diff --git a/core/res/res/values-bg/strings.xml b/core/res/res/values-bg/strings.xml
index 583d21a..479e118 100644
--- a/core/res/res/values-bg/strings.xml
+++ b/core/res/res/values-bg/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"запис на данни за контактите"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Разрешава на приложението да променя данните за контактите (за адрес), съхранени в таблета ви. Злонамерените приложения могат да използват това, за да изтрият или променят тези данни."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Разрешава на приложението да променя данните за контактите (за адрес), съхранени в телефона ви. Злонамерените приложения могат да използват това, за да изтрият или променят тези данни."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"четене на списъка с обаждания"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Разрешава на приложението да чете списъка с обаждания на таблета ви, включително данните за входящите и изходящите обаждания. Злонамерените приложения могат да използват това, за да изпращат информацията ви на други хора."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Разрешава на приложението да чете списъка с обаждания на телефона ви, включително данните за входящите и изходящите обаждания. Злонамерените приложения могат да използват това, за да изпращат информацията ви на други хора."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"запис на списъка с обаждания"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Разрешава на приложението да променя списъка с обаждания на таблета ви, включително данните за входящите и изходящите обаждания. Злонамерените приложения могат да използват това, за да изтрият или променят този списък."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Разрешава на приложението да променя списъка с обаждания на телефона ви, включително данните за входящите и изходящите обаждания. Злонамерените приложения могат да използват това, за да изтрият или променят този списък."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"четене на данните в профила ви"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Разрешава на приложението да чете информацията от личния потребителски профил, съхранена на устройството ви, например вашето име и данни за връзка. Това означава, че приложението може да ви идентифицира и да изпраща информацията за потребителския ви профил на други хора."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"запис в потр. ви профил"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Разрешава на приложението да чете частни думи, имена и фрази, които потребителят може да е съхранил в потребителския речник."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"запис в дефинирания от потребителя речник"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Разрешава на приложението да записва нови думи в потребителския речник."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"четене на съдържанието на USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"четене на съдържанието на SD картата"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Разрешава на прил. да чете съдърж. на USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Разрешава на приложението да чете съдържанието на SD картата."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"промяна/изтриване на съдържанието в USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"промяна/изтриване на съдържанието на SD картата"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Разрешава на приложението да записва в USB."</string>
diff --git a/core/res/res/values-ca-rES/arrays.xml b/core/res/res/values-ca-rES/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ca-rES/arrays.xml
rename to core/res/res/values-ca-rES/donottranslate-maps.xml
diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml
index 36288c5..64d0f87 100644
--- a/core/res/res/values-ca/strings.xml
+++ b/core/res/res/values-ca/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"escriure dades de contacte"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permet que l\'aplicació modifiqui les dades de contacte (adreça) emmagatzemades a la tauleta. Les aplicacions malicioses poden utilitzar-ho per esborrar o modificar les dades de contacte."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permet que l\'aplicació modifiqui les dades de contacte (adreça) emmagatzemades al telèfon. Les aplicacions malicioses poden utilitzar-ho per esborrar o per modificar les dades de contacte."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"lectura del registre de trucades"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permet que l\'aplicació llegeixi el registre de trucades de la teva tauleta, incloses les dades de les trucades entrants i sortints. És possible que les aplicacions malicioses ho utilitzin per enviar les teves dades a altres persones."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permet que l\'aplicació llegeixi el registre de trucades del teu telèfon, incloses les dades de les trucades entrants i sortints. És possible que les aplicacions malicioses ho utilitzin per enviar les teves dades a altres persones."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"escriptura del registre de trucades"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permet que l\'aplicació modifiqui el registre de trucades de la teva tauleta, incloses les dades de les trucades entrants i sortints. És possible que les aplicacions malicioses ho utilitzin per eliminar o per modificar el teu registre de trucades."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permet que l\'aplicació modifiqui el registre de trucades del teu telèfon, incloses les dades de les trucades entrants i sortints. És possible que les aplicacions malicioses ho utilitzin per eliminar o per modificar el teu registre de trucades."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"lectura de dades del teu perfil"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permet que l\'aplicació pugui llegir informació del perfil personal emmagatzemada al dispositiu, com ara el teu nom i la teva informació de contacte. Això significa que l\'aplicació et pot identificar i enviar la informació del teu perfil a altres persones."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"escriptura a les teves dades del perfil"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permet que l\'aplicació llegeixi les paraules, els noms i les frases privats que l\'usuari pot haver emmagatzemat al seu diccionari."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"escriu al diccionari definit per l\'usuari"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permet que l\'aplicació escrigui paraules noves al diccionari de l\'usuari."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"llegeix el contingut de l\'emmagatzematge USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"llegeix el contingut de la targeta SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permet que l\'aplicació llegeixi el contingut de l\'emmagatzematge USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permet que l\'aplicació llegeixi el contingut de la targeta SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modificar/esborrar contingut USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificar/esborrar contingut de la targeta SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permet que l\'aplicació escrigui a l\'emmagatzematge USB."</string>
diff --git a/core/res/res/values-cs-rCZ/arrays.xml b/core/res/res/values-cs-rCZ/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-cs-rCZ/arrays.xml
rename to core/res/res/values-cs-rCZ/donottranslate-maps.xml
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index 2cda293..d2a4cc1 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"zapisovat data kontaktů"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Umožňuje aplikaci upravit kontaktní údaje (adresy) uložené v tabletu. Škodlivé aplikace mohou toto oprávnění použít k vymazání nebo úpravě kontaktních údajů."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Umožňuje aplikaci upravit kontaktní údaje uložené v telefonu (adresu). Škodlivé aplikace mohou toto oprávnění použít k vymazání nebo úpravě kontaktních údajů."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"číst seznam hovorů"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Umožňuje aplikaci číst seznam hovorů vašeho tabletu, včetně dat o příchozích a odchozích hovorech. Škodlivé aplikace mohou tato data posílat jiným osobám."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Umožňuje aplikaci číst seznam hovorů vašeho telefonu, včetně dat o příchozích a odchozích hovorech. Škodlivé aplikace mohou tato data posílat jiným osobám."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"zapisovat seznam hovorů"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Umožňuje aplikaci upravovat seznam hovorů vašeho tabletu, včetně dat o příchozích a odchozích hovorech. Škodlivé aplikace to mohou zneužít k vymazání nebo změnám seznamu hovorů."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Umožňuje aplikaci upravovat seznam hovorů vašeho telefonu, včetně dat o příchozích a odchozích hovorech. Škodlivé aplikace to mohou zneužít k vymazání nebo změnám seznamu hovorů."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"čtení údajů o vašem profilu"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Umožňuje aplikaci číst údaje v osobním profilu uložené v zařízení, například jméno nebo kontaktní údaje. Znamená to, že vás ostatní aplikace mohou identifikovat a odeslat údaje z profilu dalším aplikacím."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"zapisovat do údajů o profilu"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Umožní aplikaci číst soukromá slova, jména a fráze, která uživatel mohl uložit do svého slovníku."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"zápis do slovníku definovaného uživatelem"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Umožňuje aplikaci zapisovat nová slova do uživatelského slovníku."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"čtení obsahu USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"čtení obsahu karty SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Umožňuje čtení obsahu USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Umožňuje aplikaci čtení obsahu karty SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"úprava/mazání obsahu úložiště USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"změna/smazání obsahu karty SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Umožňuje aplikaci zapisovat do úložiště USB."</string>
@@ -914,8 +916,8 @@
<string name="no" msgid="5141531044935541497">"Zrušit"</string>
<string name="dialog_alert_title" msgid="2049658708609043103">"Upozornění"</string>
<string name="loading" msgid="7933681260296021180">"Načítání..."</string>
- <string name="capital_on" msgid="1544682755514494298">"ZAPNUTO"</string>
- <string name="capital_off" msgid="6815870386972805832">"VYPNUTO"</string>
+ <string name="capital_on" msgid="1544682755514494298">"I"</string>
+ <string name="capital_off" msgid="6815870386972805832">"O"</string>
<string name="whichApplication" msgid="4533185947064773386">"Dokončit akci pomocí aplikace"</string>
<string name="alwaysUse" msgid="4583018368000610438">"Použít jako výchozí nastavení pro tuto činnost."</string>
<string name="clearDefaultHintMsg" msgid="3252584689512077257">"Výchozí nastavení vymažete v části Nastavení systému > Aplikace > Stažené."</string>
diff --git a/core/res/res/values-da-rDK/arrays.xml b/core/res/res/values-da-rDK/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-da-rDK/arrays.xml
rename to core/res/res/values-da-rDK/donottranslate-maps.xml
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index 4f9f0f1..b139e5e 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"skriv kontaktdata"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Tillader, at appen kan ændre data for kontaktpersoner (adresser), der er gemt på din tablet. Ondsindede apps kan bruge dette til at slette eller ændre dine kontaktoplysninger."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Tillader, at appen kan ændre kontaktdata (adresser), der er gemt på din telefon. Ondsindede apps kan bruge dette til at slette eller ændre kontaktdata."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"læs opkaldsliste"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Tillader, at appen læser din tablets opkaldsliste, herunder data om indgående og udgående opkald. Ondsindede apps kan bruge dette til at sende dine data til andre personer."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Tillader, at appen læser telefonens opkaldsliste, herunder data om indgående og udgående opkald. Ondsindede apps kan bruge dette til at sende dine data til andre personer."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"skriv opkaldsliste"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Tillader, at appen ændrer din tablets opkaldsliste, herunder data om indgående og udgående opkald. Ondsindede apps kan bruge dette til at slette eller ændre din opkaldsliste."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Tillader, at appen ændrer telefonens opkaldsliste, herunder data om indgående og udgående opkald. Ondsindede apps kan bruge dette til at slette eller ændre din opkaldsliste."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"læse dine profildata"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Tillader, at appen kan læse personlige profiloplysninger, der er gemt på din enhed, f.eks. dit navn og dine kontaktoplysninger. Det betyder, at appen kan identificere dig og sende dine profiloplysninger til andre."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"skrive til dine profildata"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Tillader, at appen kan læse alle private ord, navne og sætninger, som brugeren kan have gemt i brugerordbogen."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"skrive til brugerordbogen"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Tillader, at appen kan skrive nye ord i brugerordbogen."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"læse USB-lagerets indhold"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"læse indholdet af SD-kortet"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Tillader, at appen læser indhold på USB-lageret."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Tillader, at appen læser indholdet af SD-kortet."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"rette/slette i USB-lager"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"ret/slet indholdet på SD-kortet"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Lader appen skrive til USB."</string>
diff --git a/core/res/res/values-de-rAT/arrays.xml b/core/res/res/values-de-rAT/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-de-rAT/arrays.xml
rename to core/res/res/values-de-rAT/donottranslate-maps.xml
diff --git a/core/res/res/values-de-rCH/arrays.xml b/core/res/res/values-de-rCH/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-de-rCH/arrays.xml
rename to core/res/res/values-de-rCH/donottranslate-maps.xml
diff --git a/core/res/res/values-de-rDE/arrays.xml b/core/res/res/values-de-rDE/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-de-rDE/arrays.xml
rename to core/res/res/values-de-rDE/donottranslate-maps.xml
diff --git a/core/res/res/values-de-rLI/arrays.xml b/core/res/res/values-de-rLI/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-de-rLI/arrays.xml
rename to core/res/res/values-de-rLI/donottranslate-maps.xml
diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml
index b064243..baf3e40 100644
--- a/core/res/res/values-de/strings.xml
+++ b/core/res/res/values-de/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"Kontaktdaten schreiben"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Ermöglicht der App, die auf Ihrem Tablet gespeicherten Kontaktdaten (Adressen) zu ändern. Schädliche Apps können so Ihre Kontaktdaten löschen oder ändern."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Ermöglicht der App, die auf Ihrem Telefon gespeicherten Kontaktdaten (Adressen) zu ändern. Schädliche Apps können so Ihre Kontaktdaten löschen oder ändern."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"Anrufprotokoll lesen"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Ermöglicht der App, das Anrufprotokoll Ihres Tablets zu lesen, einschließlich der Daten über ein- und ausgehende Anrufe. Schädliche Apps können so Ihre Daten an Dritte senden."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Ermöglicht der App, das Anrufprotokoll Ihres Telefons zu lesen, einschließlich der Daten über ein- und ausgehende Anrufe. Schädliche Apps können so Ihre Daten an Dritte senden."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"Anrufprotokoll bearbeiten"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Ermöglicht der App, das Anrufprotokoll Ihres Tablets zu ändern, einschließlich der Daten über ein- und ausgehende Anrufe. Schädliche Apps können so Ihr Anrufprotokoll löschen oder ändern."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Ermöglicht der App, das Anrufprotokoll Ihres Telefons zu ändern, einschließlich der Daten über ein- und ausgehende Anrufe. Schädliche Apps können so Ihr Anrufprotokoll löschen oder ändern."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"Ihre Profildaten lesen"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Ermöglicht der App, auf Ihrem Gerät gespeicherte persönliche Profilinformationen zu lesen, darunter Ihren Namen und Ihre Kontaktdaten. Die App kann Sie somit identifizieren und Ihre Profilinformationen an andere senden."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"In Ihre Profildaten schreiben"</string>
@@ -411,8 +417,8 @@
<string name="permdesc_performCdmaProvisioning" msgid="1994193538802314186">"Ermöglicht der App, die CDMA-Bereitstellung zu starten. Schädliche Apps können so die CDMA-Bereitstellung unnötigerweise starten."</string>
<string name="permlab_locationUpdates" msgid="7785408253364335740">"Benachrichtigungen für Standortaktualisierung steuern"</string>
<string name="permdesc_locationUpdates" msgid="1120741557891438876">"Ermöglicht der App, Mobilfunkbenachrichtigungen über Standort-Updates zu aktivieren bzw. zu deaktivieren. Nicht für normale Apps vorgesehen."</string>
- <string name="permlab_checkinProperties" msgid="7855259461268734914">"Auf Check-In-Eigenschaften zugreifen"</string>
- <string name="permdesc_checkinProperties" msgid="4024526968630194128">"Ermöglicht der App Schreib-/Lesezugriff auf vom Check-In-Service hochgeladene Elemente. Nicht für normale Apps vorgesehen."</string>
+ <string name="permlab_checkinProperties" msgid="7855259461268734914">"Auf Check-in-Eigenschaften zugreifen"</string>
+ <string name="permdesc_checkinProperties" msgid="4024526968630194128">"Ermöglicht der App Schreib-/Lesezugriff auf vom Check-in-Service hochgeladene Elemente. Nicht für normale Apps vorgesehen."</string>
<string name="permlab_bindGadget" msgid="776905339015863471">"Widgets auswählen"</string>
<string name="permdesc_bindGadget" msgid="8261326938599049290">"Ermöglicht der App, dem System zu melden, welche Widgets von welcher App verwendet werden können. Mit dieser Berechtigung können Apps anderen Apps Zugriff auf persönliche Daten gewähren. Nicht für normale Apps vorgesehen."</string>
<string name="permlab_modifyPhoneState" msgid="8423923777659292228">"Telefonstatus ändern"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Ermöglicht der App, alle privaten Wörter, Namen und Ausdrücke zu lesen, die ein Nutzer in seinem Wörterbuch gespeichert hat"</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"In benutzerdefiniertes Wörterbuch schreiben"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Ermöglicht der App, dem Nutzerwörterbuch neue Einträge hinzuzufügen"</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USB-Speicher-Inhalt lesen"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SD-Karten-Inhalt lesen"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Ermöglicht der App, den USB-Speicher zu lesen"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Ermöglicht der App, den Inhalt einer SD-Karte zu lesen"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USB-Speicherinhalt ändern/löschen"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"SD-Karten-Inhalt ändern/löschen"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Ermöglicht der App, in den USB-Speicher zu schreiben"</string>
@@ -741,8 +743,7 @@
<string name="double_tap_toast" msgid="4595046515400268881">"Tipp: Zum Vergrößern und Verkleinern zweimal tippen"</string>
<string name="autofill_this_form" msgid="4616758841157816676">"AutoFill"</string>
<string name="setup_autofill" msgid="7103495070180590814">"AutoFill konfig."</string>
- <!-- no translation found for autofill_address_name_separator (6350145154779706772) -->
- <skip />
+ <string name="autofill_address_name_separator" msgid="6350145154779706772">" "</string>
<string name="autofill_address_summary_name_format" msgid="3268041054899214945">"$1$2$3"</string>
<string name="autofill_address_summary_separator" msgid="7483307893170324129">", "</string>
<string name="autofill_address_summary_format" msgid="4874459455786827344">"$1$2$3"</string>
diff --git a/core/res/res/values-el-rGR/arrays.xml b/core/res/res/values-el-rGR/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-el-rGR/arrays.xml
rename to core/res/res/values-el-rGR/donottranslate-maps.xml
diff --git a/core/res/res/values-el/strings.xml b/core/res/res/values-el/strings.xml
index b05cbe5..ad840e3 100644
--- a/core/res/res/values-el/strings.xml
+++ b/core/res/res/values-el/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"εγγραφή δεδομένων επαφής"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Επιτρέπει στην εφαρμογή να τροποποιεί τα δεδομένα επαφής (διεύθυνσης) που είναι αποθηκευμένα στο tablet σας. Κακόβουλες εφαρμογές μπορούν να το χρησιμοποιήσουν για να διαγράψουν ή να τροποποιήσουν τα δεδομένα επαφών σας."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Επιτρέπει στην εφαρμογή να τροποποιεί τα δεδομένα επαφής (διεύθυνσης) που είναι αποθηκευμένα στο τηλέφωνό σας. Κακόβουλες εφαρμογές μπορούν να το χρησιμοποιήσουν για να διαγράψουν ή να τροποποιήσουν τα δεδομένα επαφών σας."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"ανάγνωση αρχείου καταγραφής κλήσεων"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Επιτρέπει στην εφαρμογή να διαβάζει το αρχείο καταγραφής κλήσεων του tablet σας, συμπεριλαμβανομένων των δεδομένων σχετικά με τις εισερχόμενες και τις εξερχόμενες κλήσεις. Οι κακόβουλες εφαρμογές μπορεί να το χρησιμοποιήσουν για να στείλουν τα δεδομένα σας σε άλλα άτομα."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Επιτρέπει στην εφαρμογή να διαβάζει το αρχείο καταγραφής κλήσεων του τηλεφώνου σας, συμπεριλαμβανομένων των δεδομένων σχετικά με τις εισερχόμενες και τις εξερχόμενες κλήσεις. Οι κακόβουλες εφαρμογές μπορεί να το χρησιμοποιήσουν για να στείλουν τα δεδομένα σας σε άλλα άτομα."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"εγγραφή αρχείου καταγραφής κλήσεων"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Επιτρέπει στην εφαρμογή να τροποποιεί το αρχείο καταγραφής κλήσεων του tablet σας, συμπεριλαμβανομένων των δεδομένων σχετικά με τις εισερχόμενες και τις εξερχόμενες κλήσεις. Οι κακόβουλες εφαρμογές μπορεί να το χρησιμοποιήσουν για να διαγράψουν ή να τροποποιήσουν το αρχείο καταγραφής κλήσεων."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Επιτρέπει στην εφαρμογή να τροποποιεί το αρχείο καταγραφής κλήσεων του τηλεφώνου σας, συμπεριλαμβανομένων των δεδομένων σχετικά με τις εισερχόμενες και τις εξερχόμενες κλήσεις. Οι κακόβουλες εφαρμογές μπορεί να το χρησιμοποιήσουν για να διαγράψουν ή να τροποποιήσουν το αρχείο καταγραφής κλήσεων."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"ανάγν. δεδ. προφ."</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Επιτρέπει στην εφαρμογή την ανάγνωση προσωπικών πληροφοριών προφίλ οι οποίες είναι αποθηκευμένες στη συσκευή σας, όπως το όνομα και τα στοιχεία επικοινωνίας σας. Αυτό σημαίνει ότι η εφαρμογή μπορεί να σας αναγνωρίσει και να στείλει τις πληροφορίες σας προφίλ σε άλλους."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"εγγρ. σε δεδ. προφίλ"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Επιτρέπει στην εφαρμογή την ανάγνωση ιδιωτικών λέξεων, ονομάτων και φράσεων, τα οποία ο χρήστης ενδέχεται να έχει αποθηκεύσει στο λεξικό χρήστη."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"εγγραφή σε λεξικό καθορισμένο από τον χρήστη"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Επιτρέπει στην εφαρμογή την εγγραφή νέων λέξεων στο λεξικό χρήστη."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"ανάγν. περιεχ. αποθ. χώρ. USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"ανάγνωση περιεχομένου κάρτας SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Επιτρ. η ανάγν. περιεχ. απ. χώρου USB"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Επιτρέπει στην εφαρμογή την ανάγνωση περιεχομένου της κάρτας SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"τροπ./διαγρ. περ. απ. χώρ. USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"τροποποίηση/διαγραφή περιεχομένων κάρτας SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Επιτρέπει στην εφαρμογή την εγγραφή στον αποθηκευτικό χώρο USB."</string>
diff --git a/core/res/res/values-en-rAU/arrays.xml b/core/res/res/values-en-rAU/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rAU/arrays.xml
rename to core/res/res/values-en-rAU/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rCA/arrays.xml b/core/res/res/values-en-rCA/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rCA/arrays.xml
rename to core/res/res/values-en-rCA/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rGB/arrays.xml b/core/res/res/values-en-rGB/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rGB/arrays.xml
rename to core/res/res/values-en-rGB/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rGB/strings.xml b/core/res/res/values-en-rGB/strings.xml
index 38078a6..de92665 100644
--- a/core/res/res/values-en-rGB/strings.xml
+++ b/core/res/res/values-en-rGB/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"write contact data"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Allows the app to modify the contact (address) data stored on your tablet. Malicious apps may use this to erase or modify your contact data."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Allows the app to modify the contact (address) data stored on your phone. Malicious apps may use this to erase or modify your contact data."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"read call log"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Allows the app to read your tablet\'s call log, including data about incoming and outgoing calls. Malicious apps may use this to send your data to other people."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Allows the app to read your phone\'s call log, including data about incoming and outgoing calls. Malicious apps may use this to send your data to other people."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"write call log"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Allows the app to modify your tablet\'s call log, including data about incoming and outgoing calls. Malicious apps may use this to erase or modify your call log."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Allows the app to modify your phone\'s call log, including data about incoming and outgoing calls. Malicious apps may use this to erase or modify your call log."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"read your profile data"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Allows the app to read personal profile information stored on your device, such as your name and contact information. This means the app can identify you and send your profile information to others."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"write to your profile data"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Allows the app to read any private words, names and phrases that the user may have stored in the user dictionary."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"write to user-defined dictionary"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Allows the app to write new words into the user dictionary."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"read USB storage contents"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"read SD card contents"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Allows the app to read contents of USB storage."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Allows the app to read contents of SD card."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modify/delete USB storage contents"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modify/delete SD card contents"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Allows the app to write to the USB storage."</string>
diff --git a/core/res/res/values-en-rIE/arrays.xml b/core/res/res/values-en-rIE/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rIE/arrays.xml
rename to core/res/res/values-en-rIE/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rIN/arrays.xml b/core/res/res/values-en-rIN/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rIN/arrays.xml
rename to core/res/res/values-en-rIN/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rNZ/arrays.xml b/core/res/res/values-en-rNZ/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rNZ/arrays.xml
rename to core/res/res/values-en-rNZ/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rSG/arrays.xml b/core/res/res/values-en-rSG/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rSG/arrays.xml
rename to core/res/res/values-en-rSG/donottranslate-maps.xml
diff --git a/core/res/res/values-en-rZA/arrays.xml b/core/res/res/values-en-rZA/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-en-rZA/arrays.xml
rename to core/res/res/values-en-rZA/donottranslate-maps.xml
diff --git a/core/res/res/values-es-rES/arrays.xml b/core/res/res/values-es-rES/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-es-rES/arrays.xml
rename to core/res/res/values-es-rES/donottranslate-maps.xml
diff --git a/core/res/res/values-es-rUS/strings.xml b/core/res/res/values-es-rUS/strings.xml
index d1dc89f..8761ca9 100644
--- a/core/res/res/values-es-rUS/strings.xml
+++ b/core/res/res/values-es-rUS/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"escribir datos de contacto"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permite que la aplicación modifique la información de contacto (dirección) almacenada en tu tableta. Las aplicaciones maliciosas pueden utilizar este permiso para borrar o modificar tu información de contacto."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permite que la aplicación modifique la información de contacto (dirección) almacenada en tu dispositivo. Las aplicaciones maliciosas pueden utilizar este permiso para borrar o modificar tu información de contacto."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"leer el registro de llamadas"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permite que la aplicación lea el registro de llamadas de la tableta, incluidos los datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para enviar tus datos a otros usuarios."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permite que la aplicación lea el registro de llamadas del dispositivo, incluidos los datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para enviar tus datos a otros usuarios."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"escribir en el registro de llamadas"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permite que la aplicación modifique el registro de llamadas de la tableta, incluidos los datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para borrar o modificar el registro de llamadas."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permite que la aplicación modifique el registro de llamadas del dispositivo, incluidos los datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para borrar o modificar el registro de llamadas."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"Leer tus datos de perfil"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permite que la aplicación lea la información de perfil almacenada en tu dispositivo, como tu nombre e información de contacto. Esto significa que la aplicación puede identificarte y enviar tu información de perfil a otros."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"Escrib. en datos de tu perfil"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permite que la aplicación lea cualquier palabra, nombre o frase de carácter privado que el usuario haya almacenado en su diccionario."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"agregar al diccionario definido por el usuario"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permite que la aplicación ingrese palabras nuevas en el diccionario del usuario."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"Leer almacenamiento USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"Leer el contenido de la tarjeta SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permite leer USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permite a la aplicación leer el contenido de la tarjeta SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modificar o eliminar el contenido del almacenamiento USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificar/eliminar el contenido de la tarjeta SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permite que la aplicación escriba en el almacenamiento USB."</string>
diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml
index c39617a..9ede6a0 100644
--- a/core/res/res/values-es/strings.xml
+++ b/core/res/res/values-es/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"escribir datos de contacto"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permite que la aplicación lea todos los datos (direcciones) de contactos almacenados en el tablet. Las aplicaciones malintencionadas pueden usar este permiso para borrar o modificar los datos de contactos."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permite que la aplicación consulte todos los datos (direcciones) de contactos almacenados en el teléfono. Las aplicaciones malintencionadas pueden usar este permiso para borrar o modificar los datos de contactos."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"leer el registro de llamadas"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permite que la aplicación lea el registro de llamadas del tablet, incluidos datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para enviar tus datos a otros usuarios."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permite que la aplicación lea el registro de llamadas del teléfono, incluidos datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para enviar tus datos a otros usuarios."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"escribir en el registro de llamadas"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permite que la aplicación modifique el registro de llamadas del tablet, incluidos datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para borrar o modificar el registro de llamadas."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permite que la aplicación modifique el registro de llamadas del teléfono, incluidos datos sobre llamadas entrantes y salientes. Las aplicaciones malintencionadas pueden usar este permiso para borrar o modificar el registro de llamadas."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"acceder a datos de tu perfil"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permite que la aplicación acceda a información del perfil personal almacenada en el dispositivo (como el nombre o la información de contacto), lo que significa que la aplicación puede identificar al usuario y enviar la información de su perfil a otros usuarios."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"escribir en datos de tu perfil"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permite que la aplicación lea cualquier palabra, nombre o frase de carácter privado que el usuario haya almacenado en su diccionario."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"añadir al diccionario definido por el usuario"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permite que la aplicación escriba palabras nuevas en el diccionario de usuario."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"leer contenido del almacenamiento USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"leer contenido de la tarjeta SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permite que la aplicación lea contenido del almacenamiento USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permite que la aplicación lea contenidos de la tarjeta SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modificar/borrar contenido USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificar/eliminar contenido de la tarjeta SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permite escribir en el almacenamiento USB."</string>
diff --git a/core/res/res/values-et/strings.xml b/core/res/res/values-et/strings.xml
index 07aef03..b68944e 100644
--- a/core/res/res/values-et/strings.xml
+++ b/core/res/res/values-et/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"kirjuta kontaktandmeid"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Võimaldab rakendusel muuta tahvelarvutisse salvestatud kontaktandmeid (aadresse). Pahatahtlikud rakendused võivad seda kasutada teie kontaktandmete kustutamiseks või muutmiseks."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Võimaldab rakendusel muuta telefoni salvestatud kontaktandmeid (aadresse). Pahatahtlikud rakendused võivad seda kasutada teie kontaktandmete kustutamiseks või muutmiseks."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"kõnelogi lugemine"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Lubab rakendusel lugeda tahvelarvuti kõnelogi, sh teavet sissetulevate ja väljaminevate kõnede kohta. Pahatahtlikud rakendused võivad saata selle abil teie teavet teistele inimestele."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Lubab rakendusel lugeda telefoni kõnelogi, sh teavet sissetulevate ja väljaminevate kõnede kohta. Pahatahtlikud rakendused võivad saata selle abil teie teavet teistele inimestele."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"kõnelogi kirjutamine"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Lubab rakendusel muuta tahvelarvuti kõnelogi, sh sissetulevate ja väljaminevate kõnede andmeid. Pahatahtlikud rakendused võivad kasutada seda kõnelogi kustutamiseks või muutmiseks."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Lubab rakendusel muuta telefoni kõnelogi, sh sissetulevate ja väljaminevate kõnede andmeid. Pahatahtlikud rakendused võivad kasutada seda kõnelogi kustutamiseks või muutmiseks."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"profiili andmete lugemine"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Võimaldab rakendusel lugeda seadmesse salvestatud isiklikku teavet, näiteks teie nime ja kontaktandmeid. See tähendab, et rakendus saab teid tuvastada ja saata teie profiiliteavet teistele."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"andmete kirjutamine profiili"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Võimaldab rakendusel lugeda kõiki privaatseid sõnu, nimesid ja fraase, mille kasutaja võis salvestada kasutajasõnastikku."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"Kasutaja määratud sõnastikku kirjutamine"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Võimaldab rakendusel kirjutada kasutajasõnastikku uusi sõnu."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USB-salvestusruumi sisu lugem."</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SD-kaardi sisu lugemine"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Rak. loeb USB-s.-ruumi sisu."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Võimaldab rakendusel lugeda SD-kaardi sisu."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USB-seadme sisu muutm./kustut."</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"muuda/kustuta SD-kaardi sisu"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Võimaldab rakendusel kirjutada USB-mäluseadmele."</string>
diff --git a/core/res/res/values-fa-rIR/arrays.xml b/core/res/res/values-fa-rIR/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-fa-rIR/arrays.xml
rename to core/res/res/values-fa-rIR/donottranslate-maps.xml
diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml
index 96201c6..7ee47e7 100644
--- a/core/res/res/values-fa/strings.xml
+++ b/core/res/res/values-fa/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"نوشتن اطلاعات تماس"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"به برنامه اجازه میدهد دادههای مخاطب ذخیره شده در رایانه لوحی را تغییر دهد. برنامههای مخرب میتوانند از آن استفاده کنند تا دادههای تماس شما را تغییر دهند یا پاک کنند."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"به برنامه اجازه میدهد تا دادههای مخاطب (آدرس) را که در تلفن ذخیره شده تغییر دهد. برنامههای مخرب میتوانند از این استفاده کنند تا دادههای تماس شما را پاک کنند یا تغییر دهند."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"خواندن گزارش تماس"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"به برنامه اجازه میدهد گزارشات تماس رایانه لوحی شما، از جمله دادههایی درمورد تماسهای ورودی و خروجی را بخواند. برنامههای مخرب ممکن است از این ویژگی برای ارسال دادههای شما به دیگران استفاده کنند."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"به برنامه اجازه میدهد گزارشات تماس تلفنی شما، از جمله دادههایی درمورد تماسهای ورودی و خروجی را بخواند. برنامههای مخرب ممکن است از این ویژگی برای ارسال دادههای شما به دیگران استفاده کنند."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"نوشتن گزارش تماس"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"به برنامه اجازه میدهد گزارشات تماس رایانه لوحی شما، از جمله دادههایی درمورد تماسهای ورودی و خروجی را تغییر دهد. برنامههای مخرب ممکن است از این ویژگی برای پاک کردن یا تغییر گزارش تماس شما استفاده کنند."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"به برنامه اجازه میدهد گزارشات تماس تلفنی شما، از جمله دادههایی درمورد تماسهای ورودی و خروجی را تغییر دهد. برنامههای مخرب ممکن است از این ویژگی برای پاک کردن یا تغییر گزارش تماس شما استفاده کنند."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"خواندن دادههای نمایه شما"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"به برنامه اجازه میدهد اطلاعات نمایه شخصی ذخیره شده در دستگاه شما را بخواند. یعنی برنامه میتواند شما را شناسایی کند و اطلاعات نمایه شما را به دیگران ارسال کند."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"نوشتن در دادههای نمایه شما"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"به برنامه اجازه میدهد هر گونه کلمه، نام، عبارت خصوصی را که کاربر در فرهنگ لغت خود ذخیره کرده است بخواند."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"نوشتن در فرهنگ لغت تعریف شده از سوی کاربر"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"به برنامه اجازه میدهد تا کلمات جدید را در فهرست کاربر بنویسد."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"خواندن محتوای حافظه USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"خواندن محتوای کارت SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"به برنامه اجازه خواندن محتوای حافظه USB را میدهد."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"به برنامه اجازه خواندن محتوای کارت SD را میدهد."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"اصلاح/حذف محتواهای حافظه USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"اصلاح کردن/حذف محتویات کارت SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"به برنامه اجازه میدهد تا در حافظه USB بنویسد."</string>
diff --git a/core/res/res/values-fi-rFI/arrays.xml b/core/res/res/values-fi-rFI/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-fi-rFI/arrays.xml
rename to core/res/res/values-fi-rFI/donottranslate-maps.xml
diff --git a/core/res/res/values-fi/strings.xml b/core/res/res/values-fi/strings.xml
index dfdc3fb..b1009a5 100644
--- a/core/res/res/values-fi/strings.xml
+++ b/core/res/res/values-fi/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"kirjoita yhteystietoja"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Antaa sovelluksen muokata tablet-laitteen yhteystietoja (osoitetietoja). Haitalliset sovellukset voivat käyttää tätä yhteystietojen poistamiseen tai muokkaamiseen."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Antaa sovelluksen muokata puhelimen yhteystietoja (osoitetietoja). Haitalliset sovellukset voivat käyttää tätä yhteystietojen poistamiseen tai muokkaamiseen."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"lue puhelulokia"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Antaa sovelluksen lukea tablet-laitteesi puhelulokia, kuten tietoja vastatuista ja soitetuista puheluista. Haitalliset sovellukset voivat lähettää tietojasi muille henkilöille."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Antaa sovelluksen lukea puhelimesi puhelulokia, kuten tietoja vastatuista ja soitetuista puheluista. Haitalliset sovellukset voivat lähettää tietojasi muille henkilöille."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"kirjoita puhelulokiin"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Antaa sovelluksen muokata tablet-laitteesi puhelulokia, kuten tietoja vastatuista ja soitetuista puheluista. Haitalliset sovellukset voivat poistaa puhelulokisi tai muokata sitä."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Antaa sovelluksen muokata puhelimesi puhelulokia, kuten tietoja vastatuista ja soitetuista puheluista. Haitalliset sovellukset voivat poistaa puhelulokisi tai muokata sitä."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"lukea profiilisi tiedot"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Antaa sovelluksen lukea laitteelle tallennettuja henkilökohtaisia tietoja, kuten nimen ja yhteystietoja. Tämä antaa sovelluksen tunnistaa sinut ja lähettää profiilitietojasi muille."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"kirjoittaa profiilin tietoihin"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Antaa sovelluksen lukea yksityisiä sanoja, nimiä tai ilmauksia, joita käyttäjä on voinut tallentaa käyttäjän sanakirjaan."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"käyttäjän määrittelemään sanakirjaan kirjoittaminen"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Antaa sovelluksen kirjoittaa uusia sanoja käyttäjän sanakirjaan."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"lue USB-tallennustilan sisältöä"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"lue SD-kortin sisältöä"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Antaa sovelluksen lukea USB-tallennustilan sisältöä."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Antaa sovelluksen lukea SD-kortin sisältöä."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"muokkaa/poista USB-sisältöä"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"muokkaa/poista SD-kortin sisältöä"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Antaa sovelluksen kirjoittaa USB-tallennustilaan."</string>
diff --git a/core/res/res/values-fr-rBE/arrays.xml b/core/res/res/values-fr-rBE/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-fr-rBE/arrays.xml
rename to core/res/res/values-fr-rBE/donottranslate-maps.xml
diff --git a/core/res/res/values-fr-rCA/arrays.xml b/core/res/res/values-fr-rCA/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-fr-rCA/arrays.xml
rename to core/res/res/values-fr-rCA/donottranslate-maps.xml
diff --git a/core/res/res/values-fr-rCH/arrays.xml b/core/res/res/values-fr-rCH/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-fr-rCH/arrays.xml
rename to core/res/res/values-fr-rCH/donottranslate-maps.xml
diff --git a/core/res/res/values-fr-rFR/arrays.xml b/core/res/res/values-fr-rFR/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-fr-rFR/arrays.xml
rename to core/res/res/values-fr-rFR/donottranslate-maps.xml
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index 3abc1b4..d044a70 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"Édition des données d\'un contact"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permet à l\'application de modifier les coordonnées (adresses) de vos contacts qui sont stockées sur votre tablette. Des applications malveillantes peuvent exploiter cette fonctionnalité pour effacer ou modifier ces coordonnées."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permet à l\'application de modifier les coordonnées (adresses) de vos contacts qui sont stockées sur votre téléphone. Des applications malveillantes peuvent exploiter cette fonctionnalité pour effacer ou modifier ces coordonnées."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"lire le journal d\'appels"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permet à l\'application de lire le journal d\'appels de votre tablette, y compris les données relatives aux appels entrants et sortants. Des applications malveillantes peuvent utiliser cette fonctionnalité pour envoyer vos données à des tiers."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permet à l\'application de lire le journal d\'appels de votre téléphone, y compris les données relatives aux appels entrants et sortants. Des applications malveillantes peuvent utiliser cette fonctionnalité pour envoyer vos données à des tiers."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"modifier le journal d\'appels"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permet à l\'application de lire le journal d\'appels de votre tablette, y compris les données relatives aux appels entrants et sortants. Des applications malveillantes peuvent utiliser cette fonctionnalité pour effacer ou modifier votre journal d\'appels."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permet à l\'application de lire le journal d\'appels de votre téléphone, y compris les données relatives aux appels entrants et sortants. Des applications malveillantes peuvent utiliser cette fonctionnalité pour effacer ou modifier votre journal d\'appels."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"lire vos données de profil"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permet à l\'application de lire les informations de profil stockées sur votre appareil, telles que votre nom et vos coordonnées, ou d\'en ajouter. D\'autres applications peuvent alors vous identifier et envoyer vos informations de profil à des tiers."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"modifier vos données de profil"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permet à l\'application de lire tous les mots, noms et expressions privés que l\'utilisateur a pu enregistrer dans son dictionnaire personnel."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"enregistrer dans le dictionnaire défini par l\'utilisateur"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permet à l\'application d\'enregistrer de nouveaux mots dans le dictionnaire personnel de l\'utilisateur."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"lire contenu de la mémoire USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"lire le contenu de la carte SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permet à l\'appli de lire contenu de mémoire USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permet à l\'application de lire le contenu de la carte SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"Modifier/Supprimer contenu mémoire USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modifier/supprimer le contenu de la carte SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permet à l\'application de modifier le contenu de la mémoire de stockage USB."</string>
diff --git a/core/res/res/values-hi-rIN/arrays.xml b/core/res/res/values-hi-rIN/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-hi-rIN/arrays.xml
rename to core/res/res/values-hi-rIN/donottranslate-maps.xml
diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml
index 5acca98..bd8863f 100644
--- a/core/res/res/values-hi/strings.xml
+++ b/core/res/res/values-hi/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"संपर्क डेटा लिखें"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"एप्लिकेशन को आपके टेबलेट में संग्रहीत संपर्क (पता) डेटा संशोधित करने देता है. दुर्भावनापूर्ण एप्लिकेशन इसका उपयोग आपके संपर्क डेटा को मिटाने या संशोधित करने में कर सकते हैं."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"एप्लिकेशन को आपके फ़ोन में संग्रहीत संपर्क (पता) डेटा संशोधित करने देता है. दुर्भावनापूर्ण एप्लिकेशन इसका उपयोग आपके संपर्क डेटा को मिटाने या संशोधित करने में कर सकते हैं."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"कॉल लॉग पढ़ें"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"एप्लिकेशन को इनकमिंग और आउटगोइंग कॉल के डेटा सहित, आपके टेबलेट का कॉल लॉग पढ़ने देता है. दुर्भावनापूर्ण एप्लिकेशन अन्य लोगों को आपका डेटा भेजने के लिए इसका उपयोग कर सकते हैं."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"एप्लिकेशन को इनकमिंग और आउटगोइंग कॉल के डेटा सहित, आपके फ़ोन का कॉल लॉग पढ़ने देता है. दुर्भावनापूर्ण एप्लिकेशन अन्य लोगों को आपका डेटा भेजने के लिए इसका उपयोग कर सकते हैं."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"कॉल लॉग लिखें"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"एप्लिकेशन को इनकमिंग और आउटगोइंग कॉल के डेटा सहित, आपके टेबलेट का कॉल लॉग संशोधित करने देता है. दुर्भावनापूर्ण एप्लिकेशन आपके कॉल लॉग को मिटाने या संशोधित करने के लिए इसका उपयोग कर सकते हैं."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"एप्लिकेशन को इनकमिंग और आउटगोइंग कॉल के डेटा सहित, आपके फ़ोन का कॉल लॉग संशोधित करने देता है. दुर्भावनापूर्ण एप्लिकेशन आपके कॉल लॉग को मिटाने या संशोधित करने के लिए इसका उपयोग कर सकते हैं."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"अपना प्रोफ़ाइल डेटा पढ़ें"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"एप्लिकेशन को आपके उपकरण में संग्रहीत नाम और संपर्क जानकारी जैसी निजी प्रोफ़ाइल जानकारी पढ़ने देता है. इसका अर्थ है कि एप्लिकेशन आपको पहचान सकता है और आपकी प्रोफ़ाइल की जानकारी अन्य लोगों को भेज सकता है."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"अपने प्रोफ़ाइल डेटा में लिखें"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"एप्लिकेशन को ऐसे निजी शब्दों, नामों और वाक्यांशों को पढ़ने देता है जो संभवत: उपयोगकर्ता द्वारा उपयोगकर्ता डिक्शनरी में संग्रहीत किए गए हों."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"उपयोगकर्ता-निर्धारित डिक्शनरी में लिखें"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"एप्लिकेशन को उपयोगकर्ता डिक्शनरी में नए शब्द लिखने देता है."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USB संग्रहण की सामग्री पढ़ें"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SD कार्ड की सामग्री पढ़ें"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"एप्लि. को USB संग्रहण की सामग्री पढ़ने देता है."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"एप्लिकेशन को SD कार्ड की सामग्री पढ़ने देता है."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USB संग्रहण सामग्रियों को संशोधित करें/हटाएं"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"SD कार्ड सामग्रियां संशोधित करें/हटाएं"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"एप्लि. को USB संग्रहण में लिखने देता है."</string>
diff --git a/core/res/res/values-hr/strings.xml b/core/res/res/values-hr/strings.xml
index 671bc8d..749012b 100644
--- a/core/res/res/values-hr/strings.xml
+++ b/core/res/res/values-hr/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"pisanje kontaktnih podataka"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Omogućuje aplikaciji da promijeni kontaktne podatke (adrese) pohranjene na tabletnom računalu. Zlonamjerne aplikacije mogu na taj način izbrisati ili promijeniti vaše kontaktne podatke."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Omogućuje aplikaciji da promijeni kontaktne podatke (adrese) pohranjene na telefonu. Zlonamjerne aplikacije mogu na taj način izbrisati ili promijeniti vaše kontaktne podatke."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"čitanje dnevnika poziva"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Aplikaciji omogućuje čitanje dnevnika poziva vašeg tabletnog računala zajedno s podacima o dolaznim i odlaznim pozivima. Zlonamjerne aplikacije to mogu upotrebljavati za slanje vaših podataka drugim osobama."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Aplikaciji omogućuje čitanje dnevnika poziva vašeg telefona zajedno s podacima o dolaznim i odlaznim pozivima. Zlonamjerne aplikacije to mogu upotrebljavati za slanje vaših podataka drugim osobama."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"pisanje u dnevnik poziva"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Aplikaciji omogućuje izmjenu dnevnika poziva vašeg tabletnog računala zajedno s podacima o dolaznim i odlaznim pozivima. Zlonamjerne aplikacije to mogu upotrebljavati za brisanje ili izmjenu vašeg dnevnika poziva."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Aplikaciji omogućuje izmjenu dnevnika poziva vašeg telefona zajedno s podacima o dolaznim i odlaznim pozivima. Zlonamjerne aplikacije to mogu upotrebljavati za brisanje ili izmjenu vašeg dnevnika poziva."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"čitanje podataka vašeg profila"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Omogućuje aplikaciji čitanje osobnih podataka profila pohranjenih na uređaju, kao što su vaše ime ili kontaktni podaci. To znači da vas aplikacija može identificirati i slati informacije s vašeg profila drugima."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"pisanje u podatke profila"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Aplikaciji omogućuje čitanje svih privatnih riječi, imena i izraza koje je korisnik pohranio u korisničkom rječniku."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"pisanje u korisnički definiran rječnik"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Aplikaciji omogućuje pisanje novih riječi u korisnički rječnik."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"čitanje sadržaja USB pohrane"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"čitanje sadržaja SD kartice"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Aplikaciji omog. čitanje sadržaja USB pohrane."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Aplikaciji omogućuje čitanje sadržaja SD kartice."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"izmjeni/briši sadržaje memorije USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"izmjena/brisanje sadržaja SD kartice"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Dopušta pisanje u USB pohranu."</string>
diff --git a/core/res/res/values-hu-rHU/arrays.xml b/core/res/res/values-hu-rHU/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-hu-rHU/arrays.xml
rename to core/res/res/values-hu-rHU/donottranslate-maps.xml
diff --git a/core/res/res/values-hu/strings.xml b/core/res/res/values-hu/strings.xml
index 20280b3..24a70d7 100644
--- a/core/res/res/values-hu/strings.xml
+++ b/core/res/res/values-hu/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"névjegyadatok írása"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Lehetővé teszi az alkalmazás számára, hogy módosítsa a táblagépen tárolt névjegy- (cím-) adatokat. A rosszindulatú alkalmazások felhasználhatják ezt a névjegyadatok törlésére vagy módosítására."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Lehetővé teszi az alkalmazás számára, hogy módosítsa a telefonon tárolt névjegy- (cím-) adatokat. A rosszindulatú alkalmazások felhasználhatják ezt a névjegyadatok törlésére vagy módosítására."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"Híváslista beolvasása"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Lehetővé teszi, hogy az alkalmazás hozzáférjen a táblagép híváslistájához, beleértve a bejövő és kimenő hívások adatait. A rosszindulatú alkalmazások ezt arra használhatják, hogy az adatait elküldjék másoknak."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Lehetővé teszi, hogy az alkalmazás hozzáférjen híváslistájához, beleértve a bejövő és kimenő hívások adatait. A rosszindulatú alkalmazások ezt arra használhatják, hogy az adatait elküldjék másoknak."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"Híváslista készítése"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Lehetővé teszi, hogy az alkalmazás módosítsa a táblagép híváslistáját, beleértve a bejövő és kimenő hívások adatait is. A rosszindulatú alkalmazások ezt arra használhatják, hogy híváslistáját töröljék vagy módosítsák."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Lehetővé teszi, hogy az alkalmazás módosítsa a telefon híváslistáját, beleértve a bejövő és kimenő hívások adatait is. A rosszindulatú alkalmazások ezt arra használhatják, hogy híváslistáját töröljék vagy módosítsák."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"olvassa el profiladatait"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Lehetővé teszi az alkalmazás számára a készüléken tárolt személyes profiladatok, például a név és elérhetőség olvasását. Ez azt jelenti, hogy más alkalmazások is azonosíthatják Önt, és elküldhetik másoknak a profiladatait."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"írás a profiladatokba"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Lehetővé teszi az alkalmazás számára, hogy olvassa a felhasználói szótárban tárolt saját szavakat, neveket és kifejezéseket."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"a felhasználó által definiált szótár írása"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Lehetővé teszi az alkalmazás számára, hogy új szavakat írjon a felhasználói szótárba."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USB-tár tartalmának beolvasása"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SD-kártya tartalmának beolvasása"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Beolvashat USB-tartalmakat."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Lehetővé teszi az alkalmazás számára SD-kártyák tartalmának beolvasását."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USB-tár tartalmának módosítása és törlése"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"az SD-kártya tartalmának módosítása és törlése"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Az alkalmazás USB-tárra írhat."</string>
diff --git a/core/res/res/values-in-rID/arrays.xml b/core/res/res/values-in-rID/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-in-rID/arrays.xml
rename to core/res/res/values-in-rID/donottranslate-maps.xml
diff --git a/core/res/res/values-in/strings.xml b/core/res/res/values-in/strings.xml
index 0807c4d..8384b48 100644
--- a/core/res/res/values-in/strings.xml
+++ b/core/res/res/values-in/strings.xml
@@ -277,7 +277,7 @@
<string name="permlab_bindWallpaper" msgid="8716400279937856462">"mengikat ke wallpaper"</string>
<string name="permdesc_bindWallpaper" msgid="7108428692595491668">"Mengizinkan pemegang mengikat antarmuka tingkat tinggi dari suatu wallpaper. Tidak pernah diperlukan oleh apl normal."</string>
<string name="permlab_bindRemoteViews" msgid="5697987759897367099">"mengikat ke layanan widget"</string>
- <string name="permdesc_bindRemoteViews" msgid="4717987810137692572">"Mengizinkan pemegang mengikat antarmuka tingkat tinggi dari suatu layanan gawit. Tidak pernah diperlukan oleh apl normal."</string>
+ <string name="permdesc_bindRemoteViews" msgid="4717987810137692572">"Mengizinkan pemegang mengikat antarmuka tingkat tinggi dari suatu layanan widget. Tidak pernah diperlukan oleh apl normal."</string>
<string name="permlab_bindDeviceAdmin" msgid="8704986163711455010">"berinteraksi dengan admin perangkat"</string>
<string name="permdesc_bindDeviceAdmin" msgid="569715419543907930">"Mengizinkan pemegang mengirimkan tujuan kepada administrator perangkat. Tidak pernah diperlukan oleh apl normal."</string>
<string name="permlab_setOrientation" msgid="3365947717163866844">"ubah orientasi layar"</string>
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"tuliskan data kenalan"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Mengizinkan apl mengubah data (alamat) kenalan yang tersimpan di tablet. Apl berbahaya dapat menggunakan ini untuk menghapus atau mengubah data kenalan Anda."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Mengizinkan apl memodifikasi data (alamat) kenalan yang tersimpan di ponsel Anda. Apl berbahaya dapat menggunakan ini untuk menghapus atau memodifikasi data kenalan Anda."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"membaca log panggilan"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Memungkinkan apl membaca log panggilan tablet Anda, termasuk data tentang panggilan masuk dan keluar. Apl berbahaya dapat menggunakan ini untuk mengirim data ke orang lain."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Memungkinkan apl membaca log panggilan ponsel Anda, termasuk data tentang panggilan masuk dan keluar. Apl berbahaya dapat menggunakan ini untuk mengirim data ke orang lain."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"menulis log panggilan"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Memungkinkan apl memodifikasi log panggilan tablet Anda, termasuk data tentang panggilan masuk dan keluar. Apl berbahaya dapat menggunakan ini untuk menghapus atau memodifikasi log panggilan Anda."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Memungkinkan apl memodifikasi log panggilan ponsel Anda, termasuk data tentang panggilan masuk dan keluar. Apl berbahaya dapat menggunakan ini untuk menghapus atau memodifikasi log panggilan Anda."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"membaca data profil Anda"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Mengizinkan apl membaca informasi profil pribadi yang tersimpan di perangkat Anda, misalnya nama dan informasi kenalan Anda. Ini artinya apl dapat mengenali dan mengirim informasi profil Anda ke orang lain."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"menulis ke data profil Anda"</string>
@@ -390,7 +396,7 @@
<string name="permdesc_asec_destroy" msgid="7218749286145526537">"Mengizinkan apl merusak penyimpanan internal."</string>
<string name="permlab_asec_mount_unmount" msgid="8877998101944999386">"memasang/melepas penyimpanan internal"</string>
<string name="permdesc_asec_mount_unmount" msgid="3451360114902490929">"Mengizinkan apl memasang/melepas penyimpanan internal."</string>
- <string name="permlab_asec_rename" msgid="7496633954080472417">"ubah nama penyimpanan internal"</string>
+ <string name="permlab_asec_rename" msgid="7496633954080472417">"ganti nama penyimpanan internal"</string>
<string name="permdesc_asec_rename" msgid="1794757588472127675">"Mengizinkan apl mengganti nama penyimpanan internal."</string>
<string name="permlab_vibrate" msgid="7768356019980849603">"mengontrol penggetar"</string>
<string name="permdesc_vibrate" msgid="6284989245902300945">"Mengizinkan aplikasi untuk mengendalikan vibrator."</string>
@@ -414,7 +420,7 @@
<string name="permlab_checkinProperties" msgid="7855259461268734914">"akses properti lapor masuk"</string>
<string name="permdesc_checkinProperties" msgid="4024526968630194128">"Mengizinkan apl membaca/menulis akses ke properti yang diunggah oleh layanan lapor masuk. Tidak untuk digunakan oleh apl normal."</string>
<string name="permlab_bindGadget" msgid="776905339015863471">"pilih widget"</string>
- <string name="permdesc_bindGadget" msgid="8261326938599049290">"Mengizinkan apl memberi tahu sistem tentang gawit mana yang dapat digunakan oleh suatu apl. Apl dengan izin ini dapat memberikan akses ke data pribadi untuk apl lain. Tidak untuk digunakan oleh apl normal."</string>
+ <string name="permdesc_bindGadget" msgid="8261326938599049290">"Mengizinkan apl memberi tahu sistem tentang widget mana yang dapat digunakan oleh suatu apl. Apl dengan izin ini dapat memberikan akses ke data pribadi untuk apl lain. Tidak untuk digunakan oleh apl normal."</string>
<string name="permlab_modifyPhoneState" msgid="8423923777659292228">"ubah kondisi ponsel"</string>
<string name="permdesc_modifyPhoneState" msgid="1029877529007686732">"Mengizinkan apl mengontrol fitur telepon perangkat. Apl dengan izin ini dapat mengalihkan jaringan, menyalakan dan mematikan radio ponsel, dan melakukan hal serupa lainnya tanpa pernah memberi tahu Anda."</string>
<string name="permlab_readPhoneState" msgid="2326172951448691631">"baca kondisi dan identitas ponsel"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Mengizinkan apl membaca kata, nama, dan frasa pribadi apa pun yang mungkin disimpan oleh pengguna di kamus pengguna."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"menulis ke kamus yang dibuat pengguna"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Mengizinkan apl menulis kata-kata baru ke dalam kamus pengguna."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"membaca konten penyimpanan USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"membaca konten kartu SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Mengizinkan apl membaca konten penyimpanan USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Mengizinkan apl membaca konten kartu SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"ubah/hapus konten penyimpanan USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"ubah/hapus isi kartu SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Mengizinkan apl menulis ke penyimpanan USB."</string>
@@ -1086,7 +1088,7 @@
<string name="permlab_copyProtectedData" msgid="4341036311211406692">"menyalin konten"</string>
<string name="permdesc_copyProtectedData" msgid="4390697124288317831">"Mengizinkan apl menjalankan layanan kontainer default untuk menyalin konten. Tidak untuk digunakan oleh apl normal."</string>
<string name="tutorial_double_tap_to_zoom_message_short" msgid="4070433208160063538">"Sentuh dua kali untuk mengontrol perbesar/perkecil"</string>
- <string name="gadget_host_error_inflating" msgid="4882004314906466162">"Tidak dapat menambahkan gawit."</string>
+ <string name="gadget_host_error_inflating" msgid="4882004314906466162">"Tidak dapat menambahkan widget."</string>
<string name="ime_action_go" msgid="8320845651737369027">"Buka"</string>
<string name="ime_action_search" msgid="658110271822807811">"Telusuri"</string>
<string name="ime_action_send" msgid="2316166556349314424">"Kirimkan"</string>
diff --git a/core/res/res/values-it-rCH/arrays.xml b/core/res/res/values-it-rCH/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-it-rCH/arrays.xml
rename to core/res/res/values-it-rCH/donottranslate-maps.xml
diff --git a/core/res/res/values-it-rIT/arrays.xml b/core/res/res/values-it-rIT/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-it-rIT/arrays.xml
rename to core/res/res/values-it-rIT/donottranslate-maps.xml
diff --git a/core/res/res/values-it/strings.xml b/core/res/res/values-it/strings.xml
index 2d1a413..75ed4e8 100644
--- a/core/res/res/values-it/strings.xml
+++ b/core/res/res/values-it/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"scrittura dati di contatto"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Consente all\'applicazione di modificare i dati di contatto (indirizzi) memorizzati sul tablet. Le applicazioni dannose potrebbero farne uso per cancellare o modificare i tuoi dati di contatto."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Consente all\'applicazione di modificare i dati di contatto (indirizzi) memorizzati sul telefono. Le applicazioni dannose potrebbero farne uso per cancellare o modificare i tuoi dati di contatto."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"lettura del registro chiamate"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Consente all\'applicazione di leggere il registro chiamate del tablet, inclusi i dati sulle chiamate in arrivo e in uscita. Le applicazioni dannose potrebbero fare uso di questa funzione per inviare dati ad altre persone."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Consente all\'applicazione di leggere il registro chiamate del telefono, inclusi i dati sulle chiamate in arrivo e in uscita. Le applicazioni dannose potrebbero fare uso di questa funzione per inviare dati ad altre persone."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"scrittura del registro chiamate"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Consente all\'applicazione di modificare il registro chiamate del tablet, inclusi i dati sulle chiamate in arrivo e in uscita. Le applicazioni dannose potrebbero farne uso per cancellare o modificare il registro chiamate."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Consente all\'applicazione di modificare il registro chiamate del telefono, inclusi i dati sulle chiamate in arrivo e in uscita. Le applicazioni dannose potrebbero farne uso per cancellare o modificare il registro chiamate."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"lettura dei tuoi dati profilo"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Consente all\'applicazione di leggere informazioni del profilo personale memorizzate sul dispositivo, come il tuo nome e le tue informazioni di contatto. Ciò significa che l\'applicazione può identificarti e inviare le tue informazioni di profilo ad altri."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"scrittura dati del profilo"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Consente all\'applicazione di leggere parole, frasi e nomi privati che l\'utente potrebbe aver memorizzato nel dizionario utente."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"scrittura nel dizionario definito dall\'utente"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Consente all\'applicazione di scrivere nuove parole nel dizionario utente."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"lettura contenuti archivio USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"lettura dei contenuti della scheda SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Consente di leggere l\'archivio USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Consente all\'applicazione di leggere contenuti della scheda SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modifica/eliminaz. contenuti archivio USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificare/eliminare i contenuti della scheda SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Consente all\'applicazione di scrivere nell\'archivio USB."</string>
diff --git a/core/res/res/values-iw-rIL/arrays.xml b/core/res/res/values-iw-rIL/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-iw-rIL/arrays.xml
rename to core/res/res/values-iw-rIL/donottranslate-maps.xml
diff --git a/core/res/res/values-iw/strings.xml b/core/res/res/values-iw/strings.xml
index e49b724..f51f232 100644
--- a/core/res/res/values-iw/strings.xml
+++ b/core/res/res/values-iw/strings.xml
@@ -130,7 +130,7 @@
<string name="low_memory" product="tablet" msgid="6494019234102154896">"שטח האחסון של הטבלט מלא. מחק קבצים כדי לפנות מקום."</string>
<string name="low_memory" product="default" msgid="3475999286680000541">"שטח האחסון של הטלפון מלא. מחק חלק מהקבצים כדי לפנות שטח."</string>
<string name="me" msgid="6545696007631404292">"אני"</string>
- <string name="power_dialog" product="tablet" msgid="8545351420865202853">"אפשרויות טבלט"</string>
+ <string name="power_dialog" product="tablet" msgid="8545351420865202853">"אפשרויות טאבלט"</string>
<string name="power_dialog" product="default" msgid="1319919075463988638">"אפשרויות טלפון"</string>
<string name="silent_mode" msgid="7167703389802618663">"מצב שקט"</string>
<string name="turn_on_radio" msgid="3912793092339962371">"הפעל חיבור אלחוטי"</string>
@@ -146,7 +146,7 @@
<string name="shutdown_confirm_question" msgid="2906544768881136183">"האם ברצונך לבצע כיבוי?"</string>
<string name="recent_tasks_title" msgid="3691764623638127888">"נוצרו לאחרונה"</string>
<string name="no_recent_tasks" msgid="8794906658732193473">"אין יישומים אחרונים"</string>
- <string name="global_actions" product="tablet" msgid="408477140088053665">"אפשרויות טבלט"</string>
+ <string name="global_actions" product="tablet" msgid="408477140088053665">"אפשרויות טאבלט"</string>
<string name="global_actions" product="default" msgid="2406416831541615258">"אפשרויות טלפון"</string>
<string name="global_action_lock" msgid="2844945191792119712">"נעילת מסך"</string>
<string name="global_action_power_off" msgid="4471879440839879722">"כיבוי"</string>
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"כתוב נתונים של אנשי קשר"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"מאפשר ליישום לשנות את פרטי הקשר (כתובת) המאוחסנים בטבלט. יישומים זדוניים עלולים להשתמש בכך כדי למחוק או לשנות את פרטי הקשר שלך."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"מאפשר ליישום לשנות את פרטי הקשר (כתובת) המאוחסנים בטלפון. יישומים זדוניים עלולים להשתמש בכך כדי למחוק או לשנות את פרטי הקשר שלך."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"קריאת יומן שיחות"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"מאפשר ליישום לקרוא את יומן השיחות של הטבלט, כולל נתונים על שיחות נכנסות ויוצאות. יישומים זדוניים עלולים לעשות בכך שימוש כדי לשלוח את הנתונים שלך לאנשים אחרים."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"מאפשר ליישום לקרוא את יומן השיחות של הטלפון, כולל נתונים על שיחות נכנסות ויוצאות. יישומים זדוניים עלולים לעשות בכך שימוש כדי לשלוח את הנתונים שלך לאנשים אחרים."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"כתיבת יומן שיחות"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"מאפשר ליישום לשנות את יומן השיחות של הטבלט, כולל נתונים על שיחות נכנסות ויוצאות. יישומים זדוניים עלולים לעשות בכך שימוש כדי למחוק או לשנות את יומן השיחות שלך."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"מאפשר ליישום לשנות את יומן השיחות של הטלפון, כולל נתונים על שיחות נכנסות ויוצאות. יישומים זדוניים עלולים לעשות בכך שימוש כדי למחוק או לשנות את יומן השיחות שלך."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"קרא את נתוני הפרופיל שלך"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"מאפשר ליישום לקרוא נתונים בפרטי הפרופיל האישי המאוחסנים במכשיר, כגון שמך ופרטי הקשר שלך. משמעות הדבר שהיישום יוכל לזהות אותך ולשלוח את מידע הפרופיל שלך לאנשים אחרים."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"כתוב בנתוני הפרופיל שלך"</string>
@@ -370,7 +376,7 @@
<string name="permdesc_recordAudio" msgid="2387462233976248635">"מאפשר ליישום לגשת לנתיב להקלטת אודיו."</string>
<string name="permlab_camera" msgid="3616391919559751192">"צלם תמונות וסרטונים"</string>
<string name="permdesc_camera" msgid="1507407407002492176">"מאפשר ליישום לצלם תמונות וסרטוני וידאו עם המצלמה. הגדרה זו מאפשרת ליישום לאסוף תמונות שהמצלמה קולטת בכל עת."</string>
- <string name="permlab_brick" product="tablet" msgid="2961292205764488304">"השבת טבלט לצמיתות"</string>
+ <string name="permlab_brick" product="tablet" msgid="2961292205764488304">"השבת טאבלט לצמיתות"</string>
<string name="permlab_brick" product="default" msgid="8337817093326370537">"השבת טלפון לצמיתות"</string>
<string name="permdesc_brick" product="tablet" msgid="4334818808001699530">"מאפשר ליישום להשבית את הטבלט כולו לצמיתות. זו הרשאה מסוכנת מאוד."</string>
<string name="permdesc_brick" product="default" msgid="5788903297627283099">"מאפשר ליישום להשבית את הטלפון כולו לצמיתות. זו הרשאה מסוכנת מאוד."</string>
@@ -406,7 +412,7 @@
<string name="permdesc_callPhone" msgid="6396463004110544744">"מאפשר ליישום להתקשר למספרי טלפון ללא התערבותך. יישומים זדוניים עלולים לגרום לחיובי שיחות בלתי צפויים בחשבון הטלפון שלך. לתשומת לבך, הרשאה זו לא מאפשרת ליישום להתקשר למספרי חירום."</string>
<string name="permlab_callPrivileged" msgid="4198349211108497879">"התקשר ישירות לכל מספר טלפון"</string>
<string name="permdesc_callPrivileged" msgid="1689024901509996810">"מאפשר ליישום להתקשר לכל מספר טלפון שהוא, כולל מספרי חירום, ללא התערבותך. יישומים זדוניים עלולים לבצע שיחות מיותרות ולא חוקיות לשירותי חירום."</string>
- <string name="permlab_performCdmaProvisioning" product="tablet" msgid="4842576994144604821">"הפעל ישירות התקנת טבלט מסוג CDMA"</string>
+ <string name="permlab_performCdmaProvisioning" product="tablet" msgid="4842576994144604821">"הפעל ישירות התקנת טאבלט מסוג CDMA"</string>
<string name="permlab_performCdmaProvisioning" product="default" msgid="5604848095315421425">"הפעל ישירות הגדרה של טלפון CDMA"</string>
<string name="permdesc_performCdmaProvisioning" msgid="1994193538802314186">"מאפשר ליישום להפעיל הקצאת CDMA. יישומים זדוניים עלולים להפעיל הקצאת CDMA ללא צורך."</string>
<string name="permlab_locationUpdates" msgid="7785408253364335740">"שלוט בהתראות על עדכון מיקום"</string>
@@ -423,7 +429,7 @@
<string name="permlab_wakeLock" product="default" msgid="573480187941496130">"מניעת מעבר הטלפון למצב שינה"</string>
<string name="permdesc_wakeLock" product="tablet" msgid="7311319824400447868">"מאפשר ליישום למנוע מהטבלט לעבור למצב שינה."</string>
<string name="permdesc_wakeLock" product="default" msgid="8559100677372928754">"מאפשר ליישום למנוע מהטלפון לעבור למצב שינה."</string>
- <string name="permlab_devicePower" product="tablet" msgid="2787034722616350417">"הפעלה או כיבוי של טבלט"</string>
+ <string name="permlab_devicePower" product="tablet" msgid="2787034722616350417">"הפעלה או כיבוי של טאבלט"</string>
<string name="permlab_devicePower" product="default" msgid="4928622470980943206">"הפעל או כבה את הטלפון"</string>
<string name="permdesc_devicePower" product="tablet" msgid="6689862878984631831">"מאפשר ליישום להפעיל או לכבות את הטבלט."</string>
<string name="permdesc_devicePower" product="default" msgid="6037057348463131032">"מאפשר ליישום להפעיל או לכבות את הטלפון."</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"מאפשר ליישום לקרוא מילים, שמות וביטויים פרטיים שהמשתמש אחסן במילון המשתמש."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"כתיבה למילון בהגדרת המשתמש"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"מאפשר ליישום לכתוב מילים חדשות במילון המשתמש."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"קריאת תוכן אחסון USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"קריאת תוכן כרטיס SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"מאפשר ליישום לקרוא את התוכן של אחסון USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"מאפשר ליישום לקרוא את התוכן של כרטיס SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"שנה/מחק תוכן באמצעי אחסון מסוג USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"שנה/מחק תוכן של כרטיס SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"מאפשר ליישום לכתוב להתקן האחסון מסוג USB."</string>
diff --git a/core/res/res/values-ja-rJP/arrays.xml b/core/res/res/values-ja-rJP/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ja-rJP/arrays.xml
rename to core/res/res/values-ja-rJP/donottranslate-maps.xml
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index 5512eaf..549c1e2 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"連絡先データの書き込み"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"タブレットに保存されている連絡先(アドレス)データの変更をアプリに許可します。この許可を悪意のあるアプリに利用されると、連絡先データが消去または変更される恐れがあります。"</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"携帯端末に保存されている連絡先(アドレス)データの変更をアプリに許可します。この許可を悪意のあるアプリに利用されると、連絡先データが消去または変更される恐れがあります。"</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"通話履歴の読み取り"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"タブレットの通話履歴(着信や発信のデータなど)の読み取りをアプリに許可します。この許可を悪意のあるアプリに利用されると、データが他のユーザーに送信される恐れがあります。"</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"携帯端末の通話履歴(着信や発信のデータなど)の読み取りをアプリに許可します。この許可を悪意のあるアプリに利用されると、データが他のユーザーに送信される恐れがあります。"</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"通話履歴の書き込み"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"タブレットの通話履歴(着信や発信のデータなど)の変更をアプリに許可します。この許可を悪意のあるアプリに利用されると、通話履歴が消去または変更される恐れがあります。"</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"携帯端末の通話履歴(着信や発信のデータなど)の変更をアプリに許可します。この許可を悪意のあるアプリに利用されると、通話履歴が消去または変更される恐れがあります。"</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"プロフィールデータの読み取り"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"端末に保存されている個人のプロフィール情報(名前、連絡先情報など)を読み取ることをアプリに許可します。許可すると、アプリではユーザーの身元を特定したりプロフィール情報を第三者に転送したりできるようになります。"</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"プロフィールデータに書き込む"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"ユーザーが単語リストに個人情報として登録した可能性のある語句や名前を読み込むことをアプリに許可します。"</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"単語リストへの書き込み"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"単語リストに新しい語句を書き込むことをアプリに許可します。"</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USBストレージの読み取り"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SDカードのコンテンツの読み取り"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"USBストレージの読み取りをアプリに許可します。"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"SDカードのコンテンツの読み取りをアプリに許可します。"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USBストレージのコンテンツの変更/削除"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"SDカードのコンテンツを修正/削除する"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"USBストレージへの書き込みをアプリに許可します。"</string>
diff --git a/core/res/res/values-ko-rKR/arrays.xml b/core/res/res/values-ko-rKR/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ko-rKR/arrays.xml
rename to core/res/res/values-ko-rKR/donottranslate-maps.xml
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index 29a7211..fc8e7b1 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"연락처 데이터 작성"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"앱이 태블릿에 저장된 모든 연락처(주소) 데이터를 읽을 수 있도록 허용합니다. 이 경우 악성 앱이 연락처 데이터를 지우거나 수정할 수 있습니다."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"앱이 휴대전화에 저장된 모든 연락처(주소) 데이터를 읽을 수 있도록 허용합니다. 이 경우 악성 앱이 연락처 데이터를 지우거나 수정할 수 있습니다."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"통화 기록 읽기"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"앱에서 수신 및 발신 통화 데이터를 포함하여 태블릿의 통화 기록을 읽을 수 있도록 허용합니다. 이 경우 악성 앱이 데이터를 다른 사용자에게 보낼 수 있습니다."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"앱에서 수신 및 발신 통화 데이터를 포함하여 휴대전화의 통화 기록을 읽을 수 있도록 허용합니다. 이 경우 악성 앱이 데이터를 다른 사용자에게 보낼 수 있습니다."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"통화 기록 쓰기"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"앱에서 수신 및 발신 통화 데이터를 포함하여 태블릿의 통화 기록을 수정할 수 있도록 허용합니다. 이 경우 악성 앱이 통화 기록을 지우거나 수정할 수 있습니다."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"앱에서 수신 및 발신 통화 데이터를 포함하여 휴대전화의 통화 기록을 수정할 수 있도록 허용합니다. 이 경우 악성 앱이 통화 기록을 지우거나 수정할 수 있습니다."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"프로필 데이터 읽기"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"앱이 기기에 저장된 개인 프로필 정보(예: 사용자 이름, 연락처 정보 등)를 읽을 수 있도록 허용합니다. 이는 앱이 사용자를 확인하고 다른 사용자들에게 해당 프로필 정보를 전송할 수 있다는 것을 의미합니다."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"프로필 데이터에 쓰기"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"앱이 사용자 사전에 보관되어 있는 비공개 단어, 이름 및 구문을 읽도록 허용합니다."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"사용자 정의 사전에 작성"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"앱이 사용자 사전에 새 단어를 입력할 수 있도록 허용합니다."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USB 저장소 콘텐츠 읽기"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SD 카드 콘텐츠 읽기"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"앱이 USB 콘텐츠를 읽도록 허용"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"앱이 SD 카드의 콘텐츠를 읽을 수 있도록 허용합니다."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USB 저장소 콘텐츠 수정/삭제"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"SD 카드 콘텐츠 수정/삭제"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"앱이 USB 저장소에 쓸 수 있도록 허용합니다."</string>
diff --git a/core/res/res/values-lt-rLT/arrays.xml b/core/res/res/values-lt-rLT/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-lt-rLT/arrays.xml
rename to core/res/res/values-lt-rLT/donottranslate-maps.xml
diff --git a/core/res/res/values-lt/strings.xml b/core/res/res/values-lt/strings.xml
index da747b62..5e9d3f4 100644
--- a/core/res/res/values-lt/strings.xml
+++ b/core/res/res/values-lt/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"rašyti adresatų duomenis"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Leidžiama programai keisti planšetiniame kompiuteryje saugomus kontaktinius (adreso) duomenis. Kenkėjiškos programos gali tai naudoti, kad ištrintų ar pakeistų jūsų kontaktinius duomenis."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Leidžiama programai keisti telefone saugomus kontaktinius (adreso) duomenis. Kenkėjiškos programos gali tai naudoti, kad ištrintų ar pakeistų jūsų kontaktinius duomenis."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"skaityti skambučių žurnalą"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Programai leidžiama skaityti planšetinio kompiuterio skambučių žurnalą, įskaitant duomenis apie gaunamus ir siunčiamus skambučius. Kenkėjiškos programos tai gali naudoti, kad išsiųstų jūsų duomenis kitiems žmonėms."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Programai leidžiama skaityti telefono skambučių žurnalą, įskaitant duomenis apie gaunamus ir siunčiamus skambučius. Kenkėjiškos programos tai gali naudoti, kad išsiųstų jūsų duomenis kitiems žmonėms."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"rašyti skambučių žurnalą"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Programai leidžiama skaityti planšetinio kompiuterio skambučių žurnalą, įskaitant duomenis apie gaunamus ir siunčiamus skambučius. Kenkėjiškos programos tai gali naudoti, kad ištrintų ar keistų jūsų skambučių žurnalą."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Programai leidžiama skaityti telefono skambučių žurnalą, įskaitant duomenis apie gaunamus ir siunčiamus skambučius. Kenkėjiškos programos tai gali naudoti, kad ištrintų ar keistų jūsų skambučių žurnalą."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"skaityti profilio duomenis"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Leidžiama programai skaityti asmeninę profilio informaciją, saugomą jūsų įrenginyje, pvz., jūsų vardą, pavardę ir kontaktinę informaciją. Tai reiškia, kad programa gali nustatyti jūsų tapatybę ir siųsti profilio informaciją kitiems."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"rašyti kaip profilio duomenis"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Leidžiama programai skaityti privačius žodžius, vardus ir frazes, kuriuos naudotojas išsaugojo naudotojo žodyne."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"rašyti naudotojo nustatytame žodyne"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Leidžiama programai rašyti naujus žodžius į naudotojo žodyną."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"skaityti USB atmint. turinį"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"skaityti SD kortelės turinį"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Leid. progr. skait. USB turin."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Leidžiama programai skaityti SD kortelės turinį."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"keisti / ištrinti USB atmintinės turinį"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"keisti / ištrinti SD kortelės turinį"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Leidž. progr. raš. į USB atm."</string>
diff --git a/core/res/res/values-lv-rLV/arrays.xml b/core/res/res/values-lv-rLV/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-lv-rLV/arrays.xml
rename to core/res/res/values-lv-rLV/donottranslate-maps.xml
diff --git a/core/res/res/values-lv/strings.xml b/core/res/res/values-lv/strings.xml
index c96df5e..a568c3b 100644
--- a/core/res/res/values-lv/strings.xml
+++ b/core/res/res/values-lv/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"rakstīt kontaktpersonu datus"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Ļauj lietotnei modificēt planšetdatorā saglabātos kontaktpersonu (adrešu) datus. Ļaunprātīgas lietotnes to var izmantot, lai dzēstu vai modificētu kontaktpersonu datus."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Ļauj lietotnei modificēt tālrunī saglabātos kontaktpersonu (adrešu) datus. Ļaunprātīgas lietotnes to var izmantot, lai dzēstu vai modificētu kontaktpersonu datus."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"nolasīt zvanu žurnālu"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Ļauj lietotnei nolasīt planšetdatora zvanu žurnālu, tostarp ienākošo un izejošo zvanu datus. Ļaunprātīgas lietotnes var to izmantot, lai sūtītu jūsu datus citām personām."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Ļauj lietotnei nolasīt tālruņa zvanu žurnālu, tostarp ienākošo un izejošo zvanu datus. Ļaunprātīgas lietotnes var to izmantot, lai sūtītu jūsu datus citām personām."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"rakstīt zvanu žurnālā"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Ļauj lietotnei pārveidot planšetdatora zvanu žurnālu, tostarp ienākošo un izejošo zvanu datus. Ļaunprātīgas lietotnes var to izmantot, lai dzēstu vai pārveidotu savu zvanu žurnālu."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Ļauj lietotnei pārveidot tālruņa zvanu žurnālu, tostarp ienākošo un izejošo zvanu datus. Ļaunprātīgas lietotnes var to izmantot, lai dzēstu vai pārveidotu savu zvanu žurnālu."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"jūsu profila datu lasīšana"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Ļauj lietotnei lasīt ierīcē saglabāto personīgā profila informāciju, piemēram, jūsu vārdu un kontaktinformāciju. Tas nozīmē, ka lietotne var jūs identificēt un sūtīt jūsu profila informāciju citām personām."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"rakstīšana jūsu profila datos"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Ļauj lietotnei lasīt jebkurus privātu vārdus, nosaukumus un frāzes, ko lietotājs saglabājis savā lietotāja vārdnīcā."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"rakstīt lietotāja noteiktā vārdnīcā"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Ļauj lietotnei rakstīt jaunus vārdus lietotāja vārdnīcā."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"lasīt USB atmiņas saturu"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"lasīt SD kartes saturu"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Ļauj liet. lasīt USB atm. sat."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Ļauj lietotnei lasīt SD kartes saturu."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"pārveidot/dzēst USB kr. sat."</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"pārveidot/dzēst SD kartes saturu"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Ļauj lietotnei rakstīt USB atmiņā."</string>
diff --git a/core/res/res/values-mcc204/arrays.xml b/core/res/res/values-mcc204/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-mcc204/arrays.xml
rename to core/res/res/values-mcc204/donottranslate-maps.xml
diff --git a/core/res/res/values-mcc230/arrays.xml b/core/res/res/values-mcc230/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-mcc230/arrays.xml
rename to core/res/res/values-mcc230/donottranslate-maps.xml
diff --git a/core/res/res/values-mcc232/arrays.xml b/core/res/res/values-mcc232/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-mcc232/arrays.xml
rename to core/res/res/values-mcc232/donottranslate-maps.xml
diff --git a/core/res/res/values-mcc260/arrays.xml b/core/res/res/values-mcc260/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-mcc260/arrays.xml
rename to core/res/res/values-mcc260/donottranslate-maps.xml
diff --git a/core/res/res/values-mcc262/arrays.xml b/core/res/res/values-mcc262/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-mcc262/arrays.xml
rename to core/res/res/values-mcc262/donottranslate-maps.xml
diff --git a/core/res/res/values-ms-rMY/arrays.xml b/core/res/res/values-ms-rMY/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ms-rMY/arrays.xml
rename to core/res/res/values-ms-rMY/donottranslate-maps.xml
diff --git a/core/res/res/values-ms/strings.xml b/core/res/res/values-ms/strings.xml
index f97f481..363832d 100644
--- a/core/res/res/values-ms/strings.xml
+++ b/core/res/res/values-ms/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"tulis data kenalan"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Membenarkan apl untuk mengubah suai data kenalan (alamat) yang disimpan pada tablet anda. Apl hasad boleh menggunakannya untuk memadam atau mengubah suai data kenalan anda."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Membenarkan apl untuk mengubah suai data kenalan (alamat) yang disimpan pada telefon anda. Apl hasad boleh menggunakannya untuk memadam atau mengubah suai data kenalan anda."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"baca log panggilan"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Membenarkan apl membaca log panggilan tablet anda, termasuk data tentang panggilan masuk dan keluar. Apl hasad boleh menggunakannya untuk menghantar data anda kepada orang lain."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Membenarkan apl membaca log panggilan telefon anda, termasuk data tentang panggilan masuk dan keluar. Apl hasad boleh menggunakannya untuk menghantar data anda kepada orang lain."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"tulis log panggilan"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Membenarkan apl untuk mengubah suai panggilan tablet anda, termasuk data tentang panggilan masuk dan keluar. Apl hasad boleh menggunakannya untuk memadam atau mengubah suai log panggilan anda."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Membenarkan apl untuk mengubah suai panggilan telefon anda, termasuk data tentang panggilan masuk dan keluar. Apl hasad boleh menggunakannya untuk memadam atau mengubah suai log panggilan anda."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"baca data profil anda"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Membenarkan apl untuk membaca maklumat profil peribadi yang disimpan dalam peranti anda, seperti nama dan maklumat kenalan anda. Ini bermakna apl lain boleh mengenal pasti anda dan menghantar maklumat profil anda kepada orang lain."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"tulis ke data profil anda"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Membenarkan apl membaca sebarang kata-kata peribadi, nama dan frasa yang mungkin telah disimpan oleh pengguna dalam kamus pengguna."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"tulis ke kamus yang ditakrifkan pengguna"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Membenarkan apl menulis perkataan baharu ke dalam kamus pengguna."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"baca kandungan storan USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"baca kandungan kad SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Membenarkan apl membaca kandungan storan USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Membenarkan apl membaca kandungan kad SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"ubah suai/padam kdgn storn USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"ubah suai/padamkan kandungan kad SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Membenarkan apl menulis ke storan USB."</string>
diff --git a/core/res/res/values-nb-rNO/arrays.xml b/core/res/res/values-nb-rNO/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-nb-rNO/arrays.xml
rename to core/res/res/values-nb-rNO/donottranslate-maps.xml
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index 9e3e480..384fdac 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"skrive kontaktinformasjon"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Lar appen lese alle kontaktdataene (adressene) som er lagret på nettbrettet. Ondsinnede apper kan bruke dette til å slette eller endre kontaktdataene dine."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Lar appen lese alle kontaktdataene (adressene) som er lagret på telefonen. Ondsinnede apper kan bruke dette til å slette eller endre kontaktdataene dine."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"lar appen lese anropsloggen"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Lar appen lese nettbrettets samtalelogg, inkludert data om innkommende og utgående anrop. Skadelige apper kan utnytte denne tillatelsen til å sende dataene dine til andre personer."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Lar appen lese telefonens samtalelogg, inkludert data om innkommende og utgående anrop. Skadelige apper kan utnytte denne tillatelsen til å sende dataene dine til andre personer."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"lar appen endre samtaleloggen"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Lar appen endre nettbrettets samtalelogg, inkludert data om innkommende og utgående anrop. Skadelige apper kan utnytte denne tillatelsen til å slette eller endre samtaleloggen din."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Lar appen endre telefonens samtalelogg, inkludert data om innkommende og utgående anrop. Skadelige apper kan utnytte denne tillatelsen til å slette eller endre samtaleloggen din."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"lese profildataene dine"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Lar appen lese personlige profilinformasjon som er lagret på enheten, som for eksempel navn og kontaktinformasjon. Dette betyr at appen kan identifisere deg og sende profilinformasjonen din til andre."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"skriv til profildataene dine"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Lar appen lese eventuelle private ord, navn og uttrykk som brukeren kan ha lagret i brukerordlisten."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"skrive i brukerdefinert ordliste"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Lar appen skrive nye ord i brukerordlisten."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"lese innhold på USB-lagr."</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"lese innhold på SD-kortet"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Lar appen lese innhold på USB-lager."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Lar appen lese innhold på SD-kortet."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"endre/slette innh. i USB-lagr."</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"redigere/slette innhold på minnekort"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Gir appen tillatelse til å skrive til USB-lagringen."</string>
diff --git a/core/res/res/values-nl-rBE/arrays.xml b/core/res/res/values-nl-rBE/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-nl-rBE/arrays.xml
rename to core/res/res/values-nl-rBE/donottranslate-maps.xml
diff --git a/core/res/res/values-nl-rNL/arrays.xml b/core/res/res/values-nl-rNL/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-nl-rNL/arrays.xml
rename to core/res/res/values-nl-rNL/donottranslate-maps.xml
diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml
index 8946bbb..030222d 100644
--- a/core/res/res/values-nl/strings.xml
+++ b/core/res/res/values-nl/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"contactgegevens schrijven"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Hiermee kan de app de op uw tablet opgeslagen contactgegevens (adresgegevens) wijzigen. Schadelijke apps kunnen hiermee uw contactgegevens verwijderen of wijzigen."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Hiermee kan de app de op uw telefoon opgeslagen contactgegevens (adresgegevens) wijzigen. Schadelijke apps kunnen hiermee uw contactgegevens verwijderen of wijzigen."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"oproeplogboek lezen"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Toestaan dat de app het oproeplogboek van uw tablet leest, waaronder gegevens over inkomende en uitgaande oproepen. Schadelijke apps kunnen hiermee uw gegevens naar andere personen verzenden."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Toestaan dat de app het oproeplogboek van uw telefoon leest, waaronder gegevens over inkomende en uitgaande oproepen. Schadelijke apps kunnen hiermee uw gegevens naar andere personen verzenden."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"oproeplogboek schrijven"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Toestaan dat de app het oproeplogboek van uw tablet aanpast, waaronder gegevens over inkomende en uitgaande oproepen. Schadelijke apps kunnen hiermee uw oproeplogboek wissen of aanpassen."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Toestaan dat de app het oproeplogboek van uw telefoon aanpast, waaronder gegevens over inkomende en uitgaande oproepen. Schadelijke apps kunnen hiermee uw oproeplogboek wissen of aanpassen."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"uw profielgegevens lezen"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Hiermee kan de app persoonlijke profielgegevens lezen die op uw apparaat zijn opgeslagen, zoals uw naam en contactgegevens. Dit betekent dat de app u kan identificeren en uw profielgegevens naar anderen kan verzenden."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"schrijven naar profielgegevens"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Hiermee kan de app privéwoorden, namen en woordcombinaties lezen die de gebruiker heeft opgeslagen in het gebruikerswoordenboek."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"schrijven naar door gebruiker gedefinieerd woordenboek"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Hiermee kan de app nieuwe woorden schrijven naar het gebruikerswoordenboek."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"inhoud van USB-opslag lezen"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"inhoud van SD-kaart lezen"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"App kan inhoud van USB lezen."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Hiermee kan de app de inhoud van de SD-kaart lezen."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"inhoud van USB-opslag aanpassen/verwijderen"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"inhoud op de SD-kaart aanpassen/verwijderen"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Hiermee kan de app schrijven naar de USB-opslag."</string>
diff --git a/core/res/res/values-pl-rPL/arrays.xml b/core/res/res/values-pl-rPL/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-pl-rPL/arrays.xml
rename to core/res/res/values-pl-rPL/donottranslate-maps.xml
diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml
index a1bfa7c..9e4cbf3 100644
--- a/core/res/res/values-pl/strings.xml
+++ b/core/res/res/values-pl/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"zapisywanie danych kontaktowych"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Pozwala aplikacji na zmianę danych kontaktowych (adresowych) zapisanych w tablecie. Złośliwe aplikacje mogą to wykorzystać w celu usunięcia lub zmodyfikowania Twoich danych kontaktowych."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Pozwala aplikacji na zmianę danych kontaktowych (adresowych) zapisanych w telefonie. Złośliwe aplikacje mogą to wykorzystać do usunięcia lub zmodyfikowania Twoich danych kontaktowych."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"czytanie rejestru połączeń"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Zezwala aplikacji na odczytywanie rejestru połączeń tabletu, w tym danych o połączeniach przychodzących i wychodzących. Złośliwe aplikacje mogą wykorzystywać tę możliwość, by wysyłać dane do innych osób."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Zezwala aplikacji na odczytywanie rejestru połączeń telefonu, w tym danych o połączeniach przychodzących i wychodzących. Złośliwe aplikacje mogą wykorzystywać tę możliwość, by wysyłać dane do innych osób."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"zapisywanie rejestru połączeń"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Zezwala aplikacji na modyfikowanie rejestru połączeń tabletu, w tym danych o połączeniach przychodzących i wychodzących. Złośliwe aplikacje mogą wykorzystać tę możliwość, by wyczyścić lub zmodyfikować rejestr połączeń."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Zezwala aplikacji na modyfikowanie rejestru połączeń telefonu, w tym danych o połączeniach przychodzących i wychodzących. Złośliwe aplikacje mogą wykorzystać tę możliwość, by wyczyścić lub zmodyfikować rejestr połączeń."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"odczyt danych z Twojego profilu"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Pozwala aplikacji na odczyt informacji, takich jak Twoje nazwisko i informacje kontaktowe, z profilu osobistego przechowywanego na urządzeniu. Oznacza to, że inne aplikacje mogą Cię zidentyfikować i przesłać informacje z Twojego profilu do innych osób."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"zapis danych w Twoim profilu"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Pozwala aplikacji na odczytywanie wszelkich prywatnych słów, nazw i wyrażeń zapisanych w słowniku użytkownika."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"zapisywanie w słowniku zdefiniowanym przez użytkownika"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Pozwala aplikacji na zapisywanie nowych słów do słownika użytkownika."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"odczyt zawartości pamięci USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"odczyt zawartości karty SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Pozwala aplikacji na odczyt pamięci USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Pozwala aplikacji na odczyt karty SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"Modyfikowanie/usuwanie z nośnika USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modyfikowanie/usuwanie zawartości karty SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Pozwala aplikacji na zapis w pamięci USB."</string>
diff --git a/core/res/res/values-pt-rBR/arrays.xml b/core/res/res/values-pt-rBR/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-pt-rBR/arrays.xml
rename to core/res/res/values-pt-rBR/donottranslate-maps.xml
diff --git a/core/res/res/values-pt-rPT/arrays.xml b/core/res/res/values-pt-rPT/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-pt-rPT/arrays.xml
rename to core/res/res/values-pt-rPT/donottranslate-maps.xml
diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml
index e5b2628..abe1454 100644
--- a/core/res/res/values-pt-rPT/strings.xml
+++ b/core/res/res/values-pt-rPT/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"escrever dados de contacto"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permite que a aplicação modifique os dados de contacto (endereço) armazenados no tablet. As aplicações maliciosas podem utilizar isto para apagar ou modificar os dados dos seus contactos."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permite que uma aplicação modifique os dados de contacto (endereço) armazenados no telemóvel. As aplicações maliciosas podem utilizar isto para apagar ou modificar os dados dos seus contactos."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"ler registo de chamadas"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permite à aplicação ler o registo de chamadas do tablet, incluindo os dados sobre as chamadas recebidas e efetuadas. As aplicações maliciosas podem utilizar esta funcionalidade para enviar os seus dados para outras pessoas."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permite que a aplicação leia o registo de chamadas do telemóvel, incluindo os dados sobre as chamadas recebidas e efetuadas. As aplicações maliciosas podem utilizar esta funcionalidade para enviar os seus dados para outras pessoas."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"escrever registo de chamadas"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permite à aplicação modificar o registo de chamadas do tablet, incluindo os dados sobre as chamadas recebidas e efetuadas. As aplicações maliciosas podem utilizar esta funcionalidade para apagar ou modificar o registo de chamadas."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permite à aplicação modificar o registo de chamadas do telemóvel, incluindo os dados sobre as chamadas recebidas e efetuadas. As aplicações maliciosas podem utilizar esta funcionalidade para apagar ou modificar o seu registo de chamadas."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"ler os dados do perfil"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permite que a aplicação leia dados de perfil pessoais armazenados no seu aparelho, como o seu nome e dados de contacto. Isto significa que outras aplicações podem identificá-lo e enviar os seus dados de perfil a terceiros."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"escrever nos dados do seu perfil"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permite à aplicação ler quaisquer palavras, nomes e expressões privadas que o utilizador possa ter armazenado no dicionário do utilizador."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"escrever no dicionário definido pelo utilizador"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permite à aplicação escrever novas palavras no dicionário do utilizador."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"ler conteúdo da memória USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"ler conteúdo do cartão SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permite que a aplicação leia conteúdos da memória USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permite que a aplicação leia conteúdos do cartão SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"mod./elim. conteúdo do armaz. USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificar/eliminar conteúdo do cartão SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permite que a aplicação escreva na unidade de armazenamento USB."</string>
diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml
index c9794c1..3ae566c 100644
--- a/core/res/res/values-pt/strings.xml
+++ b/core/res/res/values-pt/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"gravar dados de contato"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permite que o aplicativo modifique os dados de contato (endereço) armazenados em seu tablet. Aplicativos maliciosos podem usar esse recurso para apagar ou modificar seus dados de contato."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permite que o aplicativo modifique os dados de contato (endereço) armazenados em seu telefone. Aplicativos maliciosos podem usar esse recurso para apagar ou modificar seus dados de contato."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"ler registro de chamadas"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permite que o aplicativo leia o registro de chamadas de seu tablet, incluindo dados sobre chamadas recebidas e efetuadas. Aplicativos maliciosos podem usar esta permissão para enviar seus dados para outras pessoas."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permite que o aplicativo leia o registro de chamadas de seu telefone, incluindo dados sobre chamadas recebidas e efetuadas. Aplicativos maliciosos podem usar esta permissão para enviar seus dados para outras pessoas."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"salvar no registo de chamadas"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permite que o aplicativo modifique o registro de chamadas de seu tablet, incluindo dados sobre chamadas recebidas e efetuadas. Aplicativos maliciosos podem usar esta permissão para apagar ou modificar seu registro de chamadas."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permite que o aplicativo modifique o registro de chamadas de seu telefone, incluindo dados sobre chamadas recebidas e efetuadas. Aplicativos maliciosos podem usar esta permissão para apagar ou modificar seu registro de chamadas."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"ler dados de seu perfil"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permite que o aplicativo leia informações de perfil pessoais armazenadas em seu dispositivo, como seu nome e informações de contato. Isso significa que o aplicativo pode identificá-lo e enviar suas informações de perfil para outros aplicativos."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"escrever nos dados do perfil"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permite que o aplicativo leia palavras, nomes e frases particulares armazenados pelo usuário no dicionário do usuário."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"gravar no dicionário definido pelo usuário"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permite que o aplicativo grave novas palavras no dicionário do usuário."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"ler conteúdo do armaz. USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"ler conteúdo do cartão SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permite apl. ler cont. arm USB"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permite que o aplicativo leia o conteúdo do cartão SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modificar/excluir cont. USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificar/excluir conteúdo do cartão SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permite gravar no armaz. USB."</string>
diff --git a/core/res/res/values-rm-rCH/arrays.xml b/core/res/res/values-rm-rCH/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-rm-rCH/arrays.xml
rename to core/res/res/values-rm-rCH/donottranslate-maps.xml
diff --git a/core/res/res/values-rm/strings.xml b/core/res/res/values-rm/strings.xml
index c58a0a3..fc6a510 100644
--- a/core/res/res/values-rm/strings.xml
+++ b/core/res/res/values-rm/strings.xml
@@ -489,6 +489,18 @@
<skip />
<!-- no translation found for permdesc_writeContacts (5075164818647934067) -->
<skip />
+ <!-- no translation found for permlab_readCallLog (3478133184624102739) -->
+ <skip />
+ <!-- no translation found for permdesc_readCallLog (3995157599976515002) -->
+ <skip />
+ <!-- no translation found for permdesc_readCallLog (3452017559804750758) -->
+ <skip />
+ <!-- no translation found for permlab_writeCallLog (8552045664743499354) -->
+ <skip />
+ <!-- no translation found for permdesc_writeCallLog (6661806062274119245) -->
+ <skip />
+ <!-- no translation found for permdesc_writeCallLog (683941736352787842) -->
+ <skip />
<!-- no translation found for permlab_readProfile (6824681438529842282) -->
<skip />
<!-- no translation found for permdesc_readProfile (94520753797630679) -->
diff --git a/core/res/res/values-ro-rRO/arrays.xml b/core/res/res/values-ro-rRO/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ro-rRO/arrays.xml
rename to core/res/res/values-ro-rRO/donottranslate-maps.xml
diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml
index 3f3658c..d443d1d 100644
--- a/core/res/res/values-ro/strings.xml
+++ b/core/res/res/values-ro/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"scriere date de contact"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Permite aplicaţiei să modifice datele de contact (adresele) stocate pe tabletă. Aplicaţiile rău intenţionate pot să utilizeze această permisiune pentru a şterge sau a modifica datele dvs. de contact."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Permite aplicaţiei să modifice datele de contact (adresele) stocate pe telefon. Aplicaţiile rău intenţionate pot să utilizeze această permisiune pentru a şterge sau pentru a modifica datele dvs. de contact."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"citeşte jurnalul de apeluri"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Permite aplicaţiei să citească jurnalul de apeluri al tabletei dvs., inclusiv datele despre apelurile primite sau efectuate. Aplicaţiile rău intenţionate pot utiliza această permisiune pentru a trimite datele dvs. altor persoane."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Permite aplicaţiei să citească jurnalul de apeluri al telefonului dvs., inclusiv datele despre apelurile primite sau efectuate. Aplicaţiile rău intenţionate pot utiliza această permisiune pentru a trimite datele dvs. altor persoane."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"scrie jurnalul de apeluri"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Permite aplicaţiei să modifice jurnalul de apeluri al tabletei dvs., inclusiv datele despre apelurile primite sau efectuate. Aplicaţiile rău intenţionate pot utiliza această permisiune pentru a şterge sau pentru a modifica jurnalul dvs. de apeluri."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Permite aplicaţiei să modifice jurnalul de apeluri al telefonului dvs., inclusiv datele despre apelurile primite sau efectuate. Aplicaţiile rău intenţionate pot utiliza această permisiune pentru a şterge sau pentru a modifica jurnalul dvs. de apeluri."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"citire date din profilul dvs."</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Permite aplicaţiei să citească informaţii de profil personal stocate pe dispozitiv, cum ar fi numele şi informaţiile de contact, ceea ce înseamnă că aplicaţia vă poate identifica şi poate trimite informaţiile dvs. de profil altor utilizatori."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"scriere date în profilul dvs."</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Permite aplicaţiei să citească cuvinte, nume şi expresii private stocate de utilizator în dicţionarul său."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"scriere în dicţionarul definit de utilizator"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Permite aplicaţiei să scrie cuvinte noi în dicţionarul utilizatorului."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"citeşte conţinutul stoc. USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"citeşte conţinutul cardului SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Permite aplic. citirea conţinutului stoc. USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Permite aplicaţiei să citească conţinutul cardului SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"modificare/ştergere a conţinutului stocării USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"modificare/ştergere conţinut card SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Permite scriere în stoc. USB."</string>
diff --git a/core/res/res/values-ru-rRU/arrays.xml b/core/res/res/values-ru-rRU/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-ru-rRU/arrays.xml
rename to core/res/res/values-ru-rRU/donottranslate-maps.xml
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index 458d107..5ed4c2e 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"перезаписывать данные контакта"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Приложение сможет изменять адреса, сохраненные на планшетном ПК. Вредоносные программы смогут таким образом удалять и изменять данные ваших контактов."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Приложение сможет изменять адреса, сохраненные на телефоне. Вредоносные программы смогут таким образом удалять и изменять данные ваших контактов."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"чтение журнала вызовов"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Приложение получит доступ к списку вызовов планшетного ПК, включая данные о входящих и исходящих звонках. Вредоносные приложения могут использовать доступ для передачи ваших данных третьим лицам."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Приложение получит доступ к списку вызовов телефона, включая данные о входящих и исходящих звонках. Вредоносные приложения смогут воспользоваться этим, чтобы отправить ваши данные третьим лицам."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"запись журнала вызовов"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Приложение сможет вносить изменения в список вызовов планшетного ПК и данные о входящих и исходящих звонках. Вредоносные приложения смогут воспользоваться этим для удаления или изменения информации о звонках."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Приложение сможет вносить изменения в список вызовов телефона и данные о входящих и исходящих звонках. Вредоносные приложения смогут воспользоваться этим для удаления или изменения информации о звонках."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"просматривать данные профиля"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Приложение сможет считывать информацию личного профиля, сохраненную на устройстве, такую как ваше имя и контактные данные. Это означает, что приложение сможет получить ваши личные данные и отправить их другим пользователям."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"изменение данных профиля"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Приложение получит доступ ко всем словам, именам и фразам, которые хранятся в пользовательском словаре."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"запись данных в пользовательский словарь"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Приложение сможет добавлять слова в пользовательский словарь."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"чтение данных с USB-накопителя"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"чтение данных с SD-карты"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Приложение сможет считывать данные с USB-накопителя."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Приложение сможет считывать данные с SD-карты."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"доступ к USB-накопителю"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"изменять/удалять содержимое SD-карты"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Приложение сможет записывать данные на USB-накопитель."</string>
diff --git a/core/res/res/values-sk-rSK/arrays.xml b/core/res/res/values-sk-rSK/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-sk-rSK/arrays.xml
rename to core/res/res/values-sk-rSK/donottranslate-maps.xml
diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml
index 3c90000..2e97b82 100644
--- a/core/res/res/values-sk/strings.xml
+++ b/core/res/res/values-sk/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"zápis údajov kontaktov"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Umožňuje aplikácii zmeniť všetky kontaktné údaje (adresy) uložené v tablete. Škodlivé aplikácie to môžu využiť a vymazať alebo zmeniť vaše kontaktné údaje."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Umožňuje aplikácii čítať všetky kontaktné údaje (adresy) uložené v telefóne. Škodlivé aplikácie to môžu využiť na odoslanie vašich údajov iným osobám."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"čítať denník hovorov"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Umožňuje aplikácii čítať denník hovorov vo vašom tablete vrátane údajov o prichádzajúcich a odchádzajúcich hovoroch. Škodlivé aplikácie to môžu zneužiť na odosielanie vašich údajov iným osobám."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Umožňuje aplikácii čítať denník hovorov vo vašom telefóne vrátane údajov o prichádzajúcich a odchádzajúcich hovoroch. Škodlivé aplikácie to môžu zneužiť na odosielanie vašich údajov iným osobám."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"zapisovať do denníka hovorov"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Umožňuje aplikácii upravovať denník hovorov vo vašom tablete vrátane údajov o prichádzajúcich a odchádzajúcich hovoroch. Škodlivé aplikácie to môžu zneužiť na vymazanie alebo úpravu vášho denníka hovorov."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Umožňuje aplikácii upravovať denník hovorov vo vašom telefóne vrátane údajov o prichádzajúcich a odchádzajúcich hovoroch. Škodlivé aplikácie to môžu zneužiť na vymazanie alebo úpravu vášho denníka hovorov."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"čítať údaje vášho profilu"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Umožňuje aplikácii čítať informácie v osobnom profile uložené vo vašom zariadení, ako je vaše meno a kontaktné informácie. Znamená to, že ďalšie aplikácie vás môžu identifikovať a poslať ostatným informácie o vašom profile."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"zapisovať do údajov profilu"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Umožňuje aplikácii čítať súkromné slová, názvy a frázy, ktoré mohol používateľ uložiť do slovníka používateľa."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"zapisovať do slovníka definovaného používateľom"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Umožňuje aplikácii zapisovať nové slová do používateľského slovníka."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"čítanie obsahu úložiska USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"čítanie obsahu karty SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Umožňuje apl. čítať obsah USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Umožňuje aplikácii čítať obsah karty SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"upraviť/odstrániť obsah ukl. pr. USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"Zmeniť/odstrániť obsah karty SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Umožňuje aplikácii zápis do ukladacieho priestoru USB."</string>
diff --git a/core/res/res/values-sl-rSI/arrays.xml b/core/res/res/values-sl-rSI/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-sl-rSI/arrays.xml
rename to core/res/res/values-sl-rSI/donottranslate-maps.xml
diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml
index 4345741..f66cabb 100644
--- a/core/res/res/values-sl/strings.xml
+++ b/core/res/res/values-sl/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"pisanje podatkov stika"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Programu omogoča spreminjanje podatkov stikov (naslov), shranjenih v tabličnem računalniku. Zlonamerni programi lahko to uporabijo za brisanje ali spreminjanje podatkov stika."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Programu omogoča spreminjanje podatkov stikov (naslov), shranjenih v telefonu. Zlonamerni programi lahko to uporabijo za brisanje ali spreminjanje podatkov stika."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"branje dnevnika klicev"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Aplikaciji dovoli branje dnevnika klicev v tabličnem računalniku, vključno s podatki o dohodnih in odhodnih klicih. Zlonamerne aplikacije lahko tako pošiljajo vaše podatke drugim."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Aplikaciji dovoli branje dnevnika klicev v telefonu, vključno s podatki o dohodnih in odhodnih klicih. Zlonamerne aplikacije lahko tako pošiljajo vaše podatke drugim."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"pisanje v dnevnik klicev"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Aplikaciji dovoli spreminjanje dnevnika klicev v tabličnem računalniku, vključno s podatki o dohodnih in odhodnih klicih. Zlonamerne aplikacije lahko tako izbrišejo ali spreminjajo vaš dnevnik klicev."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Aplikaciji dovoli spreminjanje dnevnika klicev v telefonu, vključno s podatki o dohodnih in odhodnih klicih. Zlonamerne aplikacije lahko tako izbrišejo ali spreminjajo vaš dnevnik klicev."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"branje podatkov v profilu"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Programu omogoča branje osebnih podatkov v profilu, kot so ime in podatki za stik. To pomeni, da vas lahko program prepozna in vaše podatke o profilu pošlje drugim."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"pisanje v podatke v profilu"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Programu omogoča branje morebitnih zasebnih besed, imen in izrazov, ki jih je uporabnik shranil v uporabniški slovar."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"pisanje v uporabniško določen slovar"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Programu omogoča pisanje nove besede v uporabniški slovar."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"branje vsebine pomnilnika USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"branje vsebine kartice SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Aplikaciji dovoli branje vsebine pomnilnika USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Aplikaciji dovoli branje vsebine kartice SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"spreminjanje vsebine pomnilnika USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"spreminjanje/brisanje vsebine kartice SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Programu omogoča zapisovanje v pomnilnik USB."</string>
diff --git a/core/res/res/values-sr-rRS/arrays.xml b/core/res/res/values-sr-rRS/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-sr-rRS/arrays.xml
rename to core/res/res/values-sr-rRS/donottranslate-maps.xml
diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml
index e216e57..66c0561 100644
--- a/core/res/res/values-sr/strings.xml
+++ b/core/res/res/values-sr/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"уписивање података о контактима"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Дозвољава апликацији да измени податке о контакту (адреси) сачуване на таблету. Злонамерне апликације могу то да искористе да би избрисале или измениле податке о контакту."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Дозвољава апликацији да измени податке о контакту (адреси) сачуване на телефону. Злонамерне апликације могу то да искористе да би избрисале или измениле податке о контакту."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"читање евиденције позива"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Дозвољава апликацији да чита евиденцију позива на таблету, укључујући податке о долазним и одлазним позивима. Злонамерне апликације могу ово да користе да би слале податке другим људима."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Дозвољава апликацији да чита евиденцију позива на телефону, укључујући податке о долазним и одлазним позивима. Злонамерне апликације могу ово да користе да би слале податке другим људима."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"писање евиденције позива"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Дозвољава апликацији да мења евиденцију позива на таблету, укључујући податке о долазним и одлазним позивима. Злонамерне апликације могу ово да користе да би брисале или мењале евиденцију позива."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Дозвољава апликацији да мења евиденцију позива на телефону, укључујући податке о долазним и одлазним позивима. Злонамерне апликације могу ово да користе да би брисале или мењале евиденцију позива."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"читање података о профилу"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Дозвољава апликацији да чита личне информације са профила сачуване на уређају, као што су име и контакт информације. То значи да друге апликације могу да вас идентификују и да информације о вашем профилу шаљу другима."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"уписивање у податке профила"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Дозвољава апликацији да чита све приватне речи, називе и фразе које је корисник сачувао у корисничком речнику."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"уписивање у речник који је дефинисао корисник"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Дозвољава апликацији да уписује нове речи у кориснички речник."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"читање садржаја USB меморије"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"читање садржаја SD картице"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Дозвољава апл. да чита садржај USB меморије."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Дозвољава апликацији да чита садржај SD картице."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"измена/брисање садржаја USB меморије"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"измена/брисање садржаја SD картице"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Дозвољава апликацији да уписује податке на USB меморију."</string>
diff --git a/core/res/res/values-sv-rSE/arrays.xml b/core/res/res/values-sv-rSE/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-sv-rSE/arrays.xml
rename to core/res/res/values-sv-rSE/donottranslate-maps.xml
diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml
index fbca3e4..6559fc5 100644
--- a/core/res/res/values-sv/strings.xml
+++ b/core/res/res/values-sv/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"skriva kontaktuppgifter"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Tillåter att appen ändrar kontaktuppgifter (adresser) som lagras på pekdatorn. Skadliga appar kan använda detta för att radera eller ändra kontaktuppgifter."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Tillåter att appen ändrar kontaktuppgifter (adresser) som lagras på mobilen. Skadliga appar kan använda detta för att radera eller ändra kontaktuppgifter."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"läs samtalslogg"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Tillåter att appen läser pekdatorns samtalslista, inklusive uppgifter om inkommande och utgående samtal. Skadliga appar kan använda informationen för att skicka dina data till andra personer."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Tillåter att appen läser mobilens samtalslista, inklusive uppgifter om inkommande och utgående samtal. Skadliga appar kan använda informationen för att skicka dina data till andra personer."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"skriv samtalslogg"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Tillåter att appen gör ändringar i pekdatorns samtalslista, inklusive i uppgifter om inkommande och utgående samtal. Skadliga program kan använda detta för att radera eller ändra din samtalslista."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Tillåter att appen gör ändringar i mobilens samtalslista, inklusive i uppgifter om inkommande och utgående samtal. Skadliga program kan använda detta för att radera eller ändra din samtalslista."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"läser din profilinformation"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Tillåter att appen läser personlig profilinformation som lagras på din enhet, t.ex. ditt namn och kontaktuppgifter. Det innebär att appen kan identifiera dig och skicka profilinformation till andra."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"skriver till data för din profil"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Tillåter att appen läser alla privata ord, namn och fraser som användaren har sparat i ordlistan."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"lägga till i användardefinierad ordlista"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Tillåter att appen anger nya ord i användarordlistan."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"läs innehållet på USB-lagringsenheten"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"läs innehållet på SD-kortet"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Appen får läsa innehåll på USB-enhet."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Tillåter appen att läsa innehållet på SD-kort."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"ändra/ta bort från USB-enhet"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"ändra/ta bort innehåll på SD-kortet"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Gör att app skriver till USB."</string>
@@ -741,8 +743,7 @@
<string name="double_tap_toast" msgid="4595046515400268881">"Tips! Dubbelknacka om du vill zooma in eller ut."</string>
<string name="autofill_this_form" msgid="4616758841157816676">"Autofyll"</string>
<string name="setup_autofill" msgid="7103495070180590814">"Ange Autofyll"</string>
- <!-- no translation found for autofill_address_name_separator (6350145154779706772) -->
- <skip />
+ <string name="autofill_address_name_separator" msgid="6350145154779706772">" "</string>
<string name="autofill_address_summary_name_format" msgid="3268041054899214945">"$1$2$3"</string>
<string name="autofill_address_summary_separator" msgid="7483307893170324129">", "</string>
<string name="autofill_address_summary_format" msgid="4874459455786827344">"$1$2$3"</string>
diff --git a/core/res/res/values-sw-rTZ/arrays.xml b/core/res/res/values-sw-rTZ/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-sw-rTZ/arrays.xml
rename to core/res/res/values-sw-rTZ/donottranslate-maps.xml
diff --git a/core/res/res/values-sw/strings.xml b/core/res/res/values-sw/strings.xml
index 03b40d8..39d2aba 100644
--- a/core/res/res/values-sw/strings.xml
+++ b/core/res/res/values-sw/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"andika data ya anwani"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Inaruhusu programu kurekebisha data ya mwasiliani(anwani) iliyohifadhiwa kwenye kompyuta yako ki. programu hasidi zinaweza tumia hii kufuta au kurekebisha data yako ya mwasiliani."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Inaruhusu programu kurekebisha data ya mwasiliani(anwani) iliyohifadhiwa kwenye simu yako. Programu hasidi zinaweza kutumia hii kufuta au kurekebisha data yako ya mwasiliani."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"soma rajisi ya simu"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Huruhusu programu kusoma rajisi ya simu ya kompyuta kibao yako, ikiwa ni pamoja na simu zinazoingia na kutoka. Huenda programu hasidi zikatumia hii ili kutuma data yako kwa watu wengine."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Huruhusu programu kusoma rajisi ya simu yako, ikiwa ni pamoja na data kuhusu simu zinazoingia na kutoka. Huenda programu hasidi zikatumia hii ili kutuma data yako kwa watu wengine."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"andika rajisi ya simu"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Huruhusu programu kurekebisha rajisi ya kompyuta kibao yako, ikiwa ni pamoja na simu zinazoingia na kutoka. Huenda programu hasidi zikatumia hii ili kufuta au kurekebisha rajisi ya simu yako."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Huruhusu programu kurekebisha rajisi ya simu yako, ikiwa ni pamoja na simu zinazoingia na kutoka. Huenda programu hasidi zikatumia hii ili kufuta au kurekebisha rajisi ya simu yako."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"soma data ya maelezo yako mafupi"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Inaruhusu programu kusoma maelezo mafupi ya kibinafsi yaliyohifadhiwa kwenye kifaa chako, kama vile jina lako na taarifa ya kuwasiliana. Hii ina maanisha programu inaweza kukutambua na kutuma taarifa yako fupi ya kibinafsi kwa wengine."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"andika kwenye data ya maelezo yako mafupi"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Inaruhusu programu kusoma maneno, majina na vifungu vyovyote vya kibinafsi, ambavyo huenda mtumiaji amehifadhi katika kamusi ya mtumiaji."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"andika kwa kamusi iliyobainishwa na mtumiaji"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Inaruhusu programu kuandika maneno mapya katika kamusi ya mtumiaji."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"soma maudhui ya hifadhi ya USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"soma maudhui ya kadi ya SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Huruhusu programu kusoma maudhui ya hifadhi ya USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Huruhusu programu kusoma maudhui ya kadi ya SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"rekebisha/futa maudhui ya hifadhi ya USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"rekebisha/futa maudhui ya kadi ya SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Inaruhusu programu kuandikia hifadhi ya USB."</string>
diff --git a/core/res/res/values-sw600dp/config.xml b/core/res/res/values-sw600dp/config.xml
index 7fa7658..49c8893 100644
--- a/core/res/res/values-sw600dp/config.xml
+++ b/core/res/res/values-sw600dp/config.xml
@@ -21,7 +21,7 @@
for different hardware and product builds. -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- see comment in values/config.xml -->
- <integer name="config_longPressOnPowerBehavior">2</integer>
+ <integer name="config_longPressOnPowerBehavior">1</integer>
<!-- Enable lockscreen rotation -->
<bool name="config_enableLockScreenRotation">true</bool>
diff --git a/core/res/res/values-th-rTH/arrays.xml b/core/res/res/values-th-rTH/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-th-rTH/arrays.xml
rename to core/res/res/values-th-rTH/donottranslate-maps.xml
diff --git a/core/res/res/values-th/strings.xml b/core/res/res/values-th/strings.xml
index bcd9fe6..4b59923 100644
--- a/core/res/res/values-th/strings.xml
+++ b/core/res/res/values-th/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"เขียนข้อมูลที่อยู่ติดต่อ"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"อนุญาตให้แอปพลิเคชันแก้ไขข้อมูลการติดต่อ (ที่อยู่) ที่เก็บไว้ในแท็บเล็ตของคุณ แอปพลิเคชันที่เป็นอันตรายอาจใช้การอนุญาตนี้ลบหรือแก้ไขข้อมูลการติดต่อของคุณ"</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"อนุญาตให้แอปพลิเคชันแก้ไขข้อมูลการติดต่อ (ที่อยู่) ที่เก็บไว้ในโทรศัพท์ของคุณ แอปพลิเคชันที่เป็นอันตรายอาจใช้การอนุญาตนี้ลบหรือแก้ไขข้อมูลการติดต่อของคุณ"</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"อ่านประวัติการโทร"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"อนุญาตให้แอปอ่านประวัติการโทรจากแท็บเล็ตของคุณ รวมถึงข้อมูลเกี่ยวกับสายเรียกเข้าและการโทรออก แอปที่เป็นอันตรายอาจใช้สิ่งนี้เพื่อส่งข้อมูลของคุณให้กับบุคคลอื่น"</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"อนุญาตให้แอปอ่านประวัติการโทรจากโทรศัพท์ของคุณ รวมถึงข้อมูลเกี่ยวกับสายเรียกเข้าและการโทรออก แอปที่เป็นอันตรายอาจใช้สิ่งนี้เพื่อส่งข้อมูลของคุณให้กับบุคคลอื่น"</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"เขียนประวัติการโทร"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"อนุญาตให้แอปแก้ไขประวัติการโทรจากแท็บเล็ตของคุณ รวมถึงข้อมูลเกี่ยวกับสายเรียกเข้าและการโทรออก แอปที่เป็นอันตรายอาจใช้สิ่งนี้เพื่อลบหรือแก้ไขประวัติการโทรของคุณ"</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"อนุญาตให้แอปแก้ไขประวัติการโทรจากโทรศัพท์ของคุณ รวมถึงข้อมูลเกี่ยวกับสายเรียกเข้าและการโทรออก แอปที่เป็นอันตรายอาจใช้สิ่งนี้เพื่อลบหรือแก้ไขประวัติการโทรของคุณ"</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"อ่านข้อมูลโปรไฟล์ของคุณ"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"อนุญาตให้แอปพลิเคชันอ่านข้อมูลโปรไฟล์ส่วนบุคคลที่เก็บไว้บนอุปกรณ์ของคุณ เช่น ชื่อและข้อมูลติดต่อ ซึ่งหมายความว่าแอปพลิเคชันจะสามารถระบุตัวตนของคุณและส่งข้อมูลโปรไฟล์ของคุณแก่ผู้อื่นได้"</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"เขียนลงในข้อมูลโปรไฟล์ของคุณ"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"อนุญาตให้แอปพลิเคชันอ่านคำ ชื่อ และวลีส่วนบุคคลที่ผู้ใช้อาจเก็บไว้ในพจนานุกรมของผู้ใช้"</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"เขียนลงในพจนานุกรมที่ผู้ใช้กำหนด"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"อนุญาตให้แอปพลิเคชันเขียนคำใหม่ลงในพจนานุกรมผู้ใช้"</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"อ่านเนื้อหาที่บันทึกใน USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"อ่านเนื้อหาในการ์ด SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"อนุญาตให้แอปอ่านเนื้อหาใน USB"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"อนุญาตให้แอปอ่านเนื้อหาในการ์ด SD"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"แก้ไข/ลบเนื้อหาของที่เก็บข้อมูล USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"แก้ไข/ลบข้อมูลการ์ด SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"อนุญาตให้แอปฯ เขียนลงใน USB"</string>
diff --git a/core/res/res/values-tl-rPH/arrays.xml b/core/res/res/values-tl-rPH/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-tl-rPH/arrays.xml
rename to core/res/res/values-tl-rPH/donottranslate-maps.xml
diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml
index 9e37534a..dc22a08 100644
--- a/core/res/res/values-tl/strings.xml
+++ b/core/res/res/values-tl/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"sumulat ng data ng pakikipag-ugnay"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Pinapayagan ang app na baguhin ang data ng contact (address) na nakaimbak sa iyong tablet. Maaari itong gamitin ng nakakahamak na apps upang burahin o baguhin ang iyong data ng contact."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Pinapayagan ang app na baguhin ang data ng contact (address) na nakaimbak sa iyong telepono. Maaari itong gamitin ng nakakahamak na apps upang burahin o baguhin ang iyong data ng contact."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"basahin ang log ng tawag"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Binibigyang-daan ang app na basahin ang log ng tawag ng iyong tablet, kabilang ang data tungkol sa mga paparating at papalabas na tawag. Maaari itong gamitin ng nakakahamak na apps upang ipadala ang iyong data sa ibang mga tao."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Binibigyang-daan ang app na basahin ang log ng tawag ng iyong telepono, kabilang ang data tungkol sa mga paparating at papalabas na tawag. Maaari itong gamitin ng nakakahamak na apps upang ipadala ang iyong data sa ibang mga tao."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"isulat ang log ng tawag"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Binibigyan-daan ang app na baguhin ang log ng tawag ng iyong tablet, kabilang ang data tungkol sa mga paparating at papalabas na tawag. Maaari itong gamitin ng nakakahamak na apps upang burahin o baguhin ang iyong log ng tawag."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Binibigyan-daan ang app na baguhin ang log ng tawag ng iyong telepono, kabilang ang data tungkol sa mga paparating at papalabas na tawag. Maaari itong gamitin ng nakakahamak na apps upang burahin o baguhin ang iyong log ng tawag."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"basahin ang iyong data ng profile"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Pinapayagan ang app na basahin ang personal na impormasyon ng profile na nakaimbak sa iyong device, gaya ng iyong pangalan at impormasyon ng contact. Nangangahulugan ito na makikilala ka ng app at maipapadala nito ang impormasyon ng iyong profile sa iba."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"i-write sa iyong data ng profile"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Pinapayagan ang app na magbasa ng anumang pribadong mga salita, pangalan at parirala na maaaring inimbak ng user sa diksyunaryo ng user."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"magsulat sa diksyunaryong tinukoy ng user"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Pinapayagan ang app na magsulat ng mga bagong salita sa diksyunaryo ng user."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"basahin nilalaman USB storage"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"basahin ang mga nilalaman ng SD card"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Payag app basa laman USB strg."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Binibigyang-daan ang app na basahin ang mga nilalaman ng SD card."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"baguhin/tanggalin laman ng USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"baguhin/tanggalin ang mga nilalaman ng SD card"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Pinapayagan ang app na magsulat sa USB storage."</string>
diff --git a/core/res/res/values-tr-rTR/arrays.xml b/core/res/res/values-tr-rTR/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-tr-rTR/arrays.xml
rename to core/res/res/values-tr-rTR/donottranslate-maps.xml
diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml
index 2462e90..419ae96 100644
--- a/core/res/res/values-tr/strings.xml
+++ b/core/res/res/values-tr/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"kişi verileri yaz"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Uygulamaya, tabletinizde depolanan kişi (adres) verilerini değiştirme izni verir. Kötü amaçlı uygulamalar kişi verilerinizi silmek veya değiştirmek için bunu kullanabilir."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Uygulamaya, telefonunuzda depolanan kişi (adres) verilerini değiştirme izni verir. Kötü amaçlı uygulamalar kişi verilerinizi silmek veya değiştirmek için bunu kullanabilir."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"çağrı günlüğünü oku"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Uygulamaya tabletinizin çağrı günlüğünü (gelen ve giden çağrılarla ilgili veriler dahil olmak üzere) okuma izni verir. Kötü amaçlı uygulamalar bu izni kullanarak verilerinizi başka kişilere gönderebilir."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Uygulamaya telefonunuzun çağrı günlüğünü (gelen ve giden çağrılarla ilgili veriler dahil olmak üzere) okuma izni verir. Kötü amaçlı uygulamalar bu izni kullanarak verilerinizi başka kişilere gönderebilir."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"çağrı günlüğüne yaz"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Uygulamaya tabletinizin çağrı günlüğünde (gelen ve giden çağrılarla ilgili veriler dahil olmak üzere) değişiklik yapma izni verir. Kötü amaçlı uygulamalar bu izni kullanarak çağrı günlüğünüzü silebilir veya değiştirebilir."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Uygulamaya telefonunuzun çağrı günlüğünde (gelen ve giden çağrılarla ilgili veriler dahil olmak üzere) değişiklik yapma izni verir. Kötü amaçlı uygulamalar bu izni kullanarak çağrı günlüğünüzü silebilir veya değiştirebilir."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"profil verilerimi oku"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Uygulamaya, adınız ve iletişim bilgileriniz gibi cihazınızda saklanan kişisel profil bilgilerini okuma izni verir. Bu izin, uygulamanın sizi tanımlayabileceği ve profil bilgilerinizi başkalarına gönderebileceği anlamına gelir."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"profil verilerime yaz"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Uygulamaya, kullanıcının kullanıcı sözlüğünde depolamış olabileceği kişisel kelimeleri, adları ve kelime öbeklerini okuma izni verir."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"kullanıcı tanımlı sözlüğe yaz"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Uygulamaya, kullanıcı sözlüğüne yeni kelimeler yazma izni verir."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"USB depolama içeriklerini oku"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"SD kart içeriklerini oku"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Uygulamaya USB depolama içeriğini okuma izni verir."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Uygulamaya SD kart içeriğini okuma izni verir."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"USB dep birm içeriğini dğş/sil"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"SD kart içeriklerini değiştir/sil"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Uygulamaya USB depolama birimine yazma izni verir."</string>
diff --git a/core/res/res/values-uk-rUA/arrays.xml b/core/res/res/values-uk-rUA/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-uk-rUA/arrays.xml
rename to core/res/res/values-uk-rUA/donottranslate-maps.xml
diff --git a/core/res/res/values-uk/strings.xml b/core/res/res/values-uk/strings.xml
index a4f8e62..13311f1 100644
--- a/core/res/res/values-uk/strings.xml
+++ b/core/res/res/values-uk/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"запис. контактні дані"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Дозволяє програмі змінювати контактні дані (адресу), збережені в планшетному ПК. Шкідливі програми можуть використовувати це для видалення чи зміни ваших контактних даних."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Дозволяє програмі змінювати контактні дані (адресу), збережені в телефоні. Шкідливі програми можуть використовувати це для видалення чи зміни ваших контактних даних."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"читати журнал викликів"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Дозволяє програмі читати журнал викликів вашого планшетного ПК, включно з даними про вхідні та вихідні дзвінки. Шкідливі програми можуть використовувати це для надсилання ваших даних іншим людям."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Дозволяє програмі читати журнал викликів вашого телефону, включно з даними про вхідні та вихідні дзвінки. Шкідливі програми можуть використовувати це для надсилання ваших даних іншим людям."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"записувати в журнал викликів"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Дозволяє програмі змінювати журнал викликів вашого планшетного ПК, включно з даними про вхідні та вихідні дзвінки. Шкідливі програми можуть використовувати це для стирання або зміни вашого журналу викликів."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Дозволяє програмі змінювати журнал викликів вашого телефону, включно з даними про вхідні та вихідні дзвінки. Шкідливі програми можуть використовувати це для стирання або зміни вашого журналу викликів."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"читати дані вашого профілю"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Дозволяє програмі читати особисту інформацію профілю, збережену на вашому пристрої, як-от ваше ім’я та контактну інформацію. Це означає, що інші програми можуть ідентифікувати вашу особу та надсилати дані вашого профілю іншим."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"записувати в дані профілю"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Дозволяє програмі читати будь-які особисті вислови, назви та фрази, які користувач міг зберегти у своєму словнику."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"писати у вказаний користувачем словник"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Дозволяє програмі писати нові слова в словник користувача."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"читати вміст носія USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"читати вміст карти SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Дозволяє програмі читати вміст носія USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Дозволяє програмі читати вміст карти SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"змінювати/видаляти вміст носія USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"змінювати/видал. вміст карти SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Дозволяє програмі писати на носій USB"</string>
diff --git a/core/res/res/values-vi-rVN/arrays.xml b/core/res/res/values-vi-rVN/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-vi-rVN/arrays.xml
rename to core/res/res/values-vi-rVN/donottranslate-maps.xml
diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml
index 13bdfa5..b94f104 100644
--- a/core/res/res/values-vi/strings.xml
+++ b/core/res/res/values-vi/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"ghi dữ liệu liên hệ"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Cho phép ứng dụng sửa đổi dữ liệu (địa chỉ) liên hệ được lưu trữ trên máy tính bảng của bạn. Ứng dụng độc hại có thể sử dụng quyền này để xóa hoặc sửa đổi dữ liệu liên hệ của bạn."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Cho phép ứng dụng sửa đổi dữ liệu (địa chỉ) liên hệ được lưu trữ trên điện thoại của bạn. Ứng dụng độc hại có thể sử dụng quyền này để xóa hoặc sửa đổi dữ liệu liên hệ của bạn."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"đọc nhật ký cuộc gọi"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Cho phép ứng dụng đọc nhật ký cuộc gọi trên máy tính bảng của bạn, bao gồm dữ liệu về các cuộc gọi đến và gọi đi. Các ứng dụng độc hại có thể sử dụng quyền này để gửi dữ liệu của bạn cho những người khác."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Cho phép ứng dụng đọc nhật ký cuộc gọi trên điện thoại của bạn, bao gồm dữ liệu về các cuộc gọi đến và gọi đi. Các ứng dụng độc hại có thể sử dụng quyền này để gửi dữ liệu của bạn cho những người khác."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"ghi nhật ký cuộc gọi"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Cho phép ứng dụng sửa đổi nhật ký cuộc gọi trên máy tính bảng của bạn, bao gồm dữ liệu về các cuộc gọi đến và gọi đi. Các ứng dụng độc hại có thể sử dụng quyền này để xóa hoặc sửa đổi nhật ký cuộc gọi của bạn."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Cho phép ứng dụng sửa đổi nhật ký cuộc gọi trên điện thoại của bạn, bao gồm dữ liệu về các cuộc gọi đến và gọi đi. Các ứng dụng độc hại có thể sử dụng quyền này để xóa hoặc sửa đổi nhật ký cuộc gọi của bạn."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"đọc d.liệu t.sử của bạn"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Cho phép ứng dụng đọc thông tin tiểu sử cá nhân được lưu trữ trên thiết bị, chẳng hạn như tên và thông tin liên hệ của bạn. Điều này có nghĩa là ứng dụng có thể xác định danh tính của bạn và gửi thông tin tiểu sử của bạn cho người khác."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"ghi dữ liệu t.sử của bạn"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Cho phép ứng dụng đọc bất kỳ từ, tên và cụm từ riêng nào mà người dùng có thể đã lưu trữ trong từ điển của người dùng."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"ghi vào từ điển do người dùng xác định"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Cho phép ứng dụng ghi từ mới vào từ điển của người dùng."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"đọc nội dung của bộ nhớ USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"đọc nội dung của thẻ SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Cho phép ứng dụng đọc nội dung của bộ lưu trữ USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Cho phép ứng dụng đọc nội dung của thẻ SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"sửa đổi/xóa nội dung bộ nhớ USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"sửa đổi/xóa nội dung thẻ SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Cho phép ứng dụng ghi vào bộ lưu trữ USB."</string>
diff --git a/core/res/res/values-zh-rCN/arrays.xml b/core/res/res/values-zh-rCN/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-zh-rCN/arrays.xml
rename to core/res/res/values-zh-rCN/donottranslate-maps.xml
diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml
index d848dd2..d7a1e43 100644
--- a/core/res/res/values-zh-rCN/strings.xml
+++ b/core/res/res/values-zh-rCN/strings.xml
@@ -145,7 +145,7 @@
<string name="shutdown_confirm" product="default" msgid="649792175242821353">"您的手机会关机。"</string>
<string name="shutdown_confirm_question" msgid="2906544768881136183">"您要关机吗?"</string>
<string name="recent_tasks_title" msgid="3691764623638127888">"近期任务"</string>
- <string name="no_recent_tasks" msgid="8794906658732193473">"最近没有运行任何应用程序"</string>
+ <string name="no_recent_tasks" msgid="8794906658732193473">"最近没有运行任何应用"</string>
<string name="global_actions" product="tablet" msgid="408477140088053665">"平板电脑选项"</string>
<string name="global_actions" product="default" msgid="2406416831541615258">"手机选项"</string>
<string name="global_action_lock" msgid="2844945191792119712">"屏幕锁定"</string>
@@ -179,350 +179,352 @@
<string name="permgrouplab_systemTools" msgid="4652191644082714048">"系统工具"</string>
<string name="permgroupdesc_systemTools" msgid="8162102602190734305">"对系统进行低级访问和控制。"</string>
<string name="permgrouplab_developmentTools" msgid="3446164584710596513">"开发工具"</string>
- <string name="permgroupdesc_developmentTools" msgid="7058828032358142018">"只有应用程序开发人员才需要的功能。"</string>
+ <string name="permgroupdesc_developmentTools" msgid="7058828032358142018">"只有应用开发人员才需要的功能。"</string>
<string name="permgrouplab_storage" msgid="1971118770546336966">"存储"</string>
<string name="permgroupdesc_storage" product="nosdcard" msgid="7442318502446874999">"访问 USB 存储设备。"</string>
<string name="permgroupdesc_storage" product="default" msgid="9203302214915355774">"访问 SD 卡。"</string>
<string name="permlab_statusBar" msgid="7417192629601890791">"停用或修改状态栏"</string>
- <string name="permdesc_statusBar" msgid="8434669549504290975">"允许应用程序停用状态栏或者增删系统图标。"</string>
+ <string name="permdesc_statusBar" msgid="8434669549504290975">"允许应用停用状态栏或者增删系统图标。"</string>
<string name="permlab_statusBarService" msgid="7247281911387931485">"状态栏"</string>
- <string name="permdesc_statusBarService" msgid="716113660795976060">"允许以状态栏形式显示应用程序。"</string>
+ <string name="permdesc_statusBarService" msgid="716113660795976060">"允许以状态栏形式显示应用。"</string>
<string name="permlab_expandStatusBar" msgid="1148198785937489264">"展开/收拢状态栏"</string>
- <string name="permdesc_expandStatusBar" msgid="6917549437129401132">"允许应用程序展开或折叠状态栏。"</string>
+ <string name="permdesc_expandStatusBar" msgid="6917549437129401132">"允许应用展开或折叠状态栏。"</string>
<string name="permlab_processOutgoingCalls" msgid="1136262550878335980">"拦截外拨电话"</string>
- <string name="permdesc_processOutgoingCalls" msgid="1152111671618301044">"允许应用程序处理外拨通话并更改要拨打的号码。恶意应用程序可能会监视、重定向或阻止外拨通话。"</string>
+ <string name="permdesc_processOutgoingCalls" msgid="1152111671618301044">"允许应用处理外拨通话并更改要拨打的号码。恶意应用可能会监视、重定向或阻止外拨通话。"</string>
<string name="permlab_receiveSms" msgid="2697628268086208535">"接收短信"</string>
- <string name="permdesc_receiveSms" msgid="8107887121893611793">"允许应用程序接收和处理短信。恶意应用程序可能会监视您的短信,或删除短信而不向您显示。"</string>
+ <string name="permdesc_receiveSms" msgid="8107887121893611793">"允许应用接收和处理短信。恶意应用可能会监视您的短信,或删除短信而不向您显示。"</string>
<string name="permlab_receiveMms" msgid="8894700916188083287">"接收彩信"</string>
- <string name="permdesc_receiveMms" msgid="1424805308566612086">"允许应用程序接收和处理彩信。恶意应用程序可能会监视您的短信,或删除短信而不向您显示。"</string>
+ <string name="permdesc_receiveMms" msgid="1424805308566612086">"允许应用接收和处理彩信。恶意应用可能会监视您的短信,或删除短信而不向您显示。"</string>
<string name="permlab_receiveEmergencyBroadcast" msgid="1803477660846288089">"接收紧急广播"</string>
- <string name="permdesc_receiveEmergencyBroadcast" msgid="848524070262431974">"允许应用程序接收和处理紧急广播消息。此权限仅适用于系统应用程序。"</string>
+ <string name="permdesc_receiveEmergencyBroadcast" msgid="848524070262431974">"允许应用接收和处理紧急广播消息。此权限仅适用于系统应用。"</string>
<string name="permlab_sendSms" msgid="5600830612147671529">"发送短信"</string>
- <string name="permdesc_sendSms" msgid="906546667507626156">"允许应用程序发送短信。恶意应用程序可能会未经您的确认而发送短信,由此产生相关费用。"</string>
+ <string name="permdesc_sendSms" msgid="906546667507626156">"允许应用发送短信。恶意应用可能会未经您的确认而发送短信,由此产生相关费用。"</string>
<string name="permlab_sendSmsNoConfirmation" msgid="4781483105951730228">"不经确认直接发送短信"</string>
- <string name="permdesc_sendSmsNoConfirmation" msgid="3437759207020400204">"允许应用程序发送短信。恶意应用程序可能会未经您的确认而发送短信,由此产生相关费用。"</string>
+ <string name="permdesc_sendSmsNoConfirmation" msgid="3437759207020400204">"允许应用发送短信。恶意应用可能会未经您的确认而发送短信,由此产生相关费用。"</string>
<string name="permlab_readSms" msgid="4085333708122372256">"读取短信或彩信"</string>
- <string name="permdesc_readSms" product="tablet" msgid="2341692916884515613">"允许应用程序读取您的平板电脑或 SIM 卡上存储的短信。恶意应用程序可能会读取您的机密短信。"</string>
- <string name="permdesc_readSms" product="default" msgid="5653850482025875493">"允许应用程序读取您的手机或 SIM 卡上存储的短信。恶意应用程序可能借此读取您的机密短信。"</string>
+ <string name="permdesc_readSms" product="tablet" msgid="2341692916884515613">"允许应用读取您的平板电脑或 SIM 卡上存储的短信。恶意应用可能会读取您的机密短信。"</string>
+ <string name="permdesc_readSms" product="default" msgid="5653850482025875493">"允许应用读取您的手机或 SIM 卡上存储的短信。恶意应用可能借此读取您的机密短信。"</string>
<string name="permlab_writeSms" msgid="6881122575154940744">"编辑短信或彩信"</string>
- <string name="permdesc_writeSms" product="tablet" msgid="5160413947794501538">"允许应用程序对平板电脑或 SIM 卡上存储的短信执行写入操作。恶意应用程序可能会删除您的短信。"</string>
- <string name="permdesc_writeSms" product="default" msgid="7268668709052328567">"允许应用程序对手机或 SIM 卡上存储的短信执行写入操作。恶意应用程序可能会删除您的短信。"</string>
+ <string name="permdesc_writeSms" product="tablet" msgid="5160413947794501538">"允许应用对平板电脑或 SIM 卡上存储的短信执行写入操作。恶意应用可能会删除您的短信。"</string>
+ <string name="permdesc_writeSms" product="default" msgid="7268668709052328567">"允许应用对手机或 SIM 卡上存储的短信执行写入操作。恶意应用可能会删除您的短信。"</string>
<string name="permlab_receiveWapPush" msgid="8258226427716551388">"接收 WAP"</string>
- <string name="permdesc_receiveWapPush" msgid="7983455145335316872">"允许应用程序接收和处理 WAP 短信。恶意应用程序可能会监视您的短信,或删除短信而不向您显示。"</string>
- <string name="permlab_getTasks" msgid="6466095396623933906">"检索正在运行的应用程序"</string>
- <string name="permdesc_getTasks" msgid="6608159250520381359">"允许应用程序针对近期运行的和当前正在运行的任务检索相关信息。恶意应用程序可能会发现有关其他应用程序的私密信息。"</string>
- <string name="permlab_reorderTasks" msgid="2018575526934422779">"对正在运行的应用程序重新排序"</string>
- <string name="permdesc_reorderTasks" msgid="4175137612205663399">"允许应用程序将任务移动到前台和后台。恶意应用程序可能会不受您的控制,强行让自己处于前台。"</string>
- <string name="permlab_removeTasks" msgid="6821513401870377403">"停止正在运行的应用程序"</string>
- <string name="permdesc_removeTasks" msgid="1394714352062635493">"允许该应用程序删除任务并终止这些任务的应用程序。恶意应用程序可以籍此影响其他应用程序的行为。"</string>
+ <string name="permdesc_receiveWapPush" msgid="7983455145335316872">"允许应用接收和处理 WAP 短信。恶意应用可能会监视您的短信,或删除短信而不向您显示。"</string>
+ <string name="permlab_getTasks" msgid="6466095396623933906">"检索正在运行的应用"</string>
+ <string name="permdesc_getTasks" msgid="6608159250520381359">"允许应用针对近期运行的和当前正在运行的任务检索相关信息。恶意应用可能会发现有关其他应用的私密信息。"</string>
+ <string name="permlab_reorderTasks" msgid="2018575526934422779">"对正在运行的应用重新排序"</string>
+ <string name="permdesc_reorderTasks" msgid="4175137612205663399">"允许应用将任务移动到前台和后台。恶意应用可能会不受您的控制,强行让自己处于前台。"</string>
+ <string name="permlab_removeTasks" msgid="6821513401870377403">"停止正在运行的应用"</string>
+ <string name="permdesc_removeTasks" msgid="1394714352062635493">"允许该应用删除任务并终止这些任务的应用。恶意应用可以籍此影响其他应用的行为。"</string>
<string name="permlab_setScreenCompatibility" msgid="6975387118861842061">"设置屏幕兼容性"</string>
- <string name="permdesc_setScreenCompatibility" msgid="692043618693917374">"允许该应用程序控制其他应用程序的屏幕兼容模式。恶意应用程序可以籍此影响其他应用程序的行为。"</string>
- <string name="permlab_setDebugApp" msgid="3022107198686584052">"启用应用程序调试"</string>
- <string name="permdesc_setDebugApp" msgid="4474512416299013256">"允许该应用程序对其他应用程序启用调试。恶意应用程序可以籍此终止其他的应用程序。"</string>
+ <string name="permdesc_setScreenCompatibility" msgid="692043618693917374">"允许该应用控制其他应用的屏幕兼容模式。恶意应用可以籍此影响其他应用的行为。"</string>
+ <string name="permlab_setDebugApp" msgid="3022107198686584052">"启用应用调试"</string>
+ <string name="permdesc_setDebugApp" msgid="4474512416299013256">"允许该应用对其他应用启用调试。恶意应用可以籍此终止其他的应用。"</string>
<string name="permlab_changeConfiguration" msgid="8214475779521218295">"更改用户界面设置"</string>
- <string name="permdesc_changeConfiguration" msgid="4372223873154296076">"允许该应用程序更改当前配置,例如语言区域或整体的字体大小。"</string>
+ <string name="permdesc_changeConfiguration" msgid="4372223873154296076">"允许该应用更改当前配置,例如语言区域或整体的字体大小。"</string>
<string name="permlab_enableCarMode" msgid="5684504058192921098">"启用车载模式"</string>
- <string name="permdesc_enableCarMode" msgid="4853187425751419467">"允许应用程序启用车载模式。"</string>
+ <string name="permdesc_enableCarMode" msgid="4853187425751419467">"允许应用启用车载模式。"</string>
<string name="permlab_killBackgroundProcesses" msgid="8373714752793061963">"结束后台进程"</string>
- <string name="permdesc_killBackgroundProcesses" msgid="931129103262126617">"允许应用程序在内存空间充足的情况下终止其他应用程序的后台进程。"</string>
- <string name="permlab_forceStopPackages" msgid="2329627428832067700">"强行停止其他应用程序"</string>
- <string name="permdesc_forceStopPackages" msgid="5253157296183940812">"允许应用程序强行停止其他应用程序。"</string>
- <string name="permlab_forceBack" msgid="652935204072584616">"强制应用程序关闭"</string>
- <string name="permdesc_forceBack" msgid="3892295830419513623">"允许应用程序强制关闭任何前台活动并返回。普通应用程序绝不需要此权限。"</string>
+ <string name="permdesc_killBackgroundProcesses" msgid="931129103262126617">"允许应用在内存空间充足的情况下终止其他应用的后台进程。"</string>
+ <string name="permlab_forceStopPackages" msgid="2329627428832067700">"强行停止其他应用"</string>
+ <string name="permdesc_forceStopPackages" msgid="5253157296183940812">"允许应用强行停止其他应用。"</string>
+ <string name="permlab_forceBack" msgid="652935204072584616">"强制应用关闭"</string>
+ <string name="permdesc_forceBack" msgid="3892295830419513623">"允许应用强制关闭任何前台活动并返回。普通应用绝不需要此权限。"</string>
<string name="permlab_dump" msgid="1681799862438954752">"检索系统内部状态"</string>
- <string name="permdesc_dump" msgid="1778299088692290329">"允许应用程序检索系统的内部状态。恶意应用程序可能会检索一般情况下绝不需要检索的多种私人信息和安全信息。"</string>
+ <string name="permdesc_dump" msgid="1778299088692290329">"允许应用检索系统的内部状态。恶意应用可能会检索一般情况下绝不需要检索的多种私人信息和安全信息。"</string>
<string name="permlab_retrieve_window_content" msgid="8022588608994589938">"检索屏幕内容"</string>
- <string name="permdesc_retrieve_window_content" msgid="3193269069469700265">"允许应用程序检索活动窗口的内容。恶意应用程序可能会检索整个窗口的内容,并检查其中除密码以外的所有文字。"</string>
+ <string name="permdesc_retrieve_window_content" msgid="3193269069469700265">"允许应用检索活动窗口的内容。恶意应用可能会检索整个窗口的内容,并检查其中除密码以外的所有文字。"</string>
<string name="permlab_shutdown" msgid="7185747824038909016">"部分关机"</string>
<string name="permdesc_shutdown" msgid="7046500838746291775">"使活动管理器进入关闭状态。不执行彻底关机。"</string>
- <string name="permlab_stopAppSwitches" msgid="4138608610717425573">"禁止切换应用程序"</string>
- <string name="permdesc_stopAppSwitches" msgid="8262195802582255021">"阻止用户切换到其他应用程序。"</string>
- <string name="permlab_runSetActivityWatcher" msgid="892239094867182656">"监控所有应用程序的启动"</string>
- <string name="permdesc_runSetActivityWatcher" msgid="6003603162578577406">"允许应用程序监视和控制系统是如何启动活动的。恶意应用程序可能会完全破坏系统。此权限只有在进行开发时才需要,正常使用情况下绝不需要。"</string>
+ <string name="permlab_stopAppSwitches" msgid="4138608610717425573">"禁止切换应用"</string>
+ <string name="permdesc_stopAppSwitches" msgid="8262195802582255021">"阻止用户切换到其他应用。"</string>
+ <string name="permlab_runSetActivityWatcher" msgid="892239094867182656">"监控所有应用的启动"</string>
+ <string name="permdesc_runSetActivityWatcher" msgid="6003603162578577406">"允许应用监视和控制系统是如何启动活动的。恶意应用可能会完全破坏系统。此权限只有在进行开发时才需要,正常使用情况下绝不需要。"</string>
<string name="permlab_broadcastPackageRemoved" msgid="2576333434893532475">"发送包删除的广播"</string>
- <string name="permdesc_broadcastPackageRemoved" msgid="6621901216207931089">"允许应用程序广播一条有关已删除了应用程序包的通知。恶意应用程序可能借此终止其他任何正在运行的应用程序。"</string>
+ <string name="permdesc_broadcastPackageRemoved" msgid="6621901216207931089">"允许应用广播一条有关已删除了应用包的通知。恶意应用可能借此终止其他任何正在运行的应用。"</string>
<string name="permlab_broadcastSmsReceived" msgid="5689095009030336593">"发送短信收到的广播"</string>
- <string name="permdesc_broadcastSmsReceived" msgid="4152037720034365492">"允许应用程序广播一条有关已收到短信的通知。恶意应用程序可能借此伪造接到的短信。"</string>
+ <string name="permdesc_broadcastSmsReceived" msgid="4152037720034365492">"允许应用广播一条有关已收到短信的通知。恶意应用可能借此伪造接到的短信。"</string>
<string name="permlab_broadcastWapPush" msgid="3145347413028582371">"发送 WAP-PUSH 收到的广播"</string>
- <string name="permdesc_broadcastWapPush" msgid="4783402525039442729">"允许应用程序广播一条有关已收到 WAP PUSH 短信的通知。恶意应用程序可能借此伪造短信接收,或在后台将任意网页的内容替换为恶意内容。"</string>
+ <string name="permdesc_broadcastWapPush" msgid="4783402525039442729">"允许应用广播一条有关已收到 WAP PUSH 短信的通知。恶意应用可能借此伪造短信接收,或在后台将任意网页的内容替换为恶意内容。"</string>
<string name="permlab_setProcessLimit" msgid="2451873664363662666">"限制运行的进程个数"</string>
- <string name="permdesc_setProcessLimit" msgid="7318061314040879542">"允许应用程序控制将运行的进程数上限。普通应用程序绝不需要此权限。"</string>
- <string name="permlab_setAlwaysFinish" msgid="238828158465736054">"关闭所有后台应用程序"</string>
- <string name="permdesc_setAlwaysFinish" msgid="7471310652868841499">"允许应用程序控制活动在转入后台后是否立即结束。普通应用程序绝不需要此权限。"</string>
+ <string name="permdesc_setProcessLimit" msgid="7318061314040879542">"允许应用控制将运行的进程数上限。普通应用绝不需要此权限。"</string>
+ <string name="permlab_setAlwaysFinish" msgid="238828158465736054">"关闭所有后台应用"</string>
+ <string name="permdesc_setAlwaysFinish" msgid="7471310652868841499">"允许应用控制活动在转入后台后是否立即结束。普通应用绝不需要此权限。"</string>
<string name="permlab_batteryStats" msgid="7863923071360031652">"修改电池统计信息"</string>
- <string name="permdesc_batteryStats" msgid="6835186932305744068">"允许应用程序修改收集到的电池统计信息。普通应用程序不能使用此权限。"</string>
+ <string name="permdesc_batteryStats" msgid="6835186932305744068">"允许应用修改收集到的电池统计信息。普通应用不能使用此权限。"</string>
<string name="permlab_backup" msgid="470013022865453920">"控制系统备份和还原"</string>
- <string name="permdesc_backup" msgid="6912230525140589891">"允许应用程序控制系统的备份和还原机制。普通应用程序不能使用此权限。"</string>
+ <string name="permdesc_backup" msgid="6912230525140589891">"允许应用控制系统的备份和还原机制。普通应用不能使用此权限。"</string>
<string name="permlab_confirm_full_backup" msgid="5557071325804469102">"确认完整备份或恢复操作"</string>
- <string name="permdesc_confirm_full_backup" msgid="1748762171637699562">"允许应用程序启动完整备份确认用户界面。不用于任何应用程序。"</string>
+ <string name="permdesc_confirm_full_backup" msgid="1748762171637699562">"允许应用启动完整备份确认用户界面。不用于任何应用。"</string>
<string name="permlab_internalSystemWindow" msgid="2148563628140193231">"显示未授权的窗口"</string>
- <string name="permdesc_internalSystemWindow" msgid="7458387759461466397">"允许该应用程序创建供内部系统用户界面使用的窗口。普通应用程序不应使用此权限。"</string>
+ <string name="permdesc_internalSystemWindow" msgid="7458387759461466397">"允许该应用创建供内部系统用户界面使用的窗口。普通应用不应使用此权限。"</string>
<string name="permlab_systemAlertWindow" msgid="3372321942941168324">"显示系统级警报"</string>
- <string name="permdesc_systemAlertWindow" msgid="8507863469978066409">"允许应用程序显示系统警告窗口。恶意应用程序可能会控制整个屏幕。"</string>
+ <string name="permdesc_systemAlertWindow" msgid="8507863469978066409">"允许应用显示系统警告窗口。恶意应用可能会控制整个屏幕。"</string>
<string name="permlab_setAnimationScale" msgid="2805103241153907174">"修改全局动画速度"</string>
- <string name="permdesc_setAnimationScale" msgid="7690063428924343571">"允许该应用程序随时更改全局动画速度(加快或减慢)。"</string>
- <string name="permlab_manageAppTokens" msgid="1286505717050121370">"管理应用程序令牌"</string>
- <string name="permdesc_manageAppTokens" msgid="8043431713014395671">"允许应用程序绕过其正常的 Z 排序创建和管理自己的令牌。普通应用程序绝不需要此权限。"</string>
+ <string name="permdesc_setAnimationScale" msgid="7690063428924343571">"允许该应用随时更改全局动画速度(加快或减慢)。"</string>
+ <string name="permlab_manageAppTokens" msgid="1286505717050121370">"管理应用令牌"</string>
+ <string name="permdesc_manageAppTokens" msgid="8043431713014395671">"允许应用绕过其正常的 Z 排序创建和管理自己的令牌。普通应用绝不需要此权限。"</string>
<string name="permlab_injectEvents" msgid="1378746584023586600">"按键和控制按钮"</string>
- <string name="permdesc_injectEvents" product="tablet" msgid="206352565599968632">"允许应用程序将自身的输入活动(例如按键操作等)提供给其他应用程序。恶意应用程序可能借此控制平板电脑。"</string>
- <string name="permdesc_injectEvents" product="default" msgid="653128057572326253">"允许应用程序将自身的输入活动(例如按键操作等)提供给其他应用程序。恶意应用程序可能借此控制手机。"</string>
+ <string name="permdesc_injectEvents" product="tablet" msgid="206352565599968632">"允许应用将自身的输入活动(例如按键操作等)提供给其他应用。恶意应用可能借此控制平板电脑。"</string>
+ <string name="permdesc_injectEvents" product="default" msgid="653128057572326253">"允许应用将自身的输入活动(例如按键操作等)提供给其他应用。恶意应用可能借此控制手机。"</string>
<string name="permlab_readInputState" msgid="469428900041249234">"记录您键入的内容和执行的操作"</string>
- <string name="permdesc_readInputState" msgid="8387754901688728043">"允许应用程序记录您所按的键,包括与其他应用程序进行交互(如输入密码)时按的键。普通应用程序绝不需要此权限。"</string>
+ <string name="permdesc_readInputState" msgid="8387754901688728043">"允许应用记录您所按的键,包括与其他应用进行交互(如输入密码)时按的键。普通应用绝不需要此权限。"</string>
<string name="permlab_bindInputMethod" msgid="3360064620230515776">"绑定至输入法"</string>
- <string name="permdesc_bindInputMethod" msgid="3250440322807286331">"允许用户绑定至输入法的顶级接口。普通应用程序绝不需要此权限。"</string>
+ <string name="permdesc_bindInputMethod" msgid="3250440322807286331">"允许用户绑定至输入法的顶级接口。普通应用绝不需要此权限。"</string>
<string name="permlab_bindTextService" msgid="7358378401915287938">"绑定至文字服务"</string>
- <string name="permdesc_bindTextService" msgid="8151968910973998670">"允许用户绑定至文字服务(如 SpellCheckerService)的顶级接口。普通应用程序绝不需要此权限。"</string>
+ <string name="permdesc_bindTextService" msgid="8151968910973998670">"允许用户绑定至文字服务(如 SpellCheckerService)的顶级接口。普通应用绝不需要此权限。"</string>
<string name="permlab_bindVpnService" msgid="4708596021161473255">"绑定到 VPN 服务"</string>
- <string name="permdesc_bindVpnService" msgid="2067845564581693905">"允许用户绑定到 VPN 服务的顶级接口。普通应用程序从不需要此权限。"</string>
+ <string name="permdesc_bindVpnService" msgid="2067845564581693905">"允许用户绑定到 VPN 服务的顶级接口。普通应用从不需要此权限。"</string>
<string name="permlab_bindWallpaper" msgid="8716400279937856462">"绑定到壁纸"</string>
- <string name="permdesc_bindWallpaper" msgid="7108428692595491668">"允许用户绑定到壁纸的顶级接口。普通应用程序绝不需要此权限。"</string>
+ <string name="permdesc_bindWallpaper" msgid="7108428692595491668">"允许用户绑定到壁纸的顶级接口。普通应用绝不需要此权限。"</string>
<string name="permlab_bindRemoteViews" msgid="5697987759897367099">"绑定到窗口小部件服务"</string>
- <string name="permdesc_bindRemoteViews" msgid="4717987810137692572">"允许用户绑定到窗口小部件服务的顶级接口。普通应用程序绝不需要此权限。"</string>
+ <string name="permdesc_bindRemoteViews" msgid="4717987810137692572">"允许用户绑定到窗口小部件服务的顶级接口。普通应用绝不需要此权限。"</string>
<string name="permlab_bindDeviceAdmin" msgid="8704986163711455010">"与设备管理器交互"</string>
- <string name="permdesc_bindDeviceAdmin" msgid="569715419543907930">"允许用户将意向发送给设备管理员。普通应用程序绝不需要此权限。"</string>
+ <string name="permdesc_bindDeviceAdmin" msgid="569715419543907930">"允许用户将意向发送给设备管理员。普通应用绝不需要此权限。"</string>
<string name="permlab_setOrientation" msgid="3365947717163866844">"更改屏幕显示方向"</string>
- <string name="permdesc_setOrientation" msgid="3046126619316671476">"允许应用程序随时更改屏幕的旋转状态。普通应用程序绝不需要此权限。"</string>
+ <string name="permdesc_setOrientation" msgid="3046126619316671476">"允许应用随时更改屏幕的旋转状态。普通应用绝不需要此权限。"</string>
<string name="permlab_setPointerSpeed" msgid="9175371613322562934">"更改指针速度"</string>
- <string name="permdesc_setPointerSpeed" msgid="6866563234274104233">"允许应用程序随时更改鼠标或触控板指针速度。普通应用程序绝不需要此权限。"</string>
- <string name="permlab_signalPersistentProcesses" msgid="4539002991947376659">"向应用程序发送 Linux 信号"</string>
- <string name="permdesc_signalPersistentProcesses" msgid="4896992079182649141">"允许应用程序请求将提供的信号发送给所有持续的进程。"</string>
- <string name="permlab_persistentActivity" msgid="8841113627955563938">"让应用程序始终运行"</string>
- <string name="permdesc_persistentActivity" msgid="4909910271316074418">"允许应用程序持续保留其自身的某些组件,这样系统就无法将其用于其他应用程序。"</string>
- <string name="permlab_deletePackages" msgid="184385129537705938">"删除应用程序"</string>
- <string name="permdesc_deletePackages" msgid="7411480275167205081">"允许应用程序删除 Android 程序包。恶意应用程序可能借此删除重要的应用程序。"</string>
- <string name="permlab_clearAppUserData" msgid="274109191845842756">"删除其他应用程序的数据"</string>
- <string name="permdesc_clearAppUserData" msgid="4625323684125459488">"允许应用程序清除用户数据。"</string>
- <string name="permlab_deleteCacheFiles" msgid="3128665571837408675">"删除其他应用程序的缓存"</string>
- <string name="permdesc_deleteCacheFiles" msgid="3812998599006730196">"允许应用程序删除缓存文件。"</string>
- <string name="permlab_getPackageSize" msgid="7472921768357981986">"计算应用程序存储空间"</string>
- <string name="permdesc_getPackageSize" msgid="3921068154420738296">"允许应用程序检索其代码、数据和缓存大小"</string>
- <string name="permlab_installPackages" msgid="2199128482820306924">"直接安装应用程序"</string>
- <string name="permdesc_installPackages" msgid="5628530972548071284">"允许应用程序安装新的或更新的 Android 程序包。恶意应用程序可能借此添加具有任意权限的新应用程序。"</string>
- <string name="permlab_clearAppCache" msgid="7487279391723526815">"删除所有应用程序缓存数据"</string>
- <string name="permdesc_clearAppCache" product="tablet" msgid="3523396284474042284">"允许应用程序删除应用程序缓存目录中的文件,从而释放平板电脑的存储空间。对系统进程的访问权限通常受到很大的限制。"</string>
- <string name="permdesc_clearAppCache" product="default" msgid="5067988373366292186">"允许应用程序删除应用程序缓存目录中的文件,从而释放手机的存储空间。对系统进程的访问权限通常受到很大的限制。"</string>
- <string name="permlab_movePackage" msgid="3289890271645921411">"移动应用程序资源"</string>
- <string name="permdesc_movePackage" msgid="319562217778244524">"允许应用程序在内部与外部媒体之间移动应用程序资源。"</string>
+ <string name="permdesc_setPointerSpeed" msgid="6866563234274104233">"允许应用随时更改鼠标或触控板指针速度。普通应用绝不需要此权限。"</string>
+ <string name="permlab_signalPersistentProcesses" msgid="4539002991947376659">"向应用发送 Linux 信号"</string>
+ <string name="permdesc_signalPersistentProcesses" msgid="4896992079182649141">"允许应用请求将提供的信号发送给所有持续的进程。"</string>
+ <string name="permlab_persistentActivity" msgid="8841113627955563938">"让应用始终运行"</string>
+ <string name="permdesc_persistentActivity" msgid="4909910271316074418">"允许应用持续保留其自身的某些组件,这样系统就无法将其用于其他应用。"</string>
+ <string name="permlab_deletePackages" msgid="184385129537705938">"删除应用"</string>
+ <string name="permdesc_deletePackages" msgid="7411480275167205081">"允许应用删除 Android 程序包。恶意应用可能借此删除重要的应用。"</string>
+ <string name="permlab_clearAppUserData" msgid="274109191845842756">"删除其他应用的数据"</string>
+ <string name="permdesc_clearAppUserData" msgid="4625323684125459488">"允许应用清除用户数据。"</string>
+ <string name="permlab_deleteCacheFiles" msgid="3128665571837408675">"删除其他应用的缓存"</string>
+ <string name="permdesc_deleteCacheFiles" msgid="3812998599006730196">"允许应用删除缓存文件。"</string>
+ <string name="permlab_getPackageSize" msgid="7472921768357981986">"计算应用存储空间"</string>
+ <string name="permdesc_getPackageSize" msgid="3921068154420738296">"允许应用检索其代码、数据和缓存大小"</string>
+ <string name="permlab_installPackages" msgid="2199128482820306924">"直接安装应用"</string>
+ <string name="permdesc_installPackages" msgid="5628530972548071284">"允许应用安装新的或更新的 Android 程序包。恶意应用可能借此添加具有任意权限的新应用。"</string>
+ <string name="permlab_clearAppCache" msgid="7487279391723526815">"删除所有应用缓存数据"</string>
+ <string name="permdesc_clearAppCache" product="tablet" msgid="3523396284474042284">"允许应用删除应用缓存目录中的文件,从而释放平板电脑的存储空间。对系统进程的访问权限通常受到很大的限制。"</string>
+ <string name="permdesc_clearAppCache" product="default" msgid="5067988373366292186">"允许应用删除应用缓存目录中的文件,从而释放手机的存储空间。对系统进程的访问权限通常受到很大的限制。"</string>
+ <string name="permlab_movePackage" msgid="3289890271645921411">"移动应用资源"</string>
+ <string name="permdesc_movePackage" msgid="319562217778244524">"允许应用在内部与外部媒体之间移动应用资源。"</string>
<string name="permlab_readLogs" msgid="6615778543198967614">"查阅敏感日志数据"</string>
- <string name="permdesc_readLogs" product="tablet" msgid="82061313293455151">"允许应用程序从系统的各种日志文件中读取信息。这样,应用程序就可以发现关于您平板电脑使用情况的一般信息,其中可能包含个人信息或隐私信息。"</string>
- <string name="permdesc_readLogs" product="default" msgid="2063438140241560443">"允许应用程序从系统的各个日志文件中读取信息。这样,应用程序就可以发现关于您手机使用情况的一般信息,其中可能包含个人信息或隐私信息。"</string>
+ <string name="permdesc_readLogs" product="tablet" msgid="82061313293455151">"允许应用从系统的各种日志文件中读取信息。这样,应用就可以发现关于您平板电脑使用情况的一般信息,其中可能包含个人信息或隐私信息。"</string>
+ <string name="permdesc_readLogs" product="default" msgid="2063438140241560443">"允许应用从系统的各个日志文件中读取信息。这样,应用就可以发现关于您手机使用情况的一般信息,其中可能包含个人信息或隐私信息。"</string>
<string name="permlab_anyCodecForPlayback" msgid="715805555823881818">"使用任何媒体解码器进行播放"</string>
- <string name="permdesc_anyCodecForPlayback" msgid="8283912488433189010">"允许该应用程序使用任何已安装的媒体解码器进行解码,以便播放媒体。"</string>
+ <string name="permdesc_anyCodecForPlayback" msgid="8283912488433189010">"允许该应用使用任何已安装的媒体解码器进行解码,以便播放媒体。"</string>
<string name="permlab_diagnostic" msgid="8076743953908000342">"读取/写入诊断所拥有的资源"</string>
- <string name="permdesc_diagnostic" msgid="6608295692002452283">"允许应用程序读取/写入诊断组拥有的所有资源(例如 /dev 中的文件)。这可能会影响系统的稳定性和安全性。此权限仅供制造商或运营商诊断硬件方面的问题时使用。"</string>
- <string name="permlab_changeComponentState" msgid="6335576775711095931">"启用或停用应用程序组件"</string>
- <string name="permdesc_changeComponentState" product="tablet" msgid="8887435740982237294">"允许应用程序启用或停用其他应用程序的组件。恶意应用程序可能借此停用重要的平板电脑功能。请务必谨慎使用此权限,因为这可能导致某些应用程序组件处于无法使用、不一致或不稳定的状态。"</string>
- <string name="permdesc_changeComponentState" product="default" msgid="1827232484416505615">"允许应用程序启用或停用其他应用程序的组件。恶意应用程序可能借此停用重要的手机功能。请务必谨慎使用此权限,因为这可能导致某些应用程序组件进入无法使用、不一致或不稳定的状态。"</string>
+ <string name="permdesc_diagnostic" msgid="6608295692002452283">"允许应用读取/写入诊断组拥有的所有资源(例如 /dev 中的文件)。这可能会影响系统的稳定性和安全性。此权限仅供制造商或运营商诊断硬件方面的问题时使用。"</string>
+ <string name="permlab_changeComponentState" msgid="6335576775711095931">"启用或停用应用组件"</string>
+ <string name="permdesc_changeComponentState" product="tablet" msgid="8887435740982237294">"允许应用启用或停用其他应用的组件。恶意应用可能借此停用重要的平板电脑功能。请务必谨慎使用此权限,因为这可能导致某些应用组件处于无法使用、不一致或不稳定的状态。"</string>
+ <string name="permdesc_changeComponentState" product="default" msgid="1827232484416505615">"允许应用启用或停用其他应用的组件。恶意应用可能借此停用重要的手机功能。请务必谨慎使用此权限,因为这可能导致某些应用组件进入无法使用、不一致或不稳定的状态。"</string>
<string name="permlab_grantRevokePermissions" msgid="4627315351093508795">"授予或撤消权限"</string>
<string name="permdesc_grantRevokePermissions" msgid="4088642654085850662">"允许应用针对自身或其他应用授予或撤消特定权限。恶意应用可能会借此访问您未授权它们访问的功能。"</string>
- <string name="permlab_setPreferredApplications" msgid="8463181628695396391">"设置首选应用程序"</string>
- <string name="permdesc_setPreferredApplications" msgid="4973986762241783712">"允许应用程序修改您的首选应用程序。恶意应用程序可能会在后台更改运行的应用程序,欺骗您现有的应用程序,以收集您的私人数据。"</string>
+ <string name="permlab_setPreferredApplications" msgid="8463181628695396391">"设置首选应用"</string>
+ <string name="permdesc_setPreferredApplications" msgid="4973986762241783712">"允许应用修改您的首选应用。恶意应用可能会在后台更改运行的应用,欺骗您现有的应用,以收集您的私人数据。"</string>
<string name="permlab_writeSettings" msgid="1365523497395143704">"修改全局系统设置"</string>
- <string name="permdesc_writeSettings" msgid="7775723441558907181">"允许应用程序修改系统的设置数据。恶意应用程序可能会破坏您的系统配置。"</string>
+ <string name="permdesc_writeSettings" msgid="7775723441558907181">"允许应用修改系统的设置数据。恶意应用可能会破坏您的系统配置。"</string>
<string name="permlab_writeSecureSettings" msgid="204676251876718288">"修改安全系统设置"</string>
- <string name="permdesc_writeSecureSettings" msgid="8159535613020137391">"允许应用程序修改系统的安全设置数据。普通应用程序不能使用此权限。"</string>
+ <string name="permdesc_writeSecureSettings" msgid="8159535613020137391">"允许应用修改系统的安全设置数据。普通应用不能使用此权限。"</string>
<string name="permlab_writeGservices" msgid="2149426664226152185">"修改 Google 服务地图"</string>
- <string name="permdesc_writeGservices" msgid="1287309437638380229">"允许应用程序修改 Google 服务地图。普通应用程序不能使用此权限。"</string>
+ <string name="permdesc_writeGservices" msgid="1287309437638380229">"允许应用修改 Google 服务地图。普通应用不能使用此权限。"</string>
<string name="permlab_receiveBootCompleted" msgid="7776779842866993377">"开机时自动启动"</string>
- <string name="permdesc_receiveBootCompleted" product="tablet" msgid="7390304664116880704">"允许应用程序在系统完成引导后立即自动启动。这样可能会延长平板电脑的启动时间,并允许应用程序始终运行,从而导致平板电脑总体运行速度减慢。"</string>
- <string name="permdesc_receiveBootCompleted" product="default" msgid="513950589102617504">"允许应用程序在系统完成引导后立即自动启动。这样可能会延长手机的启动时间,并允许应用程序始终运行,从而导致手机总体运行速度减慢。"</string>
+ <string name="permdesc_receiveBootCompleted" product="tablet" msgid="7390304664116880704">"允许应用在系统完成引导后立即自动启动。这样可能会延长平板电脑的启动时间,并允许应用始终运行,从而导致平板电脑总体运行速度减慢。"</string>
+ <string name="permdesc_receiveBootCompleted" product="default" msgid="513950589102617504">"允许应用在系统完成引导后立即自动启动。这样可能会延长手机的启动时间,并允许应用始终运行,从而导致手机总体运行速度减慢。"</string>
<string name="permlab_broadcastSticky" msgid="7919126372606881614">"发送持久广播"</string>
- <string name="permdesc_broadcastSticky" product="tablet" msgid="1181582512022829259">"允许应用程序发送持久广播,此类广播在结束后仍会保留。恶意应用程序可能会导致平板电脑使用过多内存,从而使速度变慢或变得不稳定。"</string>
- <string name="permdesc_broadcastSticky" product="default" msgid="3287869131621514325">"允许应用程序发送持久广播,此类广播在结束后仍会保留。恶意应用程序可能会导致手机使用过多内存,从而使速度变慢或变得不稳定。"</string>
+ <string name="permdesc_broadcastSticky" product="tablet" msgid="1181582512022829259">"允许应用发送持久广播,此类广播在结束后仍会保留。恶意应用可能会导致平板电脑使用过多内存,从而使速度变慢或变得不稳定。"</string>
+ <string name="permdesc_broadcastSticky" product="default" msgid="3287869131621514325">"允许应用发送持久广播,此类广播在结束后仍会保留。恶意应用可能会导致手机使用过多内存,从而使速度变慢或变得不稳定。"</string>
<string name="permlab_readContacts" msgid="6219652189510218240">"读取联系人数据"</string>
- <string name="permdesc_readContacts" product="tablet" msgid="4028657556924039119">"允许应用程序读取您平板电脑上存储的所有联系人(地址)数据。恶意应用程序可能借此将您的数据发送给其他人。"</string>
- <string name="permdesc_readContacts" product="default" msgid="2032222056456498547">"允许应用程序读取您手机上存储的所有联系人(地址)数据。恶意应用程序可能借此将您的数据发送给其他人。"</string>
+ <string name="permdesc_readContacts" product="tablet" msgid="4028657556924039119">"允许应用读取您平板电脑上存储的所有联系人(地址)数据。恶意应用可能借此将您的数据发送给其他人。"</string>
+ <string name="permdesc_readContacts" product="default" msgid="2032222056456498547">"允许应用读取您手机上存储的所有联系人(地址)数据。恶意应用可能借此将您的数据发送给其他人。"</string>
<string name="permlab_writeContacts" msgid="644616215860933284">"写入联系数据"</string>
- <string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"允许应用程序读取您平板电脑上存储的联系人(地址)数据。恶意应用程序可能借此清除或修改您的联系人数据。"</string>
- <string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"允许应用程序修改您手机上存储的联系人(地址)数据。恶意应用程序可能借此清除或修改您的联系人数据。"</string>
+ <string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"允许应用读取您平板电脑上存储的联系人(地址)数据。恶意应用可能借此清除或修改您的联系人数据。"</string>
+ <string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"允许应用修改您手机上存储的联系人(地址)数据。恶意应用可能借此清除或修改您的联系人数据。"</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"读取通话记录"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"允许该应用读取平板电脑的通话记录,包括有关来电和外拨电话的数据。恶意应用可能会借此将您的数据发送给他人。"</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"允许该应用读取手机的通话记录,包括有关来电和外拨电话的数据。恶意应用可能会借此将您的数据发送给他人。"</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"写入通话记录"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"允许该应用修改平板电脑的通话记录,包括有关来电和外拨电话的数据。恶意应用可能会借此清除或修改您的通话记录。"</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"允许该应用修改手机的通话记录,包括有关来电和外拨电话的数据。恶意应用可能会借此清除或修改您的通话记录。"</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"读取您的个人资料数据"</string>
- <string name="permdesc_readProfile" product="default" msgid="94520753797630679">"允许应用程序读取您设备上存储的个人资料信息,例如您的姓名和联系信息。这意味着应用程序可以识别您的身份,并将您的个人资料信息发送给他人。"</string>
+ <string name="permdesc_readProfile" product="default" msgid="94520753797630679">"允许应用读取您设备上存储的个人资料信息,例如您的姓名和联系信息。这意味着应用可以识别您的身份,并将您的个人资料信息发送给他人。"</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"写入到您的个人资料数据"</string>
- <string name="permdesc_writeProfile" product="default" msgid="4637366723793045603">"允许应用程序更改或添加您设备上存储的个人资料信息,例如您的姓名和联系信息。这意味着其他应用程序可以识别您的身份,并将您的个人资料信息发送给他人。"</string>
+ <string name="permdesc_writeProfile" product="default" msgid="4637366723793045603">"允许应用更改或添加您设备上存储的个人资料信息,例如您的姓名和联系信息。这意味着其他应用可以识别您的身份,并将您的个人资料信息发送给他人。"</string>
<string name="permlab_readSocialStream" product="default" msgid="1268920956152419170">"读取您的社交视频流"</string>
- <string name="permdesc_readSocialStream" product="default" msgid="3419050808547335320">"允许应用程序访问并同步您和好友的社交最新动态。恶意应用程序可能借此读取您与社交网络上的好友之间的私人交流信息。"</string>
+ <string name="permdesc_readSocialStream" product="default" msgid="3419050808547335320">"允许应用访问并同步您和好友的社交最新动态。恶意应用可能借此读取您与社交网络上的好友之间的私人交流信息。"</string>
<string name="permlab_writeSocialStream" product="default" msgid="3504179222493235645">"写入您的社交视频流"</string>
- <string name="permdesc_writeSocialStream" product="default" msgid="3496277176955721451">"允许应用程序显示好友的社交最新动态。恶意应用程序可能借此冒充您的某位好友,诱骗您泄露密码或其他机密信息。"</string>
+ <string name="permdesc_writeSocialStream" product="default" msgid="3496277176955721451">"允许应用显示好友的社交最新动态。恶意应用可能借此冒充您的某位好友,诱骗您泄露密码或其他机密信息。"</string>
<string name="permlab_readCalendar" msgid="5972727560257612398">"读取日历活动和机密信息"</string>
- <string name="permdesc_readCalendar" product="tablet" msgid="2338414551004122687">"允许应用程序读取您平板电脑上存储的所有日历活动,包括朋友或同事的活动。恶意应用程序可能会在所有者不知情的情况下,从这些日历活动中提取个人信息。"</string>
- <string name="permdesc_readCalendar" product="default" msgid="5693933067751827753">"允许应用程序读取您手机上存储的所有日历活动,包括朋友或同事的活动。恶意应用程序可能会在所有者不知情的情况下,从这些日历活动中提取个人信息。"</string>
+ <string name="permdesc_readCalendar" product="tablet" msgid="2338414551004122687">"允许应用读取您平板电脑上存储的所有日历活动,包括朋友或同事的活动。恶意应用可能会在所有者不知情的情况下,从这些日历活动中提取个人信息。"</string>
+ <string name="permdesc_readCalendar" product="default" msgid="5693933067751827753">"允许应用读取您手机上存储的所有日历活动,包括朋友或同事的活动。恶意应用可能会在所有者不知情的情况下,从这些日历活动中提取个人信息。"</string>
<string name="permlab_writeCalendar" msgid="8438874755193825647">"添加或修改日历活动,并在所有者不知情的情况下向邀请对象发送电子邮件"</string>
- <string name="permdesc_writeCalendar" msgid="2243771395254848873">"允许应用程序以日历所有者的身份发送活动邀请,并添加、删除和更改您可在自己设备上修改的活动,包括朋友或同事的活动。恶意应用程序可能会冒充日历所有者发送垃圾邮件,在所有者不知情的情况下修改活动,或者添加虚假活动。"</string>
+ <string name="permdesc_writeCalendar" msgid="2243771395254848873">"允许应用以日历所有者的身份发送活动邀请,并添加、删除和更改您可在自己设备上修改的活动,包括朋友或同事的活动。恶意应用可能会冒充日历所有者发送垃圾邮件,在所有者不知情的情况下修改活动,或者添加虚假活动。"</string>
<string name="permlab_accessMockLocation" msgid="8688334974036823330">"使用模拟地点来源进行测试"</string>
- <string name="permdesc_accessMockLocation" msgid="7577931556422993949">"允许应用程序创建模拟位置源以进行测试。恶意应用程序可能借此覆盖由真实位置源(如 GPS 或网络服务提供商)返回的位置和/或状态信息。"</string>
+ <string name="permdesc_accessMockLocation" msgid="7577931556422993949">"允许应用创建模拟位置源以进行测试。恶意应用可能借此覆盖由真实位置源(如 GPS 或网络服务提供商)返回的位置和/或状态信息。"</string>
<string name="permlab_accessLocationExtraCommands" msgid="2836308076720553837">"获取额外的位置信息提供程序命令"</string>
- <string name="permdesc_accessLocationExtraCommands" msgid="6737736970602176133">"允许应用程序访问额外的位置提供程序命令。恶意应用程序可能借此干扰 GPS 或其他位置源的运行。"</string>
+ <string name="permdesc_accessLocationExtraCommands" msgid="6737736970602176133">"允许应用访问额外的位置提供程序命令。恶意应用可能借此干扰 GPS 或其他位置源的运行。"</string>
<string name="permlab_installLocationProvider" msgid="6578101199825193873">"允许安装位置信息提供程序"</string>
- <string name="permdesc_installLocationProvider" msgid="1742577679350078373">"创建模拟位置源以进行测试。恶意应用程序可能借此覆盖由真实位置源(如 GPS 或网络服务提供商)返回的位置和/或状态信息,或者监视您的位置并将信息提供给外部源。"</string>
+ <string name="permdesc_installLocationProvider" msgid="1742577679350078373">"创建模拟位置源以进行测试。恶意应用可能借此覆盖由真实位置源(如 GPS 或网络服务提供商)返回的位置和/或状态信息,或者监视您的位置并将信息提供给外部源。"</string>
<string name="permlab_accessFineLocation" msgid="8116127007541369477">"精准的(GPS)位置"</string>
- <string name="permdesc_accessFineLocation" product="tablet" msgid="5326423948268164934">"访问精准的位置源,例如平板电脑上的全球定位系统(如果有)。恶意应用程序可能借此确定您所处的位置,并可能消耗额外的电池电量。"</string>
- <string name="permdesc_accessFineLocation" product="default" msgid="7130267914433890869">"访问手机上的精准位置源,例如全球定位系统(如果有)。恶意应用程序可能借此确定您所处的位置,并可能消耗额外的电池电量。"</string>
+ <string name="permdesc_accessFineLocation" product="tablet" msgid="5326423948268164934">"访问精准的位置源,例如平板电脑上的全球定位系统(如果有)。恶意应用可能借此确定您所处的位置,并可能消耗额外的电池电量。"</string>
+ <string name="permdesc_accessFineLocation" product="default" msgid="7130267914433890869">"访问手机上的精准位置源,例如全球定位系统(如果有)。恶意应用可能借此确定您所处的位置,并可能消耗额外的电池电量。"</string>
<string name="permlab_accessCoarseLocation" msgid="4642255009181975828">"(基于网络的)粗略位置"</string>
- <string name="permdesc_accessCoarseLocation" product="tablet" msgid="5460726396318105483">"访问粗略的位置源(例如蜂窝网络数据库)以确定平板电脑的大体位置(如果可以)。恶意应用程序可能借此确定您所处的大体位置。"</string>
- <string name="permdesc_accessCoarseLocation" product="default" msgid="8900795778057579522">"访问粗略的位置源(例如蜂窝网络数据库)以确定手机的大体位置(如果可以)。恶意应用程序可能借此确定您所处的大体位置。"</string>
+ <string name="permdesc_accessCoarseLocation" product="tablet" msgid="5460726396318105483">"访问粗略的位置源(例如蜂窝网络数据库)以确定平板电脑的大体位置(如果可以)。恶意应用可能借此确定您所处的大体位置。"</string>
+ <string name="permdesc_accessCoarseLocation" product="default" msgid="8900795778057579522">"访问粗略的位置源(例如蜂窝网络数据库)以确定手机的大体位置(如果可以)。恶意应用可能借此确定您所处的大体位置。"</string>
<string name="permlab_accessSurfaceFlinger" msgid="2363969641792388947">"访问 SurfaceFlinger"</string>
- <string name="permdesc_accessSurfaceFlinger" msgid="1041619516733293551">"允许应用程序使用 SurfaceFlinger 低级功能。"</string>
+ <string name="permdesc_accessSurfaceFlinger" msgid="1041619516733293551">"允许应用使用 SurfaceFlinger 低级功能。"</string>
<string name="permlab_readFrameBuffer" msgid="6690504248178498136">"读取帧缓冲区"</string>
- <string name="permdesc_readFrameBuffer" msgid="4937405521809454680">"允许应用程序读取帧缓冲区的内容。"</string>
+ <string name="permdesc_readFrameBuffer" msgid="4937405521809454680">"允许应用读取帧缓冲区的内容。"</string>
<string name="permlab_modifyAudioSettings" msgid="6095859937069146086">"更改您的音频设置"</string>
- <string name="permdesc_modifyAudioSettings" msgid="7343951185408396919">"允许应用程序修改全局音频设置,如音量和路由。"</string>
+ <string name="permdesc_modifyAudioSettings" msgid="7343951185408396919">"允许应用修改全局音频设置,如音量和路由。"</string>
<string name="permlab_recordAudio" msgid="3876049771427466323">"录音"</string>
- <string name="permdesc_recordAudio" msgid="2387462233976248635">"允许应用程序访问录音路径。"</string>
+ <string name="permdesc_recordAudio" msgid="2387462233976248635">"允许应用访问录音路径。"</string>
<string name="permlab_camera" msgid="3616391919559751192">"拍摄照片和视频"</string>
- <string name="permdesc_camera" msgid="1507407407002492176">"允许应用程序使用相机拍摄照片和视频。该权限可让应用程序随时收集相机的取景。"</string>
+ <string name="permdesc_camera" msgid="1507407407002492176">"允许应用使用相机拍摄照片和视频。该权限可让应用随时收集相机的取景。"</string>
<string name="permlab_brick" product="tablet" msgid="2961292205764488304">"永久停用平板电脑"</string>
<string name="permlab_brick" product="default" msgid="8337817093326370537">"永久停用手机"</string>
- <string name="permdesc_brick" product="tablet" msgid="4334818808001699530">"允许应用程序永久停用整个平板电脑,但这样非常危险。"</string>
- <string name="permdesc_brick" product="default" msgid="5788903297627283099">"允许应用程序永久停用整个手机,但这非常危险。"</string>
+ <string name="permdesc_brick" product="tablet" msgid="4334818808001699530">"允许应用永久停用整个平板电脑,但这样非常危险。"</string>
+ <string name="permdesc_brick" product="default" msgid="5788903297627283099">"允许应用永久停用整个手机,但这非常危险。"</string>
<string name="permlab_reboot" product="tablet" msgid="3436634972561795002">"强行重新启动平板电脑"</string>
<string name="permlab_reboot" product="default" msgid="2898560872462638242">"强行重新启动手机"</string>
- <string name="permdesc_reboot" product="tablet" msgid="8172056180063700741">"允许应用程序强行重新启动平板电脑。"</string>
- <string name="permdesc_reboot" product="default" msgid="5326008124289989969">"允许应用程序强行重新启动手机。"</string>
+ <string name="permdesc_reboot" product="tablet" msgid="8172056180063700741">"允许应用强行重新启动平板电脑。"</string>
+ <string name="permdesc_reboot" product="default" msgid="5326008124289989969">"允许应用强行重新启动手机。"</string>
<string name="permlab_mount_unmount_filesystems" msgid="1761023272170956541">"装载和卸载文件系统"</string>
- <string name="permdesc_mount_unmount_filesystems" msgid="1829290701658992347">"允许应用程序装载和卸载可移动存储设备的文件系统。"</string>
+ <string name="permdesc_mount_unmount_filesystems" msgid="1829290701658992347">"允许应用装载和卸载可移动存储设备的文件系统。"</string>
<string name="permlab_mount_format_filesystems" msgid="5523285143576718981">"格式化外部存储设备"</string>
- <string name="permdesc_mount_format_filesystems" msgid="8784268246779198627">"允许应用程序格式化可移动存储设备。"</string>
+ <string name="permdesc_mount_format_filesystems" msgid="8784268246779198627">"允许应用格式化可移动存储设备。"</string>
<string name="permlab_asec_access" msgid="3411338632002193846">"获取有关内部存储设备的信息"</string>
- <string name="permdesc_asec_access" msgid="3094563844593878548">"允许应用程序获取有关内存设备的信息。"</string>
+ <string name="permdesc_asec_access" msgid="3094563844593878548">"允许应用获取有关内存设备的信息。"</string>
<string name="permlab_asec_create" msgid="6414757234789336327">"创建内部存储设备"</string>
- <string name="permdesc_asec_create" msgid="4558869273585856876">"允许应用程序创建内存设备。"</string>
+ <string name="permdesc_asec_create" msgid="4558869273585856876">"允许应用创建内存设备。"</string>
<string name="permlab_asec_destroy" msgid="526928328301618022">"清除内部存储设备"</string>
- <string name="permdesc_asec_destroy" msgid="7218749286145526537">"允许应用程序清除内存设备。"</string>
+ <string name="permdesc_asec_destroy" msgid="7218749286145526537">"允许应用清除内存设备。"</string>
<string name="permlab_asec_mount_unmount" msgid="8877998101944999386">"装载/卸载内存设备"</string>
- <string name="permdesc_asec_mount_unmount" msgid="3451360114902490929">"允许应用程序装载/卸载内存设备。"</string>
+ <string name="permdesc_asec_mount_unmount" msgid="3451360114902490929">"允许应用装载/卸载内存设备。"</string>
<string name="permlab_asec_rename" msgid="7496633954080472417">"重命名内部存储设备"</string>
- <string name="permdesc_asec_rename" msgid="1794757588472127675">"允许应用程序重命名内存设备。"</string>
+ <string name="permdesc_asec_rename" msgid="1794757588472127675">"允许应用重命名内存设备。"</string>
<string name="permlab_vibrate" msgid="7768356019980849603">"控制振动器"</string>
- <string name="permdesc_vibrate" msgid="6284989245902300945">"允许应用程序控制振动器。"</string>
+ <string name="permdesc_vibrate" msgid="6284989245902300945">"允许应用控制振动器。"</string>
<string name="permlab_flashlight" msgid="2155920810121984215">"控制闪光灯"</string>
- <string name="permdesc_flashlight" msgid="6522284794568368310">"允许应用程序控制闪光灯。"</string>
+ <string name="permdesc_flashlight" msgid="6522284794568368310">"允许应用控制闪光灯。"</string>
<string name="permlab_manageUsb" msgid="1113453430645402723">"管理 USB 设备的偏好设置和权限"</string>
- <string name="permdesc_manageUsb" msgid="7776155430218239833">"允许应用程序管理针对 USB 设备的偏好设置和权限。"</string>
+ <string name="permdesc_manageUsb" msgid="7776155430218239833">"允许应用管理针对 USB 设备的偏好设置和权限。"</string>
<string name="permlab_accessMtp" msgid="4953468676795917042">"应用 MTP 协议"</string>
<string name="permdesc_accessMtp" msgid="6532961200486791570">"允许访问内核 MTP 驱动程序,以便应用 MTP USB 协议。"</string>
<string name="permlab_hardware_test" msgid="4148290860400659146">"测试硬件"</string>
- <string name="permdesc_hardware_test" msgid="6597964191208016605">"允许应用程序控制各种外围设备以进行硬件测试。"</string>
+ <string name="permdesc_hardware_test" msgid="6597964191208016605">"允许应用控制各种外围设备以进行硬件测试。"</string>
<string name="permlab_callPhone" msgid="3925836347681847954">"直接拨打电话号码"</string>
- <string name="permdesc_callPhone" msgid="6396463004110544744">"允许应用程序在没有您干预的情况下呼叫电话号码。恶意应用程序可能会产生意料之外的话费。请注意,此权限不允许应用程序呼叫紧急电话。"</string>
+ <string name="permdesc_callPhone" msgid="6396463004110544744">"允许应用在没有您干预的情况下呼叫电话号码。恶意应用可能会产生意料之外的话费。请注意,此权限不允许应用呼叫紧急电话。"</string>
<string name="permlab_callPrivileged" msgid="4198349211108497879">"直接呼叫任何电话号码"</string>
- <string name="permdesc_callPrivileged" msgid="1689024901509996810">"允许应用程序在没有您干预的情况下呼叫任何电话号码,包括紧急呼叫号码。恶意应用程序可能会向紧急服务进行多余以及非法呼叫。"</string>
+ <string name="permdesc_callPrivileged" msgid="1689024901509996810">"允许应用在没有您干预的情况下呼叫任何电话号码,包括紧急呼叫号码。恶意应用可能会向紧急服务进行多余以及非法呼叫。"</string>
<string name="permlab_performCdmaProvisioning" product="tablet" msgid="4842576994144604821">"直接启动 CDMA 平板电脑设置"</string>
<string name="permlab_performCdmaProvisioning" product="default" msgid="5604848095315421425">"直接启动 CDMA 电话设置"</string>
- <string name="permdesc_performCdmaProvisioning" msgid="1994193538802314186">"允许应用程序启动 CDMA 配置。恶意应用程序可能会无端启动 CDMA 配置。"</string>
+ <string name="permdesc_performCdmaProvisioning" msgid="1994193538802314186">"允许应用启动 CDMA 配置。恶意应用可能会无端启动 CDMA 配置。"</string>
<string name="permlab_locationUpdates" msgid="7785408253364335740">"控制位置更新通知"</string>
- <string name="permdesc_locationUpdates" msgid="1120741557891438876">"允许应用程序启用/停用来自无线装置的位置更新通知。普通应用程序不能使用此权限。"</string>
+ <string name="permdesc_locationUpdates" msgid="1120741557891438876">"允许应用启用/停用来自无线装置的位置更新通知。普通应用不能使用此权限。"</string>
<string name="permlab_checkinProperties" msgid="7855259461268734914">"访问检入属性"</string>
- <string name="permdesc_checkinProperties" msgid="4024526968630194128">"允许应用程序对登记服务上传的属性拥有读取/写入权限。普通应用程序不能使用此权限。"</string>
+ <string name="permdesc_checkinProperties" msgid="4024526968630194128">"允许应用对登记服务上传的属性拥有读取/写入权限。普通应用不能使用此权限。"</string>
<string name="permlab_bindGadget" msgid="776905339015863471">"选择窗口小部件"</string>
- <string name="permdesc_bindGadget" msgid="8261326938599049290">"允许应用程序告知系统哪些窗口小部件可供哪个应用程序使用。拥有此权限的应用程序可向其他应用程序授予对个人资料的访问权限。普通应用程序不能使用此权限。"</string>
+ <string name="permdesc_bindGadget" msgid="8261326938599049290">"允许应用告知系统哪些窗口小部件可供哪个应用使用。拥有此权限的应用可向其他应用授予对个人资料的访问权限。普通应用不能使用此权限。"</string>
<string name="permlab_modifyPhoneState" msgid="8423923777659292228">"修改手机状态"</string>
- <string name="permdesc_modifyPhoneState" msgid="1029877529007686732">"允许应用程序控制设备的电话功能。拥有此权限的应用程序可在不通知您的情况下执行切换网络、开关手机无线装置等此类操作。"</string>
+ <string name="permdesc_modifyPhoneState" msgid="1029877529007686732">"允许应用控制设备的电话功能。拥有此权限的应用可在不通知您的情况下执行切换网络、开关手机无线装置等此类操作。"</string>
<string name="permlab_readPhoneState" msgid="2326172951448691631">"读取手机状态和身份"</string>
- <string name="permdesc_readPhoneState" msgid="5127767618743602782">"允许应用程序访问设备的电话功能。拥有此权限的应用程序可以确定本机的电话号码和序列号、通话是否有效、呼叫的号码等。"</string>
+ <string name="permdesc_readPhoneState" msgid="5127767618743602782">"允许应用访问设备的电话功能。拥有此权限的应用可以确定本机的电话号码和序列号、通话是否有效、呼叫的号码等。"</string>
<string name="permlab_wakeLock" product="tablet" msgid="1531731435011495015">"阻止平板电脑进入休眠状态"</string>
<string name="permlab_wakeLock" product="default" msgid="573480187941496130">"防止手机休眠"</string>
- <string name="permdesc_wakeLock" product="tablet" msgid="7311319824400447868">"允许应用程序阻止平板电脑进入休眠状态。"</string>
- <string name="permdesc_wakeLock" product="default" msgid="8559100677372928754">"允许应用程序阻止手机进入休眠状态。"</string>
+ <string name="permdesc_wakeLock" product="tablet" msgid="7311319824400447868">"允许应用阻止平板电脑进入休眠状态。"</string>
+ <string name="permdesc_wakeLock" product="default" msgid="8559100677372928754">"允许应用阻止手机进入休眠状态。"</string>
<string name="permlab_devicePower" product="tablet" msgid="2787034722616350417">"打开或关闭平板电脑"</string>
<string name="permlab_devicePower" product="default" msgid="4928622470980943206">"开机或关机"</string>
- <string name="permdesc_devicePower" product="tablet" msgid="6689862878984631831">"允许应用程序打开或关闭平板电脑。"</string>
- <string name="permdesc_devicePower" product="default" msgid="6037057348463131032">"允许应用程序打开或关闭手机。"</string>
+ <string name="permdesc_devicePower" product="tablet" msgid="6689862878984631831">"允许应用打开或关闭平板电脑。"</string>
+ <string name="permdesc_devicePower" product="default" msgid="6037057348463131032">"允许应用打开或关闭手机。"</string>
<string name="permlab_factoryTest" msgid="3715225492696416187">"在出厂测试模式下运行"</string>
<string name="permdesc_factoryTest" product="tablet" msgid="3952059318359653091">"作为低级制造商测试运行,从而允许对平板电脑硬件进行完全访问。此权限仅当平板电脑在制造商测试模式下运行时才可用。"</string>
<string name="permdesc_factoryTest" product="default" msgid="8136644990319244802">"作为一项低级制造商测试来运行,从而允许对手机硬件进行完全访问。此权限仅当手机在制造商测试模式下运行时才可用。。"</string>
<string name="permlab_setWallpaper" msgid="6627192333373465143">"设置壁纸"</string>
- <string name="permdesc_setWallpaper" msgid="7373447920977624745">"允许应用程序设置系统壁纸。"</string>
+ <string name="permdesc_setWallpaper" msgid="7373447920977624745">"允许应用设置系统壁纸。"</string>
<string name="permlab_setWallpaperHints" msgid="3600721069353106851">"设置有关壁纸大小的提示"</string>
- <string name="permdesc_setWallpaperHints" msgid="8235784384223730091">"允许应用程序设置有关系统壁纸大小的提示。"</string>
+ <string name="permdesc_setWallpaperHints" msgid="8235784384223730091">"允许应用设置有关系统壁纸大小的提示。"</string>
<string name="permlab_masterClear" msgid="2315750423139697397">"将系统恢复为出厂设置"</string>
- <string name="permdesc_masterClear" msgid="3665380492633910226">"允许应用程序将系统完全重置为其出厂设置,这会清除所有数据、配置和已安装的应用程序。"</string>
+ <string name="permdesc_masterClear" msgid="3665380492633910226">"允许应用将系统完全重置为其出厂设置,这会清除所有数据、配置和已安装的应用。"</string>
<string name="permlab_setTime" msgid="2021614829591775646">"设置时间"</string>
- <string name="permdesc_setTime" product="tablet" msgid="1896341438151152881">"允许应用程序更改平板电脑的时间。"</string>
- <string name="permdesc_setTime" product="default" msgid="1855702730738020">"允许应用程序更改手机的时间。"</string>
+ <string name="permdesc_setTime" product="tablet" msgid="1896341438151152881">"允许应用更改平板电脑的时间。"</string>
+ <string name="permdesc_setTime" product="default" msgid="1855702730738020">"允许应用更改手机的时间。"</string>
<string name="permlab_setTimeZone" msgid="2945079801013077340">"设置时区"</string>
- <string name="permdesc_setTimeZone" product="tablet" msgid="1676983712315827645">"允许应用程序更改平板电脑的时区。"</string>
- <string name="permdesc_setTimeZone" product="default" msgid="4499943488436633398">"允许应用程序更改手机的时区。"</string>
+ <string name="permdesc_setTimeZone" product="tablet" msgid="1676983712315827645">"允许应用更改平板电脑的时区。"</string>
+ <string name="permdesc_setTimeZone" product="default" msgid="4499943488436633398">"允许应用更改手机的时区。"</string>
<string name="permlab_accountManagerService" msgid="4829262349691386986">"作为 AccountManagerService"</string>
- <string name="permdesc_accountManagerService" msgid="1948455552333615954">"允许该应用程序调用 AccountAuthenticators。"</string>
+ <string name="permdesc_accountManagerService" msgid="1948455552333615954">"允许该应用调用 AccountAuthenticators。"</string>
<string name="permlab_getAccounts" msgid="4549918644233460103">"发现已知帐户"</string>
- <string name="permdesc_getAccounts" product="tablet" msgid="3238360555257773358">"允许应用程序获取平板电脑已知的帐户列表。"</string>
- <string name="permdesc_getAccounts" product="default" msgid="2735689364629830348">"允许应用程序获取手机已知的帐户列表。"</string>
+ <string name="permdesc_getAccounts" product="tablet" msgid="3238360555257773358">"允许应用获取平板电脑已知的帐户列表。"</string>
+ <string name="permdesc_getAccounts" product="default" msgid="2735689364629830348">"允许应用获取手机已知的帐户列表。"</string>
<string name="permlab_authenticateAccounts" msgid="3940505577982882450">"作为帐户身份验证程序"</string>
- <string name="permdesc_authenticateAccounts" msgid="5472124296908977260">"允许应用程序使用 AccountManager 的帐户身份验证程序功能,包括创建帐户以及获取和设置其密码。"</string>
+ <string name="permdesc_authenticateAccounts" msgid="5472124296908977260">"允许应用使用 AccountManager 的帐户身份验证程序功能,包括创建帐户以及获取和设置其密码。"</string>
<string name="permlab_manageAccounts" msgid="4440380488312204365">"管理帐户列表"</string>
- <string name="permdesc_manageAccounts" msgid="8698295625488292506">"允许应用程序执行添加帐户、删除帐户、删除帐户密码等操作。"</string>
+ <string name="permdesc_manageAccounts" msgid="8698295625488292506">"允许应用执行添加帐户、删除帐户、删除帐户密码等操作。"</string>
<string name="permlab_useCredentials" msgid="6401886092818819856">"使用帐户的身份验证凭据"</string>
- <string name="permdesc_useCredentials" msgid="7984227147403346422">"允许应用程序请求身份验证令牌。"</string>
+ <string name="permdesc_useCredentials" msgid="7984227147403346422">"允许应用请求身份验证令牌。"</string>
<string name="permlab_accessNetworkState" msgid="6865575199464405769">"查看网络状态"</string>
- <string name="permdesc_accessNetworkState" msgid="479772796952547198">"允许应用程序查看所有网络的状态。"</string>
+ <string name="permdesc_accessNetworkState" msgid="479772796952547198">"允许应用查看所有网络的状态。"</string>
<string name="permlab_createNetworkSockets" msgid="9121633680349549585">"完全的互联网访问权限"</string>
- <string name="permdesc_createNetworkSockets" msgid="5963922297444265950">"允许应用程序创建网络套接字。"</string>
+ <string name="permdesc_createNetworkSockets" msgid="5963922297444265950">"允许应用创建网络套接字。"</string>
<string name="permlab_writeApnSettings" msgid="505660159675751896">"更改/拦截网络设置和流量"</string>
- <string name="permdesc_writeApnSettings" msgid="5333798886412714193">"允许应用程序更改网络设置,并拦截和检查所有网络流量,例如更改任意 APN 的代理和端口。恶意应用程序可能会在您不知情的情况下监视、重定向或修改网络数据包。"</string>
+ <string name="permdesc_writeApnSettings" msgid="5333798886412714193">"允许应用更改网络设置,并拦截和检查所有网络流量,例如更改任意 APN 的代理和端口。恶意应用可能会在您不知情的情况下监视、重定向或修改网络数据包。"</string>
<string name="permlab_changeNetworkState" msgid="958884291454327309">"更改网络连接性"</string>
- <string name="permdesc_changeNetworkState" msgid="6789123912476416214">"允许应用程序更改网络连接的状态。"</string>
+ <string name="permdesc_changeNetworkState" msgid="6789123912476416214">"允许应用更改网络连接的状态。"</string>
<string name="permlab_changeTetherState" msgid="5952584964373017960">"更改网络共享连接"</string>
- <string name="permdesc_changeTetherState" msgid="1524441344412319780">"允许应用程序更改绑定网络连接的状态。"</string>
+ <string name="permdesc_changeTetherState" msgid="1524441344412319780">"允许应用更改绑定网络连接的状态。"</string>
<string name="permlab_changeBackgroundDataSetting" msgid="1400666012671648741">"更改后台数据使用设置"</string>
- <string name="permdesc_changeBackgroundDataSetting" msgid="5347729578468744379">"允许应用程序更改后台数据使用设置。"</string>
+ <string name="permdesc_changeBackgroundDataSetting" msgid="5347729578468744379">"允许应用更改后台数据使用设置。"</string>
<string name="permlab_accessWifiState" msgid="8100926650211034400">"查看 Wi-Fi 状态"</string>
- <string name="permdesc_accessWifiState" msgid="7770452658226256831">"允许应用程序查看有关 Wi-Fi 状态的信息。"</string>
+ <string name="permdesc_accessWifiState" msgid="7770452658226256831">"允许应用查看有关 Wi-Fi 状态的信息。"</string>
<string name="permlab_changeWifiState" msgid="7280632711057112137">"更改 Wi-Fi 状态"</string>
- <string name="permdesc_changeWifiState" msgid="7399961004537946240">"允许应用程序与 Wi-Fi 接入点建立和断开连接,并对配置的 Wi-Fi 网络进行更改。"</string>
+ <string name="permdesc_changeWifiState" msgid="7399961004537946240">"允许应用与 Wi-Fi 接入点建立和断开连接,并对配置的 Wi-Fi 网络进行更改。"</string>
<string name="permlab_changeWifiMulticastState" msgid="1368253871483254784">"允许接收 Wi-Fi 多播"</string>
- <string name="permdesc_changeWifiMulticastState" msgid="7633598524564320817">"允许应用程序接收并非直接发送至您设备的数据包。在查找附近提供的服务时,此权限很有用。这种操作所耗电量大于非多播模式。"</string>
+ <string name="permdesc_changeWifiMulticastState" msgid="7633598524564320817">"允许应用接收并非直接发送至您设备的数据包。在查找附近提供的服务时,此权限很有用。这种操作所耗电量大于非多播模式。"</string>
<string name="permlab_bluetoothAdmin" msgid="3606576270792236062">"蓝牙管理"</string>
- <string name="permdesc_bluetoothAdmin" product="tablet" msgid="6921177471748882137">"允许应用程序配置本地蓝牙平板电脑,以及发现远程设备并进行配对。"</string>
- <string name="permdesc_bluetoothAdmin" product="default" msgid="8931682159331542137">"允许应用程序配置本地蓝牙手机,以及发现远程设备并进行配对。"</string>
+ <string name="permdesc_bluetoothAdmin" product="tablet" msgid="6921177471748882137">"允许应用配置本地蓝牙平板电脑,以及发现远程设备并进行配对。"</string>
+ <string name="permdesc_bluetoothAdmin" product="default" msgid="8931682159331542137">"允许应用配置本地蓝牙手机,以及发现远程设备并进行配对。"</string>
<string name="permlab_accessWimaxState" msgid="1232061307208861588">"查看 WiMAX 状态"</string>
- <string name="permdesc_accessWimaxState" msgid="5914958077555177749">"允许该应用程序查看有关 WiMAX 状态的信息。"</string>
+ <string name="permdesc_accessWimaxState" msgid="5914958077555177749">"允许该应用查看有关 WiMAX 状态的信息。"</string>
<string name="permlab_changeWimaxState" msgid="2405042267131496579">"更改 WiMAX 状态"</string>
- <string name="permdesc_changeWimaxState" msgid="3328853825006455912">"允许该应用程序连接到 WiMAX 网络以及从 WiMAX 网络断开连接。"</string>
+ <string name="permdesc_changeWimaxState" msgid="3328853825006455912">"允许该应用连接到 WiMAX 网络以及从 WiMAX 网络断开连接。"</string>
<string name="permlab_bluetooth" msgid="8361038707857018732">"创建蓝牙连接"</string>
- <string name="permdesc_bluetooth" product="tablet" msgid="7007851048416363446">"允许应用程序查看本地蓝牙平板电脑的配置,以及建立和接受与配对设备的连接。"</string>
- <string name="permdesc_bluetooth" product="default" msgid="31846362767164948">"允许应用程序查看本地蓝牙手机的配置,以及建立和接受与配对设备的连接。"</string>
+ <string name="permdesc_bluetooth" product="tablet" msgid="7007851048416363446">"允许应用查看本地蓝牙平板电脑的配置,以及建立和接受与配对设备的连接。"</string>
+ <string name="permdesc_bluetooth" product="default" msgid="31846362767164948">"允许应用查看本地蓝牙手机的配置,以及建立和接受与配对设备的连接。"</string>
<string name="permlab_nfc" msgid="4423351274757876953">"控制近距离通信"</string>
- <string name="permdesc_nfc" msgid="7120611819401789907">"允许应用程序与近距离无线通信 (NFC) 标记、卡和阅读器进行通信。"</string>
+ <string name="permdesc_nfc" msgid="7120611819401789907">"允许应用与近距离无线通信 (NFC) 标记、卡和阅读器进行通信。"</string>
<string name="permlab_disableKeyguard" msgid="4977406164311535092">"停用键锁"</string>
- <string name="permdesc_disableKeyguard" msgid="6231611286892232626">"允许应用程序停用键锁和任何关联的密码安全设置。例如,在手机上接听电话时停用键锁,在通话结束后重新启用键锁。"</string>
+ <string name="permdesc_disableKeyguard" msgid="6231611286892232626">"允许应用停用键锁和任何关联的密码安全设置。例如,在手机上接听电话时停用键锁,在通话结束后重新启用键锁。"</string>
<string name="permlab_readSyncSettings" msgid="6201810008230503052">"读取同步设置"</string>
- <string name="permdesc_readSyncSettings" msgid="5464056785274229278">"允许应用程序读取同步设置,例如是否对“联系人”应用程序启用同步功能。"</string>
+ <string name="permdesc_readSyncSettings" msgid="5464056785274229278">"允许应用读取同步设置,例如是否对“联系人”应用启用同步功能。"</string>
<string name="permlab_writeSyncSettings" msgid="6297138566442486462">"写入同步设置"</string>
- <string name="permdesc_writeSyncSettings" msgid="1466056564502117130">"允许应用程序修改同步设置,例如是否对“联系人”应用程序启用同步功能。"</string>
+ <string name="permdesc_writeSyncSettings" msgid="1466056564502117130">"允许应用修改同步设置,例如是否对“联系人”应用启用同步功能。"</string>
<string name="permlab_readSyncStats" msgid="7396577451360202448">"读取同步统计信息"</string>
- <string name="permdesc_readSyncStats" msgid="3801971839939951678">"允许应用程序读取同步统计信息;例如,已发生的同步历史记录。"</string>
+ <string name="permdesc_readSyncStats" msgid="3801971839939951678">"允许应用读取同步统计信息;例如,已发生的同步历史记录。"</string>
<string name="permlab_subscribedFeedsRead" msgid="4756609637053353318">"读取订阅的供稿"</string>
- <string name="permdesc_subscribedFeedsRead" msgid="5557058907906144505">"允许应用程序获取有关当前同步的 Feed 的详情。"</string>
+ <string name="permdesc_subscribedFeedsRead" msgid="5557058907906144505">"允许应用获取有关当前同步的 Feed 的详情。"</string>
<string name="permlab_subscribedFeedsWrite" msgid="9015246325408209296">"写入订阅的供稿"</string>
- <string name="permdesc_subscribedFeedsWrite" msgid="6928930188826089413">"允许应用程序修改您当前同步的 Feed。恶意应用程序可能会更改您的同步 Feed。"</string>
+ <string name="permdesc_subscribedFeedsWrite" msgid="6928930188826089413">"允许应用修改您当前同步的 Feed。恶意应用可能会更改您的同步 Feed。"</string>
<string name="permlab_readDictionary" msgid="8410247960433376352">"读取用户定义的词典"</string>
- <string name="permdesc_readDictionary" msgid="8977815988329283705">"允许应用程序读取用户可能在用户词典中已存储的任意私有字词、名称和短语。"</string>
+ <string name="permdesc_readDictionary" msgid="8977815988329283705">"允许应用读取用户可能在用户词典中已存储的任意私有字词、名称和短语。"</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"写入用户定义的词典"</string>
- <string name="permdesc_writeDictionary" msgid="8185385716255065291">"允许应用程序向用户词典中写入新词。"</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permdesc_writeDictionary" msgid="8185385716255065291">"允许应用向用户词典中写入新词。"</string>
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"读取 USB 存储设备的内容"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"读取 SD 卡的内容"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"允许应用读取 USB 存储设备的内容。"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"允许应用读取 SD 卡的内容。"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"修改/删除 USB 存储设备内容"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"修改/删除 SD 卡中的内容"</string>
- <string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"允许应用程序写入 USB 存储设备。"</string>
- <string name="permdesc_sdcardWrite" product="default" msgid="4337417790936632090">"允许应用程序写入 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>
- <string name="permdesc_mediaStorageWrite" product="default" msgid="8189160597698529185">"允许应用程序修改内部媒体存储设备的内容。"</string>
+ <string name="permdesc_mediaStorageWrite" product="default" msgid="8189160597698529185">"允许应用修改内部媒体存储设备的内容。"</string>
<string name="permlab_cache_filesystem" msgid="5656487264819669824">"访问缓存文件系统"</string>
- <string name="permdesc_cache_filesystem" msgid="5578967642265550955">"允许应用程序读取和写入缓存文件系统。"</string>
+ <string name="permdesc_cache_filesystem" msgid="5578967642265550955">"允许应用读取和写入缓存文件系统。"</string>
<string name="permlab_use_sip" msgid="5986952362795870502">"拨打/接听互联网通话"</string>
- <string name="permdesc_use_sip" msgid="4717632000062674294">"允许应用程序使用 SIP 服务拨打/接听互联网电话。"</string>
+ <string name="permdesc_use_sip" msgid="4717632000062674294">"允许应用使用 SIP 服务拨打/接听互联网电话。"</string>
<string name="permlab_readNetworkUsageHistory" msgid="7862593283611493232">"读取网络使用情况历史记录"</string>
- <string name="permdesc_readNetworkUsageHistory" msgid="7689060749819126472">"允许应用程序读取特定网络和应用程序的网络使用情况历史记录。"</string>
+ <string name="permdesc_readNetworkUsageHistory" msgid="7689060749819126472">"允许应用读取特定网络和应用的网络使用情况历史记录。"</string>
<string name="permlab_manageNetworkPolicy" msgid="2562053592339859990">"管理网络政策"</string>
- <string name="permdesc_manageNetworkPolicy" msgid="7537586771559370668">"允许应用程序管理网络政策和定义专门针对应用程序的规则。"</string>
+ <string name="permdesc_manageNetworkPolicy" msgid="7537586771559370668">"允许应用管理网络政策和定义专门针对应用的规则。"</string>
<string name="permlab_modifyNetworkAccounting" msgid="5088217309088729650">"修改网络使用情况记录方式"</string>
- <string name="permdesc_modifyNetworkAccounting" msgid="5443412866746198123">"允许该应用程序修改对于各应用程序的网络使用情况的统计方式。普通应用程序不应使用此权限。"</string>
+ <string name="permdesc_modifyNetworkAccounting" msgid="5443412866746198123">"允许该应用修改对于各应用的网络使用情况的统计方式。普通应用不应使用此权限。"</string>
<string name="policylab_limitPassword" msgid="4497420728857585791">"设置密码规则"</string>
<string name="policydesc_limitPassword" msgid="3252114203919510394">"控制屏幕解锁密码所允许的长度和字符。"</string>
<string name="policylab_watchLogin" msgid="914130646942199503">"监视屏幕解锁尝试次数"</string>
@@ -540,7 +542,7 @@
<string name="policylab_expirePassword" msgid="885279151847254056">"设置锁定屏幕密码的有效期"</string>
<string name="policydesc_expirePassword" msgid="1729725226314691591">"控制系统强制用户更改屏幕锁定密码的频率。"</string>
<string name="policylab_encryptedStorage" msgid="8901326199909132915">"设置存储设备加密"</string>
- <string name="policydesc_encryptedStorage" msgid="2637732115325316992">"要求对存储的应用程序数据进行加密。"</string>
+ <string name="policydesc_encryptedStorage" msgid="2637732115325316992">"要求对存储的应用数据进行加密。"</string>
<string name="policylab_disableCamera" msgid="6395301023152297826">"停用相机"</string>
<string name="policydesc_disableCamera" msgid="2306349042834754597">"禁止使用所有设备摄像头。"</string>
<string-array name="phoneTypes">
@@ -758,20 +760,20 @@
<string name="autofill_area" msgid="3547409050889952423">"区域"</string>
<string name="autofill_emirate" msgid="2893880978835698818">"酋长国"</string>
<string name="permlab_readHistoryBookmarks" msgid="1284843728203412135">"读取浏览器的历史记录和书签"</string>
- <string name="permdesc_readHistoryBookmarks" msgid="4577476392604595921">"允许应用程序读取“浏览器”访问过的所有网址,以及“浏览器”的所有书签。"</string>
+ <string name="permdesc_readHistoryBookmarks" msgid="4577476392604595921">"允许应用读取“浏览器”访问过的所有网址,以及“浏览器”的所有书签。"</string>
<string name="permlab_writeHistoryBookmarks" msgid="9009434109836280374">"写入浏览器的历史记录和书签"</string>
- <string name="permdesc_writeHistoryBookmarks" product="tablet" msgid="1757103804824209530">"允许应用程序修改“浏览器”存储在平板电脑上的历史记录或书签。恶意应用程序可能借此删除或修改“浏览器”的数据。"</string>
- <string name="permdesc_writeHistoryBookmarks" product="default" msgid="6693764355720719197">"允许应用程序修改“浏览器”存储在手机上的历史记录或书签。恶意应用程序可能借此删除或修改“浏览器”的数据。"</string>
+ <string name="permdesc_writeHistoryBookmarks" product="tablet" msgid="1757103804824209530">"允许应用修改“浏览器”存储在平板电脑上的历史记录或书签。恶意应用可能借此删除或修改“浏览器”的数据。"</string>
+ <string name="permdesc_writeHistoryBookmarks" product="default" msgid="6693764355720719197">"允许应用修改“浏览器”存储在手机上的历史记录或书签。恶意应用可能借此删除或修改“浏览器”的数据。"</string>
<string name="permlab_setAlarm" msgid="5924401328803615165">"在闹钟中设置警报"</string>
- <string name="permdesc_setAlarm" msgid="316392039157473848">"允许应用程序在已安装的闹钟应用程序中设置闹钟。有些闹钟应用程序可能无法实现此功能。"</string>
+ <string name="permdesc_setAlarm" msgid="316392039157473848">"允许应用在已安装的闹钟应用中设置闹钟。有些闹钟应用可能无法实现此功能。"</string>
<string name="permlab_addVoicemail" msgid="5525660026090959044">"添加语音邮件"</string>
- <string name="permdesc_addVoicemail" msgid="6604508651428252437">"允许应用程序向您的语音信箱收件箱添加邮件。"</string>
+ <string name="permdesc_addVoicemail" msgid="6604508651428252437">"允许应用向您的语音信箱收件箱添加邮件。"</string>
<string name="permlab_writeGeolocationPermissions" msgid="5962224158955273932">"修改“浏览器”地理位置的权限"</string>
- <string name="permdesc_writeGeolocationPermissions" msgid="1083743234522638747">"允许应用程序修改“浏览器”的地理位置权限。恶意应用程序可能借此向任意网站发送位置信息。"</string>
+ <string name="permdesc_writeGeolocationPermissions" msgid="1083743234522638747">"允许应用修改“浏览器”的地理位置权限。恶意应用可能借此向任意网站发送位置信息。"</string>
<string name="permlab_packageVerificationAgent" msgid="5568139100645829117">"验证软件包"</string>
- <string name="permdesc_packageVerificationAgent" msgid="8437590190990843381">"允许应用程序验证程序包是否可以安装。"</string>
+ <string name="permdesc_packageVerificationAgent" msgid="8437590190990843381">"允许应用验证程序包是否可以安装。"</string>
<string name="permlab_bindPackageVerifier" msgid="4187786793360326654">"绑定到软件包验证程序"</string>
- <string name="permdesc_bindPackageVerifier" msgid="3180741773233862126">"允许用户请求使用程序包验证程序。普通应用程序绝不需要此权限。"</string>
+ <string name="permdesc_bindPackageVerifier" msgid="3180741773233862126">"允许用户请求使用程序包验证程序。普通应用绝不需要此权限。"</string>
<string name="permlab_serialPort" msgid="546083327654631076">"访问串行端口"</string>
<string name="permdesc_serialPort" msgid="2991639985224598193">"允许持有人使用 SerialManager API 访问串行端口。"</string>
<string name="permlab_accessContentProvidersExternally" msgid="5077774297943409285">"从外部访问内容提供程序"</string>
@@ -916,12 +918,12 @@
<string name="loading" msgid="7933681260296021180">"正在加载..."</string>
<string name="capital_on" msgid="1544682755514494298">"打开"</string>
<string name="capital_off" msgid="6815870386972805832">"关闭"</string>
- <string name="whichApplication" msgid="4533185947064773386">"选择要使用的应用程序:"</string>
+ <string name="whichApplication" msgid="4533185947064773386">"选择要使用的应用:"</string>
<string name="alwaysUse" msgid="4583018368000610438">"设为默认选项。"</string>
- <string name="clearDefaultHintMsg" msgid="3252584689512077257">"在“系统设置”>“应用程序”>“已下载”中清除默认设置。"</string>
+ <string name="clearDefaultHintMsg" msgid="3252584689512077257">"在“系统设置”>“应用”>“已下载”中清除默认设置。"</string>
<string name="chooseActivity" msgid="7486876147751803333">"选择操作"</string>
- <string name="chooseUsbActivity" msgid="6894748416073583509">"为 USB 设备选择一个应用程序"</string>
- <string name="noApplications" msgid="2991814273936504689">"没有应用程序可执行此操作。"</string>
+ <string name="chooseUsbActivity" msgid="6894748416073583509">"为 USB 设备选择一个应用"</string>
+ <string name="noApplications" msgid="2991814273936504689">"没有应用可执行此操作。"</string>
<string name="aerr_title" msgid="1905800560317137752"></string>
<string name="aerr_application" msgid="932628488013092776">"很抱歉,“<xliff:g id="APPLICATION">%1$s</xliff:g>”已停止运行。"</string>
<string name="aerr_process" msgid="4507058997035697579">"抱歉,进程“<xliff:g id="PROCESS">%1$s</xliff:g>”已停止运行。"</string>
@@ -934,26 +936,26 @@
<string name="report" msgid="4060218260984795706">"报告"</string>
<string name="wait" msgid="7147118217226317732">"等待"</string>
<string name="webpage_unresponsive" msgid="3272758351138122503">"该网页已无响应。"\n\n"要将其关闭吗?"</string>
- <string name="launch_warning_title" msgid="1547997780506713581">"应用程序已重定向"</string>
+ <string name="launch_warning_title" msgid="1547997780506713581">"应用已重定向"</string>
<string name="launch_warning_replace" msgid="6202498949970281412">"<xliff:g id="APP_NAME">%1$s</xliff:g>目前正在运行。"</string>
<string name="launch_warning_original" msgid="188102023021668683">"<xliff:g id="APP_NAME">%1$s</xliff:g>已启动。"</string>
<string name="screen_compat_mode_scale" msgid="3202955667675944499">"缩放"</string>
<string name="screen_compat_mode_show" msgid="4013878876486655892">"始终显示"</string>
- <string name="screen_compat_mode_hint" msgid="1064524084543304459">"在“系统设置”>“应用程序”>“已下载”中重新启用此模式。"</string>
- <string name="smv_application" msgid="3307209192155442829">"“<xliff:g id="APPLICATION">%1$s</xliff:g>”应用程序(<xliff:g id="PROCESS">%2$s</xliff:g> 进程)违反了自我强制执行的严格模式 (StrictMode) 政策。"</string>
+ <string name="screen_compat_mode_hint" msgid="1064524084543304459">"在“系统设置”>“应用”>“已下载”中重新启用此模式。"</string>
+ <string name="smv_application" msgid="3307209192155442829">"“<xliff:g id="APPLICATION">%1$s</xliff:g>”应用(<xliff:g id="PROCESS">%2$s</xliff:g> 进程)违反了自我强制执行的严格模式 (StrictMode) 政策。"</string>
<string name="smv_process" msgid="5120397012047462446">"进程 <xliff:g id="PROCESS">%1$s</xliff:g> 违反了自我强制执行的严格模式 (StrictMode) 政策。"</string>
<string name="android_upgrading_title" msgid="1584192285441405746">"Android 正在升级..."</string>
<string name="android_upgrading_apk" msgid="7904042682111526169">"正在优化第 <xliff:g id="NUMBER_0">%1$d</xliff:g> 个(共 <xliff:g id="NUMBER_1">%2$d</xliff:g> 个)。"</string>
- <string name="android_upgrading_starting_apps" msgid="451464516346926713">"正在启动应用程序。"</string>
+ <string name="android_upgrading_starting_apps" msgid="451464516346926713">"正在启动应用。"</string>
<string name="android_upgrading_complete" msgid="1405954754112999229">"即将完成启动。"</string>
<string name="heavy_weight_notification" msgid="9087063985776626166">"<xliff:g id="APP">%1$s</xliff:g>正在运行"</string>
- <string name="heavy_weight_notification_detail" msgid="1721681741617898865">"触摸可切换至应用程序"</string>
- <string name="heavy_weight_switcher_title" msgid="7153167085403298169">"切换应用程序吗?"</string>
- <string name="heavy_weight_switcher_text" msgid="7022631924534406403">"已有一个应用程序正在运行,要启动新的应用程序,您必须先停止该应用程序。"</string>
+ <string name="heavy_weight_notification_detail" msgid="1721681741617898865">"触摸可切换至应用"</string>
+ <string name="heavy_weight_switcher_title" msgid="7153167085403298169">"切换应用吗?"</string>
+ <string name="heavy_weight_switcher_text" msgid="7022631924534406403">"已有一个应用正在运行,要启动新的应用,您必须先停止该应用。"</string>
<string name="old_app_action" msgid="493129172238566282">"返回至<xliff:g id="OLD_APP">%1$s</xliff:g>"</string>
- <string name="old_app_description" msgid="2082094275580358049">"不启动新的应用程序。"</string>
+ <string name="old_app_description" msgid="2082094275580358049">"不启动新的应用。"</string>
<string name="new_app_action" msgid="5472756926945440706">"启动<xliff:g id="OLD_APP">%1$s</xliff:g>"</string>
- <string name="new_app_description" msgid="1932143598371537340">"停止旧的应用程序,但不保存。"</string>
+ <string name="new_app_description" msgid="1932143598371537340">"停止旧的应用,但不保存。"</string>
<string name="sendText" msgid="5209874571959469142">"选择要对文字执行的操作"</string>
<string name="volume_ringtone" msgid="6885421406845734650">"铃声音量"</string>
<string name="volume_music" msgid="5421651157138628171">"媒体音量"</string>
@@ -1001,7 +1003,7 @@
<string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"键入所需的 PIN:"</string>
<string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
<string name="select_character" msgid="3365550120617701745">"插入字符"</string>
- <string name="sms_control_default_app_name" msgid="3058577482636640465">"未知应用程序"</string>
+ <string name="sms_control_default_app_name" msgid="3058577482636640465">"未知应用"</string>
<string name="sms_control_title" msgid="7296612781128917719">"正在发送短信"</string>
<string name="sms_control_message" msgid="4073755190243093924">"正在发送大量短信。触摸“确定”继续,或触摸“取消”停止发送。"</string>
<string name="sms_control_yes" msgid="2532062172402615953">"确定"</string>
@@ -1037,7 +1039,7 @@
<string name="usb_storage_stop_button_mount" msgid="7060218034900696029">"关闭 USB 存储设备"</string>
<string name="usb_storage_stop_error_message" msgid="1970374898263063836">"关闭 USB 存储设备时遇到问题。请检查您是否已卸载了 USB 主设备,然后重试。"</string>
<string name="dlg_confirm_kill_storage_users_title" msgid="963039033470478697">"打开 USB 存储设备"</string>
- <string name="dlg_confirm_kill_storage_users_text" msgid="5100428757107469454">"如果您打开 USB 存储设备,您正在使用的某些应用程序将会停止,并且在您关闭 USB 存储设备前都将无法使用。"</string>
+ <string name="dlg_confirm_kill_storage_users_text" msgid="5100428757107469454">"如果您打开 USB 存储设备,您正在使用的某些应用将会停止,并且在您关闭 USB 存储设备前都将无法使用。"</string>
<string name="dlg_error_title" msgid="7323658469626514207">"USB 操作失败"</string>
<string name="dlg_ok" msgid="7376953167039865701">"确定"</string>
<string name="usb_mtp_notification_title" msgid="3699913097391550394">"作为媒体设备连接"</string>
@@ -1082,9 +1084,9 @@
<string name="ext_media_nomedia_notification_message" product="default" msgid="3870120652983659641">"SD 卡已移除。请插入新的 SD 卡。"</string>
<string name="activity_list_empty" msgid="1675388330786841066">"未找到匹配的活动。"</string>
<string name="permlab_pkgUsageStats" msgid="8787352074326748892">"更新组件使用情况统计"</string>
- <string name="permdesc_pkgUsageStats" msgid="1106612424254277630">"允许应用程序修改收集到的组件使用情况统计信息。普通应用程序不能使用此权限。"</string>
+ <string name="permdesc_pkgUsageStats" msgid="1106612424254277630">"允许应用修改收集到的组件使用情况统计信息。普通应用不能使用此权限。"</string>
<string name="permlab_copyProtectedData" msgid="4341036311211406692">"复制内容"</string>
- <string name="permdesc_copyProtectedData" msgid="4390697124288317831">"允许应用程序调用默认的容器服务,以便复制内容。普通应用程序不能使用此权限。"</string>
+ <string name="permdesc_copyProtectedData" msgid="4390697124288317831">"允许应用调用默认的容器服务,以便复制内容。普通应用不能使用此权限。"</string>
<string name="tutorial_double_tap_to_zoom_message_short" msgid="4070433208160063538">"触摸两次可进行缩放控制"</string>
<string name="gadget_host_error_inflating" msgid="4882004314906466162">"无法添加窗口小部件。"</string>
<string name="ime_action_go" msgid="8320845651737369027">"开始"</string>
@@ -1096,13 +1098,13 @@
<string name="ime_action_default" msgid="2840921885558045721">"执行"</string>
<string name="dial_number_using" msgid="5789176425167573586">"拨打电话"\n"<xliff:g id="NUMBER">%s</xliff:g>"</string>
<string name="create_contact_using" msgid="4947405226788104538">"创建电话号码为"\n"<xliff:g id="NUMBER">%s</xliff:g> 的联系人"</string>
- <string name="grant_credentials_permission_message_header" msgid="2106103817937859662">"以下一个或多个应用程序请求获得相应权限,以便在当前和以后访问您的帐户。"</string>
+ <string name="grant_credentials_permission_message_header" msgid="2106103817937859662">"以下一个或多个应用请求获得相应权限,以便在当前和以后访问您的帐户。"</string>
<string name="grant_credentials_permission_message_footer" msgid="3125211343379376561">"您是否同意此请求?"</string>
<string name="grant_permissions_header_text" msgid="6874497408201826708">"访问权限请求"</string>
<string name="allow" msgid="7225948811296386551">"允许"</string>
<string name="deny" msgid="2081879885755434506">"拒绝"</string>
<string name="permission_request_notification_title" msgid="6486759795926237907">"许可权限请求"</string>
- <string name="permission_request_notification_with_subtitle" msgid="8530393139639560189">"应用程序对帐户 <xliff:g id="ACCOUNT">%s</xliff:g>"\n" 提出权限请求。"</string>
+ <string name="permission_request_notification_with_subtitle" msgid="8530393139639560189">"应用对帐户 <xliff:g id="ACCOUNT">%s</xliff:g>"\n" 提出权限请求。"</string>
<string name="input_method_binding_label" msgid="1283557179944992649">"输入法"</string>
<string name="sync_binding_label" msgid="3687969138375092423">"同步"</string>
<string name="accessibility_binding_label" msgid="4148120742096474641">"辅助功能"</string>
@@ -1195,7 +1197,7 @@
<string name="keyboardview_keycode_mode_change" msgid="4547387741906537519">"模式更改"</string>
<string name="keyboardview_keycode_shift" msgid="2270748814315147690">"Shift"</string>
<string name="keyboardview_keycode_enter" msgid="2985864015076059467">"Enter"</string>
- <string name="activitychooserview_choose_application" msgid="2125168057199941199">"选择应用程序"</string>
+ <string name="activitychooserview_choose_application" msgid="2125168057199941199">"选择应用"</string>
<string name="shareactionprovider_share_with" msgid="806688056141131819">"共享对象"</string>
<string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"与“<xliff:g id="APPLICATION_NAME">%s</xliff:g>”共享"</string>
<string name="content_description_sliding_handle" msgid="415975056159262248">"滑动手柄。触摸并按住。"</string>
diff --git a/core/res/res/values-zh-rTW/arrays.xml b/core/res/res/values-zh-rTW/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-zh-rTW/arrays.xml
rename to core/res/res/values-zh-rTW/donottranslate-maps.xml
diff --git a/core/res/res/values-zh-rTW/strings.xml b/core/res/res/values-zh-rTW/strings.xml
index ae16b6b..447af8a 100644
--- a/core/res/res/values-zh-rTW/strings.xml
+++ b/core/res/res/values-zh-rTW/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"輸入聯絡人資料"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"允許應用程式修改平板電腦上儲存的聯絡人 (地址) 資料。請注意,惡意應用程式可能利用此功能清除或修改您的聯絡人資料。"</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"允許應用程式修改手機上儲存的聯絡人 (地址) 資料。請注意,惡意應用程式可能利用此功能清除或修改您的聯絡人資料。"</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"讀取通話紀錄"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"允許應用程式讀取平板電腦的通話紀錄,包括來電和已撥電話相關資料。請注意,惡意應用程式可能濫用此功能將您的資料傳送給他人。"</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"允許應用程式讀取手機的通話紀錄,包括來電和已撥電話相關資料。請注意,惡意應用程式可能濫用此功能將您的資料傳送給他人。"</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"寫入通話紀錄"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"允許應用程式修改平板電腦的通話紀錄,包括來電和已撥電話相關資料。請注意,惡意應用程式可能濫用此功能刪除或修改您的通話紀錄。"</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"允許應用程式修改手機的通話紀錄,包括來電和已撥電話相關資料。請注意,惡意應用程式可能濫用此功能刪除或修改您的通話紀錄。"</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"讀取您的個人資料"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"允許應用程式讀取裝置上儲存的個人資料,例如您的姓名和聯絡資訊。這表示應用程式可以識別您的身分,並將您的個人資料傳送給他人。"</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"寫入您的個人資料"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"允許應用程式讀取使用者儲存在使用者字典內的任何私人字詞、名稱和詞組。"</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"寫入使用者定義的字典"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"允許應用程式將新字詞寫入使用者的字典。"</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"讀取 USB 儲存裝置的內容"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"讀取 SD 卡的內容"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"允許應用程式讀取 USB 儲存裝置的內容。"</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"允許應用程式讀取 SD 卡的內容。"</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"修改/刪除 USB 儲存裝置內容"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"修改/刪除 SD 卡的內容"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"允許應用程式寫入 USB 儲存裝置。"</string>
@@ -741,8 +743,7 @@
<string name="double_tap_toast" msgid="4595046515400268881">"提示:輕按兩下即可縮放。"</string>
<string name="autofill_this_form" msgid="4616758841157816676">"自動填入功能"</string>
<string name="setup_autofill" msgid="7103495070180590814">"設定自動填入功能"</string>
- <!-- no translation found for autofill_address_name_separator (6350145154779706772) -->
- <skip />
+ <string name="autofill_address_name_separator" msgid="6350145154779706772">" //*** Empty segment here as a separator ***//"</string>
<string name="autofill_address_summary_name_format" msgid="3268041054899214945">"$1$2$3"</string>
<string name="autofill_address_summary_separator" msgid="7483307893170324129">", "</string>
<string name="autofill_address_summary_format" msgid="4874459455786827344">"$1$2$3"</string>
diff --git a/core/res/res/values-zu-rZA/arrays.xml b/core/res/res/values-zu-rZA/donottranslate-maps.xml
similarity index 100%
rename from core/res/res/values-zu-rZA/arrays.xml
rename to core/res/res/values-zu-rZA/donottranslate-maps.xml
diff --git a/core/res/res/values-zu/strings.xml b/core/res/res/values-zu/strings.xml
index 9301648..f43835f 100644
--- a/core/res/res/values-zu/strings.xml
+++ b/core/res/res/values-zu/strings.xml
@@ -335,6 +335,12 @@
<string name="permlab_writeContacts" msgid="644616215860933284">"bhala idatha yothintana naye"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="988969759110632978">"Ivumela insiza ukuthi iguqule imininingwane yekheli lokuxhumana eligcinwe ekhompyutheni yakho yepeni. Izinsiza ezinobungozi zingasebenzisa lokhu ukususa noma ziguqule ulwazi lwakho lokuxhuana."</string>
<string name="permdesc_writeContacts" product="default" msgid="5075164818647934067">"Ivumela insiza ukuthi iguqule imininingwane yekheli lokuxhumana eligcinwe ocingweni lwakho. Izinsiza ezinobungozi zingasebenzisa lokhu ukususa noma ziguqule ulwazi lwakho lokuxhuana."</string>
+ <string name="permlab_readCallLog" msgid="3478133184624102739">"funda irekhodi lamakholi"</string>
+ <string name="permdesc_readCallLog" product="tablet" msgid="3995157599976515002">"Ivumela uhlelo lokusebenza ukufunda irekhodi lamakholi lethubhulethi yakho, kufaka phakathi idatha mayelana namakholi angenayo naphumayo. Izinhlelo zikusebenza ezingalungile zingasebenzisa lokhu ukuthumela idatha kwabanye abantu."</string>
+ <string name="permdesc_readCallLog" product="default" msgid="3452017559804750758">"Ivumela uhlelo lokusebenza ukufunda irekhodi lamakholi akho, kufaka phakathi idatha mayelana namakholi aphumayo nangenayo. Izinhlelo zokusebenza ezingalungile zingasebenzisa lokhu ukuthumela idatha kwabanye abantu."</string>
+ <string name="permlab_writeCallLog" msgid="8552045664743499354">"bhala irekhodi lamakholi"</string>
+ <string name="permdesc_writeCallLog" product="tablet" msgid="6661806062274119245">"Ivumela uhlelo lokusebenza ukushintsha ilogi yekholi yethebulethi yakho, kufaka phakathi idatha mayelana namakholi angenayo naphumayo. Izinhlelo zikusebenza ezingalungile zingasebenzisa lokhu ukusula noma ukushintsha irekhodi lwamakholi wakho."</string>
+ <string name="permdesc_writeCallLog" product="default" msgid="683941736352787842">"Ivumela uhlelo lokusebenza ukushintsha irekhodi lamakholi efoni yakho, kufaka phakathi idatha emayelana namakholi angenayo naphumayo. Izinhlelo zikusebenza ezingalungile zingasebenzisa lokhu ukusula noma ukushintsha irekhodi lwamakholi wakho."</string>
<string name="permlab_readProfile" msgid="6824681438529842282">"bhala imininingo yemininingwane yakho"</string>
<string name="permdesc_readProfile" product="default" msgid="94520753797630679">"Ivumela insiza ukuthi ifunde ulwazi lomuntu lwephrofayli olugcinwe edivayisini yakho njengegama lakho kanye nemininingwane yokuxhumana nawe. Lokhu kuchaza ukuthi izinsa ingakuhlonza bese ithumelela abanye imininingwane yephrofayili yakho."</string>
<string name="permlab_writeProfile" msgid="4679878325177177400">"bhala imininingwane yemininingo yakho"</string>
@@ -499,14 +505,10 @@
<string name="permdesc_readDictionary" msgid="8977815988329283705">"Ivumela uhlelo lokusebenza ukufunda noma yimaphi amagama ayimfihlo, amagama nemisho leyo umsebenzisi ayigcine kwisichazamazwi somsebenzisi."</string>
<string name="permlab_writeDictionary" msgid="2296383164914812772">"bhala kwisichazamazwi esicacisiwe somsebenzisi"</string>
<string name="permdesc_writeDictionary" msgid="8185385716255065291">"Ivumela insiza ukuthi ibhale amagama amasha esichazinimazwi."</string>
- <!-- no translation found for permlab_sdcardRead (4086221374639183281) -->
- <skip />
- <!-- no translation found for permlab_sdcardRead (8537875151845139539) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (1055302898999352339) -->
- <skip />
- <!-- no translation found for permdesc_sdcardRead (7947792373570683542) -->
- <skip />
+ <string name="permlab_sdcardRead" product="nosdcard" msgid="4086221374639183281">"funda okuqukethwe kwesitoreji se-USB"</string>
+ <string name="permlab_sdcardRead" product="default" msgid="8537875151845139539">"funda okuqukethwe kwekhadi le-SD"</string>
+ <string name="permdesc_sdcardRead" product="nosdcard" msgid="1055302898999352339">"Ivumela uhlelo lokusebenza ukufunda okuqukethwe kokugciniwe okufinyeleleka nge-USB."</string>
+ <string name="permdesc_sdcardRead" product="default" msgid="7947792373570683542">"Ivumela uhlelo lokusebenza ukufunda okuqukethwe kwekhadi le-SD."</string>
<string name="permlab_sdcardWrite" product="nosdcard" msgid="85430876310764752">"guqula/susa okuqukethwe isitoreji se-USB"</string>
<string name="permlab_sdcardWrite" product="default" msgid="8079403759001777291">"guqula/susa okuqukethwe kwekhadi le-SD"</string>
<string name="permdesc_sdcardWrite" product="nosdcard" msgid="6175406299445710888">"Ivumela insiza ukuthi ibhalele ekulondolozweni kwe-USB."</string>
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index ce734fc..90ddc4b 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -338,16 +338,6 @@
<item>#ffffffff</item>
</array>
- <!-- Do not translate. -->
- <integer-array name="maps_starting_lat_lng">
- <item>36149777</item>
- <item>-95993398</item>
- </integer-array>
- <!-- Do not translate. -->
- <integer-array name="maps_starting_zoom">
- <item>3</item>
- </integer-array>
-
<!-- Used in LocalePicker -->
<string-array translatable="false" name="special_locale_codes">
<item>zh_CN</item>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index db908ca..428790f 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -589,12 +589,6 @@
<!-- NumberPicker style. -->
<attr name="numberPickerStyle" format="reference" />
- <!-- NumberPicker up button style. -->
- <attr name="numberPickerUpButtonStyle" format="reference" />
- <!-- NumberPicker down button style. -->
- <attr name="numberPickerDownButtonStyle" format="reference" />
- <!-- NumberPicker input text style. -->
- <attr name="numberPickerInputTextStyle" format="reference" />
<!-- The CalendarView style. -->
<attr name="calendarViewStyle" format="reference" />
@@ -3617,12 +3611,12 @@
<declare-styleable name="NumberPicker">
<!-- @hide Color for the solid color background if such for optimized rendering. -->
<attr name="solidColor" format="color|reference" />
- <!-- @hide Whether the number picker supports fligning. -->
- <attr name="flingable" format="boolean" />
<!-- @hide The divider for making the selection area. -->
<attr name="selectionDivider" format="reference" />
<!-- @hide The height of the selection divider. -->
<attr name="selectionDividerHeight" format="dimension" />
+ <!-- @hide The distance between the two selection dividers. -->
+ <attr name="selectionDividersDistance" format="dimension" />
<!-- @hide The min height of the NumberPicker. -->
<attr name="internalMinHeight" format="dimension" />
<!-- @hide The max height of the NumberPicker. -->
@@ -3631,6 +3625,10 @@
<attr name="internalMinWidth" format="dimension" />
<!-- @hide The max width of the NumberPicker. -->
<attr name="internalMaxWidth" format="dimension" />
+ <!-- @hide The layout of the number picker. -->
+ <attr name="internalLayout" />
+ <!-- @hide The minimal move distance of a swipe to be considered a fling. -->
+ <attr name="minFlingDistance" format="dimension" />
</declare-styleable>
<declare-styleable name="TimePicker">
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index b1a4b42..5ff2c01 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -113,7 +113,7 @@
<color name="lockscreen_owner_info">#ff9a9a9a</color>
<!-- FaceLock -->
- <color name="facelock_color_background">#000000</color>
+ <color name="facelock_spotlight_mask">#CC000000</color>
<!-- For holo theme -->
<drawable name="screen_background_holo_light">#fff3f3f3</drawable>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 4d9b043a..4fde018 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -284,6 +284,10 @@
point on the move. A value of 0 means no periodic scans will be used in the framework. -->
<integer translatable="false" name="config_wifi_framework_scan_interval">300000</integer>
+ <!-- Wifi driver stop delay, in milliseconds.
+ Default value is 2 minutes. -->
+ <integer translatable="false" name="config_wifi_driver_stop_delay">120000</integer>
+
<!-- Flag indicating whether the keyguard should be bypassed when
the slider is open. This can be set or unset depending how easily
the slider can be opened (for example, in a pocket or purse). -->
@@ -304,6 +308,9 @@
<!-- If this is true, the screen will fade off. -->
<bool name="config_animateScreenLights">true</bool>
+ <!-- If this is true, key chords can be used to take a screenshot on the device. -->
+ <bool name="config_enableScreenshotChord">true</bool>
+
<!-- If true, the screen can be rotated via the accelerometer in all 4
rotations as the default behavior. -->
<bool name="config_allowAllRotations">false</bool>
@@ -628,6 +635,10 @@
cell broadcasting sms, and MMS. -->
<bool name="config_sms_capable">true</bool>
+ <!-- Enable/disable default bluetooth profiles:
+ HSP_AG, ObexObjectPush, Audio, NAP -->
+ <bool name="config_bluetooth_default_profiles">true</bool>
+
<!-- IP address of the dns server to use if nobody else suggests one -->
<string name="config_default_dns_server" translatable="false">8.8.8.8</string>
diff --git a/core/res/res/values/donottranslate-maps.xml b/core/res/res/values/donottranslate-maps.xml
new file mode 100644
index 0000000..ee32f01
--- /dev/null
+++ b/core/res/res/values/donottranslate-maps.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/colors.xml
+**
+** 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.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- Do not translate. -->
+ <integer-array name="maps_starting_lat_lng">
+ <item>36149777</item>
+ <item>-95993398</item>
+ </integer-array>
+ <!-- Do not translate. -->
+ <integer-array name="maps_starting_zoom">
+ <item>3</item>
+ </integer-array>
+
+</resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index a089021..e1bc33b 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -194,6 +194,10 @@
<java-symbol type="id" name="zoomIn" />
<java-symbol type="id" name="zoomMagnify" />
<java-symbol type="id" name="zoomOut" />
+ <java-symbol type="id" name="actions" />
+ <java-symbol type="id" name="action0" />
+ <java-symbol type="id" name="action1" />
+ <java-symbol type="id" name="action2" />
<java-symbol type="attr" name="actionModeShareDrawable" />
<java-symbol type="attr" name="alertDialogCenterButtons" />
@@ -240,6 +244,8 @@
<java-symbol type="bool" name="config_useMasterVolume" />
<java-symbol type="bool" name="config_enableWallpaperService" />
<java-symbol type="bool" name="config_sendAudioBecomingNoisy" />
+ <java-symbol type="bool" name="config_enableScreenshotChord" />
+ <java-symbol type="bool" name="config_bluetooth_default_profiles" />
<java-symbol type="integer" name="config_cursorWindowSize" />
<java-symbol type="integer" name="config_longPressOnPowerBehavior" />
@@ -251,6 +257,7 @@
<java-symbol type="integer" name="db_journal_size_limit" />
<java-symbol type="integer" name="db_wal_autocheckpoint" />
<java-symbol type="integer" name="max_action_buttons" />
+ <java-symbol type="integer" name="config_wifi_driver_stop_delay" />
<java-symbol type="color" name="tab_indicator_text_v4" />
@@ -974,6 +981,9 @@
<java-symbol type="drawable" name="unlock_halo" />
<java-symbol type="drawable" name="unlock_ring" />
<java-symbol type="drawable" name="unlock_wave" />
+ <java-symbol type="drawable" name="ic_lockscreen_camera" />
+ <java-symbol type="drawable" name="ic_lockscreen_silent" />
+ <java-symbol type="drawable" name="ic_lockscreen_unlock" />
<java-symbol type="layout" name="action_bar_home" />
<java-symbol type="layout" name="action_bar_title_item" />
@@ -1059,6 +1069,7 @@
<java-symbol type="layout" name="zoom_container" />
<java-symbol type="layout" name="zoom_controls" />
<java-symbol type="layout" name="zoom_magnify" />
+ <java-symbol type="layout" name="notification_intruder_content" />
<java-symbol type="anim" name="slide_in_child_bottom" />
<java-symbol type="anim" name="slide_in_right" />
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index a51f3f9..288b8b2 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -521,10 +521,10 @@
</style>
<style name="Widget.NumberPicker">
+ <item name="android:internalLayout">@android:layout/number_picker</item>
<item name="android:orientation">vertical</item>
<item name="android:fadingEdge">vertical</item>
<item name="android:fadingEdgeLength">50dip</item>
- <item name="android:flingable">false</item>
</style>
<style name="Widget.TimePicker">
@@ -536,25 +536,6 @@
<item name="android:calendarViewShown">false</item>
</style>
- <style name="Widget.ImageButton.NumberPickerUpButton">
- <item name="android:background">@android:drawable/numberpicker_up_btn</item>
- <item name="android:paddingTop">22dip</item>
- <item name="android:paddingBottom">22dip</item>
- </style>
-
- <style name="Widget.ImageButton.NumberPickerDownButton">
- <item name="android:background">@android:drawable/numberpicker_down_btn</item>
- <item name="android:paddingTop">22dip</item>
- <item name="android:paddingBottom">22dip</item>
- </style>
-
- <style name="Widget.EditText.NumberPickerInputText">
- <item name="android:textAppearance">@style/TextAppearance.Large.Inverse.NumberPickerInputText</item>
- <item name="android:gravity">center</item>
- <item name="android:singleLine">true</item>
- <item name="android:background">@drawable/numberpicker_input</item>
- </style>
-
<style name="Widget.AutoCompleteTextView" parent="Widget.EditText">
<item name="android:completionHintView">@android:layout/simple_dropdown_hint</item>
<item name="android:completionThreshold">2</item>
@@ -1656,12 +1637,14 @@
</style>
<style name="Widget.Holo.NumberPicker" parent="Widget.NumberPicker">
+ <item name="android:internalLayout">@android:layout/number_picker_with_selector_wheel</item>
<item name="android:solidColor">@android:color/transparent</item>
- <item name="android:flingable">true</item>
<item name="android:selectionDivider">@android:drawable/numberpicker_selection_divider</item>
<item name="android:selectionDividerHeight">2dip</item>
+ <item name="android:selectionDividersDistance">48dip</item>
<item name="android:internalMinWidth">48dip</item>
<item name="android:internalMaxHeight">200dip</item>
+ <item name="android:minFlingDistance">150dip</item>
</style>
<style name="Widget.Holo.TimePicker" parent="Widget.TimePicker">
@@ -1673,31 +1656,6 @@
<item name="android:calendarViewShown">true</item>
</style>
- <style name="Widget.Holo.ImageButton.NumberPickerUpButton">
- <item name="android:background">@null</item>
- <item name="android:src">@android:drawable/numberpicker_up_btn_holo_dark</item>
- <item name="android:paddingTop">16dip</item>
- <item name="android:paddingBottom">22dip</item>
- </style>
-
- <style name="Widget.Holo.ImageButton.NumberPickerDownButton">
- <item name="android:background">@null</item>
- <item name="android:src">@android:drawable/numberpicker_down_btn_holo_dark</item>
- <item name="android:paddingTop">22dip</item>
- <item name="android:paddingBottom">16dip</item>
- </style>
-
- <style name="Widget.Holo.EditText.NumberPickerInputText">
- <item name="android:paddingTop">13sp</item>
- <item name="android:paddingBottom">13sp</item>
- <item name="android:paddingLeft">2sp</item>
- <item name="android:paddingRight">2sp</item>
- <item name="android:gravity">center</item>
- <item name="android:singleLine">true</item>
- <item name="android:textSize">18sp</item>
- <item name="android:background">@null</item>
- </style>
-
<style name="Widget.Holo.ActivityChooserView" parent="Widget.ActivityChooserView">
</style>
@@ -2109,17 +2067,6 @@
<style name="Widget.Holo.Light.DatePicker" parent="Widget.Holo.DatePicker">
</style>
- <style name="Widget.Holo.Light.ImageButton.NumberPickerUpButton" parent="Widget.Holo.ImageButton.NumberPickerUpButton">
- <item name="android:src">@android:drawable/numberpicker_up_btn_holo_light</item>
- </style>
-
- <style name="Widget.Holo.Light.ImageButton.NumberPickerDownButton" parent="Widget.Holo.ImageButton.NumberPickerDownButton">
- <item name="android:src">@android:drawable/numberpicker_down_btn_holo_light</item>
- </style>
-
- <style name="Widget.Holo.Light.EditText.NumberPickerInputText" parent="Widget.Holo.EditText.NumberPickerInputText">
- </style>
-
<style name="Widget.Holo.Light.ActivityChooserView" parent="Widget.Holo.ActivityChooserView">
<item name="android:background">@android:drawable/ab_share_pack_holo_light</item>
</style>
diff --git a/core/res/res/values/styles_device_defaults.xml b/core/res/res/values/styles_device_defaults.xml
index 6419872..330e68c 100644
--- a/core/res/res/values/styles_device_defaults.xml
+++ b/core/res/res/values/styles_device_defaults.xml
@@ -200,9 +200,6 @@
<style name="Widget.DeviceDefault.CompoundButton.Switch" parent="Widget.Holo.CompoundButton.Switch">
</style>
- <style name="Widget.DeviceDefault.EditText.NumberPickerInputText" parent="Widget.Holo.EditText.NumberPickerInputText">
-
- </style>
<style name="Widget.DeviceDefault.ExpandableListView.White" parent="Widget.Holo.ExpandableListView.White">
</style>
@@ -212,12 +209,6 @@
<style name="Widget.DeviceDefault.GestureOverlayView" parent="Widget.Holo.GestureOverlayView">
</style>
- <style name="Widget.DeviceDefault.ImageButton.NumberPickerDownButton" parent="Widget.Holo.ImageButton.NumberPickerDownButton">
-
- </style>
- <style name="Widget.DeviceDefault.ImageButton.NumberPickerUpButton" parent="Widget.Holo.ImageButton.NumberPickerUpButton">
-
- </style>
<style name="Widget.DeviceDefault.ImageWell" parent="Widget.Holo.ImageWell">
</style>
@@ -465,9 +456,6 @@
<style name="Widget.DeviceDefault.Light.DatePicker" parent="Widget.Holo.Light.DatePicker">
</style>
- <style name="Widget.DeviceDefault.Light.EditText.NumberPickerInputText" parent="Widget.Holo.Light.EditText.NumberPickerInputText">
-
- </style>
<style name="Widget.DeviceDefault.Light.ExpandableListView.White" parent="Widget.Holo.Light.ExpandableListView.White">
</style>
@@ -477,12 +465,6 @@
<style name="Widget.DeviceDefault.Light.GestureOverlayView" parent="Widget.Holo.Light.GestureOverlayView">
</style>
- <style name="Widget.DeviceDefault.Light.ImageButton.NumberPickerDownButton" parent="Widget.Holo.Light.ImageButton.NumberPickerDownButton">
-
- </style>
- <style name="Widget.DeviceDefault.Light.ImageButton.NumberPickerUpButton" parent="Widget.Holo.Light.ImageButton.NumberPickerUpButton">
-
- </style>
<style name="Widget.DeviceDefault.Light.ImageWell" parent="Widget.Holo.Light.ImageWell">
</style>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 55438b2..7e06e24 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -345,10 +345,7 @@
<!-- PreferenceFrameLayout attributes -->
<item name="preferenceFrameLayoutStyle">@android:style/Widget.PreferenceFrameLayout</item>
- <!-- NumberPicker styles-->
- <item name="numberPickerUpButtonStyle">@style/Widget.ImageButton.NumberPickerUpButton</item>
- <item name="numberPickerDownButtonStyle">@style/Widget.ImageButton.NumberPickerDownButton</item>
- <item name="numberPickerInputTextStyle">@style/Widget.EditText.NumberPickerInputText</item>
+ <!-- NumberPicker style-->
<item name="numberPickerStyle">@style/Widget.NumberPicker</item>
<!-- CalendarView style-->
@@ -1141,10 +1138,7 @@
<!-- PreferenceFrameLayout attributes -->
<item name="preferenceFrameLayoutStyle">@android:style/Widget.Holo.PreferenceFrameLayout</item>
- <!-- NumberPicker styles-->
- <item name="numberPickerUpButtonStyle">@style/Widget.Holo.ImageButton.NumberPickerUpButton</item>
- <item name="numberPickerDownButtonStyle">@style/Widget.Holo.ImageButton.NumberPickerDownButton</item>
- <item name="numberPickerInputTextStyle">@style/Widget.Holo.EditText.NumberPickerInputText</item>
+ <!-- NumberPicker style-->
<item name="numberPickerStyle">@style/Widget.Holo.NumberPicker</item>
<!-- CalendarView style-->
@@ -1443,10 +1437,7 @@
<item name="searchDialogTheme">@style/Theme.Holo.Light.SearchBar</item>
- <!-- NumberPicker attributes and styles-->
- <item name="numberPickerUpButtonStyle">@style/Widget.Holo.Light.ImageButton.NumberPickerUpButton</item>
- <item name="numberPickerDownButtonStyle">@style/Widget.Holo.Light.ImageButton.NumberPickerDownButton</item>
- <item name="numberPickerInputTextStyle">@style/Widget.Holo.Light.EditText.NumberPickerInputText</item>
+ <!-- NumberPicker style-->
<item name="numberPickerStyle">@style/Widget.Holo.Light.NumberPicker</item>
<!-- CalendarView style-->
diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml
index 7fd981c..ae9255a 100644
--- a/core/res/res/values/themes_device_defaults.xml
+++ b/core/res/res/values/themes_device_defaults.xml
@@ -179,10 +179,7 @@
<!-- PreferenceFrameLayout attributes -->
<item name="preferenceFrameLayoutStyle">@android:style/Widget.DeviceDefault.PreferenceFrameLayout</item>
- <!-- NumberPicker styles-->
- <item name="numberPickerUpButtonStyle">@style/Widget.DeviceDefault.ImageButton.NumberPickerUpButton</item>
- <item name="numberPickerDownButtonStyle">@style/Widget.DeviceDefault.ImageButton.NumberPickerDownButton</item>
- <item name="numberPickerInputTextStyle">@style/Widget.DeviceDefault.EditText.NumberPickerInputText</item>
+ <!-- NumberPicker style-->
<item name="numberPickerStyle">@style/Widget.DeviceDefault.NumberPicker</item>
<!-- CalendarView style-->
@@ -329,10 +326,7 @@
<item name="searchDialogTheme">@style/Theme.DeviceDefault.Light.SearchBar</item>
- <!-- NumberPicker attributes and styles-->
- <item name="numberPickerUpButtonStyle">@style/Widget.DeviceDefault.Light.ImageButton.NumberPickerUpButton</item>
- <item name="numberPickerDownButtonStyle">@style/Widget.DeviceDefault.Light.ImageButton.NumberPickerDownButton</item>
- <item name="numberPickerInputTextStyle">@style/Widget.DeviceDefault.Light.EditText.NumberPickerInputText</item>
+ <!-- NumberPicker style -->
<item name="numberPickerStyle">@style/Widget.DeviceDefault.Light.NumberPicker</item>
<!-- CalendarView style-->
diff --git a/core/tests/coretests/src/android/content/pm/AppCacheTest.java b/core/tests/coretests/src/android/content/pm/AppCacheTest.java
index 2982816..0c31e2d 100755
--- a/core/tests/coretests/src/android/content/pm/AppCacheTest.java
+++ b/core/tests/coretests/src/android/content/pm/AppCacheTest.java
@@ -24,6 +24,7 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.StatFs;
+import android.os.UserId;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
@@ -674,7 +675,7 @@
PackageDataObserver observer = new PackageDataObserver();
//wait on observer
synchronized(observer) {
- getPm().clearApplicationUserData(packageName, observer);
+ getPm().clearApplicationUserData(packageName, observer, 0 /* TODO: Other users */);
long waitTime = 0;
while(!observer.isDone() || (waitTime > MAX_WAIT_TIME)) {
observer.wait(WAIT_TIME_INCR);
@@ -717,7 +718,8 @@
File getDataDir() {
try {
- ApplicationInfo appInfo = getPm().getApplicationInfo(mContext.getPackageName(), 0);
+ ApplicationInfo appInfo = getPm().getApplicationInfo(mContext.getPackageName(), 0,
+ UserId.myUserId());
return new File(appInfo.dataDir);
} catch (RemoteException e) {
throw new RuntimeException("Pacakge manager dead", e);
@@ -746,7 +748,7 @@
@LargeTest
public void testClearApplicationUserDataNoObserver() throws Exception {
- getPm().clearApplicationUserData(mContext.getPackageName(), null);
+ getPm().clearApplicationUserData(mContext.getPackageName(), null, UserId.myUserId());
//sleep for 1 minute
Thread.sleep(60*1000);
//confirm files dont exist
diff --git a/core/tests/coretests/src/android/net/SSLTest.java b/core/tests/coretests/src/android/net/SSLTest.java
index 810ed0d..c573498 100644
--- a/core/tests/coretests/src/android/net/SSLTest.java
+++ b/core/tests/coretests/src/android/net/SSLTest.java
@@ -16,17 +16,16 @@
package android.net;
-import android.net.SSLCertificateSocketFactory;
import android.test.suitebuilder.annotation.Suppress;
-import junit.framework.TestCase;
-
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
+import java.util.Arrays;
+import junit.framework.TestCase;
-//This test relies on network resources.
-@Suppress
public class SSLTest extends TestCase {
+ //This test relies on network resources.
+ @Suppress
public void testCertificate() throws Exception {
// test www.fortify.net/sslcheck.html
Socket ssl = SSLCertificateSocketFactory.getDefault().createSocket("www.fortify.net",443);
@@ -49,4 +48,35 @@
// System.out.println(new String(b));
}
+
+ public void testStringsToNpnBytes() {
+ byte[] expected = {
+ 6, 's', 'p', 'd', 'y', '/', '2',
+ 8, 'h', 't', 't', 'p', '/', '1', '.', '1',
+ };
+ assertTrue(Arrays.equals(expected, SSLCertificateSocketFactory.toNpnProtocolsList(
+ new byte[] { 's', 'p', 'd', 'y', '/', '2' },
+ new byte[] { 'h', 't', 't', 'p', '/', '1', '.', '1' })));
+ }
+
+ public void testStringsToNpnBytesEmptyByteArray() {
+ try {
+ SSLCertificateSocketFactory.toNpnProtocolsList(new byte[0]);
+ fail();
+ } catch (IllegalArgumentException expected) {
+ }
+ }
+
+ public void testStringsToNpnBytesEmptyArray() {
+ byte[] expected = {};
+ assertTrue(Arrays.equals(expected, SSLCertificateSocketFactory.toNpnProtocolsList()));
+ }
+
+ public void testStringsToNpnBytesOversizedInput() {
+ try {
+ SSLCertificateSocketFactory.toNpnProtocolsList(new byte[256]);
+ fail();
+ } catch (IllegalArgumentException expected) {
+ }
+ }
}
diff --git a/test-runner/src/android/test/BandwidthTest.java b/core/tests/utillib/src/android/test/BandwidthTest.java
similarity index 91%
rename from test-runner/src/android/test/BandwidthTest.java
rename to core/tests/utillib/src/android/test/BandwidthTest.java
index e02ae00..6cff0ff 100644
--- a/test-runner/src/android/test/BandwidthTest.java
+++ b/core/tests/utillib/src/android/test/BandwidthTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * 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.
@@ -24,8 +24,6 @@
* annotation is present, the test method is profiled for bandwidth metrics and the results
* written through instrumentation output. It can also be used on the class itself,
* which is equivalent to tagging all test methods with this annotation.
- *
- * {@hide} Pending approval for public API.
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface BandwidthTest {
diff --git a/core/tests/utillib/src/android/test/BandwidthTestCase.java b/core/tests/utillib/src/android/test/BandwidthTestCase.java
new file mode 100644
index 0000000..4f95f77
--- /dev/null
+++ b/core/tests/utillib/src/android/test/BandwidthTestCase.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.test;
+
+import android.net.NetworkStats;
+import android.net.TrafficStats;
+import android.os.Bundle;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+/**
+ * A bandwidth test case that collects bandwidth statistics for tests that are
+ * annotated with {@link BandwidthTest} otherwise the test is executed
+ * as an {@link InstrumentationTestCase}
+ */
+public class BandwidthTestCase extends InstrumentationTestCase {
+ 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";
+ private static final String REPORT_KEY_BYTES_RECEIVED = "rxBytes";
+ private static final String REPORT_KEY_OPERATIONS = "operations";
+
+ @Override
+ protected void runTest() throws Throwable {
+ //This is a copy of {@link InstrumentationTestCase#runTest} with
+ //added logic to handle bandwidth measurements
+ String fName = getName();
+ assertNotNull(fName);
+ Method method = null;
+ Class testClass = null;
+ try {
+ // use getMethod to get all public inherited
+ // methods. getDeclaredMethods returns all
+ // methods of this class but excludes the
+ // inherited ones.
+ testClass = getClass();
+ method = testClass.getMethod(fName, (Class[]) null);
+ } catch (NoSuchMethodException e) {
+ fail("Method \""+fName+"\" not found");
+ }
+
+ if (!Modifier.isPublic(method.getModifiers())) {
+ fail("Method \""+fName+"\" should be public");
+ }
+
+ int runCount = 1;
+ boolean isRepetitive = false;
+ if (method.isAnnotationPresent(FlakyTest.class)) {
+ runCount = method.getAnnotation(FlakyTest.class).tolerance();
+ } else if (method.isAnnotationPresent(RepetitiveTest.class)) {
+ runCount = method.getAnnotation(RepetitiveTest.class).numIterations();
+ isRepetitive = true;
+ }
+
+ if (method.isAnnotationPresent(UiThreadTest.class)) {
+ final int tolerance = runCount;
+ final boolean repetitive = isRepetitive;
+ final Method testMethod = method;
+ final Throwable[] exceptions = new Throwable[1];
+ getInstrumentation().runOnMainSync(new Runnable() {
+ public void run() {
+ try {
+ runMethod(testMethod, tolerance, repetitive);
+ } catch (Throwable throwable) {
+ exceptions[0] = throwable;
+ }
+ }
+ });
+ if (exceptions[0] != null) {
+ throw exceptions[0];
+ }
+ } else if (method.isAnnotationPresent(BandwidthTest.class) ||
+ testClass.isAnnotationPresent(BandwidthTest.class)) {
+ TrafficStats.startDataProfiling(null);
+ runMethod(method, 1, false);
+ NetworkStats stats = TrafficStats.stopDataProfiling(null);
+ NetworkStats.Entry entry = stats.getTotal(null);
+ getInstrumentation().sendStatus(2, getBandwidthStats(entry));
+ } else {
+ runMethod(method, runCount, isRepetitive);
+ }
+ }
+
+ private void runMethod(Method runMethod, int tolerance, boolean isRepetitive) throws Throwable {
+ //This is a copy of {@link InstrumentationTestCase#runMethod}
+ Throwable exception = null;
+
+ int runCount = 0;
+ do {
+ try {
+ runMethod.invoke(this, (Object[]) null);
+ exception = null;
+ } catch (InvocationTargetException e) {
+ e.fillInStackTrace();
+ exception = e.getTargetException();
+ } catch (IllegalAccessException e) {
+ e.fillInStackTrace();
+ exception = e;
+ } finally {
+ runCount++;
+ // Report current iteration number, if test is repetitive
+ if (isRepetitive) {
+ Bundle iterations = new Bundle();
+ iterations.putInt("currentiterations", runCount);
+ getInstrumentation().sendStatus(2, iterations);
+ }
+ }
+ } while ((runCount < tolerance) && (isRepetitive || exception != null));
+
+ if (exception != null) {
+ throw exception;
+ }
+ }
+
+ private Bundle getBandwidthStats(NetworkStats.Entry entry){
+ Bundle bundle = new Bundle();
+ bundle.putLong(REPORT_KEY_BYTES_RECEIVED, entry.rxBytes);
+ bundle.putLong(REPORT_KEY_BYTES_SENT, entry.txBytes);
+ bundle.putLong(REPORT_KEY_PACKETS_RECEIVED, entry.rxPackets);
+ bundle.putLong(REPORT_KEY_PACKETS_SENT, entry.txPackets);
+ bundle.putLong(REPORT_KEY_OPERATIONS, entry.operations);
+ return bundle;
+ }
+}
+
diff --git a/data/fonts/fallback_fonts.xml b/data/fonts/fallback_fonts.xml
index 51b07e4..63b3a58 100644
--- a/data/fonts/fallback_fonts.xml
+++ b/data/fonts/fallback_fonts.xml
@@ -21,6 +21,15 @@
fallback fonts. That file can also specify the order in which the fallback fonts should be
searched, to ensure that a vendor-provided font will be used before another fallback font
which happens to handle the same glyph.
+
+ Han languages (Chinese, Japanese, and Korean) share a common range of unicode characters;
+ their ordering in the fallback or vendor files gives priority to the first in the list.
+ Locale-specific ordering can be configured by adding language and region codes to the end
+ of the filename (e.g. /system/etc/fallback_fonts-ja.xml). When no region code is used,
+ as with this example, all regions are matched. Use separate files for each supported locale.
+ The standard fallback file (fallback_fonts.xml) is used when a locale does not have its own
+ file. All fallback files must contain the same complete set of fonts; only their ordering
+ can differ.
-->
<familyset>
<family>
diff --git a/data/fonts/vendor_fonts.xml b/data/fonts/vendor_fonts.xml
index fe51fd27..5850f94 100644
--- a/data/fonts/vendor_fonts.xml
+++ b/data/fonts/vendor_fonts.xml
@@ -3,7 +3,12 @@
Vendor-provided fallback fonts
This file can be edited to add references to fonts that are not installed or referenced in the
- default system. The file should then be placed in /vendor/etc/fallback_fonts.xml.
+ default system. The file should then be placed in /vendor/etc/fallback_fonts.xml. Note
+ that in your makefile, this directory should be referenced as $(TARGET_COPY_OUT_VENDOR)/etc/:
+
+ PRODUCT_COPY_FILES += \
+ frameworks/base/data/fonts/vendor_fonts.xml:$(TARGET_COPY_OUT_VENDOR)/etc/fallback_fonts.xml \
+ frameworks/base/data/fonts/vendor_fonts-ja.xml:$(TARGET_COPY_OUT_VENDOR)/etc/fallback_fonts-ja.xml
For example, vendors might want to build configurations for locales that are
better served by fonts which either handle glyphs not supported in the default fonts or which
@@ -25,6 +30,35 @@
place in the overall fallback fonts. The order of this list determines which fallback font
will be used to support any glyphs that are not handled by the default system fonts.
+ Han languages (Chinese, Japanese, and Korean) share a common range of unicode characters;
+ their ordering in the fallback or vendor files gives priority to the first in the list.
+ Locale-specific ordering can be configured by adding language and region codes to the end
+ of the filename (e.g. /vendor/etc/fallback_fonts-ja.xml). When no region code is used,
+ as with this example, all regions are matched. Use separate files for each supported locale.
+ The standard fallback file (fallback_fonts.xml) is used when a locale does not have its own
+ file. All fallback files must contain the same complete set of fonts; only their ordering
+ can differ. For example, on a device supporting Japanese, but with English as the default,
+ /vendor/etc/fallback_fonts.xml might contain:
+
+ <familyset>
+ <family>
+ <fileset>
+ <file>DroidSansJapanese.ttf</file>
+ </fileset>
+ </family>
+ </familyset>
+
+ placing the Japanese font at the end of the fallback sequence for English, with a corresponding
+ /system/vendor/etc/fallback_fonts-ja.xml, placing it at the front of the list.
+
+ <familyset>
+ <family order="0">
+ <fileset>
+ <file>DroidSansJapanese.ttf</file>
+ </fileset>
+ </family>
+ </familyset>
+
The sample configuration below is an example of how one might provide two families of fonts
that get inserted at the first and second (0 and 1) position in the overall fallback fonts.
diff --git a/docs/html/guide/developing/debugging/ddms.jd b/docs/html/guide/developing/debugging/ddms.jd
index 4398ec9..80b1e47 100644
--- a/docs/html/guide/developing/debugging/ddms.jd
+++ b/docs/html/guide/developing/debugging/ddms.jd
@@ -11,7 +11,19 @@
<li><a href="#running">Running DDMS</a></li>
<li><a href="#how-ddms-works">How DDMS Interacts with a Debugger</a></li>
- <li><a href="#using-ddms">Using DDMS</a></li>
+ <li><a href="#using-ddms">Using DDMS</a>
+ <ol>
+ <li><a href="#heap">Viewing heap usage for a process</a></li>
+ <li><a href="#alloc">Tracking memory allocation of objects</a></li>
+ <li><a href="#emulator">Working with an emulator or device's file system</a></li>
+ <li><a href="#thread">Examining thread information</a></li>
+ <li><a href="#profiling">Starting method profiling</a></li>
+ <li><a href="#network">Using the Network Traffic tool</a></li>
+ <li><a href="#logcat">Using LogCat</a></li>
+ <li><a href="#ops-location">Emulating phone operations and location</a></li>
+ </ol>
+
+ </li>
</ol>
</div>
</div>
@@ -90,7 +102,7 @@
<a href="#running">Running DDMS</a>.
- <h3>Viewing heap usage for a process</h3>
+ <h3 id="heap">Viewing heap usage for a process</h3>
<p>DDMS allows you to view how much heap memory a process is using. This information is useful in
tracking heap usage at a certain point of time during the execution of your application.</p>
@@ -110,7 +122,7 @@
allocated for a particular memory size in bytes.</li>
</ol>
- <h3>Tracking memory allocation of objects</h3>
+ <h3 id="alloc">Tracking memory allocation of objects</h3>
<p>DDMS provides a feature to track objects that are being allocated to memory and to see which
classes and threads are allocating the objects. This allows you to track, in real time, where
@@ -140,7 +152,7 @@
line number of the code that allocated the object.</li>
</ol>
- <h3>Working with an emulator or device's file system</h3>
+ <h3 id="emulator">Working with an emulator or device's file system</h3>
<p>DDMS provides a File Explorer tab that allows you to view, copy, and delete files on the
device. This feature is useful in examining files that are created by your application or if you
@@ -160,7 +172,7 @@
<!-- Need to elaborate more on where things are stored in the file system,
databases, apks, user info, files that are important to look at -->
- <h3>Examining thread information</h3>
+ <h3 id="thread">Examining thread information</h3>
<p>The Threads tab in DDMS shows you the currently running threads for a selected process.</p>
@@ -204,6 +216,67 @@
Profiling</strong>.</li>
</ol>
+ <h3 id="network">Using the Network Traffic tool</h3>
+
+ <p>In Android 4.0, the DDMS (Dalvik Debug Monitor Server) includes a Detailed
+Network Usage tab that makes it possible to track when your application is
+making network requests. Using this tool, you can monitor how and when your app
+transfers data and optimize the underlying code appropriately. You can also
+distinguish between different traffic types by applying a “tag” to network
+sockets before use.</p>
+
+<p>These tags are shown in a stack area chart in DDMS, as shown in figure 2:</p>
+
+<img src="{@docRoot}images/developing/ddms-network.png" />
+<p class="img-caption"><strong>Figure 2.</strong> Network Usage tab.</p>
+
+<p>By monitoring the frequency of your data transfers, and the amount of data
+transferred during each connection, you can identify areas of your application
+that can be made more battery-efficient. Generally, you should look for
+short spikes that can be delayed, or that should cause a later transfer to be
+pre-empted. </p>
+
+<p>To better identify the cause of transfer spikes, the
+{@link android.net.TrafficStats} API allows you
+to tag the data transfers occurring within a thread using {@link
+android.net.TrafficStats#setThreadStatsTag setThreadStatsTag()}, followed
+by manually tagging (and untagging) individual sockets using {@link
+android.net.TrafficStats#tagSocket tagSocket()} and {@link
+android.net.TrafficStats#untagSocket untagSocket()}. For example:</p>
+
+<pre>TrafficStats.setThreadStatsTag(0xF00D);
+TrafficStats.tagSocket(outputSocket);
+// Transfer data using socket
+TrafficStats.untagSocket(outputSocket);</pre>
+
+<p>Alternatively, the Apache {@link org.apache.http.client.HttpClient} and
+{@link java.net.URLConnection} APIs included in the platform
+automatically tag sockets internally based on the active tag (as
+identified by
+{@link android.net.TrafficStats#getThreadStatsTag getThreadStatsTag()}).
+These APIs correctly tag/untag sockets when recycled through
+keep-alive pools. In the following example,
+{@link android.net.TrafficStats#setThreadStatsTag setThreadStatsTag()}
+sets the active tag to be {@code 0xF00D}.
+There can only be one active tag per thread.
+That is the value that will
+be returned by {@link android.net.TrafficStats#getThreadStatsTag getThreadStatsTag()}
+and thus used by {@link org.apache.http.client.HttpClient}
+ to tag sockets. The {@code finally} statement
+invokes
+{@link android.net.TrafficStats#clearThreadStatsTag clearThreadStatsTag()}
+to clear the tag.</p>
+
+<pre>TrafficStats.setThreadStatsTag(0xF00D);
+ try {
+ // Make network request using HttpClient.execute()
+ } finally {
+ TrafficStats.clearThreadStatsTag();
+}</pre>
+
+<p>Socket tagging is supported in Android 4.0, but real-time stats will only be
+displayed on devices running Android 4.0.3 or higher.</p>
+
<h3 id="logcat">Using LogCat</h3>
<p>LogCat is integrated into DDMS, and outputs the messages that you print out using the {@link android.util.Log}
@@ -230,7 +303,7 @@
with the log tags or with the process id that generated the log message. The add filter,
edit filter, and delete filter buttons let you manage your custom filters.</p>
- <h3>Emulating phone operations and location</h3>
+ <h3 id="ops-location">Emulating phone operations and location</h3>
<p>The Emulator control tab lets you simulate a
phone's voice and data network status. This is useful when you want to test your application's
robustness in differing network environments.</p>
diff --git a/docs/html/guide/developing/device.jd b/docs/html/guide/developing/device.jd
index d22dca1..d91551a 100644
--- a/docs/html/guide/developing/device.jd
+++ b/docs/html/guide/developing/device.jd
@@ -134,11 +134,11 @@
</tr>
<tr>
<td>ASUS</td>
- <td><code>0B05</code></td>
+ <td><code>0b05</code></td>
</tr>
<tr>
<td>Dell</td>
- <td><code>413C</code></td>
+ <td><code>413c</code></td>
</tr>
<tr>
<td>Foxconn</td>
@@ -146,35 +146,35 @@
</tr>
<tr>
<td>Fujitsu</td>
- <td><code>04C5</code></td>
+ <td><code>04c5</code></td>
</tr>
<tr>
<td>Fujitsu Toshiba</td>
- <td><code>04C5</code></td>
+ <td><code>04c5</code></td>
</tr>
<tr>
<td>Garmin-Asus</td>
- <td><code>091E</code></td>
+ <td><code>091e</code></td>
</tr>
<tr>
<td>Google</td>
- <td><code>18D1</code></td>
+ <td><code>18d1</code></td>
</tr>
<tr>
<td>Hisense</td>
- <td><code>109B</code></td>
+ <td><code>109b</code></td>
</tr>
<tr>
<td>HTC</td>
- <td><code>0BB4</code></td>
+ <td><code>0bb4</code></td>
</tr>
<tr>
<td>Huawei</td>
- <td><code>12D1</code></td>
+ <td><code>12d1</code></td>
</tr>
<tr>
<td>K-Touch</td>
- <td><code>24E3</code></td>
+ <td><code>24e3</code></td>
</tr>
<tr>
<td>KT Tech</td>
@@ -185,8 +185,8 @@
<td><code>0482</code></td>
</tr>
<tr>
- <td>Lenevo</td>
- <td><code>17EF</code></td>
+ <td>Lenovo</td>
+ <td><code>17ef</code></td>
</tr>
<tr>
<td>LG</td>
@@ -194,7 +194,7 @@
</tr>
<tr>
<td>Motorola</td>
- <td><code>22B8</code></td>
+ <td><code>22b8</code></td>
</tr>
<tr>
<td>NEC</td>
@@ -214,11 +214,11 @@
</tr>
<tr>
<td>Pantech</td>
- <td><code>10A9</code></td>
+ <td><code>10a9</code></td>
</tr>
<tr>
<td>Pegatron</td>
- <td><code>1D4D</code></td>
+ <td><code>1d4d</code></td>
</tr>
<tr>
<td>Philips</td>
@@ -226,31 +226,31 @@
</tr>
<tr>
<td>PMC-Sierra</td>
- <td><code>04DA</code></td>
+ <td><code>04da</code></td>
</tr>
<tr>
<td>Qualcomm</td>
- <td><code>05C6</code></td>
+ <td><code>05c6</code></td>
</tr>
<tr>
<td>SK Telesys</td>
- <td><code>1F53</code></td>
+ <td><code>1f53</code></td>
</tr>
<tr>
<td>Samsung</td>
- <td><code>04E8</code></td>
+ <td><code>04e8</code></td>
</tr>
<tr>
<td>Sharp</td>
- <td><code>04DD</code></td>
+ <td><code>04dd</code></td>
</tr>
<tr>
<td>Sony</td>
- <td><code>054C</code></td>
+ <td><code>054c</code></td>
</tr>
<tr>
<td>Sony Ericsson</td>
- <td><code>0FCE</code></td>
+ <td><code>0fce</code></td>
</tr>
<tr>
<td>Teleepoch</td>
@@ -262,6 +262,6 @@
</tr>
<tr>
<td>ZTE</td>
- <td><code>19D2</code></td>
+ <td><code>19d2</code></td>
</tr>
</table>
diff --git a/docs/html/guide/developing/devices/emulator.jd b/docs/html/guide/developing/devices/emulator.jd
index c217790..5edd1f5 100644
--- a/docs/html/guide/developing/devices/emulator.jd
+++ b/docs/html/guide/developing/devices/emulator.jd
@@ -9,28 +9,58 @@
<h2>In this document</h2>
<ol>
<li><a href="#overview">Overview</a></li>
+ <li><a href="#avds">Android Virtual Devices and the Emulator</a></li>
<li><a href="#starting">Starting and Stopping the Emulator</a></li>
- <li><a href="#starting">Android Virtual Devices and the Emulator</a></li>
- <li><a href="#controlling">Controlling the Emulator</a></li>
- <li><a href="#startup-options">Emulator Startup Options</a></li>
+ <li><a href="#apps">Installing Applications on the Emulator</a></li>
+ <li><a href="#acceleration">Using Hardware Acceleration</a>
+ <ol>
+ <li><a href="#accel-graphics">Configuring Graphics Acceleration</a></li>
+ <li><a href="#accel-vm">Configuring Virtual Machine Acceleration</a></li>
+ </ol>
+ </li>
+ <li><a href="#sdcard">SD Card Emulation</a>
+ <ol>
+ <li><a href="#sdcard-creating">Creating an SD card image</a></li>
+ <li><a href="#sdcard-files">Copying files to an SD card image</a></li>
+ <li><a href="#sdcard-loading">Loading an SD card image</a></li>
+ </ol>
+ </li>
<li><a href="#diskimages">Working with Emulator Disk Images</a>
<ol>
- <li><a href="#defaultimages">Default Images</a></li>
- <li><a href="#runtimeimages">Runtime Images: User Data and SD Card</a></li>
- <li><a href="#temporaryimages">Temporary Images</a></li>
+ <li><a href="#defaultimages">Default image files</a></li>
+ <li><a href="#runtimeimages">Runtime images: user data and SD card</a></li>
+ <li><a href="#temporaryimages">Temporary images</a></li>
</ol>
</li>
<li><a href="#emulatornetworking">Emulator Networking</a>
<ol>
<li><a href="#networkaddresses">Network Address Space</a></li>
<li><a href="#networkinglimitations">Local Networking Limitations</a></li>
- <li><a href="#redirections">Using Network Redirections</a></li>
+ <li><a href="#redirection">Using Network Redirection</a></li>
<li><a href="#dns">Configuring the Emulator's DNS Settings</a></li>
<li><a href="#proxy">Using the Emulator with a Proxy</a></li>
<li><a href="#connecting">Interconnecting Emulator Instances</a></li>
<li><a href="#calling">Sending a Voice Call or SMS to Another Emulator Instance</a></li>
</ol>
</li>
+ <li><a href="#console">Using the Emulator Console</a>
+ <ol>
+ <li><a href="#portredirection">Port Redirection</a></li>
+ <li><a href="#geo">Geo Location Provider Emulation</a></li>
+ <li><a href="#events">Hardware Events Emulation</a></li>
+ <li><a href="#power">Device Power Characteristics</a></li>
+ <li><a href="#netstatus">Network Status</a></li>
+ <li><a href="#netdelay">Network Delay Emulation</a></li>
+ <li><a href="#netspeed">Network Speed Emulation</a></li>
+ <li><a href="#telephony">Telephony Emulation</a></li>
+ <li><a href="#sms">SMS Emulation</a></li>
+ <li><a href="#vm">VM State</a></li>
+ <li><a href="#window">Emulator Window</a></li>
+ <li><a href="#terminating">Terminating an Emulator Instance</a></li>
+ </ol>
+ </li>
+ <li><a href="#limitations">Emulator Limitations</a></li>
+ <li><a href="#troubleshooting">Troubleshooting Emulator Problems</a></li>
</ol>
<h2>See also</h2>
@@ -44,7 +74,7 @@
<img src="{@docRoot}images/emulator-wvga800l.png" alt="Image of the Android Emulator"
width="367" height="349" style="margin-left:2em;float:right;"/>
<p>The Android SDK includes a virtual mobile device emulator
-that runs on your computer. The emulator lets you prototype, develop, and test
+that runs on your computer. The emulator lets you prototype, develop and test
Android applications without using a physical device. </p>
<p>The Android emulator mimics all of the hardware and software features
@@ -52,7 +82,7 @@
calls. It provides a variety of navigation and control keys, which you can "press"
using your mouse or keyboard to generate events for your application. It also
provides a screen in which your application is displayed, together with any other
-Android applications running. </p>
+active Android applications. </p>
<p>To let you model and test your application more easily, the emulator utilizes
Android Virtual Device (AVD) configurations. AVDs let you define certain hardware
@@ -62,16 +92,16 @@
applications, access the network, play audio and video, store and retrieve data,
notify the user, and render graphical transitions and themes. </p>
-<p>The emulator also includes a variety of debug capabilities, such as a console
-from which you can log kernel output, simulate application interrupts (such as
-arriving SMS messages or phone calls), and simulate latency effects and dropouts
-on the data channel.</p>
+<p>The emulator also includes a variety of debug capabilities, such as a console
+from which you can log kernel output, simulate application interrupts (such as
+arriving SMS messages or phone calls), and simulate latency effects and dropouts
+on the data network.</p>
-<h2 id="overview">Overview</h2>
+<h2 id="overview">Overview</h2>
-<p>The Android emulator is a QEMU-based application that provides a virtual ARM
+<p>The Android emulator is an application that provides a virtual
mobile device on which you can run your Android applications. It runs a full
Android system stack, down to the kernel level, that includes a set of
preinstalled applications (such as the dialer) that you can access from your
@@ -81,16 +111,15 @@
you can use a variety of commands and options to control its behavior.
</p>
-<p>The Android system image distributed in the SDK contains ARM machine code for
-the Android Linux kernel, the native libraries, the Dalvik VM, and the various
-Android package files (such as for for the Android framework and preinstalled
-applications). The emulator's QEMU layers provide dynamic binary translation of
-the ARM machine code to the OS and processor architecture of your development
-machine. </p>
+<p>The Android system images available through the Android SDK Manager contain
+code for the Android Linux kernel, the native libraries, the Dalvik VM, and the
+various Android packages (such as the Android framework and preinstalled
+applications). The emulator provides dynamic binary translation of device
+machine code to the OS and processor architecture of your development
+machine.</p>
-<p>Adding custom capabilities to the underlying QEMU services, the Android
-emulator supports many hardware features likely to be found on mobile devices,
-including: </p>
+<p>The Android emulator supports many hardware features likely to be found on
+mobile devices, including: </p>
<ul>
<li>An ARMv5 CPU and the corresponding memory-management unit (MMU)</li>
@@ -101,41 +130,37 @@
<li>Flash memory partitions (emulated through disk image files on the
development machine)</li>
<li>A GSM modem, including a simulated SIM Card</li>
+ <li>A camera, using a webcam connected to your development computer.</li>
+ <li>Sensors like an accelerometer, using data from a USB-connected Android device.</li>
</ul>
-<p>The sections below provide more information about the emulator and how to use
-it for developing Android applications.</p>
+<p>The following sections describe the emulator and its use for development of Android
+applications in more detail.</p>
-<a name="avds"></a>
-
-<h2>Android Virtual Devices and the Emulator</h2>
+<h2 id="avds">Android Virtual Devices and the Emulator</h2>
<p>To use the emulator, you first must create one or more AVD configurations. In each
configuration, you specify an Android platform to run in the emulator and the set of hardware
options and emulator skin you want to use. Then, when you launch the emulator, you specify
the AVD configuration that you want to load. </p>
-<p>To specify the AVD you want to load when starting the emulator, you use the
-<code>-avd</code> argument, as shown in the previous section. </p>
-
<p>Each AVD functions as an independent device, with its own private storage for
user data, SD card, and so on. When you launch the emulator with an AVD configuration,
it automatically loads the user data and SD card data from the AVD directory. By default,
the emulator stores the user data, SD card data, and cache in the AVD directory.</p>
<p>To create and manage AVDs you use the AVD Manager UI or the <code>android</code> tool
-that is included in the SDK.
+that is included in the SDK.
For complete information about how to set up AVDs, see <a
href="{@docRoot}guide/developing/devices/index.html">Managing Virtual Devices</a>.</p>
-<a name="starting"></a>
-<h2>Starting and Stopping the Emulator</h2>
+<h2 id="starting">Starting and Stopping the Emulator</h2>
<p>During development and testing of your application, you install and run your
application in the Android emulator. You can launch the emulator as a standalone
-application, from a command line, or you can use it as part of your Eclipse
+application from a command line, or you can run it from within your Eclipse
development environment. In either case, you specify the AVD configuration to
load and any startup options you want to use, as described in this document.
</p>
@@ -144,20 +169,24 @@
depending on your needs, you can start multiple emulator instances and run your
application in more than one emulated device. You can use the emulator's
built-in commands to simulate GSM phone calling or SMS between emulator
-instances, and you can set up network redirections that allow emulators to send
+instances, and you can set up network redirection that allows emulators to send
data to one another. For more information, see <a href="#telephony">Telephony
Emulation</a>, <a href="#sms">SMS Emulation</a>, and
<a href="#emulatornetworking">Emulator Networking</a></p>
-<p>To start an instance of the emulator from the command line, change to the
+<p>To start an instance of the emulator from the command line, navigate to the
<code>tools/</code> folder of the SDK. Enter <code>emulator</code> command
like this: </p>
-<pre>emulator -avd <avd_name></pre>
+<pre>emulator -avd <avd_name> [<options>]</pre>
-<p>This initializes the emulator and loads an AVD configuration (see the next
-section for more information about AVDs). You will see the emulator window
-appear on your screen. </p>
+<p>This initializes the emulator, loads an AVD configuration and displays the emulator
+window. For more information about command line options for the emulator, see the
+<a href="{@docRoot}guide/developing/tools/emulator.html">Android Emulator</a> tool reference.</p>
+
+<p class="note"><strong>Note:</strong> You can run multiple
+instances of the emulator concurrently, each with its own AVD configuration and
+storage area for user data, SD card, and so on.</p>
<p>If you are working in Eclipse, the ADT plugin for Eclipse installs your
application and starts the emulator automatically, when you run or debug
@@ -171,585 +200,435 @@
<p>To stop an emulator instance, just close the emulator's window.</p>
<p>For a reference of the emulator's startup commands and keyboard mapping, see
-the <a href="{@docRoot}guide/developing/tools/emulator.html">Android Emulator</a> document.</p>
+the <a href="{@docRoot}guide/developing/tools/emulator.html">Android Emulator</a> tool
+reference.</p>
+<h2 id="apps">Installing Applications on the Emulator</h2>
+
+<p>If you don't have access to Eclipse or the ADT Plugin, you can install your application on the
+emulator using the <a href="{@docRoot}guide/developing/tools/adb.html#move">adb</a> utility. Before
+installing the application, you need to build and package it into an <code>.apk</code> as described
+in <a href="{@docRoot}guide/developing/building/index.html">Building and
+Running Apps</a>. Once the application is installed, you can start the emulator from the command
+line as described previously, using any startup options necessary.
+When the emulator is running, you can also connect to the emulator instance's
+<a href="#console">console</a> to issue commands as needed.</p>
+
+<p>As you update your code, you periodically package and install it on the emulator.
+The emulator preserves the application and its state data across restarts,
+in a user-data disk partition. To ensure that the application runs properly
+as you update it, you may need to delete the emulator's user-data partition.
+To do so, start the emulator with the <code>-wipe-data</code> option.
+For more information about the user-data partition and other emulator storage,
+see <a href="#diskimages">Working with Emulator Disk Images</a>.</p>
+<h2 id="acceleration">Using Hardware Acceleration</h2>
-<a name="controlling"></a>
+<p>In order to make the Android emulator run faster and be more responsive, you can configure it to
+take advantage of hardware acceleration, using a combination of configuration options, specific
+Android system images and hardware drivers.</p>
-<h2>Controlling the Emulator</h2>
+<h3 id="accel-graphics">Configuring Graphics Acceleration</h3>
-<p>You can use emulator <a href="#startup-options">startup options</a> and <a
-href="#console">console commands</a> to control the behaviors and
-characteristics of the emulated environment itself.
+<p class="caution"><strong>Caution:</strong> As of SDK Tools Revision 17, the graphics
+acceleration feature for the emulator is experimental; be alert for incompatibilities and
+errors when using this feature. </p>
+
+<p>Graphics acceleration for the emulator takes advantage of your development computer's graphics
+hardware, specifically its graphics processing unit (GPU), to make screen drawing faster. To use
+the graphics acceleration feature, you must have the following versions of the Android development
+tools installed:</p>
+
+<ul>
+ <li>Android SDK Tools, Revision 17 or higher</li>
+ <li>Android SDK Platform API 15, Revision 3 or higher</li>
+</ul>
+
+<p>Use the <a href="{@docRoot}sdk/installing.html#AddingComponents">Android SDK
+Manager</a> to install these components:</p>
+
+<p class="note"><strong>Note:</strong> Not all applications are compatible with graphics hardware
+acceleration. In particular, the Browser application and applications using the {@link
+android.webkit.WebView} component are not compatible with graphics acceleration.</p>
+
+<p>To configure an AVD to use graphics acceleration:</p>
+
+<ol>
+ <li>Make sure you have the required SDK components installed (listed above).</li>
+ <li>Start the AVD Manager and create a new AVD with the <strong>Target</strong> value of
+<strong>Android 4.0.3 (API Level 15)</strong>, revision 3 or higher.</li>
+ <li>If you want to have graphics acceleration enabled by default for this AVD, in the
+<strong>Hardware</strong> section, click <strong>New</strong>, select <strong>GPU emulation</strong>
+and set the value to <strong>Yes</strong>.
+ <p class="note"><strong>Note:</strong> You can also enable graphics acceleration when you
+start an emulator using command line options as describe in the next section.</p>
+ </li>
+ <li>Name the AVD instance and select any other configuration options.
+ <p class="caution"><strong>Caution:</strong> Do not select the <strong>Snapshot: Enabled</strong>
+option. Snapshots are not supported for emulators with graphics acceleration enabled.</p>
+ </li>
+ <li>Click <strong>Create AVD</strong> to save the emulator configuration.</li>
+</ol>
+
+<p>If you set <strong>GPU emulation</strong> to <strong>Yes</strong> for your AVD, then graphics
+acceleration is automatically enabled when you run it. If you did not enable <strong>GPU
+emulation</strong> when you created the AVD, you can still enable it at runtime.</p>
+
+<p>To enable graphics acceleration at runtime for an AVD:</p>
+
+<ul>
+ <li>If you are running the emulator from the command line, just include the {@code -gpu on}
+option:
+<pre>emulator -avd <avd_name> -gpu on</pre>
+ <p class="note"><strong>Note:</strong> You must specify an AVD configuration that uses
+Android 4.0.3 (API Level 15, revision 3) or higher system image target. Graphics acceleration is not
+available for earlier system images.</p>
+ </li>
+ <li>If you are running the emulator from Eclipse, run your Android application using an AVD with
+the {@code -gpu on} option enabled:
+ <ol>
+ <li>In Eclipse, click your Android project folder and then select <strong>Run > Run
+Configurations...</strong></li>
+ <li>In the left panel of the <strong>Run Configurations</strong> dialog, select your Android
+project run configuration or create a new configuration.</li>
+ <li>Click the <strong>Target</strong> tab.</li>
+ <li>Select the AVD you created in the previous procedure.</li>
+ <li>In the <strong>Additional Emulator Command Line Options</strong> field, enter:<br>
+ {@code -gpu on}</li>
+ <li>Run your Android project using this run configuration.</li>
+ </ol>
+ </li>
+</ul>
+
+
+<h3 id="accel-vm">Configuring Virtual Machine Acceleration</h2>
+
+<p class="caution"><strong>Caution:</strong> As of SDK Tools Revision 17, the virtual machine
+acceleration feature for the emulator is experimental; be alert for incompatibilities and errors
+when using this feature.</p>
+
+<p>Many modern CPUs provide extensions for running virtual machines (VMs) more efficiently. Taking
+advantage of these extensions with the Android emulator requires some additional configuration of
+your development system, but can significantly improve the execution speed. Before attempting to use
+this type of acceleration, you should first determine if your development system’s CPU supports one
+of the following virtualization extensions technologies:</p>
+
+<ul>
+ <li>Intel Virtualization Technology (VT, VT-x, vmx) extensions</li>
+ <li>AMD Virtualization (AMD-V, SVM) extensions (only supported for Linux)</li>
+</ul>
+
+<p>The specifications from the manufacturer of your CPU should indicate if it supports
+virtualization extensions. If your CPU does not support one of these virtualization technologies,
+then you cannot use virtual machine acceleration.</p>
+
+<p class="note"><strong>Note:</strong> Virtualization extensions are typically enabled through
+your computer's BIOS and are frequently turned off by default. Check the documentation for your
+system's motherboard to find out how to enable virtualization extensions.</p>
+
+<p>Once you have determined that your CPU supports virtualization extensions, make sure you can work
+within these additional requirements of running an emulator inside an accelerated virtual
+machine:</p>
+
+<ul>
+ <li><strong>x86 AVD Only</strong> - You must use an AVD that is uses an x86 system image target.
+AVDs that use ARM-based system images cannot be accelerated using the emulator configurations
+described here.</li>
+ <li><strong>Not Inside a VM</strong> - You cannot run a VM-accelerated emulator inside another
+virtual machine, such as a VirtualBox or VMWare-hosted virtual machine. You must run the emulator
+directly on your system hardware.</li>
+ <li><strong>Other VM Drivers</strong> - If you are running another virtualization technology on
+your system such as VirtualBox or VMWare, you may need to unload the driver for that virtual machine
+hosting software before running an accelerated emulator.</li>
+ <li><strong>OpenGL® Graphics</strong> - Emulation of OpenGL ES graphics may not perform at the
+same level as an actual device.</li>
+</ul>
+
+<p>To use virtual machine acceleration with the emulator, you need the following version of Android
+development tools. Use the <a href="{@docRoot}sdk/installing.html#AddingComponents">Android SDK
+Manager</a> to install these components:</p>
+
+<ul>
+ <li>Android SDK Tools, Revision 17 or higher</li>
+ <li>Android x86-based system image</li>
+</ul>
+
+<p>If your development environment meets all of the requirements for running a VM-accelerated
+emulator, you can use the AVD Manager to create an x86-based AVD configuration:</p>
+
+<ol>
+ <li>In the Android SDK Manager, make sure you have an x86-based <strong>System Image</strong>
+ installed for your target Android version. If you do not have an x86 <strong>System
+ Image</strong> installed, select one in the Android SDK Manager and install it.
+ <p class="note"><strong>Tip:</strong> System images are listed under each API Level in the SDK
+ Manager. An x86 system image may not be available for all API levels.</p>
+ </li>
+ <li>Start the AVD Manager and create a new AVD with an x86 value for the
+<strong>CPU/ABI</strong> field. You may need to select a specific <strong>Target</strong> value, or
+select a <strong>Target</strong> value and then select a specific <strong>CPU/ABI</strong>
+option.</li>
+ <li>Name the emulator instance and select any other configuration options.</li>
+ <li>Click <strong>Create AVD</strong> to save the emulator configuration.</li>
+</ol>
+
+<h4 id="vm-windows">Configuring VM Acceleration on Windows</h4>
+
+<p>Virtual machine acceleration for Windows requires the installation of the Intel Hardware
+Accelerated Execution Manager (Intel HAXM). The software requires an Intel CPU with
+Virtualization Technology (VT) support and one of the following operating systems:</p>
+
+<ul>
+ <li>Windows 7 (32/64-bit)</li>
+ <li>Windows Vista (32/64-bit)</li>
+ <li>Windows XP (32-bit only)</li>
+</ul>
+
+<p>To install the virtualization driver:</p>
+
+<ol>
+ <li>Start the Android SDK Manager, select <strong>Extras</strong> and then select <strong>Intel
+Hardware Accelerated Execution Manager</strong>.</li>
+ <li>After the download completes, execute {@code
+<sdk>/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.exe}.</li>
+ <li>Follow the on-screen instructions to complete installation.</li>
+ <li>After installation completes, confirm that the virtualization driver is operating correctly by
+opening a command prompt window and running the following command:
+ <pre>sc query intelhaxm</pre>
+ <p>You should see a status message including the following information:</p>
+<pre>
+SERVICE_NAME: intelhaxm
+ ...
+ STATE : 4 RUNNING
+ ...
+</pre>
+ </li>
+</ol>
+
+<p>To run an x86-based emulator with VM acceleration:</p>
+<ul>
+ <li>If you are running the emulator from the command line, just specify an x86-based AVD:
+<pre>emulator -avd <avd_name></pre>
+ <p class="note"><strong>Note:</strong> You must provide an x86-based AVD configuration
+name, otherwise VM acceleration will not be enabled.</p>
+ </li>
+ <li>If you are running the emulator from Eclipse, run your Android application with an x86-based
+AVD:
+ <ol>
+ <li>In Eclipse, click your Android project folder and then select <strong>Run > Run
+Configurations...</strong></li>
+ <li>In the left panel of the <strong>Run Configurations</strong> dialog, select your Android
+project run configuration or create a new configuration.</li>
+ <li>Click the <strong>Target</strong> tab.</li>
+ <li>Select the x86-based AVD you created previously.</li>
+ <li>Run your Android project using this run configuration.</li>
+ </ol>
+ </li>
+</ul>
+
+<p>You can adjust the amount of memory available to the Intel HAXM kernel extension by re-running
+its installer.</p>
+
+<p>You can stop using the virtualization driver by uninstalling it. Re-run the installer or use
+the Control Panel to remove the software.</p>
+
+
+<h4 id="vm-mac">Configuring VM Acceleration on Mac</h4>
+
+<p>Virtual machine acceleration on a Mac requires the installation of the Intel Hardware Accelerated
+Execution Manager (Intel HAXM) kernel extension to allow the Android emulator to make use of CPU
+virtualization extensions. The kernel extension is compatible with Mac OS X Snow Leopard (version
+10.6.0) and higher.</p>
+
+<p>To install the Intel HAXM kernel extension:</p>
+
+<ol>
+ <li>Start the Android SDK Manager, select <strong>Extras</strong> and then select <strong>Intel
+Hardware Accelerated Execution Manager</strong>.
+ <li>After the download completes, execute
+ {@code <sdk>/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.dmg}.</li>
+ <li>Double click the <strong>IntelHAXM.mpkg</strong> icon to begin installation.</li>
+ <li>Follow the on-screen instructions to complete installation.</li>
+ <li>After installation completes, confirm that the new kernel extension is operating correctly by
+opening a terminal window and running the following command:
+ <pre>kextstat | grep intel</pre>
+ <p>You should see a status message containing the following extension name, indicating that the
+ kernel extension is loaded:</p>
+ <pre>com.intel.kext.intelhaxm</pre>
+ </li>
+</ol>
+
+<p>To run an x86-based emulator with VM acceleration:</p>
+<ul>
+ <li>If you are running the emulator from the command line, just specify an x86-based AVD:
+<pre>emulator -avd <avd_name></pre>
+ <p class="note"><strong>Note:</strong> You must provide an x86-based AVD configuration
+name, otherwise VM acceleration will not be enabled.</p>
+ </li>
+ <li>If you are running the emulator from Eclipse, run your Android application with an x86-based
+AVD:
+ <ol>
+ <li>In Eclipse, click your Android project folder and then select <strong>Run > Run
+Configurations...</strong></li>
+ <li>In the left panel of the <strong>Run Configurations</strong> dialog, select your Android
+project run configuration or create a new configuration.</li>
+ <li>Click the <strong>Target</strong> tab.</li>
+ <li>Select the x86-based AVD you created previously.</li>
+ <li>Run your Android project using this run configuration.</li>
+ </ol>
+ </li>
+</ul>
+
+<p>You can adjust the amount of memory available to the Intel HAXM kernel extension by re-running
+the installer.</p>
+
+<p>You can stop using the virtualization kernel driver by uninstalling it. Before removing it, shut
+down any running x86 emulators. To unload the virtualization kernel driver, run the following
+command in a terminal window:</p>
+
+<pre>sudo /System/Library/Extensions/intelhaxm.kext/Contents/Resources/uninstall.sh</pre>
+
+<h4 id="vm-linux">Configuring VM Acceleration on Linux</h4>
+
+<p>Linux-based systems support virtual machine acceleration through the KVM software package. Follow
+<a href="https://www.google.com/?q=kvm+installation">instructions for installing KVM</a> on your
+Linux system, and verify that KVM is enabled. In addition to following the installation
+instructions, be aware of these configuration requirements:</p>
+
+<ul>
+ <li>Running KVM requires specific user permissions, make sure you have sufficient permissions
+according to the KVM installation instructions.</li>
+ <li>If you use another virtualization technology in your Linux platform, unload its kernel driver
+before running the x86 emulator. For example, the VirtualBox driver program is {@code vboxdrv}.</li>
+</ul>
+
+<p>To run an x86-based emulator with VM acceleration:</p>
+
+<ul>
+ <li>If you are running the emulator from the command line, start the emulator with an x86-based
+AVD and include the KVM options:
+<pre>emulator -avd <avd_name> -qemu -m 512 -enable-kvm</pre>
+ <p class="note"><strong>Note:</strong> You must provide an x86-based AVD configuration
+name, otherwise VM acceleration will not be enabled.</p>
+ </li>
+ <li>If you are running the emulator from Eclipse, run your Android application with an x86-based
+AVD and include the KVM options:
+ <ol>
+ <li>In Eclipse, click your Android project folder and then select <strong>Run > Run
+Configurations...</strong></li>
+ <li>In the left panel of the <strong>Run Configurations</strong> dialog, select your Android
+project run configuration or create a new configuration.</li>
+ <li>Click the <strong>Target</strong> tab.</li>
+ <li>Select the x86-based AVD you created previously.</li>
+ <li>In the <strong>Additional Emulator Command Line Options</strong> field, enter:
+ <pre>-qemu -m 512 -enable-kvm</pre>
+ </li>
+ <li>Run your Android project using this run configuration.</li>
+ </ol>
+ </li>
+</ul>
+
+<p class="note"><strong>Important:</strong> When using the {@code -qemu} command line option, make sure
+it is the last parameter in your command. All subsequent options are interpreted as qemu-specific
+parameters.</p>
+
+
+<h2 id="sdcard">SD Card Emulation</h2>
+
+<p>You can create a disk image and then load it to the emulator at startup, to
+simulate the presence of a user's SD card in the device. To do this, you can specify
+an SD card image when you create an AVD, or you can use the mksdcard utility included
+in the SDK.</p>
+
+<p>The following sections describe how to create an SD card disk image, how to copy
+files to it, and how to load it in the emulator at startup. </p>
+
+<p>Note that you can only load a disk image at emulator startup. Similarly, you
+can not remove a simulated SD card from a running emulator. However, you can
+browse, send files to, and copy/remove files from a simulated SD card either
+with adb or the emulator. </p>
+
+<p>The emulator supports emulated SDHC cards, so you can create an SD card image
+of any size up to 128 gigabytes.</p>
+
+
+<h3 id="sdcard-creating">Creating an SD card image</h3>
+
+<p>There are several ways of creating an SD card image. The easiest way is to use the
+<strong>AVD Manager</strong> to create a new SD card by specifying a size when you create an AVD.
+You can also use the {@code android} command line tool when creating an AVD. Just add the
+<code>-c</code> option to your command: </p>
+
+<pre>android create avd -n <avd_name> -t <targetID> -c <size>[K|M]</pre>
+
+<p>The <code>-c</code> option can also be used to to specify a path to an SD card
+image for the new AVD. For more information, see <a
+href="{@docRoot}guide/developing/devices/managing-avds-cmdline.html">Managing Virtual Devices
+from the Command Line</a>.
</p>
-<p>When the emulator is running, you can interact with the emulated mobile
-device just as you would an actual mobile device, except that you use your mouse
-pointer to "touch" the touchscreen and your keyboard keys to
-"press" the simulated device keys. </p>
+<p>You can also use the mksdcard tool, included in the SDK, to create a FAT32 disk
+image that you can load in the emulator at startup. You can access mksdcard in
+the tools/ directory of the SDK and create a disk image like this: </p>
-<p>The table below summarizes the mappings between the emulator keys and and
-the keys of your keyboard. </p>
+<pre>mksdcard <size> <file></pre>
-<table border="0" style="clear:left;">
- <tr>
- <th>Emulated Device Key </th>
- <th>Keyboard Key </th>
- </tr>
- <tr>
- <td>Home</td>
- <td>HOME</td>
- </tr>
- <tr>
- <td>Menu (left softkey)</td>
- <td>F2 <em>or</em> Page-up button</td>
- </tr>
- <tr>
- <td>Star (right softkey)</td>
- <td>Shift-F2 <em>or </em>Page Down</td>
- </tr>
- <tr>
- <td>Back</td>
- <td>ESC</td>
- </tr>
- <tr>
- <td>Call/dial button </td>
- <td>F3</td>
- </tr>
- <tr>
- <td>Hangup/end call button</td>
- <td>F4</td>
- </tr>
- <tr>
- <td>Search</td>
- <td>F5 </td>
- </tr>
- <tr>
- <td>Power button</td>
- <td>F7 </td>
- </tr>
- <tr>
- <td>Audio volume up button</td>
- <td>KEYPAD_PLUS, Ctrl-5</td>
- </tr>
+<p>For example:</p>
- <tr>
- <td>Audio volume down button</td>
- <td>KEYPAD_MINUS, Ctrl-F6</td>
- </tr>
- <tr>
- <td>Camera button</td>
- <td>Ctrl-KEYPAD_5, Ctrl-F3</td>
- </tr>
- <tr>
- <td>Switch to previous layout orientation (for example, portrait, landscape)</td>
- <td>KEYPAD_7, Ctrl-F11</td>
- </tr>
- <tr>
- <td>Switch to next layout orientation (for example, portrait, landscape)</td>
- <td>KEYPAD_9, Ctrl-F12</td>
- </tr>
- <tr>
- <td>Toggle cell networking on/off</td>
- <td>F8</td>
- </tr>
- <tr>
- <td>Toggle code profiling</td>
- <td>F9 (only with <code>-trace</code> startup option)</td>
- </tr>
- <tr>
- <td>Toggle fullscreen mode</td>
- <td>Alt-Enter</td>
- </tr>
- <tr>
- <td>Toggle trackball mode</td>
- <td>F6</td>
- </tr>
- <tr>
- <td>Enter trackball mode temporarily (while key is pressed)</td>
- <td>Delete</td>
- </tr>
- <tr>
- <td>DPad left/up/right/down</td>
- <td>KEYPAD_4/8/6/2</td>
- </tr>
- <tr>
- <td>DPad center click</td>
- <td>KEYPAD_5</td>
- </tr>
- <tr>
- <td>Onion alpha increase/decrease</td>
- <td>KEYPAD_MULTIPLY(*) / KEYPAD_DIVIDE(/)</td>
- </tr>
-</table>
+<pre>mksdcard 1024M sdcard1.iso</pre>
-<p>Note that, to use keypad keys, you must first disable NumLock on your development computer. </p>
-
-<h2 id="emulator">Emulator Startup Options</h2>
-
-<p>The emulator supports a variety of options that you can specify
-when launching the emulator, to control its appearance or behavior.
-Here's the command-line usage for launching the emulator with options: </p>
-
-<pre>emulator -avd <avd_name> [-<option> [<value>]] ... [-<qemu args>]</pre>
-
-<p>The table below summarizes the available options.</p>
-
-<table>
-<tr>
- <th width="10%" >Category</th>
- <th width="20%" >Option</th>
- <th width="30%" >Description</th>
- <th width="40%" >Comments</th>
-</tr>
-
-<tr>
- <td rowspan="9">Help</td>
- <td><code>-help</code></td>
- <td>Print a list of all emulator options.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-all</code></td>
- <td>Print help for all startup options.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-<option></code></td>
- <td>Print help for a specific startup option.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-debug-tags</code></td>
- <td>Print a list of all tags for <code>-debug <tags></code>.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-disk-images</code></td>
- <td>Print help for using emulator disk images.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-environment</code></td>
- <td>Print help for emulator environment variables.</td>
- <td> </td>
-</tr><tr>
- <td><code>-help-keys</code></td>
- <td>Print the current mapping of keys.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-keyset-file</code></td>
- <td>Print help for defining a custom key mappings file.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-virtual-device</code></td>
- <td>Print help for Android Virtual Device usage.</td>
- <td> </td>
-</tr>
-<tr>
- <td>AVD</td>
- <td><code>-avd <avd_name></code> or <br>
- <code>@<avd_name></code></td>
- <td><strong>Required</strong>. Specifies the AVD to load for this emulator
- instance.</td>
- <td>You must create an AVD configuration before launching the emulator. For
- information, see <a href="{@docRoot}guide/developing/devices/managing-avds.html">Managing
- Virtual Devices with AVD Manager</a>.</td>
-<tr>
- <td rowspan="7">Disk Images</td>
- <td><code>-cache <filepath></code></td>
- <td>Use <filepath> as the working cache partition image. </td>
- <td>Optionally, you can specify a path relative to the current working directory.
- If no cache file is specified, the emulator's default behavior is to use a temporary file instead.
- <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td></tr>
-<tr>
- <td><code>-data <filepath></code></td>
- <td>Use <filepath> as the working user-data disk image. </td>
- <td>Optionally, you can specify a path relative to the current working directory.
- If <code>-data</code> is not used, the emulator looks for a file named "userdata-qemu.img"
- in the storage area of the AVD being used (see <code>-avd</code>).
-</td></tr>
-<!--
-<tr>
- <td><code>-datadir <dir></code></td>
- <td>Search for the user-data disk image specified in <code>-data</code> in <dir></td>
- <td><code><dir></code> is a path relative to the current working directory.
-
-<p>If you do not specify <code>-datadir</code>, the emulator looks for the user-data image
-in the storage area of the AVD being used (see <code>-avd</code>)</p><p>For more information
-on disk images, use <code>-help-disk-images</code>.</p>
-</td></tr>
--->
-<!--
-<tr>
- <td><code>-image <filepath></code></td>
- <td>Use <filepath> as the system image.</td>
- <td>Optionally, you can specify a path relative to the current working directory.
- Default is <system>/system.img.</td>
-</tr>
--->
-<tr>
- <td><code>-initdata <filepath></code></td>
- <td>When resetting the user-data image (through <code>-wipe-data</code>), copy the contents
- of this file to the new user-data disk image. By default, the emulator copies the <code><system>/userdata.img</code>.</td>
- <td>Optionally, you can specify a path relative to the current working directory. See also <code>-wipe-data</code>.
- <p>For more information on disk images, use <code>-help-disk-images</code>.</p></td>
-</tr>
-<!--
-<tr>
- <td><code>-kernel <filepath></code></td>
- <td>Use <filepath> as the emulated kernel.</td>
- <td>Optionally, you can specify a path relative to the current working directory. </td>
-</tr>
--->
-<tr>
- <td><code>-nocache</code></td>
- <td>Start the emulator without a cache partition.</td>
- <td>See also <code>-cache <file></code>.</td>
-</tr>
-<tr>
- <td><code>-ramdisk <filepath></code></td>
- <td>Use <filepath> as the ramdisk image.</td>
- <td>Default value is <code><system>/ramdisk.img</code>.
- <p>Optionally, you can specify a path relative to the current working directory.
- For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td>
-</tr>
-<tr>
- <td><code>-sdcard <filepath></code></td>
- <td>Use <file> as the SD card image.</td>
- <td>Default value is <code><system>/sdcard.img</code>.
- <p>Optionally, you can specify a path relative to the current working directory. For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td>
-</tr>
-<!--
-<tr>
- <td><code>-system <dirpath></code></td>
- <td>Search for system, ramdisk and user data images in <dir>.</td>
- <td><code><dir></code> is a directory path relative to the current
- working directory.</td>
-</tr>
--->
-<tr>
- <td><code>-wipe-data</code></td>
- <td>Reset the current user-data disk image (that is, the file specified by <code>-datadir</code> and
- <code>-data</code>, or the default file). The emulator deletes all data from the user data image file,
- then copies the contents of the file at <code>-inidata</code> data to the image file before starting.
- </td>
- <td>See also <code>-initdata</code>.
- <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td>
-</tr>
-<tr>
- <td rowspan="9">Debug</td>
- <td><code>-debug <tags></code></td>
- <td>Enable/disable debug messages for the specified debug tags.</td>
- <td><code><tags></code> is a space/comma/column-separated list of debug component names.
- Use <code>-help-debug-tags</code> to print a list of debug component names that you can use. </td>
-</tr>
-<tr>
- <td><code>-debug-<tag></code></td>
- <td>Enable/disable debug messages for the specified debug tag.</td>
- <td rowspan="2">Use <code>-help-debug-tags</code> to print a list of debug component names that you can use in <code><tag></code>. </td>
-</tr>
-<tr>
- <td><code>-debug-no-<tag></code></td>
- <td>Disable debug messages for the specified debug tag.</td>
-</tr>
-<tr>
- <td><code>-logcat <logtags></code></td>
- <td>Enable logcat output with given tags.</td>
- <td>If the environment variable ANDROID_LOG_TAGS is defined and not
- empty, its value will be used to enable logcat output by default.</td>
-</tr>
-<tr>
- <td><code>-shell</code></td>
- <td>Create a root shell console on the current terminal.</td>
- <td>You can use this command even if the adb daemon in the emulated system is broken.
- Pressing Ctrl-c from the shell stops the emulator instead of the shell.</td>
-</tr>
-<tr>
- <td><code>-shell-serial <device></code></td>
- <td>Enable the root shell (as in <code>-shell</code> and specify the QEMU character
- device to use for communication with the shell.</td>
- <td><device> must be a QEMU device type. See the documentation for '-serial <em>dev</em>' at
- <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>
- for a list of device types.
-
-<p>Here are some examples: </p>
-<ul>
- <li><code>-shell-serial stdio</code> is identical to <code>-shell</code></li>
- <li><code>-shell-serial tcp::4444,server,nowait</code> lets you communicate with the shell over TCP port 4444</li>
- <li><code>-shell-serial fdpair:3:6</code> lets a parent process communicate with the shell using fds 3 (in) and 6 (out)</li>
- <li><code>-shell-serial fdpair:0:1</code> uses the normal stdin and stdout fds, except that QEMU won't tty-cook the data.</li>
- </ul>
-</td>
-</tr>
-<tr>
- <td><code>-show-kernel <name></code></td>
- <td>Display kernel messages.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-trace <name></code></td>
- <td>Enable code profiling (press F9 to start), written to a specified file.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-verbose</code></td>
- <td>Enable verbose output.</td>
- <td>Equivalent to <code>-debug-init</code>.
-<p>You can define the default verbose output options used by emulator instances in the Android environment variable
-ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, specifying only the stem of each option:
-<code>-debug-<tags>.</code> </p>
-<p>Here's an example showing ANDROID_VERBOSE defined with the <code>-debug-init</code> and <code>-debug-modem</code> options:
-<p><code>ANDROID_VERBOSE=init,modem</code></p>
-<p>For more information about debug tags, use <code><-help-debug-tags></code>.</p>
-</td>
-</tr>
-<tr>
- <td rowspan="6">Media</td>
- <td><code>-audio <backend></code></td>
- <td>Use the specified audio backend.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-audio-in <backend></code></td>
- <td>Use the specified audio-input backend.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-audio-out <backend></code></td>
- <td>Use the specified audio-output backend.</td>
- <td> </td>
-</tr>
-<!--<tr>
- <td><code>-mic <device or file></code></td>
- <td>Use device or WAV file for audio input.</td>
- <td> </td>
-</tr>
--->
-<tr>
- <td><code>-noaudio</code></td>
- <td>Disable audio support in the current emulator instance.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-radio <device></code></td>
- <td>Redirect radio modem interface to a host character device.</td>
- <td> </td></tr>
-<tr>
- <td><code>-useaudio</code></td>
- <td>Enable audio support in the current emulator instance.</td>
- <td>Enabled by default. </td>
-</tr>
-
-<tr>
- <td rowspan="7">Network</td>
- <td><code>-dns-server <servers></code></td>
- <td>Use the specified DNS server(s). </td>
- <td>The value of <code><servers></code> must be a comma-separated list of up to 4 DNS server names or
- IP addresses.</td>
-</tr>
-<tr>
- <td><code>-http-proxy <proxy></code></td>
- <td>Make all TCP connections through a specified HTTP/HTTPS proxy</td>
- <td>The value of <code><proxy></code> can be one of the following:<br>
- <code>http://<server>:<port></code><br>
- <code>http://<username>:<password>@<server>:<port></code>
- <p>The <code>http://</code> prefix can be omitted. If the <code>-http-proxy <proxy></code> command is not supplied,
- the emulator looks up the <code>http_proxy</code> environment variable and automatically uses any value matching
- the <code><proxy></code> format described above.</p></td>
-</tr>
-<tr>
- <td><code>-netdelay <delay></code></td>
- <td>Set network latency emulation to <delay>.</td>
- <td>Default value is <code>none</code>. See the table in <a href="#netdelay">Network Delay Emulation</a> for
- supported <code><delay></code> values. </td>
-</tr>
-<tr>
- <td><code>-netfast</code></td>
- <td>Shortcut for <code>-netspeed full -netdelay none</code></td>
- <td> </td></tr>
-<tr>
- <td><code>-netspeed <speed></code></td>
- <td>Set network speed emulation to <speed>.</td>
- <td>Default value is <code>full</code>. See the table in <a href="#netspeed">Network Speed Emulation</a> for
- supported <code><speed></code> values. </td>
-</tr>
-<tr>
- <td><code>-port <port></code></td>
- <td>Set the console port number for this emulator instance to <code><port></code>.</td>
- <td>The console port number must be an even integer between 5554 and 5584, inclusive. <code><port></code>+1
- must also be free and will be reserved for ADB.</td>
-</tr>
-<tr>
- <td><code>-report-console <socket></code></td>
- <td>Report the assigned console port for this emulator instance to a remote third party
- before starting the emulation. </td>
- <td><code><socket></code> must use one of these formats:
-
-<p><code>tcp:<port>[,server][,max=<seconds>]</code></br>
-<code>unix:<port>[,server][,max=<seconds>]</code></p>
-
-<p>Use <code>-help-report-console</code></p> to view more information about this topic. </td>
-</tr>
-<tr>
- <td rowspan="8">System</td>
- <td><code>-cpu-delay <delay></code></td>
- <td>Slow down emulated CPU speed by <delay> </td>
- <td>Supported values for <delay> are integers between 0 and 1000.
-
-<p>Note that the <delay> does not correlate to clock speed or other absolute metrics
-— it simply represents an abstract, relative delay factor applied non-deterministically
-in the emulator. Effective performance does not always
-scale in direct relationship with <delay> values.</p>
-</td>
-</tr>
-<tr>
- <td><code>-gps <device></code></td>
- <td>Redirect NMEA GPS to character device.</td>
- <td>Use this command to emulate an NMEA-compatible GPS unit connected to
- an external character device or socket. The format of <code><device></code> must be QEMU-specific
- serial device specification. See the documentation for 'serial -dev' at
- <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>.
-</td>
-</tr>
-<tr>
- <td><code>-nojni</code></td>
- <td>Disable JNI checks in the Dalvik runtime.</td><td> </td></tr>
-<tr>
- <td><code>-qemu</code></td>
- <td>Pass arguments to qemu.</td>
- <td> </td></tr>
-<tr>
- <td><code>-qemu -h</code></td>
- <td>Display qemu help.</td>
- <td></td></tr>
-<tr>
- <td><code>-radio <device></code></td>
- <td>Redirect radio mode to the specified character device.</td>
- <td>The format of <code><device></code> must be QEMU-specific
- serial device specification. See the documentation for 'serial -dev' at
-<a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>.
-</td>
-</tr>
-<tr>
- <td><code>-timezone <timezone></code></td>
- <td>Set the timezone for the emulated device to <timezone>, instead of the host's timezone.</td>
- <td><code><timezone></code> must be specified in zoneinfo format. For example:
-<p>"America/Los_Angeles"<br>
-"Europe/Paris"</p>
-</td>
-</tr>
-<tr>
- <td><code>-version</code></td>
- <td>Display the emulator's version number.</td>
- <td> </td>
-</tr>
-<tr>
- <td rowspan="12">UI</td>
- <td><code>-dpi-device <dpi></code></td>
- <td>Scale the resolution of the emulator to match the screen size
- of a physical device.</td>
- <td>The default value is 165. See also <code>-scale</code>.</td>
-</tr>
-<tr>
- <td><code>-no-boot-anim</code></td>
- <td>Disable the boot animation during emulator startup.</td>
- <td>Disabling the boot animation can speed the startup time for the emulator.</td>
-</tr>
-<tr>
- <td><code>-no-window</code></td>
- <td>Disable the emulator's graphical window display.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-scale <scale></code></td>
- <td>Scale the emulator window. </td>
- <td><code><scale></code> is a number between 0.1 and 3 that represents the desired scaling factor. You can
- also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto"
- tells the emulator to select the best window size.</td>
-</tr>
-<tr>
- <td><code>-raw-keys</code></td>
- <td>Disable Unicode keyboard reverse-mapping.</td>
- <td> </td></tr>
-<tr>
- <td><code>-noskin</code></td>
- <td>Don't use any emulator skin.</td>
- <td> </td></tr>
-<tr>
- <td><code>-keyset <file></code></td>
- <td>Use the specified keyset file instead of the default.</td>
- <td>The keyset file defines the list of key bindings between the emulator and the host keyboard.
- For more information, use <code>-help-keyset</code> to print information about this topic.
-</td>
-</tr>
-<tr>
- <td><code>-onion <image></code></td>
- <td>Use overlay image over screen.</td>
- <td>No support for JPEG. Only PNG is supported.</td></tr>
-<tr>
- <td><code>-onion-alpha <percent></code></td>
- <td>Specify onion skin translucency value (as percent).
- <td>Default is 50.</td>
-</tr>
-<tr>
- <td><code>-onion-rotation <position></code></td>
- <td>Specify onion skin rotation.
- <td><code><position></code> must be one of the values 0, 1, 2, 3.</td>
-</tr>
-<tr>
- <td><code>-skin <skinID></code></td>
- <td>This emulator option is deprecated. </td>
- <td>Please set skin options using AVDs, rather than by using this emulator
-option. Using this option may yield unexpected and in some cases misleading
-results, since the density with which to render the skin may not be defined.
-AVDs let you associate each skin with a default density and override the default
-as needed. For more information, see <a
-href="{@docRoot}guide/developing/devices/managing-avds.html">Managing Virtual Devices
-with AVD Manager</a>.
-</td>
-</tr>
-<tr>
- <td><code>-skindir <dir></code></td>
- <td>This emulator option is deprecated. </td>
- <td>See comments for <code>-skin</code>, above.</td></tr>
-</table>
+<p>For more information, see <a
+href="{@docRoot}guide/developing/tools/mksdcard.html"><code>mksdcard</code></a>.</p>
-<a name="diskimages"></a>
+<h3 id="sdcard-files">Copying files to an SD card image</h3>
-<h2>Working with Emulator Disk Images</h2>
+<p>Once you have created the disk image, you can copy files to it prior to
+loading it in the emulator. To copy files, you can mount the image as a loop
+device and then copy the files to it, or you can use a utility such as {@code mtools} to
+copy the files directly to the image. The {@code mtools} package is available for Linux,
+Mac, and Windows.</p>
+
+<p>Alternatively, you can use the {@code adb push} command to move files onto an SD card image
+while it is loaded in an emulator. For more information see the <a
+href="{@docRoot}guide/developing/tools/adb.html#copyfiles">{@code adb push}</a> documentation.</p>
+
+<h3 id="sdcard-loading">Loading an SD card image</h3>
+
+<p>By default, the emulator loads the SD card image that is stored with the active
+AVD (see the <code>-avd</code> startup option).</p>
+
+<p>Alternatively, you can start the emulator with the
+<code>-sdcard</code> flag and specify the name and path of your image (relative
+to the current working directory): </p>
+
+<pre>emulator -sdcard <filepath></pre>
+
+
+<h2 id="diskimages">Working with Emulator Disk Images</h2>
<p>The emulator uses mountable disk images stored on your development machine to
-simulate flash (or similar) partitions on an actual device. For example, it uses
+simulate flash (or similar) partitions on an actual device. For example, it uses a
disk image containing an emulator-specific kernel, the Android system, a
ramdisk image, and writeable images for user data and simulated SD card.</p>
<p>To run properly, the emulator requires access to a specific set of disk image
-files. By default, the Emulator always looks for the disk images in the
-private storage area of the AVD in use. If no images exist there when
-the Emulator is launched, it creates the images in the AVD directory based on
+files. By default, the Emulator always looks for the disk images in the
+private storage area of the AVD in use. If no images exist there when
+the Emulator is launched, it creates the images in the AVD directory based on
default versions stored in the SDK. </p>
-<p class="note"><strong>Note:</strong> The default storage location for
-AVDs is in <code>~/.android/avd</code> on OS X and Linux, <code>C:\Documents and
-Settings\<user>\.android\</code> on Windows XP, and
+<p class="note"><strong>Note:</strong> The default storage location for
+AVDs is in <code>~/.android/avd</code> on OS X and Linux, <code>C:\Documents and
+Settings\<user>\.android\</code> on Windows XP, and
<code>C:\Users\<user>\.android\</code>
on Windows Vista.</p>
<p>To let you use alternate or custom versions of the image files, the emulator
provides startup options that override the default locations and filenames of
-the image files. When you use the options, the emulator searches for the image
+the image files. When you use one of these options, the emulator searches for the image
file under the image name or location that you specify; if it can not locate the
image, it reverts to using the default names and location.</p>
@@ -757,20 +636,19 @@
image files, and temporary image files. The sections below describe how to
override the location/name of each type of file. </p>
-<a name="defaultimages"></a>
-<h3>Default Images</h3>
+<h3 id="defaultimages">Default image files</h3>
-<p>When the emulator launches but does not find an existing user data image in
+<p>When the emulator launches, but does not find an existing user data image in
the active AVD's storage area, it creates a new one from a default version
-included in the SDK. The default user data image is read-only. The image
+included in the SDK. The default user data image is read-only. The image
files are read-only.</p>
<p>The emulator provides the <code>-system <dir></code> startup option to
-let you override the location under which the emulator looks for the default
+let you override the location where the emulator looks for the default
user data image. </p>
<p>The emulator also provides a startup option that lets you override the name
-of the default user data image, as described in the table below. When you use the
+of the default user data image, as described in the following table. When you use the
option, the emulator looks in the default directory, or in a custom location
(if you specified <code>-system <dir></code>). </p>
@@ -810,25 +688,24 @@
</table>
-<a name="runtimeimages"></a>
-<h3>Runtime Images: User Data and SD Card</h3>
+<h3 id="runtimeimages">Runtime images: user data and SD card</h3>
-<p>At runtime, the emulator reads and writes data on two disk images: a
-user-data image and (optionally) an SD card image. This emulates the user-data
+<p>At runtime, the emulator reads and writes data to two disk images: a
+user-data image and (optionally) an SD card image. These images emulate the user-data
partition and removable storage media on actual device. </p>
-<p>The emulator provides a default user-data disk image. At startup, the emulator
-creates the default image as a copy of the system user-data image (user-data.img),
+<p>The emulator provides a default user-data disk image. At startup, the emulator
+creates the default image as a copy of the system user-data image (user-data.img),
described above. The emulator stores the new image with the files of the active AVD.</p>
<!--
-<p>The emulator provides a startup option, <code>-datadir <dir></code>,
+<p>The emulator provides a startup option, <code>-datadir <dir></code>,
that you can use to override the location under which the emulator looks for the runtime
image files. </p>
-->
-<p>The emulator provides startup options to let you override the actual names and storage
-locations of the runtime images to load, as described in the table below. When you use one
+<p>The emulator provides startup options to let you override the actual names and storage
+locations of the runtime images to load, as described in the following table. When you use one
of these options, the emulator looks for the specified file(s) in the current working directory,
in the AVD directory, or in a custom location (if you specified a path with the filename). </p>
@@ -842,7 +719,7 @@
<td><code>userdata-qemu.img</code></td>
<td>An image to which the emulator writes runtime user-data for a unique user.</td>
<td>Override using <code>-data <filepath></code>, where <code><filepath></code> is the
-path the image, relative to the current working directory. If you supply a filename only,
+path the image, relative to the current working directory. If you supply a filename only,
the emulator looks for the file in the current working directory. If the file at <code><filepath></code> does
not exist, the emulator creates an image from the default userdata.img, stores it under the name you
specified, and persists user data to it at shutdown. </td>
@@ -852,7 +729,7 @@
<td><code>sdcard.img</code></td>
<td>An image representing an SD card inserted into the emulated device.</td>
<td>Override using <code>-sdcard <filepath></code>, where <code><filepath></code> is the
-path the image, relative to the current working directory. If you supply a filename only,
+path the image, relative to the current working directory. If you supply a filename only,
the emulator looks for the file in the current working directory. </td>
</tr>
@@ -864,38 +741,38 @@
session-specific data. For example, it uses the image to store a unique user's
installed application data, settings, databases, and files. </p>
-<p>At startup, the emulator attempts to load a user-data image stored during
-a previous session. It looks for the file in the current working directory,
-in the AVD directory as described above, and at the custom location/name
+<p>At startup, the emulator attempts to load a user-data image stored during
+a previous session. It looks for the file in the current working directory,
+in the AVD directory described in a previous section and at the custom location/name
that you specified at startup. </p>
<ul>
-<li>If it finds a user-data image, it mounts the image and makes it available
-to the system for reading/writing of user data. </li>
+<li>If it finds a user-data image, it mounts the image and makes it available
+to the system for reading and writing of user data. </li>
<li>If it does not find one, it creates an image by copying the system user-data
image (userdata.img), described above. At device power-off, the system persists
-the user data to the image, so that it will be available in the next session.
+the user data to the image, so that it will be available in the next session.
Note that the emulator stores the new disk image at the location/name that you
specify in <code>-data</code> startup option.</li>
</ul>
<p class="note"><strong>Note:</strong> Because of the AVD configurations used in the emulator,
-each emulator instance now gets its own dedicated storage. There is no need
+each emulator instance gets its own dedicated storage. There is no longer a need
to use the <code>-d</code> option to specify an instance-specific storage area.</p>
<h4>SD Card</h4>
<P>Optionally, you can create a writeable disk image that the emulator can use
-to simulate removeable storage in an actual device. For information about how to create an
+to simulate removeable storage in an actual device. For information about how to create an
emulated SD card and load it in the emulator, see <a href="#sdcard">SD Card Emulation</a></p>
<p>You can also use the android tool to automatically create an SD Card image
-for you, when creating an AVD. For more information, see <a
+for you, when creating an AVD. For more information, see <a
href="{@docRoot}guide/developing/devices/managing-avds.html">Managing Virtual Devices with AVD
Manager</a>.
-<a name="temporaryimages"></a>
-<h3>Temporary Images</h3>
+
+<h3 id="temporaryimages">Temporary Images</h3>
<p>The emulator creates two writeable images at startup that it deletes at
device power-off. The images are: </p>
@@ -909,8 +786,8 @@
persisting it at device power-off. </p>
<p>The <code>/cache</code> partition image is initially empty, and is used by
-the browser to cache downloaded web pages and images. The emulator provides an
-<code>-cache <file></code>, which specifies the name of the file at which
+the browser to cache downloaded web pages and images. The emulator provides an
+<code>-cache <file></code>, which specifies the name of the file in which
to persist the <code>/cache</code> image at device power-off. If <code><file>
</code> does not exist, the emulator creates it as an empty file. </p>
@@ -918,16 +795,14 @@
<code>-nocache</code> option at startup. </p>
-<a name="emulatornetworking"></a>
-<h2>Emulator Networking</h2>
+<h2 id="emulatornetworking">Emulator Networking</h2>
<p>The emulator provides versatile networking capabilities that you can use to
set up complex modeling and testing environments for your application. The
sections below introduce the emulator's network architecture and capabilities.
</p>
-<a name="networkaddresses"></a>
-<h3>Network Address Space</h3>
+<h3 id="networkaddresses">Network Address Space</h3>
<p>Each instance of the emulator runs behind a virtual router/firewall service
that isolates it from your development machine's network interfaces and settings
@@ -990,14 +865,13 @@
devices (which are also very likely to be NAT-ed, i.e., behind a
router/firewall)</p>
-<a name="networkinglimitations"></a>
-<h3>Local Networking Limitations</h3>
-<p>Each emulator instance runs behind a virtual router, but unlike an actual
-device connected to a physical router, the emulated device doesn't have access
-to a physical network. Instead it runs as part of a normal application on your
-development machine. This means that it is subject to the same networking
-limitations as other applications on your machine:</p>
+<h3 id="networkinglimitations">Local Networking Limitations</h3>
+
+<p>Android applications running in an emulator can connect to the network available on your
+workstation. However, they connect through the emulator, not directly to hardware, and the emulator
+acts like a normal application on your workstation. This means that the emulator, and thus your
+Android applications, are subject to some limitations:</p>
<ul>
<li>Communication with the emulated device may be blocked by a firewall
@@ -1016,25 +890,24 @@
protocols (such as ICMP, used for "ping") might not be supported. Currently, the
emulator does not support IGMP or multicast. </p>
-<a name="redirections"></a>
-<h3>Using Network Redirections</h3>
+<h3 id="redirection">Using Network Redirection</h3>
<p>To communicate with an emulator instance behind its virtual router, you need
-to set up network redirections on the virtual router. Clients can then connect
+to set up network redirection on the virtual router. Clients can then connect
to a specified guest port on the router, while the router directs traffic
to/from that port to the emulated device's host port. </p>
-<p>To set up the network redirections, you create a mapping of host and guest
+<p>To set up the network redirection, you create a mapping of host and guest
ports/addresses on the the emulator instance. There are two ways to set up
-network redirections: using emulator console commands and using the ADB tool, as
+network redirection: using emulator console commands and using the ADB tool, as
described below. </p>
-<a name="consoleredir"></a>
-<h4>Setting up Redirections through the Emulator Console</h4>
+
+<h4 id="consoleredir">Setting up Redirection through the Emulator Console</h4>
<p>Each emulator instance provides a control console the you can connect to, to
issue commands that are specific to that instance. You can use the
-<code>redir</code> console command to set up redirections as needed for an
+<code>redir</code> console command to set up redirection as needed for an
emulator instance. </p>
<p>First, determine the console port number for the target emulator instance.
@@ -1044,25 +917,25 @@
<pre><code>telnet localhost 5554</code></pre>
-<p>Once connected, use the <code>redir</code> command to work with redirections.
+<p>Once connected, use the <code>redir</code> command to work with redirection.
To add a redirection, use:</p>
<pre><code>add <protocol>:<host-port>:<guest-port></code>
</pre>
-<p>where <code><protocol></code> is either <code>tcp</code> or <code>udp</code>,
-and <code><host-port></code> and <code><guest-port></code> sets the
+<p>where <code><protocol></code> is either <code>tcp</code> or <code>udp</code>,
+and <code><host-port></code> and <code><guest-port></code> sets the
mapping between your own machine and the emulated system, respectively. </p>
-<p>For example, the following command sets up a redirection that will handle all
+<p>For example, the following command sets up a redirection that handles all
incoming TCP connections to your host (development) machine on 127.0.0.1:5000
and will pass them through to the emulated system's 10.0.2.15:6000.:</p>
<pre>redir add tcp:5000:6000</pre>
<p>To delete a redirection, you can use the <code>redir del</code> command. To
-list all redirections for a specific instance, you can use <code>redir
-list</code>. For more information about these and other console commands, see
+list all redirection for a specific instance, you can use <code>redir
+list</code>. For more information about these and other console commands, see
<a href="#console">Using the Emulator Console</a>. </p>
<p>Note that port numbers are restricted by your local environment. this typically
@@ -1071,29 +944,28 @@
host port that is already in use by another process on your machine. In that
case, <code>redir</code> generates an error message to that effect. </p>
-<a name="adbredir"></a>
-<h4>Setting Up Redirections through ADB</h4>
+<h4 id="adbredir">Setting Up Redirection through ADB</h4>
<p>The Android Debug Bridge (ADB) tool provides port forwarding, an alternate
-way for you to set up network redirections. For more information, see <a
+way for you to set up network redirection. For more information, see <a
href="{@docRoot}guide/developing/tools/adb.html#forwardports">Forwarding Ports</a> in the ADB
documentation.</p>
<p>Note that ADB does not currently offer any way to remove a redirection,
except by killing the ADB server.</p>
-<a name="dns"></a>
-<h3>Configuring the Emulator's DNS Settings</h3>
+
+<h3 id="dns">Configuring the Emulator's DNS Settings</h3>
<p>At startup, the emulator reads the list of DNS servers that your system is
currently using. It then stores the IP addresses of up to four servers on this
list and sets up aliases to them on the emulated addresses 10.0.2.3, 10.0.2.4,
10.0.2.5 and 10.0.2.6 as needed. </p>
-<p>On Linux and OS X, the emulator obtains the DNS server addresses by parsing
-the file <code>/etc/resolv.conf</code>. On Windows, the emulator obtains the
-addresses by calling the <code>GetNetworkParams()</code> API. Note that this
-usually means that the emulator ignores the content of your "hosts" file
+<p>On Linux and OS X, the emulator obtains the DNS server addresses by parsing
+the file <code>/etc/resolv.conf</code>. On Windows, the emulator obtains the
+addresses by calling the <code>GetNetworkParams()</code> API. Note that this
+usually means that the emulator ignores the content of your "hosts" file
(<code>/etc/hosts</code> on Linux/OS X, <code>%WINDOWS%/system32/HOSTS</code>
on Windows).</P>
@@ -1104,8 +976,8 @@
encounter DNS resolution problems in the emulated network (for example, an
"Unknown Host error" message that appears when using the web browser).</p>
-<a name="proxy"></a>
-<h3>Using the Emulator with a Proxy</h3>
+
+<h3 id="proxy">Using the Emulator with a Proxy</h3>
<p>If your emulator must access the Internet through a proxy server, you can use
the <code>-http-proxy <proxy></code> option when starting the emulator, to
@@ -1132,18 +1004,18 @@
<p>You can use the <code>-verbose-proxy</code> option to diagnose proxy
connection problems.</p>
-<a name="connecting"></a>
-<h3>Interconnecting Emulator Instances</h3>
+
+<h3 id="connecting">Interconnecting Emulator Instances</h3>
<p>To allow one emulator instance to communicate with another, you must set up
-the necessary network redirections as illustrated below. </p>
+the necessary network redirection as illustrated below. </p>
<p>Assume that your environment is</p>
<ul>
<li>A is you development machine</li>
<li>B is your first emulator instance, running on A</li>
- <li>C is your second emulator instance, running on A too</li>
+ <li>C is your second emulator instance, also running on A</li>
</ul>
<p>and you want to run a server on B, to which C will connect, here is how you
@@ -1168,10 +1040,11 @@
<li>C connects to 10.0.2.2:8080</li>
</ul>
-<a name="calling"></a>
-<h3>Sending a Voice Call or SMS to Another Emulator Instance</h3>
+<h3 id="calling">Sending a Voice Call or SMS to Another Emulator Instance</h3>
-<p>The emulator automatically forwards simulated voice calls and SMS messages from one instance to another. To send a voice call or SMS, you use the dialer application and SMS application (if available) installed on one emulator </p>
+<p>The emulator automatically forwards simulated voice calls and SMS messages from one instance to
+another. To send a voice call or SMS, use the dialer application or SMS application, respectively,
+from one of the emulators.</p>
<p>To initiate a simulated voice call to another emulator instance:</p>
<ol>
@@ -1186,16 +1059,23 @@
<p>You can also connect to an emulator instance's console to simulate an incoming voice call or SMS. For more information, see <a href="#telephony">Telephony Emulation</a> and <a href="#sms">SMS Emulation</a>.
-<a name="console"></a>
-<h2>Using the Emulator Console</h2>
+<h2 id="console">Using the Emulator Console</h2>
-<p>Each running emulator instance includes a console facility that lets you dynamically query and control the simulated device environment. For example, you can use the console to dynamically manage port redirections and network characteristics and simulate telephony events. To access the console and enter commands, you use telnet to connect to the console's port number. </p>
+<p>Each running emulator instance provides a console that lets you query and control the emulated
+device environment. For example, you can use the console to manage port redirection, network
+characteristics, and telephony events while your application is running on the emulator. To
+access the console and enter commands, use telnet to connect to the console's port number.</p>
+
<p>To connect to the console of any running emulator instance at any time, use this command: </p>
<pre>telnet localhost <console-port></pre>
-<p>An emulator instance occupies a pair of adjacent ports: a console port and an adb port. The port numbers differ by 1, with the adb port having the higher port number. The console of the first emulator instance running on a given machine uses console port 5554 and adb port 5555. Subsequent instances use port numbers increasing by two — for example, 5556/5557, 5558/5559, and so on. Up to 16 concurrent emulator instances can run a console facility. </p>
+<p>An emulator instance occupies a pair of adjacent ports: a console port and an {@code adb} port.
+The port numbers differ by 1, with the {@code adb} port having the higher port number. The console
+of the first emulator instance running on a given machine uses console port 5554 and {@code adb}
+port 5555. Subsequent instances use port numbers increasing by two — for example, 5556/5557,
+5558/5559, and so on. Up to 16 concurrent emulator instances can run a console facility. </p>
<p>To connect to the emulator console, you must specify a valid console port. If multiple emulator instances are running, you need to determine the console port of the emulator instance you want to connect to. You can find the instance's console port listed in the title of the instance window. For example, here's the window title for an instance whose console port is 5554:</p>
@@ -1209,12 +1089,14 @@
<p>To exit the console session, use <code>quit</code> or <code>exit</code>.</p>
-<p>The sections below describe the major functional areas of the console.</p>
+<p>The following sections below describe the major functional areas of the console.</p>
-<a name="portredirection"></a>
-<h3>Port Redirection</h3>
-<p>You can use the console to add and remove port redirections while the emulator is running. After connecting to the console, you can manage port redirections in this way:</p>
+<h3 id="portredirection">Port Redirection</h3>
+
+<p>You can use the console to add and remove port redirection while the emulator is running. After
+you connect to the console, manage port redirection by entering the following command:</p>
+
<pre>redir <list|add|del> </pre>
<p>The <code>redir</code> command supports the subcommands listed in the table below. </p>
@@ -1225,14 +1107,14 @@
<th width="30%" >Description</th>
<th width="35%">Comments</th>
</tr>
-
+
<tr>
<td><code>list</code></td>
- <td>List the current port redirections.</td>
+ <td>List the current port redirection.</td>
<td> </td>
</tr>
-
+
<tr>
<td><code>add <protocol>:<host-port>:<guest-port></code></td>
<td>Add a new port redirection.</td>
@@ -1244,16 +1126,16 @@
<tr>
<td><code>del <protocol>:<host-port></code></td>
<td>Delete a port redirection.</td>
-<td>See above for meanings of <protocol> and <host-port>.</td>
+<td>The meanings of <protocol> and <host-port> are listed in the previous row.</td>
</tr>
</table>
-<a name="geo"></a>
-<h3>Geo Location Provider Emulation</h3>
-<p>The console provides commands to let you set the geo position used by an emulator emulated device.
-You can use the <code>geo</code> command to send a simple GPS fix to the emulator, without needing to
-use NMEA 1083 formatting. The usage for the command is:</p>
+<h3 id="geo">Geo Location Provider Emulation</h3>
+
+<p>You can use the console to set the geographic location reported to the applications running
+inside an emulator. Use the <code>geo</code> command to send a simple GPS fix to the
+emulator, with or without NMEA 1083 formatting:</p>
<pre>geo <fix|nmea></pre>
@@ -1261,11 +1143,11 @@
<table>
<tr>
- <th width="25%" >Subcommand
- <th width="30%" >Description</th>
+ <th width="25%">Subcommand</th>
+ <th width="30%">Description</th>
<th width="35%">Comments</th>
</tr>
-
+
<tr>
<td><code>fix <longitude> <latitude> [<altitude>]</code></td>
<td>Send a simple GPS fix to the emulator instance.</td>
@@ -1278,19 +1160,21 @@
</tr>
</table>
-<p>You can issue the <code>geo</code> command to fix the GPS location as soon as an emulator instance is running.
-The emulator creates a mock location provider that sends it to GPS-aware applications as soon as they start and
-register location listeners. Any application can query the location manager to obtain the current GPS fix for the
-emulated device by calling:
+<p>You can issue the <code>geo</code> command as soon as an emulator instance is running. The
+emulator sets the location you enter by creating a mock location provider. This provider responds to
+location listeners set by applications, and also supplies the location to the {@link
+android.location.LocationManager}. Any application can query the location manager to obtain the
+current GPS fix for the emulated device by calling:
<pre>LocationManager.getLastKnownLocation("gps")</pre>
-<p>For more information about the Location Manager, see {@link android.location.LocationManager} and its methods.</p>
+<p>For more information about the Location Manager, see {@link android.location.LocationManager}.
+</p>
-<a name="events"></a>
-<h3>Hardware Events Emulation</h3>
+<h3 id="events">Hardware Events Emulation</h3>
-<p>You can use the <code>event</code> command to send various events to the emulator.The usage for the command is: </p>
+<p>The {@code event} console commands sends hardware events to the emulator. The syntax for this
+command is as follows:</p>
<pre>event <send|types|codes|text></pre>
@@ -1302,7 +1186,7 @@
<th width="30%" >Description</th>
<th width="35%">Comments</th>
</tr>
-
+
<tr>
<td><code>send <type>:<code>:<value> [...]</code></td>
<td>Send one or more events to the Android kernel. </td>
@@ -1315,7 +1199,7 @@
</tr>
<tr>
<td><code>codes <type></code></td>
- <td>List all <code><codes></code> string aliases supported by the <code>event</code>
+ <td>List all <code><codes></code> string aliases supported by the <code>event</code>
subcommands for the specified <code><type></code>.</td>
<td> </td>
</tr>
@@ -1326,10 +1210,11 @@
</tr>
</table>
-<a name="power"></a>
-<h3>Device Power Characteristics</h3>
-<p>You can use the <code>power</code> command to control the simulated power state of the emulator instance.The usage for the command is: </p>
+<h3 id="power">Device Power Characteristics</h3>
+
+<p>The {@code power} command controls the power state reported by the emulator to applications. The
+syntax for this command is as follows: </p>
<pre>power <display|ac|status|present|health|capacity></pre>
@@ -1341,7 +1226,7 @@
<th width="30%" >Description</th>
<th width="35%">Comments</th>
</tr>
-
+
<tr>
<td><code>display</code></td>
<td>Display battery and charger state.</td>
@@ -1375,23 +1260,32 @@
</tr>
</table>
-<a name="netstatus"></a>
-<h3>Network Status</h3>
+
+<h3 id="netstatus">Network Status</h3>
<p>You can use the console to check the network status and current delay and speed characteristics. To do so, connect to the console and use the <code>netstatus</code> command. Here's an example of the command and its output. </p>
<pre>network status
</pre>
-<a name="netdelay"></a>
-<h3>Network Delay Emulation</h3>
-<p>The emulator lets you simulate various network latency levels, so that you can test your application in an environment more typical of the actual conditions in which it will run. You can set a latency level or range at emulator startup or you can use the console to change the latency dynamically, while the application is running in the emulator. </p>
-<p>To set latency at emulator startup, use the <code>-netdelay</code> emulator option with a supported <code><delay></code> value, as listed in the table below. Here are some examples:</p>
+<h3 id="netdelay">Network Delay Emulation</h3>
+
+<p>The emulator lets you simulate various network latency levels, so that you can test your
+application in an environment more typical of the actual conditions in which it will run. You can
+set a latency level or range at emulator startup or you can use the console to change the latency,
+while the application is running in the emulator. </p>
+
+<p>To set latency at emulator startup, use the <code>-netdelay</code> emulator option with a
+supported <code><delay></code> value, as listed in the table below. Here are some
+examples:</p>
+
<pre>emulator -netdelay gprs
emulator -netdelay 40 100</pre>
-<p>To make dynamic changes to network delay while the emulator is running, connect to the console and use the <code>netdelay</code> command with a supported <code><delay></code> value from the table below. </p>
+<p>To make changes to network delay while the emulator is running, connect to the console and use
+the <code>netdelay</code> command with a supported <code><delay></code> value from the table
+below.</p>
<pre>network delay gprs</pre>
@@ -1401,7 +1295,7 @@
<tr>
<th width="30%" >Value</th>
<th width="35%" >Description</th><th width="35%">Comments</th></tr>
-
+
<tr><td><code>gprs</code></td><td>GPRS</td>
<td>(min 150, max 550)</td>
</tr>
@@ -1421,19 +1315,22 @@
<td> </td></tr>
</table>
-<a name="netspeed"></a>
-<h3>Network Speed Emulation</h3>
-<p>The emulator also lets you simulate various network transfer rates.
-You can set a transfer rate or range at emulator startup or you can use the console to change the rate dynamically,
-while the application is running in the emulator.</p>
+<h3 id="netspeed">Network Speed Emulation</h3>
+
+<p>The emulator also lets you simulate various network transfer rates.
+You can set a transfer rate or range at emulator startup or you can use the console to change the
+rate, while the application is running in the emulator.</p>
<p>To set the network speed at emulator startup, use the <code>-netspeed</code> emulator option with a supported
<code><speed></code> value, as listed in the table below. Here are some examples:</p>
+
<pre>emulator -netspeed gsm
emulator -netspeed 14.4 80</pre>
-<p>To make dynamic changes to network speed while the emulator is running, connect to the console and use the <code>netspeed</code> command with a supported <code><speed></code> value from the table below. </p>
+<p>To make changes to network speed while the emulator is running, connect to the console and use
+the <code>netspeed</code> command with a supported <code><speed></code> value from the table
+below.</p>
<pre>network speed 14.4 80</pre>
@@ -1444,7 +1341,7 @@
<tr>
<th width="30%">Value</th>
<th width="35%">Description</th><th width="35%">Comments</th></tr>
-
+
<tr>
<td><code>gsm</code></td>
<td>GSM/CSD</td><td>(Up: 14.4, down: 14.4)</td></tr>
@@ -1476,14 +1373,19 @@
<td>Set exact rates for upload and download separately.</td><td></td></tr>
</table>
-<a name="telephony"></a>
-<h3>Telephony Emulation</h3>
+<h3 id="telephony">Telephony Emulation</h3>
-<p>The Android emulator includes its own GSM emulated modem that lets you simulate telephony functions in the emulator. For example, you can simulate inbound phone calls and establish/terminate data connections. The Android system handles simulated calls exactly as it would actual calls. The emulator does not support call audio in this release. </p>
-<p>You can use the console to access the emulator's telephony functions. After connecting to the console, you can use</p>
+<p>The Android emulator includes its own GSM emulated modem that lets you simulate telephony
+functions in the emulator. For example, you can simulate inbound phone calls, establish data
+connections and terminate them. The Android system handles simulated calls exactly as it would
+actual calls. The emulator does not support call audio.</p>
+
+<p>You can use the {@code gsm} command to access the emulator's telephony functions after connecting
+to the console. The syntax for this command is as follows:</p>
+
<pre>gsm <call|accept|busy|cancel|data|hold|list|voice|status> </pre>
-<p>to invoke telephony functions. </p>
+
<p>The <code>gsm</code> command supports the subcommands listed in the table below. </p>
<table>
<tr>
@@ -1559,11 +1461,12 @@
</tr>
</table>
-<a name="sms"></a>
-<h3>SMS Emulation</h3>
+<h3 id="sms">SMS Emulation</h3>
-<p>The Android emulator console lets you generate an SMS message and direct it to an emulator instance. Once you connect to an emulator instance, you can generate an emulated incoming SMS using this command:</p>
+<p>The Android emulator console lets you generate an SMS message and direct it to an emulator
+instance. Once you connect to an emulator instance, you can generate an emulated incoming SMS using
+the following command:</p>
<pre>sms send <senderPhoneNumber> <textmessage></pre>
@@ -1571,11 +1474,11 @@
<p>The console forwards the SMS message to the Android framework, which passes it through to an application that handles that message type. </p>
-<a name="vm"></a>
-<h3>VM State</h3>
+<h3 id="vm">VM State</h3>
-<p>You can use the <code>vm</code> command to control the VM on an emulator instance.The usage for the command is: </p>
+<p>You can use the <code>vm</code> command to control the VM on an emulator instance. The syntax for
+this command is as follows: </p>
<pre>vm <start|stop|status></pre>
@@ -1583,8 +1486,8 @@
<table>
<tr>
- <th width="25%" >Subcommand </th>
- <th width="30%" >Description</th>
+ <th width="25%">Subcommand</th>
+ <th width="30%">Description</th>
<th width="35%">Comments</th>
</tr>
<tr>
@@ -1605,11 +1508,10 @@
</table>
-<a name="window"></a>
+<h3 id="window">Emulator Window</h3>
-<h3>Emulator Window</h3>
-
-<p>You can use the <code>window</code> command to manage the emulator window. The usage for the command is: </p>
+<p>You can use the <code>window</code> command to manage the emulator window. The syntax for this
+command is as follows: </p>
<pre>window <scale></pre>
@@ -1617,158 +1519,53 @@
<table>
<tr>
- <th width="25%" >Subcommand
- <th width="30%" >Description</th>
+ <th width="25%">Subcommand</th>
+ <th width="30%">Description</th>
<th width="35%">Comments</th>
</tr>
<tr>
<td><code>scale <scale></code></td>
<td>Scale the emulator window.</td>
- <td><scale> must be a number between 0.1 and 3 that describes the desired scaling factor. You can
- also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto"
+ <td>A number between 0.1 and 3 that sets the scaling factor. You can
+ also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto"
tells the emulator to select the best window size.</td>
</tr>
</table>
-<a name="terminating"></a>
-
-<h3>Terminating an Emulator Instance</h3>
+<h3 id="terminating">Terminating an Emulator Instance</h3>
<p>You can terminate an emulator instance through the console, using the <code>kill</code> command.</p>
-<a name="skins"></a>
+<h2 id="limitations">Emulator Limitations</h2>
-<h2>Using Emulator Skins</h2>
-
-<p>The Android SDK includes several Emulator skins that you can use to control the resolution and density of the emulated device's screen. To select a specific skin for running the emulator, create an AVD that uses that skin. Please do not use deprecated emulator options such as <code>-skin</code> to control the skin used by an emulator instance. For more information about AVDs, see <a
-href="{@docRoot}guide/developing/devices/index.html">Managing Virtual Devices</a>.</p>
+<p>The functional limitations of the emulator include: </p>
+<ul>
+ <li>No support for placing or receiving actual phone calls. You can simulate phone calls (placed
+ and received) through the emulator console, however. </li>
+ <li>No support for USB connections</li>
+ <li>No support for device-attached headphones</li>
+ <li>No support for determining network connected state</li>
+ <li>No support for determining battery charge level and AC charging state</li>
+ <li>No support for determining SD card insert/eject</li>
+ <li>No support for Bluetooth</li>
+</ul>
-<a name="multipleinstances"></a>
+<h2 id="troubleshooting">Troubleshooting Emulator Problems</h2>
-<h2>Running Multiple Emulator Instances</h2>
+<p>The {@code adb} utility sees the emulator as an actual physical device. For this reason, you
+might have to use the {@code -d} flag with some common {@code adb} commands, such as
+<code>install</code>. The {@code -d} flag lets you specify which of several connected devices to use
+as the target of a command. If you don't specify {@code -d}, the emulator targets the first
+device in its list. For more information about {@code adb}, see <a
+href="{@docRoot}guide/developing/tools/adb.html">Android Debug Bridge</a>.</p>
-<p>Through the AVDs configurations used by the emulator, you can run multiple
-instances of the emulator concurrently, each with its own AVD configuration and
-storage area for user data, SD card, and so on. You no longer need to use the
-<code>-d</code> option when launching the emulator, to point to an
-instance-specific storage area. </p>
-
-<a name="apps"></a>
-
-<h2>Installing Applications on the Emulator</h2>
-
-<p>If you don't have access to Eclipse or the ADT Plugin, you can install
-your application on the emulator <a href="{@docRoot}guide/developing/tools/adb.html#move">using
-the adb utility</a>. Before installing the application, you need to build and package it
-into an <code>.apk</code> as described in <a href="{@docRoot}guide/developing/building/index.html">Building and
-Running Apps</a>. Once the application is installed, you can start the emulator from the command
-line, as described in this document, using any startup options necessary.
-When the emulator is running, you can also connect to the emulator instance's
-console to issue commands as needed.</p>
-
-<p>As you update your code, you periodically package and install it on the emulator.
-The emulator preserves the application and its state data across restarts,
-in a user-data disk partition. To ensure that the application runs properly
-as you update it, you may need to delete the emulator's user-data partition.
-To do so, start the emulator with the <code>-wipe-data</code> option.
-For more information about the user-data partition and other emulator storage,
-see <a href="#diskimages">Working with Emulator Disk Images</a>.</p>
-
-<a name="sdcard"></a>
-<a name="creating"></a>
-
-<h2>SD Card Emulation</h2>
-
-<p>You can create a disk image and then load it to the emulator at startup, to
-simulate the presence of a user's SD card in the device. To do this, you can use
-the android tool to create a new SD card image with a new AVD, or you can use
-the mksdcard utility included in the SDK. </p>
-
-<p>The sections below describe how to create an SD card disk image, how to copy
-files to it, and how to load it in the emulator at startup. </p>
-
-<p>Note that you can only load disk image at emulator startup. Similarly, you
-can not remove a simulated SD card from a running emulator. However, you can
-browse, send files to, and copy/remove files from a simulated SD card either
-with adb or the emulator. </p>
-
-<p>The emulator supports emulated SDHC cards, so you can create an SD card image
-of any size up to 128 gigabytes.</p>
-
-<h3 id="creatinga">Creating an SD card image using the android tool</h3>
-
-<p>The easiest way to create a new SD card is to use the android tool. When
-creating an AVD, you simply specify the <code>-c</code> option, like this: </p>
-
-<pre>android create avd -n <avd_name> -t <targetID> -c <size>[K|M]</pre>
-
-<p>You can also use the <code>-c</code> option to specify a path to an SD card
-image to use in the new AVD. For more information, see <a
-href="{@docRoot}guide/developing/devices/managing-avds-cmdline.html">Managing Virtual Devices
-from the Command Line</a>.
-</p>
-
-<h3 id="creatingm">Creating an SD card image using mksdcard</h3>
-
-<p>You can use the mksdcard tool, included in the SDK, to create a FAT32 disk
-image that you can load in the emulator at startup. You can access mksdcard in
-the tools/ directory of the SDK and create a disk image like this: </p>
-
-<pre>mksdcard <size> <file></pre>
-
-<p>For example:</p>
-
-<pre>mksdcard 1024M sdcard1.iso</pre>
-
-<p>For more information, see <a href="{@docRoot}guide/developing/tools/mksdcard.html"><code>mksdcard</code></a>.</p>
-
-<a name="copying"></a>
-<h3>Copying Files to a Disk Image</h3>
-
-<p>Once you have created the disk image, you can copy files to it prior to
-loading it in the emulator. To copy files, you can mount the image as a loop
-device and then copy the files to it, or you can use a utility such as mtools to
-copy the files directly to the image. The mtools package is available for Linux,
-Mac, and Windows.</p>
-
-<a name="loading"></a>
-<a name="step3" id="step3"></a>
-
-<h3>Loading the Disk Image at Emulator Startup</h3>
-
-<p>By default, the emulator loads the SD card image that is stored with the active
-AVD (see the <code>-avd</code> startup option).</p>
-
-<p>Alternatively, you ca start the emulator with the
-<code>-sdcard</code> flag and specify the name and path of your image (relative
-to the current working directory): </p>
-
-<pre>emulator -sdcard <filepath></pre>
-
-<a name="troubleshooting"></a>
-
-<h2>Troubleshooting Emulator Problems</h2>
-
-<p>The adb utility sees the emulator as an actual physical device. For this reason, you might have to use the -d flag with some common adb commands, such as <code>install</code>. The -d flag lets you specify which of several connected devices to use as the target of a command. If you don't specify -d, the emulator will target the first device in its list. For more information about adb, see <a href="{@docRoot}guide/developing/tools/adb.html">Android Debug Bridge</a>.</p>
-
-<p>For emulators running on Mac OS X, if you see an error "Warning: No DNS servers found" when starting the emulator, check to see whether you have an <code>/etc/resolv.conf</code> file. If not, please run the following line in a command window:</p>
+<p>For emulators running on Mac OS X, if you see an error {@code Warning: No DNS servers found}
+when starting the emulator, check to see whether you have an <code>/etc/resolv.conf</code> file. If
+not, please run the following line in a command window:</p>
<pre>ln -s /private/var/run/resolv.conf /etc/resolv.conf</pre>
-<p>See <a href="{@docRoot}resources/faq/index.html">Frequently Asked Questions</a> for more troubleshooting information. </p>
-
-<a name="limitations"></a>
- <h2>Emulator Limitations</h2>
- <p>In this release, the limitations of the emulator include: </p>
- <ul>
- <li>No support for placing or receiving actual phone calls. You can simulate phone calls (placed and received) through the emulator console, however. </li>
- <li>No support for USB connections</li>
- <li>No support for camera/video capture (input).</li>
- <li>No support for device-attached headphones</li>
- <li>No support for determining connected state</li>
- <li>No support for determining battery charge level and AC charging state</li>
- <li>No support for determining SD card insert/eject</li>
- <li>No support for Bluetooth</li>
- </ul>
+<p>See <a href="{@docRoot}resources/faq/index.html">Frequently Asked Questions</a> for more
+troubleshooting information. </p>
diff --git a/docs/html/guide/developing/tools/emulator.jd b/docs/html/guide/developing/tools/emulator.jd
index 09e41c3..21d4263 100644
--- a/docs/html/guide/developing/tools/emulator.jd
+++ b/docs/html/guide/developing/tools/emulator.jd
@@ -8,8 +8,8 @@
<h2>In this document</h2>
<ol>
- <li><a href="#startup-options">Emulator Startup Options</a></li>
- <li><a href="#KeyMapping">Emulator Keyboard Mapping</a></li>
+ <li><a href="#KeyMapping">Keyboard Commands</a></li>
+ <li><a href="#startup-options">Command Line Parameters</a></li>
</ol>
<h2>See also</h2>
@@ -22,461 +22,21 @@
</div>
-<p>The Android SDK includes a mobile device emulator — a virtual mobile device
+<p>The Android SDK includes a mobile device emulator — a virtual mobile device
that runs on your computer. The emulator lets you develop and test
Android applications without using a physical device.</p>
-<p>When the emulator is running, you can interact with the emulated mobile
-device just as you would an actual mobile device, except that you use your mouse
-pointer to "touch" the touchscreen and can use some keyboard keys to
-invoke certain keys on the device. </p>
-
-<p>This document is a reference to the available command line options and the keyboard mapping to device keys.
-For a complete guide to using the Android Emulator, see
+<p>This document is a reference to the available command line options and the keyboard mapping to
+device keys.
+For a complete guide to using the Android Emulator, see
<a href="{@docRoot}guide/developing/devices/emulator.html">Using the Android Emulator</a>.
-<h2 id="startup-options">Emulator Startup Options</h2>
+<h2 id="KeyMapping">Keyboard Commands</h2>
-<p>The emulator supports a variety of options that you can specify
-when launching the emulator, to control its appearance or behavior.
-Here's the command-line usage for launching the emulator with options: </p>
+<p>Table 1 summarizes the mappings between the emulator keys and the keys of your keyboard.</p>
-<pre>emulator -avd <avd_name> [-<option> [<value>]] ... [-<qemu args>]</pre>
-
-<p class="table-caption"><strong>Table 1.</strong>Emulator startup options</p>
-
-<table>
-<tr>
- <th width="10%" >Category</th>
- <th width="20%" >Option</th>
- <th width="30%" >Description</th>
- <th width="40%" >Comments</th>
-</tr>
-
-<tr>
- <td rowspan="9">Help</td>
- <td><code>-help</code></td>
- <td>Print a list of all emulator options.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-all</code></td>
- <td>Print help for all startup options.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-<option></code></td>
- <td>Print help for a specific startup option.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-debug-tags</code></td>
- <td>Print a list of all tags for <code>-debug <tags></code>.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-disk-images</code></td>
- <td>Print help for using emulator disk images.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-environment</code></td>
- <td>Print help for emulator environment variables.</td>
- <td> </td>
-</tr><tr>
- <td><code>-help-keys</code></td>
- <td>Print the current mapping of keys.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-keyset-file</code></td>
- <td>Print help for defining a custom key mappings file.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-help-virtual-device</code></td>
- <td>Print help for Android Virtual Device usage.</td>
- <td> </td>
-</tr>
-<tr>
- <td>AVD</td>
- <td><code>-avd <avd_name></code> or <br>
- <code>@<avd_name></code></td>
- <td><strong>Required</strong>. Specifies the AVD to load for this emulator
- instance.</td>
- <td>You must create an AVD configuration before launching the emulator. For
- information, see <a href="{@docRoot}guide/developing/devices/managing-avds.html#createavd">
- Managing AVDs with AVD Manager</a>.</td>
-<tr>
- <td rowspan="7">Disk Images</td>
- <td><code>-cache <filepath></code></td>
- <td>Use <filepath> as the working cache partition image. </td>
- <td>Optionally, you can specify a path relative to the current working directory.
- If no cache file is specified, the emulator's default behavior is to use a temporary file instead.
- <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td></tr>
-<tr>
- <td><code>-data <filepath></code></td>
- <td>Use <filepath> as the working user-data disk image. </td>
- <td>Optionally, you can specify a path relative to the current working directory.
- If <code>-data</code> is not used, the emulator looks for a file named "userdata-qemu.img"
- in the storage area of the AVD being used (see <code>-avd</code>).
-</td></tr>
-<!--
-<tr>
- <td><code>-datadir <dir></code></td>
- <td>Search for the user-data disk image specified in <code>-data</code> in <dir></td>
- <td><code><dir></code> is a path relative to the current working directory.
-
-<p>If you do not specify <code>-datadir</code>, the emulator looks for the user-data image
-in the storage area of the AVD being used (see <code>-avd</code>)</p><p>For more information
-on disk images, use <code>-help-disk-images</code>.</p>
-</td></tr>
--->
-<!--
-<tr>
- <td><code>-image <filepath></code></td>
- <td>Use <filepath> as the system image.</td>
- <td>Optionally, you can specify a path relative to the current working directory.
- Default is <system>/system.img.</td>
-</tr>
--->
-<tr>
- <td><code>-initdata <filepath></code></td>
- <td>When resetting the user-data image (through <code>-wipe-data</code>), copy the contents
- of this file to the new user-data disk image. By default, the emulator copies the <code><system>/userdata.img</code>.</td>
- <td>Optionally, you can specify a path relative to the current working directory. See also <code>-wipe-data</code>. <p>For more information on disk images, use <code>-help-disk-images</code>.</p></td>
-</tr>
-<!--
-<tr>
- <td><code>-kernel <filepath></code></td>
- <td>Use <filepath> as the emulated kernel.</td>
- <td>Optionally, you can specify a path relative to the current working directory. </td>
-</tr>
--->
-<tr>
- <td><code>-nocache</code></td>
- <td>Start the emulator without a cache partition.</td>
- <td>See also <code>-cache <file></code>.</td>
-</tr>
-<tr>
- <td><code>-ramdisk <filepath></code></td>
- <td>Use <filepath> as the ramdisk image.</td>
- <td>Default value is <code><system>/ramdisk.img</code>.
- <p>Optionally, you can specify a path relative to the current working directory. For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td>
-</tr>
-<tr>
- <td><code>-sdcard <filepath></code></td>
- <td>Use <file> as the SD card image.</td>
- <td>Default value is <code><system>/sdcard.img</code>.
- <p>Optionally, you can specify a path relative to the current working directory. For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td>
-</tr>
-<!--
-<tr>
- <td><code>-system <dirpath></code></td>
- <td>Search for system, ramdisk and user data images in <dir>.</td>
- <td><code><dir></code> is a directory path relative to the current
- working directory.</td>
-</tr>
--->
-<tr>
- <td><code>-wipe-data</code></td>
- <td>Reset the current user-data disk image (that is, the file specified by <code>-datadir</code> and
- <code>-data</code>, or the default file). The emulator deletes all data from the user data image file,
- then copies the contents of the file at <code>-inidata</code> data to the image file before starting.
- </td>
- <td>See also <code>-initdata</code>.
- <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
-</td>
-</tr>
-<tr>
- <td rowspan="9">Debug</td>
- <td><code>-debug <tags></code></td>
- <td>Enable/disable debug messages for the specified debug tags.</td>
- <td><code><tags></code> is a space/comma/column-separated list of debug component names.
- Use <code>-help-debug-tags</code> to print a list of debug component names that you can use. </td>
-</tr>
-<tr>
- <td><code>-debug-<tag></code></td>
- <td>Enable/disable debug messages for the specified debug tag.</td>
- <td rowspan="2">Use <code>-help-debug-tags</code> to print a list of debug component names that you can use in <code><tag></code>. </td>
-</tr>
-<tr>
- <td><code>-debug-no-<tag></code></td>
- <td>Disable debug messages for the specified debug tag.</td>
-</tr>
-<tr>
- <td><code>-logcat <logtags></code></td>
- <td>Enable logcat output with given tags.</td>
- <td>If the environment variable ANDROID_LOG_TAGS is defined and not
- empty, its value will be used to enable logcat output by default.</td>
-</tr>
-<tr>
- <td><code>-shell</code></td>
- <td>Create a root shell console on the current terminal.</td>
- <td>You can use this command even if the adb daemon in the emulated system is broken.
- Pressing Ctrl-c from the shell stops the emulator instead of the shell.</td>
-</tr>
-<tr>
- <td><code>-shell-serial <device></code></td>
- <td>Enable the root shell (as in <code>-shell</code> and specify the QEMU character
- device to use for communication with the shell.</td>
- <td><device> must be a QEMU device type. See the documentation for '-serial <em>dev</em>' at
- <a href="http://wiki.qemu.org/download/qemu-doc.html">wiki.qemu.org</a>
- for more information.</p>
-
-<p>Here are some examples: </p>
-<ul>
- <li><code>-shell-serial stdio</code> is identical to <code>-shell</code></li>
- <li><code>-shell-serial tcp::4444,server,nowait</code> lets you communicate with the shell over TCP port 4444</li>
- <li><code>-shell-serial fdpair:3:6</code> lets a parent process communicate with the shell using fds 3 (in) and 6 (out)</li>
- <li><code>-shell-serial fdpair:0:1</code> uses the normal stdin and stdout fds, except that QEMU won't tty-cook the data.</li>
- </ul>
-</td>
-</tr>
-<tr>
- <td><code>-show-kernel <name></code></td>
- <td>Display kernel messages.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-trace <name></code></td>
- <td>Enable code profiling (press F9 to start), written to a specified file.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-verbose</code></td>
- <td>Enable verbose output.</td>
- <td>Equivalent to <code>-debug-init</code>.
-<p>You can define the default verbose output options used by emulator instances in the Android environment variable
-ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, specifying only the stem of each option:
-<code>-debug-<tags>.</code> </p>
-<p>Here's an example showing ANDROID_VERBOSE defined with the <code>-debug-init</code> and <code>-debug-modem</code> options:
-<p><code>ANDROID_VERBOSE=init,modem</code></p>
-<p>For more information about debug tags, use <code><-help-debug-tags></code>.</p>
-</td>
-</tr>
-<tr>
- <td rowspan="6">Media</td>
- <td><code>-audio <backend></code></td>
- <td>Use the specified audio backend.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-audio-in <backend></code></td>
- <td>Use the specified audio-input backend.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-audio-out <backend></code></td>
- <td>Use the specified audio-output backend.</td>
- <td> </td>
-</tr>
-<!--<tr>
- <td><code>-mic <device or file></code></td>
- <td>Use device or WAV file for audio input.</td>
- <td> </td>
-</tr>
--->
-<tr>
- <td><code>-noaudio</code></td>
- <td>Disable audio support in the current emulator instance.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-radio <device></code></td>
- <td>Redirect radio modem interface to a host character device.</td>
- <td> </td></tr>
-<tr>
- <td><code>-useaudio</code></td>
- <td>Enable audio support in the current emulator instance.</td>
- <td>Enabled by default. </td>
-</tr>
-
-<tr>
- <td rowspan="7">Network</td>
- <td><code>-dns-server <servers></code></td>
- <td>Use the specified DNS server(s). </td>
- <td>The value of <code><servers></code> must be a comma-separated list of up to 4 DNS server names or
- IP addresses.</td>
-</tr>
-<tr>
- <td><code>-http-proxy <proxy></code></td>
- <td>Make all TCP connections through a specified HTTP/HTTPS proxy</td>
- <td>The value of <code><proxy></code> can be one of the following:<br>
- <code>http://<server>:<port></code><br>
- <code>http://<username>:<password>@<server>:<port></code>
- <p>The <code>http://</code> prefix can be omitted. If the <code>-http-proxy <proxy></code> command is not supplied,
- the emulator looks up the <code>http_proxy</code> environment variable and automatically uses any value matching
- the <code><proxy></code> format described above.</p></td>
-</tr>
-<tr>
- <td><code>-netdelay <delay></code></td>
- <td>Set network latency emulation to <delay>.</td>
- <td>Default value is <code>none</code>. See the table in <a href="#netdelay">Network Delay Emulation</a> for
- supported <code><delay></code> values. </td>
-</tr>
-<tr>
- <td><code>-netfast</code></td>
- <td>Shortcut for <code>-netspeed full -netdelay none</code></td>
- <td> </td></tr>
-<tr>
- <td><code>-netspeed <speed></code></td>
- <td>Set network speed emulation to <speed>.</td>
- <td>Default value is <code>full</code>. See the table in <a href="#netspeed">Network Speed Emulation</a> for
- supported <code><speed></code> values. </td>
-</tr>
-<tr>
- <td><code>-port <port></code></td>
- <td>Set the console port number for this emulator instance to <code><port></code>.</td>
- <td>The console port number must be an even integer between 5554 and 5584, inclusive. <code><port></code>+1
- must also be free and will be reserved for ADB.</td>
-</tr>
-<tr>
- <td><code>-report-console <socket></code></td>
- <td>Report the assigned console port for this emulator instance to a remote third party
- before starting the emulation. </td>
- <td><code><socket></code> must use one of these formats:
-
-<p><code>tcp:<port>[,server][,max=<seconds>]</code></br>
-<code>unix:<port>[,server][,max=<seconds>]</code></p>
-
-<p>Use <code>-help-report-console</code></p> to view more information about this topic. </td>
-</tr>
-<tr>
- <td rowspan="8">System</td>
- <td><code>-cpu-delay <delay></code></td>
- <td>Slow down emulated CPU speed by <delay> </td>
- <td>Supported values for <delay> are integers between 0 and 1000.
-
-<p>Note that the <delay> does not correlate to clock speed or other absolute metrics
-— it simply represents an abstract, relative delay factor applied non-deterministically
-in the emulator. Effective performance does not always
-scale in direct relationship with <delay> values.</p>
-</td>
-</tr>
-<tr>
- <td><code>-gps <device></code></td>
- <td>Redirect NMEA GPS to character device.</td>
- <td>Use this command to emulate an NMEA-compatible GPS unit connected to
- an external character device or socket. The format of <code><device></code> must be QEMU-specific
- serial device specification. See the documentation for 'serial -dev' at
- <a href="http://www.bellard.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a>.
-</td>
-</tr>
-<tr>
- <td><code>-nojni</code></td>
- <td>Disable JNI checks in the Dalvik runtime.</td><td> </td></tr>
-<tr>
- <td><code>-qemu</code></td>
- <td>Pass arguments to qemu.</td>
- <td> </td></tr>
-<tr>
- <td><code>-qemu -h</code></td>
- <td>Display qemu help.</td>
- <td></td></tr>
-<tr>
- <td><code>-radio <device></code></td>
- <td>Redirect radio mode to the specified character device.</td>
- <td>The format of <code><device></code> must be QEMU-specific
- serial device specification. See the documentation for 'serial -dev' at
-<a href="http://www.bellard.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a>.
-</td>
-</tr>
-<tr>
- <td><code>-timezone <timezone></code></td>
- <td>Set the timezone for the emulated device to <timezone>, instead of the host's timezone.</td>
- <td><code><timezone></code> must be specified in zoneinfo format. For example:
-<p>"America/Los_Angeles"<br>
-"Europe/Paris"</p>
-</td>
-</tr>
-<tr>
- <td><code>-version</code></td>
- <td>Display the emulator's version number.</td>
- <td> </td>
-</tr>
-<tr>
- <td rowspan="12">UI</td>
- <td><code>-dpi-device <dpi></code></td>
- <td>Scale the resolution of the emulator to match the screen size
- of a physical device.</td>
- <td>The default value is 165. See also <code>-scale</code>.</td>
-</tr>
-<tr>
- <td><code>-no-boot-anim</code></td>
- <td>Disable the boot animation during emulator startup.</td>
- <td>Disabling the boot animation can speed the startup time for the emulator.</td>
-</tr>
-<tr>
- <td><code>-no-window</code></td>
- <td>Disable the emulator's graphical window display.</td>
- <td> </td>
-</tr>
-<tr>
- <td><code>-scale <scale></code></td>
- <td>Scale the emulator window. </td>
- <td><code><scale></code> is a number between 0.1 and 3 that represents the desired scaling factor. You can
- also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto"
- tells the emulator to select the best window size.</td>
-</tr>
-<tr>
- <td><code>-raw-keys</code></td>
- <td>Disable Unicode keyboard reverse-mapping.</td>
- <td> </td></tr>
-<tr>
- <td><code>-noskin</code></td>
- <td>Don't use any emulator skin.</td>
- <td> </td></tr>
-<tr>
- <td><code>-keyset <file></code></td>
- <td>Use the specified keyset file instead of the default.</td>
- <td>The keyset file defines the list of key bindings between the emulator and the host keyboard.
- For more information, use <code>-help-keyset</code> to print information about this topic.
-</td>
-</tr>
-<tr>
- <td><code>-onion <image></code></td>
- <td>Use overlay image over screen.</td>
- <td>No support for JPEG. Only PNG is supported.</td></tr>
-<tr>
- <td><code>-onion-alpha <percent></code></td>
- <td>Specify onion skin translucency value (as percent).
- <td>Default is 50.</td>
-</tr>
-<tr>
- <td><code>-onion-rotation <position></code></td>
- <td>Specify onion skin rotation.
- <td><code><position></code> must be one of the values 0, 1, 2, 3.</td>
-</tr>
-<tr>
- <td><code>-skin <skinID></code></td>
- <td>This emulator option is deprecated. </td>
- <td>Please set skin options using AVDs, rather than by using this emulator
-option. Using this option may yield unexpected and in some cases misleading
-results, since the density with which to render the skin may not be defined.
-AVDs let you associate each skin with a default density and override the default
-as needed. For more information, see <a
-href="{@docRoot}guide/developing/devices/managing-avds.html#createavd">
-Managing Virtual Devices with AVD Manager</a>.
-</td>
-</tr>
-<tr>
- <td><code>-skindir <dir></code></td>
- <td>This emulator option is deprecated. </td>
- <td>See comments for <code>-skin</code>, above.</td></tr>
-</table>
-
-
-
-<h2 id="KeyMapping">Emulator Keyboard Mapping</h2>
-
-<p>The table below summarizes the mappings between the emulator keys and and
-the keys of your keyboard. </p>
-<p class="table-caption"><strong>Table 2.</strong> Emulator keyboard mapping</p>
+<p class="table-caption"><strong>Table 1.</strong> Emulator keyboard mapping</p>
<table border="0" style="clear:left;">
<tr>
<th>Emulated Device Key </th>
@@ -569,4 +129,453 @@
</tr>
</table>
-<p>Note that, to use keypad keys, you must first disable NumLock on your development computer. </p>
+
+<h2 id="startup-options">Command Line Parameters</h2>
+
+<p>The emulator supports a variety of options that you can specify
+when launching the emulator, to control its appearance or behavior.
+Here's the command-line syntax of the options available to the {@code emulator} program:</p>
+
+<pre>emulator -avd <avd_name> [-<option> [<value>]] ... [-<qemu args>]</pre>
+
+<p class="table-caption"><strong>Table 2.</strong> Emulator command line parameters</p>
+<table>
+<tr>
+ <th width="10%" >Category</th>
+ <th width="20%" >Option</th>
+ <th width="30%" >Description</th>
+ <th width="40%" >Comments</th>
+</tr>
+
+<tr>
+ <td>AVD</td>
+ <td><code>-avd <avd_name></code> or <br>
+ <code>@<avd_name></code></td>
+ <td><strong>Required</strong>. Specifies the AVD to load for this emulator
+ instance.</td>
+ <td>You must create an AVD configuration before launching the emulator. For
+ information, see <a href="{@docRoot}guide/developing/devices/managing-avds.html">Managing
+ AVDs with AVD Manager</a>.</td>
+<tr>
+ <td rowspan="7">Disk Images</td>
+ <td><code>-cache <filepath></code></td>
+ <td>Use <filepath> as the working cache partition image. </td>
+ <td>An absolute or relative path to the current working directory.
+ If no cache file is specified, the emulator's default behavior is to use a temporary file instead.
+ <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
+</td></tr>
+<tr>
+ <td><code>-data <filepath></code></td>
+ <td>Use {@code <filepath>} as the working user-data disk image. </td>
+ <td>Optionally, you can specify a path relative to the current working directory.
+ If <code>-data</code> is not used, the emulator looks for a file named {@code userdata-qemu.img}
+ in the storage area of the AVD being used (see <code>-avd</code>).
+</td></tr>
+<!--
+<tr>
+ <td><code>-datadir <dir></code></td>
+ <td>Search for the user-data disk image specified in <code>-data</code> in <dir></td>
+ <td><code><dir></code> is a path relative to the current working directory.
+
+<p>If you do not specify <code>-datadir</code>, the emulator looks for the user-data image
+in the storage area of the AVD being used (see <code>-avd</code>)</p><p>For more information
+on disk images, use <code>-help-disk-images</code>.</p>
+</td></tr>
+-->
+<!--
+<tr>
+ <td><code>-image <filepath></code></td>
+ <td>Use <filepath> as the system image.</td>
+ <td>Optionally, you can specify a path relative to the current working directory.
+ Default is <system>/system.img.</td>
+</tr>
+-->
+<tr>
+ <td><code>-initdata <filepath></code></td>
+ <td>When resetting the user-data image (through <code>-wipe-data</code>), copy the contents
+ of this file to the new user-data disk image. By default, the emulator copies the <code><system>/userdata.img</code>.</td>
+ <td>Optionally, you can specify a path relative to the current working directory. See also <code>-wipe-data</code>.
+ <p>For more information on disk images, use <code>-help-disk-images</code>.</p></td>
+</tr>
+<tr>
+ <td><code>-nocache</code></td>
+ <td>Start the emulator without a cache partition.</td>
+ <td>See also <code>-cache <file></code>.</td>
+</tr>
+<tr>
+ <td><code>-ramdisk <filepath></code></td>
+ <td>Use <filepath> as the ramdisk image.</td>
+ <td>Default value is <code><system>/ramdisk.img</code>.
+ <p>Optionally, you can specify a path relative to the current working directory.
+ For more information on disk images, use <code>-help-disk-images</code>.</p>
+</td>
+</tr>
+<tr>
+ <td><code>-sdcard <filepath></code></td>
+ <td>Use <file> as the SD card image.</td>
+ <td>Default value is <code><system>/sdcard.img</code>.
+ <p>Optionally, you can specify a path relative to the current working directory. For more information on disk images, use <code>-help-disk-images</code>.</p>
+</td>
+</tr>
+<!--
+<tr>
+ <td><code>-system <dirpath></code></td>
+ <td>Search for system, ramdisk and user data images in <dir>.</td>
+ <td><code><dir></code> is a directory path relative to the current
+ working directory.</td>
+</tr>
+-->
+<tr>
+ <td><code>-wipe-data</code></td>
+ <td>Reset the current user-data disk image (that is, the file specified by <code>-datadir</code> and
+ <code>-data</code>, or the default file). The emulator deletes all data from the user data image file,
+ then copies the contents of the file at <code>-inidata</code> data to the image file before starting.
+ </td>
+ <td>See also <code>-initdata</code>.
+ <p>For more information on disk images, use <code>-help-disk-images</code>.</p>
+</td>
+</tr>
+<tr>
+ <td rowspan="9">Debug</td>
+ <td><code>-debug <tags></code></td>
+ <td>Enable/disable debug messages for the specified debug tags.</td>
+ <td><code><tags></code> is a space/comma/column-separated list of debug component names.
+ Use <code>-help-debug-tags</code> to print a list of debug component names that you can use. </td>
+</tr>
+<tr>
+ <td><code>-debug-<tag></code></td>
+ <td>Enable/disable debug messages for the specified debug tag.</td>
+ <td rowspan="2">Use <code>-help-debug-tags</code> to print a list of debug component names that you can use in <code><tag></code>. </td>
+</tr>
+<tr>
+ <td><code>-debug-no-<tag></code></td>
+ <td>Disable debug messages for the specified debug tag.</td>
+</tr>
+<tr>
+ <td><code>-logcat <logtags></code></td>
+ <td>Enable logcat output with given tags.</td>
+ <td>If the environment variable ANDROID_LOG_TAGS is defined and not
+ empty, its value will be used to enable logcat output by default.</td>
+</tr>
+<tr>
+ <td><code>-shell</code></td>
+ <td>Create a root shell console on the current terminal.</td>
+ <td>You can use this command even if the adb daemon in the emulated system is broken.
+ Pressing Ctrl-c from the shell stops the emulator instead of the shell.</td>
+</tr>
+<tr>
+ <td><code>-shell-serial <device></code></td>
+ <td>Enable the root shell (as in <code>-shell</code> and specify the QEMU character
+ device to use for communication with the shell.</td>
+ <td><device> must be a QEMU device type. See the documentation for '-serial <em>dev</em>' at
+ <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>
+ for a list of device types.
+
+<p>Here are some examples: </p>
+<ul>
+ <li><code>-shell-serial stdio</code> is identical to <code>-shell</code></li>
+ <li><code>-shell-serial tcp::4444,server,nowait</code> lets you communicate with the shell over TCP port 4444</li>
+ <li><code>-shell-serial fdpair:3:6</code> lets a parent process communicate with the shell using fds 3 (in) and 6 (out)</li>
+ <li><code>-shell-serial fdpair:0:1</code> uses the normal stdin and stdout fds, except that QEMU won't tty-cook the data.</li>
+ </ul>
+</td>
+</tr>
+<tr>
+ <td><code>-show-kernel <name></code></td>
+ <td>Display kernel messages.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-trace <name></code></td>
+ <td>Enable code profiling (press F9 to start), written to a specified file.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-verbose</code></td>
+ <td>Enable verbose output.</td>
+ <td>Equivalent to <code>-debug-init</code>.
+<p>You can define the default verbose output options used by emulator instances in the Android environment variable
+ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, specifying only the stem of each option:
+<code>-debug-<tags>.</code> </p>
+<p>Here's an example showing ANDROID_VERBOSE defined with the <code>-debug-init</code> and <code>-debug-modem</code> options:
+<p><code>ANDROID_VERBOSE=init,modem</code></p>
+<p>For more information about debug tags, use <code><-help-debug-tags></code>.</p>
+</td>
+</tr>
+<tr>
+ <td rowspan="6">Media</td>
+ <td><code>-audio <backend></code></td>
+ <td>Use the specified audio backend.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-audio-in <backend></code></td>
+ <td>Use the specified audio-input backend.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-audio-out <backend></code></td>
+ <td>Use the specified audio-output backend.</td>
+ <td> </td>
+</tr>
+<!--<tr>
+ <td><code>-mic <device or file></code></td>
+ <td>Use device or WAV file for audio input.</td>
+ <td> </td>
+</tr>
+-->
+<tr>
+ <td><code>-noaudio</code></td>
+ <td>Disable audio support in the current emulator instance.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-radio <device></code></td>
+ <td>Redirect radio modem interface to a host character device.</td>
+ <td> </td></tr>
+<tr>
+ <td><code>-useaudio</code></td>
+ <td>Enable audio support in the current emulator instance.</td>
+ <td>Enabled by default. </td>
+</tr>
+
+<tr>
+ <td rowspan="7">Network</td>
+ <td><code>-dns-server <servers></code></td>
+ <td>Use the specified DNS server(s). </td>
+ <td>The value of <code><servers></code> must be a comma-separated list of up to 4 DNS server names or
+ IP addresses.</td>
+</tr>
+<tr>
+ <td><code>-http-proxy <proxy></code></td>
+ <td>Make all TCP connections through a specified HTTP/HTTPS proxy</td>
+ <td>The value of <code><proxy></code> can be one of the following:<br>
+ <code>http://<server>:<port></code><br>
+ <code>http://<username>:<password>@<server>:<port></code>
+ <p>The <code>http://</code> prefix can be omitted. If the <code>-http-proxy <proxy></code> command is not supplied,
+ the emulator looks up the <code>http_proxy</code> environment variable and automatically uses any value matching
+ the <code><proxy></code> format described above.</p></td>
+</tr>
+<tr>
+ <td><code>-netdelay <delay></code></td>
+ <td>Set network latency emulation to <delay>.</td>
+ <td>Default value is <code>none</code>. See the table in
+ <a href="{@docRoot}guide/developing/devices/emulator.html#netdelay">Network Delay Emulation</a>
+ for supported <code><delay></code> values. </td>
+</tr>
+<tr>
+ <td><code>-netfast</code></td>
+ <td>Shortcut for <code>-netspeed full -netdelay none</code></td>
+ <td> </td></tr>
+<tr>
+ <td><code>-netspeed <speed></code></td>
+ <td>Set network speed emulation to <speed>.</td>
+ <td>Default value is <code>full</code>. See the table in
+ <a href="{@docRoot}guide/developing/devices/emulator.html#netspeed">Network Speed Emulation</a> for
+ supported <code><speed></code> values. </td>
+</tr>
+<tr>
+ <td><code>-port <port></code></td>
+ <td>Set the console port number for this emulator instance to <code><port></code>.</td>
+ <td>The console port number must be an even integer between 5554 and 5584, inclusive. <code><port></code>+1
+ must also be free and will be reserved for ADB.</td>
+</tr>
+<tr>
+ <td><code>-report-console <socket></code></td>
+ <td>Report the assigned console port for this emulator instance to a remote third party
+ before starting the emulation. </td>
+ <td><code><socket></code> must use one of these formats:
+
+<p><code>tcp:<port>[,server][,max=<seconds>]</code></br>
+<code>unix:<port>[,server][,max=<seconds>]</code></p>
+
+<p>Use <code>-help-report-console</code></p> to view more information about this topic. </td>
+</tr>
+<tr>
+ <td rowspan="10">System</td>
+ <td><code>-cpu-delay <delay></code></td>
+ <td>Slow down emulated CPU speed by <delay> </td>
+ <td>Supported values for <delay> are integers between 0 and 1000.
+
+<p>Note that the <delay> does not correlate to clock speed or other absolute metrics
+— it simply represents an abstract, relative delay factor applied non-deterministically
+in the emulator. Effective performance does not always
+scale in direct relationship with <delay> values.</p>
+</td>
+</tr>
+<tr>
+ <td><code>-gps <device></code></td>
+ <td>Redirect NMEA GPS to character device.</td>
+ <td>Use this command to emulate an NMEA-compatible GPS unit connected to
+ an external character device or socket. The format of <code><device></code> must be QEMU-specific
+ serial device specification. See the documentation for 'serial -dev' at
+ <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>.
+</td>
+</tr>
+<tr>
+ <td><code>-nojni</code></td>
+ <td>Disable JNI checks in the Dalvik runtime.</td><td> </td></tr>
+<tr>
+ <td><code>-qemu</code></td>
+ <td>Pass arguments to the qemu emulator software.</td>
+ <td><p class="caution"><strong>Important:</strong> When using this option, make sure it is the
+ <em>last option</em> specified, since all options after it are interpretted as qemu-specific
+ options.</p></td></tr>
+<tr>
+ <td><code>-qemu -enable-kvm</code></td>
+ <td>Enable KVM acceleration of the emulator virtual machine.</td>
+ <td>This option is only effective when your system is set up to use
+ <a href="{@docRoot}guide/developing/devices/emulator.html#vm-linux">KVM-based VM acceleration</a>.
+ You can optionally specify a memory size ({@code -m <size>}) for the VM, which should match
+ your emulator's memory size:</p>
+ {@code -qemu -m 512 -enable-kvm}<br>
+ {@code -qemu -m 1024 -enable-kvm}
+ </td></tr>
+<tr>
+ <td><code>-qemu -h</code></td>
+ <td>Display qemu help.</td>
+ <td></td></tr>
+<tr>
+ <td><code>-gpu on</code></td>
+ <td>Turn on graphics acceleration for the emulator.</td>
+ <td>This option is only available for emulators using a system image with API Level 15, revision 3
+ and higher. For more information, see
+ <a href="{@docRoot}guide/developing/devices/emulator.html#accel-graphics">Using the Android
+ Emulator</a>.</td></tr>
+<tr>
+ <td><code>-radio <device></code></td>
+ <td>Redirect radio mode to the specified character device.</td>
+ <td>The format of <code><device></code> must be QEMU-specific
+ serial device specification. See the documentation for 'serial -dev' at
+<a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>.
+</td>
+</tr>
+<tr>
+ <td><code>-timezone <timezone></code></td>
+ <td>Set the timezone for the emulated device to <timezone>, instead of the host's timezone.</td>
+ <td><code><timezone></code> must be specified in zoneinfo format. For example:
+<p>"America/Los_Angeles"<br>
+"Europe/Paris"</p>
+</td>
+</tr>
+<tr>
+ <td><code>-version</code></td>
+ <td>Display the emulator's version number.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td rowspan="12">UI</td>
+ <td><code>-dpi-device <dpi></code></td>
+ <td>Scale the resolution of the emulator to match the screen size
+ of a physical device.</td>
+ <td>The default value is 165. See also <code>-scale</code>.</td>
+</tr>
+<tr>
+ <td><code>-no-boot-anim</code></td>
+ <td>Disable the boot animation during emulator startup.</td>
+ <td>Disabling the boot animation can speed the startup time for the emulator.</td>
+</tr>
+<tr>
+ <td><code>-no-window</code></td>
+ <td>Disable the emulator's graphical window display.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-scale <scale></code></td>
+ <td>Scale the emulator window. </td>
+ <td><code><scale></code> is a number between 0.1 and 3 that represents the desired scaling factor. You can
+ also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto"
+ tells the emulator to select the best window size.</td>
+</tr>
+<tr>
+ <td><code>-raw-keys</code></td>
+ <td>Disable Unicode keyboard reverse-mapping.</td>
+ <td> </td></tr>
+<tr>
+ <td><code>-noskin</code></td>
+ <td>Don't use any emulator skin.</td>
+ <td> </td></tr>
+<tr>
+ <td><code>-keyset <file></code></td>
+ <td>Use the specified keyset file instead of the default.</td>
+ <td>The keyset file defines the list of key bindings between the emulator and the host keyboard.
+ For more information, use <code>-help-keyset</code> to print information about this topic.
+</td>
+</tr>
+<tr>
+ <td><code>-onion <image></code></td>
+ <td>Use overlay image over screen.</td>
+ <td>No support for JPEG. Only PNG is supported.</td></tr>
+<tr>
+ <td><code>-onion-alpha <percent></code></td>
+ <td>Specify onion skin translucency value (as percent).
+ <td>Default is 50.</td>
+</tr>
+<tr>
+ <td><code>-onion-rotation <position></code></td>
+ <td>Specify onion skin rotation.
+ <td><code><position></code> must be one of the values 0, 1, 2, 3.</td>
+</tr>
+<tr>
+ <td><code>-skin <skinID></code></td>
+ <td>This emulator option is deprecated. </td>
+ <td>Please set skin options using AVDs, rather than by using this emulator
+option. Using this option may yield unexpected and in some cases misleading
+results, since the density with which to render the skin may not be defined.
+AVDs let you associate each skin with a default density and override the default
+as needed. For more information, see <a
+href="{@docRoot}guide/developing/devices/managing-avds.html">Managing Virtual Devices
+with AVD Manager</a>.
+</td>
+</tr>
+<tr>
+ <td><code>-skindir <dir></code></td>
+ <td>This emulator option is deprecated. </td>
+ <td>See comments for <code>-skin</code>, above.</td>
+</tr>
+<tr>
+ <td rowspan="9">Help</td>
+ <td><code>-help</code></td>
+ <td>Print a list of all emulator options.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-help-all</code></td>
+ <td>Print help for all startup options.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-help-<option></code></td>
+ <td>Print help for a specific startup option.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-help-debug-tags</code></td>
+ <td>Print a list of all tags for <code>-debug <tags></code>.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-help-disk-images</code></td>
+ <td>Print help for using emulator disk images.</td>
+ <td> </td>
+ </tr>
+<tr>
+ <td><code>-help-environment</code></td>
+ <td>Print help for emulator environment variables.</td>
+ <td> </td>s
+</tr><tr>
+ <td><code>-help-keys</code></td>
+ <td>Print the current mapping of keys.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-help-keyset-file</code></td>
+ <td>Print help for defining a custom key mappings file.</td>
+ <td> </td>
+</tr>
+<tr>
+ <td><code>-help-virtual-device</code></td>
+ <td>Print help for Android Virtual Device usage.</td>
+ <td> </td>
+</tr>
+</table>
diff --git a/docs/html/guide/developing/tools/monkeyrunner_concepts.jd b/docs/html/guide/developing/tools/monkeyrunner_concepts.jd
index 499b610..346a0c6 100644
--- a/docs/html/guide/developing/tools/monkeyrunner_concepts.jd
+++ b/docs/html/guide/developing/tools/monkeyrunner_concepts.jd
@@ -236,7 +236,7 @@
You can generate an API reference for monkeyrunner by running:
</p>
<pre>
-monkeyrunner <format> help.py <outfile>
+monkeyrunner help.py <format> <outfile>
</pre>
<p>
The arguments are:
diff --git a/docs/html/guide/market/expansion-files.jd b/docs/html/guide/market/expansion-files.jd
index 01acb33..36b8f9c 100644
--- a/docs/html/guide/market/expansion-files.jd
+++ b/docs/html/guide/market/expansion-files.jd
@@ -1088,12 +1088,8 @@
<dd>Most applications don't need to use this class. This class defines a {@link
android.content.ContentProvider} that marshals the data from the ZIP files through a content
provider {@link android.net.Uri} in order to provide file access for certain Android APIs that
-expect {@link android.net.Uri} access to media files.
- <p>The sample application available in the
-Apk Expansion package demonstrates a scenario in which this class is useful
-to specify a video with {@link android.widget.VideoView#setVideoURI
-VideoView.setVideoURI()}. See the sample app's class {@code SampleZipfileProvider} for an
-example of how to extend this class to use in your application.</p></dd>
+expect {@link android.net.Uri} access to media files. For example, this is useful if you want to
+play a video with {@link android.widget.VideoView#setVideoURI VideoView.setVideoURI()}.</p></dd>
</dl>
<h4>Reading from a ZIP file</h4>
diff --git a/docs/html/guide/market/licensing/setting-up.jd b/docs/html/guide/market/licensing/setting-up.jd
index 15214d1..41e3bc4 100644
--- a/docs/html/guide/market/licensing/setting-up.jd
+++ b/docs/html/guide/market/licensing/setting-up.jd
@@ -177,12 +177,6 @@
<strong>Google APIs Add-On, API 8 (release 2) or higher</strong> includes the necessary Google
Play services.</p>
-
-<img src="{@docRoot}images/licensing_gapis_8.png" alt=""/>
-<p class="img-caption"><strong>Figure 2.</strong> Google APIs
-Add-On, API 8 (release 2) or higher lets you debug and test your licensing
-implementation in an emulator.</p>
-
<p>To set up an emulator for adding licensing to an application, follow
these steps: </p>
@@ -190,7 +184,7 @@
<li>Launch the Android SDK Manager. </li>
<li>In the <strong>Available Packages</strong> panel, select and download the
SDK component "Google APIs (Google Inc.) - API Level 8" (or higher) from the SDK
-repository, as shown in figure 2.
+repository.
<p>When the download is complete, use the Android SDK Manager to
create a new AVD based on that component, described next.</p></li>
<li>In the <strong>Virtual
@@ -256,11 +250,11 @@
<p>To download the LVL component into your development environment, use the
Android SDK Manager. Launch the Android SDK Manager and then
-select the "Google Market Licensing" component, as shown in figure 3.
+select the "Google Market Licensing" component, as shown in figure 2.
Accept the terms and click <strong>Install Selected</strong> to begin the download. </p>
<img src="{@docRoot}images/licensing_package.png" alt=""/>
-<p class="img-caption"><strong>Figure 3.</strong> The Licensing package contains the LVL and
+<p class="img-caption"><strong>Figure 2.</strong> The Licensing package contains the LVL and
the LVL sample application.</p>
<p>When the download is complete, the Android SDK Manager installs both
@@ -390,7 +384,7 @@
<img src="{@docRoot}images/licensing_add_library.png" alt=""/>
-<p class="img-caption"><strong>Figure 4.</strong> If you are
+<p class="img-caption"><strong>Figure 3.</strong> If you are
working in Eclipse with ADT, you can add the LVL library project to your
application from the application's project properties.</p>
@@ -494,7 +488,7 @@
href="{@docRoot}guide/market/licensing/licensing-reference.html">Licensing Reference</a>.</p>
<img src="{@docRoot}images/licensing_test_response.png" alt=""/>
-<p class="img-caption"><strong>Figure 5.</strong> The Licensing
+<p class="img-caption"><strong>Figure 4.</strong> The Licensing
panel of your account's Edit Profile page, showing the Test Accounts field and the
Test Response menu.</p>
@@ -586,7 +580,7 @@
<h4 id="reg-test-acct">Registering test accounts on the publisher account</h4>
<p>To get started, you need to register each test account in your publisher
-account. As shown in Figure 5, you
+account. As shown in Figure 4, you
register test accounts in the Licensing panel of your publisher account's Edit
Profile page. Simply enter the accounts as a comma-delimited list and click
<strong>Save</strong> to save your profile changes.</p>
diff --git a/docs/html/guide/topics/fundamentals/tasks-and-back-stack.jd b/docs/html/guide/topics/fundamentals/tasks-and-back-stack.jd
index 465cf54..0880614 100644
--- a/docs/html/guide/topics/fundamentals/tasks-and-back-stack.jd
+++ b/docs/html/guide/topics/fundamentals/tasks-and-back-stack.jd
@@ -154,7 +154,7 @@
<p>Because the activities in the back stack are never rearranged, if your application allows
users to start a particular activity from more than one activity, a new instance of
-that activity is created and popped onto the stack (rather than bringing any previous instance of
+that activity is created and pushed onto the stack (rather than bringing any previous instance of
the activity to the top). As such, one activity in your application might be instantiated multiple
times (even from different tasks), as shown in figure 3. As such, if the user navigates backward
using the <em>Back</em> button, each instance of the activity is revealed in the order they were
@@ -291,7 +291,7 @@
should associate with a task, then Activity A's request (as defined in the intent) is honored
over Activity B's request (as defined in its manifest).</p>
-<p class="note"><strong>Note:</strong> Some the launch modes available in the manifest
+<p class="note"><strong>Note:</strong> Some launch modes available for the manifest file
are not available as flags for an intent and, likewise, some launch modes available as flags
for an intent cannot be defined in the manifest.</p>
diff --git a/docs/html/guide/topics/manifest/manifest-element.jd b/docs/html/guide/topics/manifest/manifest-element.jd
index 9788945..98968d7 100644
--- a/docs/html/guide/topics/manifest/manifest-element.jd
+++ b/docs/html/guide/topics/manifest/manifest-element.jd
@@ -37,7 +37,7 @@
<dt>description:</dt>
<dd>The root element of the AndroidManifest.xml file. It must
contain an <code><a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a></code> element
-and specify {@code xlmns:android} and {@code package} attributes.</dd>
+and specify {@code xmlns:android} and {@code package} attributes.</dd>
<dt>attributes:</dt>
<dd>
diff --git a/docs/html/guide/topics/providers/content-provider-basics.jd b/docs/html/guide/topics/providers/content-provider-basics.jd
index 40b5c3f..de89568 100644
--- a/docs/html/guide/topics/providers/content-provider-basics.jd
+++ b/docs/html/guide/topics/providers/content-provider-basics.jd
@@ -123,7 +123,7 @@
<!-- Intro paragraphs -->
<p>
- A content provider manages access to a central repository of data. The provider and
+ A content provider manages access to a central repository of data. A provider
is part of an Android application, which often provides its own UI for working with
the data. However, content providers are primarily intended to be used by other
applications, which access the provider using a provider client object. Together, providers
@@ -569,7 +569,7 @@
</pre>
<p>
A selection clause that uses <code>?</code> as a replaceable parameter and an array of
- selection arguments array are preferred way to specify a selection, even the provider isn't
+ selection arguments array are preferred way to specify a selection, even if the provider isn't
based on an SQL database.
</p>
<!-- Displaying the results -->
diff --git a/docs/html/guide/topics/resources/providing-resources.jd b/docs/html/guide/topics/resources/providing-resources.jd
index 380791a..b33a097 100644
--- a/docs/html/guide/topics/resources/providing-resources.jd
+++ b/docs/html/guide/topics/resources/providing-resources.jd
@@ -287,9 +287,8 @@
from the SIM card in the device. For example, <code>mcc310</code> is U.S. on any carrier,
<code>mcc310-mnc004</code> is U.S. on Verizon, and <code>mcc208-mnc00</code> is France on
Orange.</p>
- <p>If the device uses a radio connection (GSM phone), the MCC comes
- from the SIM, and the MNC comes from the network to which the
- device is connected.</p>
+ <p>If the device uses a radio connection (GSM phone), the MCC and MNC values come
+ from the SIM card.</p>
<p>You can also use the MCC alone (for example, to include country-specific legal
resources in your application). If you need to specify based on the language only, then use the
<em>language and region</em> qualifier instead (discussed next). If you decide to use the MCC and
diff --git a/docs/html/guide/topics/resources/string-resource.jd b/docs/html/guide/topics/resources/string-resource.jd
index ecd2d48..5f5484e 100644
--- a/docs/html/guide/topics/resources/string-resource.jd
+++ b/docs/html/guide/topics/resources/string-resource.jd
@@ -358,11 +358,14 @@
<pre>
int count = getNumberOfsongsAvailable();
Resources res = {@link android.content.Context#getResources()};
-String songsFound = res.{@link android.content.res.Resources#getQuantityString(int,int)
-getQuantityString}(R.plurals.numberOfSongsAvailable, count, count);
+String songsFound = res.<a
+href="{@docRoot}reference/android/content/res/Resources.html#getQuantityString(int, int, java.lang.Object...)"
+>getQuantityString</a>(R.plurals.numberOfSongsAvailable, count, count);
</pre>
-<p>When using the {@link android.content.res.Resources#getQuantityString(int,int)
-getQuantityString()} method, you need to pass the {@code count} twice if your string includes
+
+<p>When using the <a
+href="{@docRoot}reference/android/content/res/Resources.html#getQuantityString(int, int, java.lang.Object...)">{@code
+getQuantityString()}</a> method, you need to pass the {@code count} twice if your string includes
<a href="#FormattingAndStyling">string formatting</a> with a number. For example, for the string
{@code %d songs found}, the first {@code count} parameter selects the appropriate plural string and
the second {@code count} parameter is inserted into the {@code %d} placeholder. If your plural
diff --git a/docs/html/guide/topics/sensors/index.jd b/docs/html/guide/topics/sensors/index.jd
index 75a1716..43903dc 100644
--- a/docs/html/guide/topics/sensors/index.jd
+++ b/docs/html/guide/topics/sensors/index.jd
@@ -43,7 +43,7 @@
application might use the geomagnetic field sensor and accelerometer to report a compass
bearing.</p>
-<p>The Android platform supports four broad categories of sensors:</p>
+<p>The Android platform supports three broad categories of sensors:</p>
<ul>
<li>Motion sensors
diff --git a/docs/html/guide/topics/ui/layout-objects.jd b/docs/html/guide/topics/ui/layout-objects.jd
index 8b2792d..e251fe9 100644
--- a/docs/html/guide/topics/ui/layout-objects.jd
+++ b/docs/html/guide/topics/ui/layout-objects.jd
@@ -163,7 +163,7 @@
<td>
<pre>
<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/blue"
diff --git a/docs/html/guide/topics/wireless/wifip2p.jd b/docs/html/guide/topics/wireless/wifip2p.jd
index 4dd3d26..ec8e71e 100644
--- a/docs/html/guide/topics/wireless/wifip2p.jd
+++ b/docs/html/guide/topics/wireless/wifip2p.jd
@@ -333,7 +333,7 @@
...
mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
mChannel = mManager.initialize(this, getMainLooper(), null);
- Receiver = new WiFiDirectBroadcastReceiver(manager, channel, this);
+ mReceiver = new WiFiDirectBroadcastReceiver(manager, channel, this);
...
}
</pre>
@@ -364,13 +364,13 @@
@Override
protected void onResume() {
super.onResume();
- registerReceiver(receiver, intentFilter);
+ registerReceiver(mReceiver, mIntentFilter);
}
/* unregister the broadcast receiver */
@Override
protected void onPause() {
super.onPause();
- unregisterReceiver(receiver);
+ unregisterReceiver(mReceiver);
}
</pre>
diff --git a/docs/html/images/avd-manager.png b/docs/html/images/avd-manager.png
index c33d8a8..fd373f9 100644
--- a/docs/html/images/avd-manager.png
+++ b/docs/html/images/avd-manager.png
Binary files differ
diff --git a/docs/html/images/billing_package.png b/docs/html/images/billing_package.png
index 951e117..6e673c8 100644
--- a/docs/html/images/billing_package.png
+++ b/docs/html/images/billing_package.png
Binary files differ
diff --git a/docs/html/images/developing/avd-dialog.png b/docs/html/images/developing/avd-dialog.png
index d0e2eec..9dfbd68 100644
--- a/docs/html/images/developing/avd-dialog.png
+++ b/docs/html/images/developing/avd-dialog.png
Binary files differ
diff --git a/docs/html/images/developing/ddms-network.png b/docs/html/images/developing/ddms-network.png
new file mode 100644
index 0000000..5aa1290
--- /dev/null
+++ b/docs/html/images/developing/ddms-network.png
Binary files differ
diff --git a/docs/html/images/developing/sdk-usb-driver.png b/docs/html/images/developing/sdk-usb-driver.png
index 207d3d7..3489991 100644
--- a/docs/html/images/developing/sdk-usb-driver.png
+++ b/docs/html/images/developing/sdk-usb-driver.png
Binary files differ
diff --git a/docs/html/images/emulator-wvga800l.png b/docs/html/images/emulator-wvga800l.png
index a214033..c92c1b9 100644
--- a/docs/html/images/emulator-wvga800l.png
+++ b/docs/html/images/emulator-wvga800l.png
Binary files differ
diff --git a/docs/html/images/licensing_add_library.png b/docs/html/images/licensing_add_library.png
index 3bbe6d5..257a628 100644
--- a/docs/html/images/licensing_add_library.png
+++ b/docs/html/images/licensing_add_library.png
Binary files differ
diff --git a/docs/html/images/licensing_gapis_8.png b/docs/html/images/licensing_gapis_8.png
deleted file mode 100644
index 480d989..0000000
--- a/docs/html/images/licensing_gapis_8.png
+++ /dev/null
Binary files differ
diff --git a/docs/html/images/licensing_package.png b/docs/html/images/licensing_package.png
index eb2c5cf..dc34473 100644
--- a/docs/html/images/licensing_package.png
+++ b/docs/html/images/licensing_package.png
Binary files differ
diff --git a/docs/html/images/sdk_manager_packages.png b/docs/html/images/sdk_manager_packages.png
index 19a7cb9..a0e8108 100644
--- a/docs/html/images/sdk_manager_packages.png
+++ b/docs/html/images/sdk_manager_packages.png
Binary files differ
diff --git a/docs/html/index.jd b/docs/html/index.jd
index cfd9ff1..787a655 100644
--- a/docs/html/index.jd
+++ b/docs/html/index.jd
@@ -12,10 +12,8 @@
</div><!-- end homeTitle -->
<div id="announcement-block">
<!-- total max width is 520px -->
- <a href="{@docRoot}design/index.html">
<img src="{@docRoot}images/home/play_logo.png"
alt="Google Play" width="120px" style="padding:10px 52px"/>
- </a>
<div id="announcement" style="width:275px">
<p>Introducing <strong>Google Play</strong>: An integrated digital content destination where
users buy and enjoy all of their favorite content in one place. It's the new destination for
diff --git a/docs/html/resources/resources_toc.cs b/docs/html/resources/resources_toc.cs
index 8483037..e1a5e0f 100644
--- a/docs/html/resources/resources_toc.cs
+++ b/docs/html/resources/resources_toc.cs
@@ -99,6 +99,27 @@
</li>
<li class="toggle-list">
+ <div><a href="<?cs var:toroot ?>training/search/index.html">
+ <span class="en">Adding Search Functionality</span>
+ </a> <span class="new">new!</span>
+ </div>
+ <ul>
+ <li><a href="<?cs var:toroot ?>training/search/setup.html">
+ <span class="en">Setting up the Search Interface</span>
+ </a>
+ </li>
+ <li><a href="<?cs var:toroot ?>training/search/search.html">
+ <span class="en">Storing and Searching for Data</span>
+ </a>
+ </li>
+ <li><a href="<?cs var:toroot ?>training/search/backward-compat.html">
+ <span class="en">Remaining Backward Compatible</span>
+ </a>
+ </li>
+ </ul>
+ </li>
+
+ <li class="toggle-list">
<div><a href="<?cs var:toroot ?>training/id-auth/index.html">
<span class="en">Remembering Users</span>
</a></div>
diff --git a/docs/html/resources/tutorials/views/hello-webview.jd b/docs/html/resources/tutorials/views/hello-webview.jd
index 2d07647..f6a6a71 100644
--- a/docs/html/resources/tutorials/views/hello-webview.jd
+++ b/docs/html/resources/tutorials/views/hello-webview.jd
@@ -52,7 +52,7 @@
<li>While you're in the manifest, give some more space for web pages by removing the title
bar, with the "NoTitleBar" theme:
<pre>
-<activity android:name=".HelloGoogleMaps" android:label="@string/app_name"
+<activity android:name=".HelloWebView" android:label="@string/app_name"
<strong>android:theme="@android:style/Theme.NoTitleBar"</strong>>
</pre>
</li>
diff --git a/docs/html/sdk/android-4.0-highlights.jd b/docs/html/sdk/android-4.0-highlights.jd
index 50e9a14..98f467d 100644
--- a/docs/html/sdk/android-4.0-highlights.jd
+++ b/docs/html/sdk/android-4.0-highlights.jd
@@ -343,7 +343,7 @@
<p>The Camera app includes many new features that let users capture special moments
with great photos and videos. After capturing images, they can edit and share
-them easily with friemds. </p>
+them easily with friends. </p>
<p>When taking pictures, <strong>continuous focus</strong>, <strong>zero shutter
lag exposure</strong>, and decreased shot-to-shot speed help capture clear,
diff --git a/docs/html/sdk/android-4.0.3.jd b/docs/html/sdk/android-4.0.3.jd
index 809c83c..c8563ac 100644
--- a/docs/html/sdk/android-4.0.3.jd
+++ b/docs/html/sdk/android-4.0.3.jd
@@ -68,15 +68,16 @@
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-opened.png"
class="toggle-content-img" alt="" />
- Android {@sdkPlatformVersion}, Revision 2</a> <em>(January 2012)</em>
+ Revision 2</a> <em>(January 2012)</em>
</a></p>
<div class="toggle-content-toggleme" style="padding-left:2em;">
-<dl>
-<dt>Maintenance release. SDK Tools r14 or higher is required.
-</dt>
-</dl>
+ <p>Maintenance update. The system version is 4.0.3.</p>
+ <dl>
+ <dt>Dependencies:</dt>
+ <dd>SDK Tools r14 or higher is required.</dd>
+ </dl>
</div>
</div>
@@ -86,15 +87,16 @@
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-closed.png"
class="toggle-content-img" alt="" />
- Android {@sdkPlatformVersion}, Revision 1</a> <em>(December 2011)</em>
+ Revision 1</a> <em>(December 2011)</em>
</a></p>
<div class="toggle-content-toggleme" style="padding-left:2em;">
-<dl>
-<dt>Initial release. SDK Tools r14 or higher is required.
-</dt>
-</dl>
+ <p>Initial release. The system version is 4.0.3.</p>
+ <dl>
+ <dt>Dependencies:</dt>
+ <dd>SDK Tools r14 or higher is required.</dd>
+ </dl>
</div>
</div>
diff --git a/docs/html/sdk/compatibility-library.jd b/docs/html/sdk/compatibility-library.jd
index df71552..30d807f 100644
--- a/docs/html/sdk/compatibility-library.jd
+++ b/docs/html/sdk/compatibility-library.jd
@@ -46,11 +46,40 @@
<p>The sections below provide notes about successive releases of
the Support Package, as denoted by revision number.</p>
-
<div class="toggle-content open">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img" />
+ Support Package, revision 7 (March 2012)
+ </a></p>
+
+ <div class="toggle-content-toggleme" style="padding-left:2em">
+ <dl>
+ <dt>Changes for v4 support library:</dt>
+ <dd>
+ <ul>
+ <li>Added {@link android.support.v4.app.ShareCompat}, which provides helper classes
+for sending and receiving content for social sharing applications, including new metadata for
+attributing shared data to the source app. This class also provides compatible integration with the
+new {@link android.widget.ShareActionProvider} in Android 4.0.</li>
+ <li>Added {@link android.support.v4.app.NavUtils} and {@link
+android.support.v4.app.TaskStackBuilder} to provide support for implementing the
+<a href="{@docRoot}design/index.html">Android Design</a> guidelines for navigation. These
+additions include a way to implement the action bar's <em>Up</em> button across versions.
+For an example implementation of this pattern, see the AppNavigation sample in
+({@code <em><sdk></em>/samples/<em><platform></em>/AppNavigation}).</li>
+ <li>Added {@link android.support.v4.app.NotificationCompat.Builder} to provide a
+compatibility implementation of Android 3.0's {@link android.app.Notification.Builder} helper class
+for creating standardized system notifications.</li>
+ </ul>
+ </dd>
+ </dl>
+ </div>
+
+<div class="toggle-content closed">
+
+ <p><a href="#" onclick="return toggleContent(this)">
+ <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" />
Support Package, revision 6 (December 2011)
</a></p>
diff --git a/docs/html/sdk/eclipse-adt.jd b/docs/html/sdk/eclipse-adt.jd
index 30825ee..3019544 100644
--- a/docs/html/sdk/eclipse-adt.jd
+++ b/docs/html/sdk/eclipse-adt.jd
@@ -1,8 +1,8 @@
page.title=ADT Plugin for Eclipse
-adt.zip.version=16.0.1
-adt.zip.download=ADT-16.0.1.zip
-adt.zip.bytes=7000078
-adt.zip.checksum=03a2a23650ddac128c8b9e8aaf0aa433
+adt.zip.version=17.0.0
+adt.zip.download=ADT-17.0.0.zip
+adt.zip.bytes=12836115
+adt.zip.checksum=ecb12c07e534997cd32c66d57f21b770
@jd:body
@@ -108,11 +108,111 @@
}
</style>
-
<div class="toggleable opened">
<a href="#" onclick="return toggleDiv(this)">
<img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px"
width="9px" />
+ADT 17.0.0</a> <em>(March 2012)</em>
+ <div class="toggleme">
+<dl>
+ <dt>Dependencies:</dt>
+
+ <dd>
+ <ul>
+ <li>Java 1.6 or higher is required for ADT 17.0.0.</li>
+ <li>Eclipse Helios (Version 3.6.2) or higher is required for ADT 17.0.0.</li>
+ <li>ADT 17.0.0 is designed for use with <a href="{@docRoot}sdk/tools-notes.html">SDK Tools
+ r17</a>. If you haven't already installed SDK Tools r17 into your SDK, use the Android SDK
+ Manager to do so.</li>
+ </ul>
+ </dd>
+
+ <dt>General improvements:</dt>
+ <dd>
+ <ul>
+ <li>New build features
+ <ul>
+ <li>Added feature to automatically setup JAR dependencies. Any {@code .jar} files in the
+ {@code /libs} folder are added to the build configuration (similar to how the Ant build
+ system works). Also, {@code .jar} files needed by library projects are also automatically
+ added to projects that depend on those library projects.
+ (<a href="http://tools.android.com/recent/dealingwithdependenciesinandroidprojects">more
+ info</a>)</li>
+ <li>Added a feature that allows you to run some code only in debug mode. Builds now
+generate a class called {@code BuildConfig} containing a {@code DEBUG} constant that is
+automatically set according to your build type. You can check the ({@code BuildConfig.DEBUG})
+constant in your code to run debug-only functions.</li>
+ <li>Added support for custom views with custom attributes in libraries. Layouts using
+custom attributes must use the namespace URI {@code http://schemas.android.com/apk/res-auto} instead
+of the URI that includes the app package name. This URI is replaced with the app specific one at
+build time.</li>
+ </ul>
+ </li>
+ <li>Improved Lint features. See the <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r17</a>
+release notes.</li>
+ <li>Improved the Lint user interface
+ <ul>
+ <li>Added <strong>Run Lint</strong> toolbar action with a dropdown menu for selecting
+specific (or all) projects, clearing results and other actions.</li>
+ <li>Updated the results window to be organized as a tree rather than a flat list. Each
+issue type has a single top level item, which makes it easier to quickly scan through the reported
+issues and narrow down to the issues you are most interested in.</li>
+ <li>Added many new toolbar actions to the results window, including expand/collapse,
+ignore in file, ignore in project, ignore everywhere, show options, and configure columns.</li>
+ <li>Added new column options for the <strong>Lint Warnings</strong> tab, such as
+category, priority, project, file and line. The column selection (as well as the column sizes) are
+persisted. You can also click on columns to sort by those values.</li>
+ <li>Added Enable All and Disable All buttons to the Lint Options dialog, and a search
+filter textbox to filter by issue id, summary and severity.</li>
+ </ul>
+ </li>
+ <li>Added Quick Outline for XML editors (Ctrl-O, Command-O). This feature shows the structure
+of the current file including icons and ids, lets you filter and quickly jump to specific ids.</li>
+ <li>Updated the resource chooser to shows the resolved value for resources. For example,
+when selecting {@code @string/hello} the chooser displays a resolved value such as "Hello World").
+The resource chooser also now allows you to edit the chosen value directly.</li>
+ <li>Updated Layout Editor so that it does not assign default ids to layouts, includes and
+merge tags. This behavior tended to pollute the namespace with a lot of unused resources since
+layouts are not usually manipulated via code, or referenced from XML. (The RelativeLayout editor
+automatically assigns ids to views without ids when pointing to them.)</li>
+ <li>Added ability to export screenshots from the Layout Editor</li>
+ </ul>
+ </dd>
+
+ <dt>Bug fixes:</dt>
+ <dd>
+ <ul>
+ <li>Fixed problem using Layout Editor with {@link android.widget.SlidingDrawer} which could
+ not be dragged into the layout on some platforms.</li>
+ <li>Fixed preview rendering for {@link android.widget.SlidingDrawer} and
+ {@link android.widget.TabHost}.
+ (<a href="http://code.google.com/p/android/issues/detail?id=23022">Issue 23022</a>).</li>
+ <li>Fixed issues that could prevent layout rendering due to unresolvable resources.
+ (<a href="http://code.google.com/p/android/issues/detail?id=21046">Issue 21046</a>,
+ <a href="http://code.google.com/p/android/issues/detail?id=21051">Issue 21051</a>)</li>
+ <li>Fixed a bug in resource chooser which made some types of framework resources impossible to
+select. (<a href="http://code.google.com/p/android/issues/detail?id=20589">Issue 20589</a>)</li>
+ <li>Fixed a bug in the formatter where a certain whitespace pattern could result in a
+ non-space character getting deleted.
+ (<a href="http://code.google.com/p/android/issues/detail?id=23940">Issue 23940</a>)</li>
+ <li>Fixed a locale bug affecting Turkish locales in particular.
+ (<a href="http://code.google.com/p/android/issues/detail?id=23747">Issue 23747</a>)</li>
+ <li>Fixed issue where dex complains about duplicate classes in cases where a Library
+ Project depends on the same jar files or Java-only projects.</li>
+ <li>Fixed issue where test projects had to independently reference the library projects used
+ by an app project. Now referencing only the app project is enough.</li>
+ </ul>
+ </dd>
+
+</dl>
+
+</div>
+</div>
+
+<div class="toggleable closed">
+ <a href="#" onclick="return toggleDiv(this)">
+ <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-img" height="9px"
+width="9px" />
ADT 16.0.1</a> <em>(December 2011)</em>
<div class="toggleme">
<dl>
@@ -182,11 +282,11 @@
<div class="toggleme">
<dl>
<dt>Dependencies:</dt>
-
+
<dd>ADT 15.0.1 is designed for use with <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r15</a>.
If you haven't already installed SDK Tools r15 into your SDK, use the Android SDK Manager to
do so.</dd>
-
+
<dt>Bug fixes:</dt>
<dd>
<ul>
diff --git a/docs/html/sdk/index.jd b/docs/html/sdk/index.jd
index 5cf05e0..c09b3c2 100644
--- a/docs/html/sdk/index.jd
+++ b/docs/html/sdk/index.jd
@@ -2,21 +2,21 @@
page.metaDescription=Download the official Android SDK to develop apps for Android-powered devices.
sdk.redirect=0
-sdk.win_installer=installer_r16-windows.exe
-sdk.win_installer_bytes=29561554
-sdk.win_installer_checksum=3521dda4904886b05980590f83cf3469
+sdk.win_installer=installer_r17-windows.exe
+sdk.win_installer_bytes=37410775
+sdk.win_installer_checksum=5afaf6511ebaa52bd6d1dba4afc61e41
-sdk.win_download=android-sdk_r16-windows.zip
-sdk.win_bytes=29562413
-sdk.win_checksum=6b926d0c0a871f1a946e65259984701a
+sdk.win_download=android-sdk_r17-windows.zip
+sdk.win_bytes=37417953
+sdk.win_checksum=3af1baeb39707e54df068e939aea5a79
-sdk.mac_download=android-sdk_r16-macosx.zip
-sdk.mac_bytes=26158334
-sdk.mac_checksum=d1dc2b6f13eed5e3ce5cf26c4e4c47aa
+sdk.mac_download=android-sdk_r17-macosx.zip
+sdk.mac_bytes=33867836
+sdk.mac_checksum=52639aae036b7c2e47cf291696b23236
-sdk.linux_download=android-sdk_r16-linux.tgz
-sdk.linux_bytes=22048174
-sdk.linux_checksum=3ba457f731d51da3741c29c8830a4583
+sdk.linux_download=android-sdk_r17-linux.tgz
+sdk.linux_bytes=29706368
+sdk.linux_checksum=14e99dfa8eb1a8fadd2f3557322245c4
@jd:body
diff --git a/docs/html/sdk/requirements.jd b/docs/html/sdk/requirements.jd
index c970f6c9..c76e8c8 100644
--- a/docs/html/sdk/requirements.jd
+++ b/docs/html/sdk/requirements.jd
@@ -24,7 +24,7 @@
<h4 style="margin-top:.25em"><em>Eclipse IDE</em></h4>
<ul>
- <li>Eclipse 3.6 (Helios) or greater
+ <li>Eclipse 3.6.2 (Helios) or greater
<p class="note"><strong>Note:</strong> Eclipse 3.5 (Galileo) is no longer
supported with the latest version of ADT.</p></li>
<li>Eclipse <a href="http://www.eclipse.org/jdt">JDT</a> plugin (included
@@ -41,8 +41,8 @@
<li>Eclipse IDE for Java EE Developers</li>
</ul>
</li>
- <li><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK 5 or JDK
-6</a> (JRE alone is not sufficient)</li>
+ <li><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK 6</a>
+ (JRE alone is not sufficient)</li>
<li><a href="eclipse-adt.html">Android Development Tools plugin</a>
(recommended)</li>
<li><strong>Not</strong> compatible with Gnu Compiler for Java (gcj)</li>
@@ -51,8 +51,8 @@
<h4><em>Other development environments or IDEs</em></h4>
<ul>
- <li><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK 5 or JDK
-6</a> (JRE alone is not sufficient)</li>
+ <li><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK 6</a>
+ (JRE alone is not sufficient)</li>
<li><a href="http://ant.apache.org/">Apache Ant</a> 1.8 or later</li>
<li><strong>Not</strong> compatible with Gnu Compiler for Java (gcj)</li>
</ul>
diff --git a/docs/html/sdk/sdk_toc.cs b/docs/html/sdk/sdk_toc.cs
index f7541f7..5a5517c 100644
--- a/docs/html/sdk/sdk_toc.cs
+++ b/docs/html/sdk/sdk_toc.cs
@@ -81,7 +81,8 @@
<div><a href="<?cs var:toroot ?>sdk/android-4.0-highlights.html">
<span class="en">Android 4.0.x Platform</span></a> <span class="new">new!</span></div>
<ul>
- <li><a href="<?cs var:toroot ?>sdk/android-4.0.3.html">Android 4.0.3 Platform</a> <span class="new">new!</span></li>
+ <li><a href="<?cs var:toroot ?>sdk/android-4.0.3.html">Android 4.0.3 Platform</a>
+ <span class="new">new!</span></li>
<li><a href="<?cs var:toroot ?>sdk/android-4.0.html">Android 4.0 Platform</a> </li>
</ul>
</li>
@@ -152,10 +153,10 @@
</li>
</ul>
<ul>
- <li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, r16</a> <span
+ <li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, r17</a> <span
class="new">new!</span></li>
<li><a href="<?cs var:toroot ?>sdk/win-usb.html">Google USB Driver, r4</a></li>
- <li><a href="<?cs var:toroot ?>sdk/compatibility-library.html">Support Package, r6</a>
+ <li><a href="<?cs var:toroot ?>sdk/compatibility-library.html">Support Package, r7</a>
<span class="new">new!</span></li>
</ul>
</li>
@@ -171,7 +172,7 @@
<span style="display:none" class="zh-TW"></span>
</span>
<ul>
- <li><a href="<?cs var:toroot ?>sdk/eclipse-adt.html">ADT 16.0.1
+ <li><a href="<?cs var:toroot ?>sdk/eclipse-adt.html">ADT 17.0.0
<span style="display:none" class="de"></span>
<span style="display:none" class="es"></span>
<span style="display:none" class="fr"></span>
diff --git a/docs/html/sdk/tools-notes.jd b/docs/html/sdk/tools-notes.jd
index 91bcb7d..dea0c38 100644
--- a/docs/html/sdk/tools-notes.jd
+++ b/docs/html/sdk/tools-notes.jd
@@ -64,11 +64,113 @@
}
</style>
-
<div class="toggleable opened">
<a href="#" onclick="return toggleDiv(this)">
<img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px"
width="9px" />
+ SDK Tools, Revision 17</a> <em>(March 2012)</em>
+
+ <div class="toggleme">
+ <p class="caution"><strong>Important:</strong> To download the new Android
+ 4.0 system components from the Android SDK Manager, you must first update the
+ SDK tools to revision 14 or later and restart the Android SDK Manager. If you do not,
+ the Android 4.0 system components will not be available for download.</p>
+
+ <dl>
+ <dt>Dependencies:</dt>
+ <dd>
+ <ul>
+ <li>Android SDK Platform-tools revision 9 or later.</li>
+ <li>If you are developing in Eclipse with ADT, note that the SDK Tools r17 is designed for
+ use with ADT 17.0.0 and later. If you haven't already, we highly recommend updating your
+ <a href="{@docRoot}sdk/eclipse-adt.html">ADT Plugin</a> to 17.0.0.</li>
+ <li>If you are developing outside Eclipse, you must have
+ <a href="http://ant.apache.org/">Apache Ant</a> 1.8 or later.</li>
+ </ul>
+ </dd>
+ <dt>General notes:</dt>
+ <dd>
+ <ul>
+ <li>Emulator
+ <ul>
+ <li>Added support for hardware accelerated graphics rendering. This feature requires an
+API Level 15, Revision 3 or later system image.
+(<a href="{@docRoot}guide/developing/devices/emulator.html#accel-graphics">more info</a>)
+ <p class="note"><strong>Note:</strong> As of the SDK Tools Revision 17 release, the
+API Level 15, Revision 3 system image is not yet available.</p>
+ </li>
+ <li>Added support for running Android x86 system images in virtualization mode on
+Windows and Mac OS X.
+(<a href="{@docRoot}guide/developing/devices/emulator.html#accel-vm">more info</a>)</li>
+ <li>Added experimental support for multi-touch input by enabing the emulator to receive
+ touch input from a USB-tethered physical Android device.
+ (<a href="http://tools.android.com/tips/hardware-emulation">more info</a>)</li>
+ </ul>
+ </li>
+ <li>Added viewing of live detailed network usage of an app in DDMS. (<a
+ href="http://tools.android.com/recent/detailednetworkusageinddms">more info</a>)</li>
+ <li>ProGuard
+ <ul>
+ <li>Updated the bundled ProGuard tool to version 4.7. In addition to many new features,
+this update fixes the {@code Conversion to Dalvik format failed with error 1} error some users have
+experienced.</li>
+ <li>Updated the default {@code proguard.cfg} file with better default flags for
+ Android.</li>
+ <li>Split the ProGuard configuration file has been in half, with project specific flags
+kept in project and the generic Android flags distributed (and updated) with the tools
+themselves.</li>
+ </ul>
+ </li>
+ <li>Build
+ <ul>
+ <li>Added a feature that allows you to run some code only in debug mode. Builds now
+generate a class called {@code BuildConfig} containing a {@code DEBUG} constant that is
+automatically set according to your build type. You can check the ({@code BuildConfig.DEBUG})
+constant in your code to run debug-only functions.</li>
+ <li>Fixed issue when a project and its libraries include the same jar file in their libs
+ folder. (<a href="http://tools.android.com/recent/dealingwithdependenciesinandroidprojects">more
+ info</a>)</li>
+ <li>Added support for custom views with custom attributes in libraries. Layouts using
+custom attributes must use the namespace URI {@code http://schemas.android.com/apk/res-auto} instead
+of the URI that includes the app package name. This URI is replaced with the app specific one at
+build time.</li>
+ </ul>
+ </li>
+ <li>Lint
+ <ul>
+ <li>Updated Lint to check Android application code. Lint rules which previously
+performed pattern based searches in the application code (such as the unused resource check) have
+been rewritten to use the more accurate Java-style parse trees.</li>
+ <li>Added support for checking library projects. This change means that rules such as
+the unused resource check properly handle resources declared in a library project and referenced in
+a downstream project.</li>
+ <li>Added ability to suppress Lint warnings in Java code with the new
+{@code @SuppressLint} annotation, and in XML files with the new tools: namespace and
+ignore attribute. (<a
+ href="http://tools.android.com/recent/ignoringlintwarnings">more info</a>)</li>
+ <li>New Lint checks:
+ <ul>
+ <li>Added check for Android API calls that require a version of Android higher than
+ the minimum supported version. You can use the new {@code @TargetApi} annotation
+ to suppress warnings when the code is wrapped in a system version condition.
+ (<a href="http://tools.android.com/recent/lintapicheck">more info</a>)</li>
+ <li>Added over 20 new Lint rules, including checks for
+ <a href="http://tools.android.com/recent/lintperformancechecks">performance</a>,
+ XML layouts, manifest and file handling.</li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </dd>
+ </dl>
+ </div>
+</div>
+
+<div class="toggleable closed">
+ <a href="#" onclick="return toggleDiv(this)">
+ <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-img" height="9px"
+ width="9px" />
SDK Tools, Revision 16</a> <em>(December 2011)</em>
<div class="toggleme">
@@ -92,10 +194,10 @@
<dt>General notes:</dt>
<dd>
<ul>
- <li>Added Lint tools to detect common errors in Android projects.
+ <li>Added Lint tools to detect common errors in Android projects.
(<a href="http://tools.android.com/recent/lint">more info</a>)</li>
<li>Added sensor emulation support, which allows the emulator to read sensor data from a
- physical Android device.
+ physical Android device.
(<a href="http://tools.android.com/recent/sensoremulation">more info</a>)</li>
<li>Added support for using a webcam to emulate a camera on Mac OS X.</li>
</ul>
diff --git a/docs/html/sdk/win-usb.jd b/docs/html/sdk/win-usb.jd
index 2bd031e..6869d74 100644
--- a/docs/html/sdk/win-usb.jd
+++ b/docs/html/sdk/win-usb.jd
@@ -147,7 +147,7 @@
<h2 id="WinUsbDriver">Downloading the Google USB Driver</h2>
-<div class="figure" style="width:498px;margin:0">
+<div class="figure" style="width:536px;margin:0">
<img src="{@docRoot}images/developing/sdk-usb-driver.png" alt="" />
<p class="img-caption"><strong>Figure 1.</strong> The SDK and AVD Manager
with the Google USB Driver selected.</p>
diff --git a/docs/html/training/monitoring-device-state/docking-monitoring.jd b/docs/html/training/monitoring-device-state/docking-monitoring.jd
index 392ce30..82d655e 100644
--- a/docs/html/training/monitoring-device-state/docking-monitoring.jd
+++ b/docs/html/training/monitoring-device-state/docking-monitoring.jd
@@ -15,7 +15,7 @@
<h2>This lesson teaches you to</h2>
<ol>
- <li><a href="#CurrentDockState">Request the Audio Focus</a></li>
+ <li><a href="#CurrentDockState">Determine the Current Docking State</a></li>
<li><a href="#DockType">Determine the Current Dock Type</a></li>
<li><a href="#MonitorDockState">Monitor for Changes in the Dock State or Type</a></li>
</ol>
diff --git a/docs/html/training/search/backward-compat.jd b/docs/html/training/search/backward-compat.jd
new file mode 100644
index 0000000..0894fa9
--- /dev/null
+++ b/docs/html/training/search/backward-compat.jd
@@ -0,0 +1,87 @@
+page.title=Remaining Backward Compatible
+trainingnavtop=true
+previous.title=Storing and Searching for Data
+previous.link=search.html
+
+@jd:body
+
+ <div id="tb-wrapper">
+ <div id="tb">
+ <h2>This lesson teaches you to</h2>
+
+ <ul>
+ <li><a href="{@docRoot}training/search/backward-compat.html#set-sdk">Set Minimum
+ and Target API levels</a></li>
+
+ <li><a href="{@docRoot}training/search/backward-compat.html#provide-sd">Provide the Search
+ Dialog for Older Devices</a></li>
+
+ <li><a href="{@docRoot}training/search/backward-compat.html#check-ver">Check the Android Build
+ Version at Runtime</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <p>The {@link android.widget.SearchView} and action bar are only available on Android 3.0 and
+ later. To support older platforms, you can fall back to the search dialog. The search dialog is a
+ system provided UI that overlays on top of your application when invoked.</p>
+
+ <h2 id="set-sdk">Set Minimum and Target API levels</h2>
+
+ <p>To setup the search dialog, first declare in your manifest that you want to support older
+ devices, but want to target Android 3.0 or later versions. When you do this, your application
+ automatically uses the action bar on Android 3.0 or later and uses the traditional menu system on
+ older devices:</p>
+ <pre>
+<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15" />
+
+<application>
+...
+</pre>
+
+ <h2 id="provide-sd">Provide the Search Dialog for Older Devices</h2>
+
+ <p>To invoke the search dialog on older devices, call {@link
+ android.app.Activity#onSearchRequested onSearchRequested()} whenever a user selects the search
+ menu item from the options menu. Because Android 3.0 and higher devices show the
+ {@link android.widget.SearchView} in the action bar (as demonstrated in the first lesson), only versions
+ older than 3.0 call {@link android.app.Activity#onOptionsItemSelected onOptionsItemSelected()} when the
+ user selects the search menu item.
+ </p>
+ <pre>
+@Override
+public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.search:
+ onSearchRequested();
+ return true;
+ default:
+ return false;
+ }
+}
+</pre>
+
+ <h2 id="check-ver">Check the Android Build Version at Runtime</h2>
+
+ <p>At runtime, check the device version to make sure an unsupported use of {@link
+ android.widget.SearchView} does not occur on older devices. In our example code, this happens in
+ the {@link android.app.Activity#onCreateOptionsMenu onCreateOptionsMenu()} method:</p>
+ <pre>
+@Override
+public boolean onCreateOptionsMenu(Menu menu) {
+
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.options_menu, menu);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ SearchManager searchManager =
+ (SearchManager) getSystemService(Context.SEARCH_SERVICE);
+ SearchView searchView =
+ (SearchView) menu.findItem(R.id.search).getActionView();
+ searchView.setSearchableInfo(
+ searchManager.getSearchableInfo(getComponentName()));
+ searchView.setIconifiedByDefault(false);
+ }
+ return true;
+}
+</pre>
diff --git a/docs/html/training/search/index.jd b/docs/html/training/search/index.jd
new file mode 100644
index 0000000..bfd1618
--- /dev/null
+++ b/docs/html/training/search/index.jd
@@ -0,0 +1,53 @@
+page.title=Adding Search Functionality
+trainingnavtop=true
+startpage=true
+next.title=Setting Up the Search Interface
+next.link=setup.html
+
+@jd:body
+
+ <div id="tb-wrapper">
+ <div id="tb">
+ <h2>Dependencies and prerequisites</h2>
+
+ <ul>
+ <li>Android 3.0 or later (with some support for Android 2.1)</li>
+
+ <li>Experience building an Android <a href="{@docRoot}guide/topics/ui/index.html">User
+ Interface</a></li>
+ </ul>
+
+ <h2>You should also read</h2>
+
+ <ul>
+ <li><a href="{@docRoot}guide/topics/search/index.html">Search</a></li>
+
+ <li><a href="{@docRoot}resources/samples/SearchableDictionary/index.html">Searchable
+ Dictionary Sample App</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <p>Android's built-in search features offer apps an easy way to provide a
+ consistent search experience for all users. There are two ways to implement search in your app
+ depending on the version of Android that is running on the device. This class covers how to add
+ search with {@link android.widget.SearchView}, which was introduced in Android 3.0, while
+ maintaining backward compatibility with older versions of Android by using the default search
+ dialog provided by the system.</p>
+
+ <h2>Lessons</h2>
+
+ <dl>
+ <dt><b><a href="setup.html">Setting Up the Search Interface</a></b></dt>
+
+ <dd>Learn how to add a search interface to your app and how to configure an activity to handle
+ search queries.</dd>
+
+ <dt><b><a href="search.html">Storing and Searching for Data</a></b></dt>
+
+ <dd>Learn a simple way to store and search for data in a SQLite virtual database table.</dd>
+
+ <dt><b><a href="backward-compat.html">Remaining Backward Compatible</a></b></dt>
+
+ <dd>Learn how to keep search features backward compatible with older devices by using.</dd>
+ </dl>
\ No newline at end of file
diff --git a/docs/html/training/search/search.jd b/docs/html/training/search/search.jd
new file mode 100644
index 0000000..17e7640
--- /dev/null
+++ b/docs/html/training/search/search.jd
@@ -0,0 +1,217 @@
+page.title=Storing and Searching for Data
+trainingnavtop=true
+previous.title=Setting Up the Search Interface
+previous.link=setup.html
+next.title=Remaining Backward Compatible
+next.link=backward-compat.html
+
+@jd:body
+
+ <div id="tb-wrapper">
+ <div id="tb">
+ <h2>This lesson teaches you to</h2>
+
+ <ul>
+ <li><a href="{@docRoot}training/search/search.html#create">Create the Virtual
+ Table</a></li>
+
+ <li><a href="{@docRoot}training/search/search.html#populate">Populate the Virtual
+ Table</a></li>
+
+ <li><a href="{@docRoot}training/search/search.html#search">Search for the Query</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <p>There are many ways to store your data, such as in an online database, in a local SQLite
+ database, or even in a text file. It is up to you to decide what is the best solution for your
+ application. This lesson shows you how to create a SQLite virtual table that can provide robust
+ full-text searching. The table is populated with data from a text file that contains a word and
+ definition pair on each line in the file.</p>
+
+ <h2 id="create">Create the Virtual Table</h2>
+
+ <p>A virtual table behaves similarly to a SQLite table, but reads and writes to an object in
+ memory via callbacks, instead of to a database file. To create a virtual table, create a class
+ for the table:</p>
+ <pre>
+public class DatabaseTable {
+ private final DatabaseOpenHelper mDatabaseOpenHelper;
+
+ public DatabaseTable(Context context) {
+ mDatabaseOpenHelper = new DatabaseOpenHelper(context);
+ }
+}
+</pre>
+
+ <p>Create an inner class in <code>DatabaseTable</code> that extends {@link
+ android.database.sqlite.SQLiteOpenHelper}. The {@link android.database.sqlite.SQLiteOpenHelper} class
+ defines abstract methods that you must override so that your database table can be created and
+ upgraded when necessary. For example, here is some code that declares a database table that will
+ contain words for a dictionary app:</p>
+ <pre>
+public class DatabaseTable {
+
+ private static final String TAG = "DictionaryDatabase";
+
+ //The columns we'll include in the dictionary table
+ public static final String COL_WORD = "WORD";
+ public static final String COL_DEFINITION = "DEFINITION";
+
+ private static final String DATABASE_NAME = "DICTIONARY";
+ private static final String FTS_VIRTUAL_TABLE = "FTS";
+ private static final int DATABASE_VERSION = 1;
+
+ private final DatabaseOpenHelper mDatabaseOpenHelper;
+
+ public DatabaseTable(Context context) {
+ mDatabaseOpenHelper = new DatabaseOpenHelper(context);
+ }
+
+ private static class DatabaseOpenHelper extends SQLiteOpenHelper {
+
+ private final Context mHelperContext;
+ private SQLiteDatabase mDatabase;
+
+ private static final String FTS_TABLE_CREATE =
+ "CREATE VIRTUAL TABLE " + FTS_VIRTUAL_TABLE +
+ " USING fts3 (" +
+ COL_WORD + ", " +
+ COL_DEFINITION + ")";
+
+ DatabaseOpenHelper(Context context) {
+ super(context, DATABASE_NAME, null, DATABASE_VERSION);
+ mHelperContext = context;
+ }
+
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+ mDatabase = db;
+ mDatabase.execSQL(FTS_TABLE_CREATE);
+ }
+
+ @Override
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+ Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
+ + newVersion + ", which will destroy all old data");
+ db.execSQL("DROP TABLE IF EXISTS " + FTS_VIRTUAL_TABLE);
+ onCreate(db);
+ }
+ }
+}
+</pre>
+
+ <h2 id="populate">Populate the Virtual Table</h2>
+
+ <p>The table now needs data to store. The following code shows you how to read a text file
+ (located in <code>res/raw/definitions.txt</code>) that contains words and their definitions, how
+ to parse that file, and how to insert each line of that file as a row in the virtual table. This
+ is all done in another thread to prevent the UI from locking. Add the following code to your
+ <code>DatabaseOpenHelper</code> inner class.</p>
+
+ <p class="note"><strong>Tip:</strong> You also might want to set up a callback to notify your UI
+ activity of this thread's completion.</p>
+ <pre>
+private void loadDictionary() {
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ loadWords();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }).start();
+ }
+
+private void loadWords() throws IOException {
+ final Resources resources = mHelperContext.getResources();
+ InputStream inputStream = resources.openRawResource(R.raw.definitions);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+
+ try {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ String[] strings = TextUtils.split(line, "-");
+ if (strings.length < 2) continue;
+ long id = addWord(strings[0].trim(), strings[1].trim());
+ if (id < 0) {
+ Log.e(TAG, "unable to add word: " + strings[0].trim());
+ }
+ }
+ } finally {
+ reader.close();
+ }
+}
+
+public long addWord(String word, String definition) {
+ ContentValues initialValues = new ContentValues();
+ initialValues.put(COL_WORD, word);
+ initialValues.put(COL_DEFINITION, definition);
+
+ return mDatabase.insert(FTS_VIRTUAL_TABLE, null, initialValues);
+}
+</pre>
+
+ <p>Call the <code>loadDictionary()</code> method wherever appropriate to populate the table. A
+ good place would be in the {@link android.database.sqlite.SQLiteOpenHelper#onCreate onCreate()}
+ method of the <code>DatabaseOpenHelper</code> class, right after you create the table:</p>
+ <pre>
+@Override
+public void onCreate(SQLiteDatabase db) {
+ mDatabase = db;
+ mDatabase.execSQL(FTS_TABLE_CREATE);
+ loadDictionary();
+}
+</pre>
+
+ <h2 id="search">Search for the Query</h2>
+
+ <p>When you have the virtual table created and populated, use the query supplied by your {@link
+ android.widget.SearchView} to search the data. Add the following methods to the
+ <code>DatabaseTable</code> class to build a SQL statement that searches for the query:</p>
+ <pre>
+public Cursor getWordMatches(String query, String[] columns) {
+ String selection = COL_WORD + " MATCH ?";
+ String[] selectionArgs = new String[] {query+"*"};
+
+ return query(selection, selectionArgs, columns);
+}
+
+private Cursor query(String selection, String[] selectionArgs, String[] columns) {
+ SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
+ builder.setTables(FTS_VIRTUAL_TABLE);
+
+ Cursor cursor = builder.query(mDatabaseOpenHelper.getReadableDatabase(),
+ columns, selection, selectionArgs, null, null, null);
+
+ if (cursor == null) {
+ return null;
+ } else if (!cursor.moveToFirst()) {
+ cursor.close();
+ return null;
+ }
+ return cursor;
+}
+</pre>
+
+ <p>Search for a query by calling <code>getWordMatches()</code>. Any matching results are returned
+ in a {@link android.database.Cursor} that you can iterate through or use to build a {@link android.widget.ListView}.
+ This example calls <code>getWordMatches()</code> in the <code>handleIntent()</code> method of the searchable
+ activity. Remember that the searchable activity receives the query inside of the {@link
+ android.content.Intent#ACTION_SEARCH} intent as an extra, because of the intent filter that you
+ previously created:</p>
+ <pre>
+DatabaseTable db = new DatabaseTable(this);
+
+...
+
+private void handleIntent(Intent intent) {
+
+ if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
+ String query = intent.getStringExtra(SearchManager.QUERY);
+ Cursor c = db.getWordMatches(query, null);
+ //process Cursor and display results
+ }
+}
+</pre>
\ No newline at end of file
diff --git a/docs/html/training/search/setup.jd b/docs/html/training/search/setup.jd
new file mode 100644
index 0000000..044e422
--- /dev/null
+++ b/docs/html/training/search/setup.jd
@@ -0,0 +1,197 @@
+page.title=Setting Up the Search Interface
+trainingnavtop=true
+next.title=Storing and Searching for Data
+next.link=search.html
+
+@jd:body
+
+ <div id="tb-wrapper">
+ <div id="tb">
+ <h2>This lesson teaches you to</h2>
+
+ <ul>
+ <li><a href="{@docRoot}training/search/setup.html#add-sv">Add the Search View to the Action
+ Bar</a></li>
+
+ <li><a href="{@docRoot}training/search/setup.html#create-sc">Create a Searchable
+ Configuration</a></li>
+
+ <li><a href="{@docRoot}training/search/setup.html#create-sa">Create a Searchable
+ Activity</a></li>
+ </ul>
+
+ <h2>You should also read:</h2>
+
+ <ul>
+ <li><a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <p>Beginning in Android 3.0, using the {@link android.widget.SearchView} widget as an item in
+ the action bar is the preferred way to provide search in your app. Like with all items in
+ the action bar, you can define the {@link android.widget.SearchView} to show at all times, only
+ when there is room, or as a collapsible action, which displays the {@link
+ android.widget.SearchView} as an icon initially, then takes up the entire action bar as a search
+ field when the user clicks the icon.</p>
+
+ <p class="note"><strong>Note:</strong> Later in this class, you will learn how to make your
+ app compatible down to Android 2.1 (API level 7) for devices that do not support
+ {@link android.widget.SearchView}.</p>
+
+ <h2 id="add-sv">Add the Search View to the Action Bar</h2>
+
+ <p>To add a {@link android.widget.SearchView} widget to the action bar, create a file named
+ <code>res/menu/options_menu.xml</code> in your project and add the following code to the file.
+ This code defines how to create the search item, such as the icon to use and the title of the
+ item. The <code>collapseActionView</code> attribute allows your {@link android.widget.SearchView}
+ to expand to take up the whole action bar and collapse back down into a
+ normal action bar item when not in use. Because of the limited action bar space on handset devices,
+ using the <code>collapsibleActionView</code> attribute is recommended to provide a better
+ user experience.</p>
+ <pre>
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/search"
+ android:title="@string/search_title"
+ android:icon="@drawable/ic_search"
+ android:showAsAction="collapseActionView|ifRoom"
+ android:actionViewClass="android.widget.SearchView" />
+</menu>
+</pre>
+
+ <p class="note"><strong>Note:</strong> If you already have an existing XML file for your menu
+ items, you can add the <code><item></code> element to that file instead.</p>
+
+ <p>To display the {@link android.widget.SearchView} in the action bar, inflate the XML menu
+ resource (<code>res/menu/options_menu.xml</code>) in the {@link
+ android.app.Activity#onCreateOptionsMenu onCreateOptionsMenu()} method of your activity:</p>
+ <pre>
+@Override
+public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.options_menu, menu);
+
+ return true;
+}
+</pre>
+
+ <p>If you run your app now, the {@link android.widget.SearchView} appears in your app's action
+ bar, but it isn't functional. You now need to define <em>how</em> the {@link
+ android.widget.SearchView} behaves.</p>
+
+ <h2 id="create-sc">Create a Searchable Configuration</h2>
+
+ <p>A <a href="http://developer.android.com/guide/topics/search/searchable-config.html">searchable
+ configuration</a> defines how the {@link android.widget.SearchView} behaves and is defined in a
+ <code>res/xml/searchable.xml</code> file. At a minimum, a searchable configuration must contain
+ an <code>android:label</code> attribute that has the same value as the
+ <code>android:label</code> attribute of the <a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a> or
+ <a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a> element in your Android manifest.
+ However, we also recommend adding an <code>android:hint</code> attribute to give the user an idea of what to enter into the search
+ box:</p>
+ <pre>
+<?xml version="1.0" encoding="utf-8"?>
+
+<searchable xmlns:android="http://schemas.android.com/apk/res/android"
+ android:label="@string/app_name"
+ android:hint="@string/search_hint" />
+</pre>
+
+ <p>In your application's manifest file, declare a <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">
+ <code><meta-data></code></a> element that points to the <code>res/xml/searchable.xml</code> file,
+ so that your application knows where to find it. Declare the element in an <code><activity></code>
+ that you want to display the {@link android.widget.SearchView} in:</p>
+ <pre>
+<activity ... >
+ ...
+ <meta-data android:name="android.app.searchable"
+ android:resource="@xml/searchable" />
+
+</activity>
+</pre>
+
+ <p>In the {@link android.app.Activity#onCreateOptionsMenu onCreateOptionsMenu()} method that you
+ created before, associate the searchable configuration with the {@link android.widget.SearchView}
+ by calling {@link android.widget.SearchView#setSearchableInfo}:</p>
+ <pre>
+@Override
+public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.options_menu, menu);
+
+ // Associate searchable configuration with the SearchView
+ SearchManager searchManager =
+ (SearchManager) getSystemService(Context.SEARCH_SERVICE);
+ SearchView searchView =
+ (SearchView) menu.findItem(R.id.search).getActionView();
+ searchView.setSearchableInfo(
+ searchManager.getSearchableInfo(getComponentName()));
+
+ return true;
+}
+</pre>
+
+ <p>The call to {@link android.app.SearchManager#getSearchableInfo getSearchableInfo()} obtains a
+ {@link android.app.SearchableInfo} object that is created from the searchable configuration XML
+ file. When the searchable configuration is correctly associated with your {@link
+ android.widget.SearchView}, the {@link android.widget.SearchView} starts an activity with the
+ {@link android.content.Intent#ACTION_SEARCH} intent when a user submits a query. You now need an
+ activity that can filter for this intent and handle the search query.</p>
+
+ <h2 id="create-sa">Create a Searchable Activity</h2>
+
+ <p>A {@link android.widget.SearchView} tries to start an activity with the {@link
+ android.content.Intent#ACTION_SEARCH} when a user submits a search query. A searchable activity
+ filters for the {@link android.content.Intent#ACTION_SEARCH} intent and searches for the query in
+ some sort of data set. To create a searchable activity, declare an activity of your choice to
+ filter for the {@link android.content.Intent#ACTION_SEARCH} intent:</p>
+ <pre>
+<activity android:name=".SearchResultsActivity" ... >
+ ...
+ <intent-filter>
+ <action android:name="android.intent.action.SEARCH" />
+ </intent-filter>
+ ...
+</activity>
+</pre>
+
+ <p>In your searchable activity, handle the {@link android.content.Intent#ACTION_SEARCH} intent by
+ checking for it in your {@link android.app.Activity#onCreate onCreate()} method.</p>
+
+ <p class="note"><strong>Note:</strong> If your searchable activity launches in single top mode
+ (<code>android:launchMode="singleTop"</code>), also handle the {@link
+ android.content.Intent#ACTION_SEARCH} intent in the {@link android.app.Activity#onNewIntent
+ onNewIntent()} method. In single top mode, only one instance of your activity is created and
+ subsequent calls to start your activity do not create a new activity on the
+ stack. This launch mode is useful so users can perform searches from the same activity
+ without creating a new activity instance every time.</p>
+ <pre>
+public class SearchResultsActivity extends Activity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ ...
+ handleIntent(getIntent());
+ }
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ ...
+ handleIntent(intent);
+ }
+
+ private void handleIntent(Intent intent) {
+
+ if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
+ String query = intent.getStringExtra(SearchManager.QUERY);
+ //use the query to search your data somehow
+ }
+ }
+ ...
+}
+</pre>
+
+ <p>If you run your app now, the {@link android.widget.SearchView} can accept the user's query and
+ start your searchable activity with the {@link android.content.Intent#ACTION_SEARCH} intent. It
+ is now up to you to figure out how to store and search your data given a query.</p>
\ No newline at end of file
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index bff2a76..c5705f6 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -32,6 +32,8 @@
* and byte-arrays.
*/
public class BitmapFactory {
+ private static final int DECODE_BUFFER_SIZE = 16 * 1024;
+
public static class Options {
/**
* Create a default Options object, which if left unchanged will give
@@ -469,7 +471,7 @@
// we need mark/reset to work properly
if (!is.markSupported()) {
- is = new BufferedInputStream(is, 16 * 1024);
+ is = new BufferedInputStream(is, DECODE_BUFFER_SIZE);
}
// so we can call reset() if a given codec gives up after reading up to
@@ -477,11 +479,30 @@
// value should be.
is.mark(1024);
- Bitmap bm;
+ Bitmap bm;
+ boolean finish = true;
if (is instanceof AssetManager.AssetInputStream) {
- bm = nativeDecodeAsset(((AssetManager.AssetInputStream) is).getAssetInt(),
- outPadding, opts);
+ final int asset = ((AssetManager.AssetInputStream) is).getAssetInt();
+
+ if (opts == null || (opts.inScaled && opts.inBitmap == null)) {
+ float scale = 1.0f;
+ int targetDensity = 0;
+ if (opts != null) {
+ final int density = opts.inDensity;
+ targetDensity = opts.inTargetDensity;
+ if (density != 0 && targetDensity != 0) {
+ scale = targetDensity / (float) density;
+ }
+ }
+
+ bm = nativeDecodeAsset(asset, outPadding, opts, true, scale);
+ if (bm != null && targetDensity != 0) bm.setDensity(targetDensity);
+
+ finish = false;
+ } else {
+ bm = nativeDecodeAsset(asset, outPadding, opts);
+ }
} else {
// pass some temp storage down to the native code. 1024 is made up,
// but should be large enough to avoid too many small calls back
@@ -490,13 +511,32 @@
byte [] tempStorage = null;
if (opts != null) tempStorage = opts.inTempStorage;
if (tempStorage == null) tempStorage = new byte[16 * 1024];
- bm = nativeDecodeStream(is, tempStorage, outPadding, opts);
+
+ if (opts == null || (opts.inScaled && opts.inBitmap == null)) {
+ float scale = 1.0f;
+ int targetDensity = 0;
+ if (opts != null) {
+ final int density = opts.inDensity;
+ targetDensity = opts.inTargetDensity;
+ if (density != 0 && targetDensity != 0) {
+ scale = targetDensity / (float) density;
+ }
+ }
+
+ bm = nativeDecodeStream(is, tempStorage, outPadding, opts, true, scale);
+ if (bm != null && targetDensity != 0) bm.setDensity(targetDensity);
+
+ finish = false;
+ } else {
+ bm = nativeDecodeStream(is, tempStorage, outPadding, opts);
+ }
}
+
if (bm == null && opts != null && opts.inBitmap != null) {
throw new IllegalArgumentException("Problem decoding into existing bitmap");
}
- return finishDecode(bm, outPadding, opts);
+ return finish ? finishDecode(bm, outPadding, opts) : bm;
}
private static Bitmap finishDecode(Bitmap bm, Rect outPadding, Options opts) {
@@ -524,12 +564,13 @@
bm = Bitmap.createScaledBitmap(oldBitmap, (int) (bm.getWidth() * scale + 0.5f),
(int) (bm.getHeight() * scale + 0.5f), true);
if (bm != oldBitmap) oldBitmap.recycle();
+
+ if (isNinePatch) {
+ np = nativeScaleNinePatch(np, scale, outPadding);
+ bm.setNinePatchChunk(np);
+ }
}
- if (isNinePatch) {
- if (scale != 1.0f) np = nativeScaleNinePatch(np, scale, outPadding);
- bm.setNinePatchChunk(np);
- }
bm.setDensity(targetDensity);
}
@@ -595,35 +636,15 @@
return decodeFileDescriptor(fd, null, null);
}
- /**
- * Set the default config used for decoding bitmaps. This config is
- * presented to the codec if the caller did not specify a preferred config
- * in their call to decode...
- *
- * The default value is chosen by the system to best match the device's
- * screen and memory constraints.
- *
- * @param config The preferred config for decoding bitmaps. If null, then
- * a suitable default is chosen by the system.
- *
- * @hide - only called by the browser at the moment, but should be stable
- * enough to expose if needed
- */
- public static void setDefaultConfig(Bitmap.Config config) {
- if (config == null) {
- // pick this for now, as historically it was our default.
- // However, if we have a smarter algorithm, we can change this.
- config = Bitmap.Config.RGB_565;
- }
- nativeSetDefaultConfig(config.nativeInt);
- }
-
- private static native void nativeSetDefaultConfig(int nativeConfig);
private static native Bitmap nativeDecodeStream(InputStream is, byte[] storage,
Rect padding, Options opts);
+ private static native Bitmap nativeDecodeStream(InputStream is, byte[] storage,
+ Rect padding, Options opts, boolean applyScale, float scale);
private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd,
Rect padding, Options opts);
private static native Bitmap nativeDecodeAsset(int asset, Rect padding, Options opts);
+ private static native Bitmap nativeDecodeAsset(int asset, Rect padding, Options opts,
+ boolean applyScale, float scale);
private static native Bitmap nativeDecodeByteArray(byte[] data, int offset,
int length, Options opts);
private static native byte[] nativeScaleNinePatch(byte[] chunk, float scale, Rect pad);
diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java
index 6698d31..383fe71 100644
--- a/graphics/java/android/graphics/drawable/LayerDrawable.java
+++ b/graphics/java/android/graphics/drawable/LayerDrawable.java
@@ -575,6 +575,11 @@
@Override
public Drawable mutate() {
if (!mMutated && super.mutate() == this) {
+ if (!mLayerState.canConstantState()) {
+ throw new IllegalStateException("One or more children of this LayerDrawable does " +
+ "not have constant state; this drawable cannot be mutated.");
+ }
+ mLayerState = new LayerState(mLayerState, this, null);
final ChildDrawable[] array = mLayerState.mChildren;
final int N = mLayerState.mNum;
for (int i = 0; i < N; i++) {
@@ -694,7 +699,7 @@
return stateful;
}
- public synchronized boolean canConstantState() {
+ public boolean canConstantState() {
if (!mCheckedConstantState && mChildren != null) {
mCanConstantState = true;
final int N = mNum;
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index 6539ff3..a76a628 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -131,22 +131,13 @@
public static final int USAGE_GRAPHICS_RENDER_TARGET = 0x0010;
/**
- * USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE The allocation
- * will be used as a SurfaceTexture graphics consumer. This
- * usage may only be used with USAGE_GRAPHICS_TEXTURE.
- *
- * @hide
- */
- public static final int USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE = 0x0020;
-
- /**
* USAGE_IO_INPUT The allocation will be used as SurfaceTexture
* consumer. This usage will cause the allocation to be created
* read only.
*
* @hide
*/
- public static final int USAGE_IO_INPUT = 0x0040;
+ public static final int USAGE_IO_INPUT = 0x0020;
/**
* USAGE_IO_OUTPUT The allocation will be used as a
@@ -155,7 +146,7 @@
*
* @hide
*/
- public static final int USAGE_IO_OUTPUT = 0x0080;
+ public static final int USAGE_IO_OUTPUT = 0x0040;
/**
* Controls mipmap behavior when using the bitmap creation and
@@ -197,6 +188,40 @@
return getID();
}
+
+ /**
+ * Get the element of the type of the Allocation.
+ *
+ * @hide
+ * @return Element
+ *
+ */
+ public Element getElement() {
+ return mType.getElement();
+ }
+
+ /**
+ * Get the usage flags of the Allocation.
+ *
+ * @hide
+ * @return usage
+ *
+ */
+ public int getUsage() {
+ return mUsage;
+ }
+
+ /**
+ * Get the size of the Allocation in bytes.
+ *
+ * @hide
+ * @return sizeInBytes
+ *
+ */
+ public int getSizeBytes() {
+ return mType.getCount() * mType.getElement().getSizeBytes();
+ }
+
private void updateCacheInfo(Type t) {
mCurrentDimX = t.getX();
mCurrentDimY = t.getY();
@@ -217,17 +242,15 @@
USAGE_GRAPHICS_VERTEX |
USAGE_GRAPHICS_CONSTANTS |
USAGE_GRAPHICS_RENDER_TARGET |
- USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE |
USAGE_IO_INPUT |
USAGE_IO_OUTPUT)) != 0) {
throw new RSIllegalArgumentException("Unknown usage specified.");
}
- if ((usage & (USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE | USAGE_IO_INPUT)) != 0) {
+ if ((usage & USAGE_IO_INPUT) != 0) {
mWriteAllowed = false;
- if ((usage & ~(USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE |
- USAGE_IO_INPUT |
+ if ((usage & ~(USAGE_IO_INPUT |
USAGE_GRAPHICS_TEXTURE |
USAGE_SCRIPT)) != 0) {
throw new RSIllegalArgumentException("Invalid usage combination.");
@@ -305,10 +328,21 @@
}
}
+ /**
+ * Get the type of the Allocation.
+ *
+ * @return Type
+ *
+ */
public Type getType() {
return mType;
}
+ /**
+ * Propagate changes from one usage of the allocation to the
+ * remaining usages of the allocation.
+ *
+ */
public void syncAll(int srcLocation) {
switch (srcLocation) {
case USAGE_SCRIPT:
@@ -348,12 +382,17 @@
public void ioGetInput() {
if ((mUsage & USAGE_IO_INPUT) == 0) {
throw new RSIllegalArgumentException(
- "Can only send buffer if IO_OUTPUT usage specified.");
+ "Can only receive if IO_INPUT usage specified.");
}
mRS.validate();
mRS.nAllocationIoReceive(getID());
}
+ /**
+ * Copy an array of RS objects to the allocation.
+ *
+ * @param d Source array.
+ */
public void copyFrom(BaseObj[] d) {
mRS.validate();
validateIsObject();
@@ -1134,13 +1173,15 @@
*
*/
public SurfaceTexture getSurfaceTexture() {
- if ((mUsage & USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE) == 0) {
+ if ((mUsage & USAGE_IO_INPUT) == 0) {
throw new RSInvalidStateException("Allocation is not a surface texture.");
}
int id = mRS.nAllocationGetSurfaceTextureID(getID());
- return new SurfaceTexture(id);
+ SurfaceTexture st = new SurfaceTexture(id);
+ mRS.nAllocationGetSurfaceTextureID2(getID(), st);
+ return st;
}
/**
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 6921f37..ab6ba54 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -16,8 +16,8 @@
package android.renderscript;
-import java.lang.reflect.Field;
import java.io.File;
+import java.lang.reflect.Field;
import android.content.Context;
import android.content.pm.ApplicationInfo;
@@ -294,6 +294,11 @@
validate();
return rsnAllocationGetSurfaceTextureID(mContext, alloc);
}
+ native void rsnAllocationGetSurfaceTextureID2(int con, int alloc, SurfaceTexture st);
+ synchronized void nAllocationGetSurfaceTextureID2(int alloc, SurfaceTexture st) {
+ validate();
+ rsnAllocationGetSurfaceTextureID2(mContext, alloc, st);
+ }
native void rsnAllocationSetSurfaceTexture(int con, int alloc, SurfaceTexture sur);
synchronized void nAllocationSetSurfaceTexture(int alloc, SurfaceTexture sur) {
validate();
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 9fc4fd4..9d4c64f 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -477,6 +477,15 @@
}
static void
+nAllocationGetSurfaceTextureID2(JNIEnv *_env, jobject _this, RsContext con, jint a, jobject jst)
+{
+ LOG_API("nAllocationGetSurfaceTextureID2, con(%p), a(%p)", con, (RsAllocation)a);
+ sp<SurfaceTexture> st = SurfaceTexture_getSurfaceTexture(_env, jst);
+
+ rsAllocationGetSurfaceTextureID2(con, (RsAllocation)a, st.get(), sizeof(SurfaceTexture *));
+}
+
+static void
nAllocationSetSurfaceTexture(JNIEnv *_env, jobject _this, RsContext con,
RsAllocation alloc, jobject sur)
{
@@ -1352,7 +1361,8 @@
{"rsnAllocationSyncAll", "(III)V", (void*)nAllocationSyncAll },
{"rsnAllocationGetSurfaceTextureID", "(II)I", (void*)nAllocationGetSurfaceTextureID },
-{"rsnAllocationSetSurfaceTexture", "(IILandroid/graphics/SurfaceTexture;)V", (void*)nAllocationSetSurfaceTexture },
+{"rsnAllocationGetSurfaceTextureID2","(IILandroid/graphics/SurfaceTexture;)V",(void*)nAllocationGetSurfaceTextureID2 },
+{"rsnAllocationSetSurfaceTexture", "(IILandroid/graphics/SurfaceTexture;)V",(void*)nAllocationSetSurfaceTexture },
{"rsnAllocationIoSend", "(II)V", (void*)nAllocationIoSend },
{"rsnAllocationIoReceive", "(II)V", (void*)nAllocationIoReceive },
{"rsnAllocationData1D", "(IIIII[II)V", (void*)nAllocationData1D_i },
diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h
index fd33d59..0b3ce9a 100644
--- a/include/android_runtime/AndroidRuntime.h
+++ b/include/android_runtime/AndroidRuntime.h
@@ -66,6 +66,12 @@
void start(const char *classname, const char* options);
+ void exit(int code);
+
+ void setExitWithoutCleanup(bool exitWithoutCleanup) {
+ mExitWithoutCleanup = exitWithoutCleanup;
+ }
+
static AndroidRuntime* getRuntime();
/**
@@ -86,14 +92,13 @@
* fork. Override it to initialize threads, etc. Upon return, the
* correct static main will be invoked.
*/
- virtual void onZygoteInit() {};
-
+ virtual void onZygoteInit() { }
/**
- * Called when the Java application exits. The default
- * implementation calls exit(code).
+ * Called when the Java application exits to perform additional cleanup actions
+ * before the process is terminated.
*/
- virtual void onExit(int code);
+ virtual void onExit(int code) { }
/** create a new thread that is visible from Java */
static android_thread_id_t createJavaThread(const char* name, void (*start)(void *),
@@ -114,6 +119,7 @@
int startVm(JavaVM** pJavaVM, JNIEnv** pEnv);
Vector<JavaVMOption> mOptions;
+ bool mExitWithoutCleanup;
/* JNI JavaVM pointer */
static JavaVM* mJavaVM;
diff --git a/include/androidfw/AssetManager.h b/include/androidfw/AssetManager.h
index d95b45e..d153c31 100644
--- a/include/androidfw/AssetManager.h
+++ b/include/androidfw/AssetManager.h
@@ -22,13 +22,13 @@
#include <androidfw/Asset.h>
#include <androidfw/AssetDir.h>
-#include <androidfw/ZipFileRO.h>
#include <utils/KeyedVector.h>
#include <utils/SortedVector.h>
#include <utils/String16.h>
#include <utils/String8.h>
#include <utils/threads.h>
#include <utils/Vector.h>
+#include <utils/ZipFileRO.h>
/*
* Native-app access is via the opaque typedef struct AAssetManager in the C namespace.
diff --git a/include/androidfw/ZipFileCRO.h b/include/androidfw/ZipFileCRO.h
deleted file mode 100644
index 3e42a95..0000000
--- a/include/androidfw/ZipFileCRO.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-//
-// C API for ead-only access to Zip archives, with minimal heap allocation.
-//
-#ifndef __LIBS_ZIPFILECRO_H
-#define __LIBS_ZIPFILECRO_H
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <utils/Compat.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Trivial typedef to ensure that ZipFileCRO is not treated as a simple integer.
- */
-typedef void* ZipFileCRO;
-
-/*
- * Trivial typedef to ensure that ZipEntryCRO is not treated as a simple
- * integer. We use NULL to indicate an invalid value.
- */
-typedef void* ZipEntryCRO;
-
-extern ZipFileCRO ZipFileXRO_open(const char* path);
-
-extern void ZipFileCRO_destroy(ZipFileCRO zip);
-
-extern ZipEntryCRO ZipFileCRO_findEntryByName(ZipFileCRO zip,
- const char* fileName);
-
-extern bool ZipFileCRO_getEntryInfo(ZipFileCRO zip, ZipEntryCRO entry,
- int* pMethod, size_t* pUncompLen,
- size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32);
-
-extern bool ZipFileCRO_uncompressEntry(ZipFileCRO zip, ZipEntryCRO entry, int fd);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*__LIBS_ZIPFILECRO_H*/
diff --git a/include/androidfw/ZipFileRO.h b/include/androidfw/ZipFileRO.h
deleted file mode 100644
index 547e36a..0000000
--- a/include/androidfw/ZipFileRO.h
+++ /dev/null
@@ -1,262 +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.
- */
-
-/*
- * Read-only access to Zip archives, with minimal heap allocation.
- *
- * This is similar to the more-complete ZipFile class, but no attempt
- * has been made to make them interchangeable. This class operates under
- * a very different set of assumptions and constraints.
- *
- * One such assumption is that if you're getting file descriptors for
- * use with this class as a child of a fork() operation, you must be on
- * a pread() to guarantee correct operation. This is because pread() can
- * atomically read at a file offset without worrying about a lock around an
- * lseek() + read() pair.
- */
-#ifndef __LIBS_ZIPFILERO_H
-#define __LIBS_ZIPFILERO_H
-
-#include <utils/Compat.h>
-#include <utils/Errors.h>
-#include <utils/FileMap.h>
-#include <utils/threads.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <time.h>
-
-namespace android {
-
-/*
- * Trivial typedef to ensure that ZipEntryRO is not treated as a simple
- * integer. We use NULL to indicate an invalid value.
- */
-typedef void* ZipEntryRO;
-
-/*
- * Open a Zip archive for reading.
- *
- * We want "open" and "find entry by name" to be fast operations, and we
- * want to use as little memory as possible. We memory-map the file,
- * and load a hash table with pointers to the filenames (which aren't
- * null-terminated). The other fields are at a fixed offset from the
- * filename, so we don't need to extract those (but we do need to byte-read
- * and endian-swap them every time we want them).
- *
- * To speed comparisons when doing a lookup by name, we could make the mapping
- * "private" (copy-on-write) and null-terminate the filenames after verifying
- * the record structure. However, this requires a private mapping of
- * every page that the Central Directory touches. Easier to tuck a copy
- * of the string length into the hash table entry.
- *
- * NOTE: If this is used on file descriptors inherited from a fork() operation,
- * you must be on a platform that implements pread() to guarantee correctness
- * on the shared file descriptors.
- */
-class ZipFileRO {
-public:
- ZipFileRO()
- : mFd(-1), mFileName(NULL), mFileLength(-1),
- mDirectoryMap(NULL),
- mNumEntries(-1), mDirectoryOffset(-1),
- mHashTableSize(-1), mHashTable(NULL)
- {}
-
- ~ZipFileRO();
-
- /*
- * Open an archive.
- */
- status_t open(const char* zipFileName);
-
- /*
- * Find an entry, by name. Returns the entry identifier, or NULL if
- * not found.
- *
- * If two entries have the same name, one will be chosen at semi-random.
- */
- ZipEntryRO findEntryByName(const char* fileName) const;
-
- /*
- * Return the #of entries in the Zip archive.
- */
- int getNumEntries(void) const {
- return mNumEntries;
- }
-
- /*
- * Return the Nth entry. Zip file entries are not stored in sorted
- * order, and updated entries may appear at the end, so anyone walking
- * the archive needs to avoid making ordering assumptions. We take
- * that further by returning the Nth non-empty entry in the hash table
- * rather than the Nth entry in the archive.
- *
- * Valid values are [0..numEntries).
- *
- * [This is currently O(n). If it needs to be fast we can allocate an
- * additional data structure or provide an iterator interface.]
- */
- ZipEntryRO findEntryByIndex(int idx) const;
-
- /*
- * Copy the filename into the supplied buffer. Returns 0 on success,
- * -1 if "entry" is invalid, or the filename length if it didn't fit. The
- * length, and the returned string, include the null-termination.
- */
- int getEntryFileName(ZipEntryRO entry, char* buffer, int bufLen) const;
-
- /*
- * Get the vital stats for an entry. Pass in NULL pointers for anything
- * you don't need.
- *
- * "*pOffset" holds the Zip file offset of the entry's data.
- *
- * Returns "false" if "entry" is bogus or if the data in the Zip file
- * appears to be bad.
- */
- bool getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen,
- size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32) const;
-
- /*
- * Create a new FileMap object that maps a subset of the archive. For
- * an uncompressed entry this effectively provides a pointer to the
- * actual data, for a compressed entry this provides the input buffer
- * for inflate().
- */
- FileMap* createEntryFileMap(ZipEntryRO entry) const;
-
- /*
- * Uncompress the data into a buffer. Depending on the compression
- * format, this is either an "inflate" operation or a memcpy.
- *
- * Use "uncompLen" from getEntryInfo() to determine the required
- * buffer size.
- *
- * Returns "true" on success.
- */
- bool uncompressEntry(ZipEntryRO entry, void* buffer) const;
-
- /*
- * Uncompress the data to an open file descriptor.
- */
- bool uncompressEntry(ZipEntryRO entry, int fd) const;
-
- /* Zip compression methods we support */
- enum {
- kCompressStored = 0, // no compression
- kCompressDeflated = 8, // standard deflate
- };
-
- /*
- * Utility function: uncompress deflated data, buffer to buffer.
- */
- static bool inflateBuffer(void* outBuf, const void* inBuf,
- size_t uncompLen, size_t compLen);
-
- /*
- * Utility function: uncompress deflated data, buffer to fd.
- */
- static bool inflateBuffer(int fd, const void* inBuf,
- size_t uncompLen, size_t compLen);
-
- /*
- * Utility function to convert ZIP's time format to a timespec struct.
- */
- static inline void zipTimeToTimespec(long when, struct tm* timespec) {
- const long date = when >> 16;
- timespec->tm_year = ((date >> 9) & 0x7F) + 80; // Zip is years since 1980
- timespec->tm_mon = (date >> 5) & 0x0F;
- timespec->tm_mday = date & 0x1F;
-
- timespec->tm_hour = (when >> 11) & 0x1F;
- timespec->tm_min = (when >> 5) & 0x3F;
- timespec->tm_sec = (when & 0x1F) << 1;
- }
-
- /*
- * Some basic functions for raw data manipulation. "LE" means
- * Little Endian.
- */
- static inline unsigned short get2LE(const unsigned char* buf) {
- return buf[0] | (buf[1] << 8);
- }
- static inline unsigned long get4LE(const unsigned char* buf) {
- return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
- }
-
-private:
- /* these are private and not defined */
- ZipFileRO(const ZipFileRO& src);
- ZipFileRO& operator=(const ZipFileRO& src);
-
- /* locate and parse the central directory */
- bool mapCentralDirectory(void);
-
- /* parse the archive, prepping internal structures */
- bool parseZipArchive(void);
-
- /* add a new entry to the hash table */
- void addToHash(const char* str, int strLen, unsigned int hash);
-
- /* compute string hash code */
- static unsigned int computeHash(const char* str, int len);
-
- /* convert a ZipEntryRO back to a hash table index */
- int entryToIndex(const ZipEntryRO entry) const;
-
- /*
- * One entry in the hash table.
- */
- typedef struct HashEntry {
- const char* name;
- unsigned short nameLen;
- //unsigned int hash;
- } HashEntry;
-
- /* open Zip archive */
- int mFd;
-
- /* Lock for handling the file descriptor (seeks, etc) */
- mutable Mutex mFdLock;
-
- /* zip file name */
- char* mFileName;
-
- /* length of file */
- size_t mFileLength;
-
- /* mapped file */
- FileMap* mDirectoryMap;
-
- /* number of entries in the Zip archive */
- int mNumEntries;
-
- /* CD directory offset in the Zip archive */
- off64_t mDirectoryOffset;
-
- /*
- * We know how many entries are in the Zip archive, so we have a
- * fixed-size hash table. We probe for an empty slot.
- */
- int mHashTableSize;
- HashEntry* mHashTable;
-};
-
-}; // namespace android
-
-#endif /*__LIBS_ZIPFILERO_H*/
diff --git a/include/androidfw/ZipUtils.h b/include/androidfw/ZipUtils.h
deleted file mode 100644
index 42c42b6..0000000
--- a/include/androidfw/ZipUtils.h
+++ /dev/null
@@ -1,67 +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.
- */
-
-//
-// Miscellaneous zip/gzip utility functions.
-//
-#ifndef __LIBS_ZIPUTILS_H
-#define __LIBS_ZIPUTILS_H
-
-#include <stdio.h>
-
-namespace android {
-
-/*
- * Container class for utility functions, primarily for namespace reasons.
- */
-class ZipUtils {
-public:
- /*
- * General utility function for uncompressing "deflate" data from a file
- * to a buffer.
- */
- static bool inflateToBuffer(int fd, void* buf, long uncompressedLen,
- long compressedLen);
- static bool inflateToBuffer(FILE* fp, void* buf, long uncompressedLen,
- long compressedLen);
-
- /*
- * Someday we might want to make this generic and handle bzip2 ".bz2"
- * files too.
- *
- * We could declare gzip to be a sub-class of zip that has exactly
- * one always-compressed entry, but we currently want to treat Zip
- * and gzip as distinct, so there's no value.
- *
- * The zlib library has some gzip utilities, but it has no interface
- * for extracting the uncompressed length of the file (you do *not*
- * want to gzseek to the end).
- *
- * Pass in a seeked file pointer for the gzip file. If this is a gzip
- * file, we set our return values appropriately and return "true" with
- * the file seeked to the start of the compressed data.
- */
- static bool examineGzip(FILE* fp, int* pCompressionMethod,
- long* pUncompressedLen, long* pCompressedLen, unsigned long* pCRC32);
-
-private:
- ZipUtils() {}
- ~ZipUtils() {}
-};
-
-}; // namespace android
-
-#endif /*__LIBS_ZIPUTILS_H*/
diff --git a/include/camera/Camera.h b/include/camera/Camera.h
index 234e165..3fedea0 100644
--- a/include/camera/Camera.h
+++ b/include/camera/Camera.h
@@ -72,7 +72,7 @@
static int32_t getNumberOfCameras();
static status_t getCameraInfo(int cameraId,
struct CameraInfo* cameraInfo);
- static sp<Camera> connect(int cameraId);
+ static sp<Camera> connect(int cameraId, bool force, bool keep);
virtual ~Camera();
void init();
diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h
deleted file mode 100644
index 7edf6b4..0000000
--- a/include/camera/CameraParameters.h
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#ifndef ANDROID_HARDWARE_CAMERA_PARAMETERS_H
-#define ANDROID_HARDWARE_CAMERA_PARAMETERS_H
-
-#include <utils/KeyedVector.h>
-#include <utils/String8.h>
-
-namespace android {
-
-struct Size {
- int width;
- int height;
-
- Size() {
- width = 0;
- height = 0;
- }
-
- Size(int w, int h) {
- width = w;
- height = h;
- }
-};
-
-class CameraParameters
-{
-public:
- CameraParameters();
- CameraParameters(const String8 ¶ms) { unflatten(params); }
- ~CameraParameters();
-
- String8 flatten() const;
- void unflatten(const String8 ¶ms);
-
- void set(const char *key, const char *value);
- void set(const char *key, int value);
- void setFloat(const char *key, float value);
- const char *get(const char *key) const;
- int getInt(const char *key) const;
- float getFloat(const char *key) const;
-
- void remove(const char *key);
-
- void setPreviewSize(int width, int height);
- void getPreviewSize(int *width, int *height) const;
- void getSupportedPreviewSizes(Vector<Size> &sizes) const;
-
- // Set the dimensions in pixels to the given width and height
- // for video frames. The given width and height must be one
- // of the supported dimensions returned from
- // getSupportedVideoSizes(). Must not be called if
- // getSupportedVideoSizes() returns an empty Vector of Size.
- void setVideoSize(int width, int height);
- // Retrieve the current dimensions (width and height)
- // in pixels for video frames, which must be one of the
- // supported dimensions returned from getSupportedVideoSizes().
- // Must not be called if getSupportedVideoSizes() returns an
- // empty Vector of Size.
- void getVideoSize(int *width, int *height) const;
- // Retrieve a Vector of supported dimensions (width and height)
- // in pixels for video frames. If sizes returned from the method
- // is empty, the camera does not support calls to setVideoSize()
- // or getVideoSize(). In adddition, it also indicates that
- // the camera only has a single output, and does not have
- // separate output for video frames and preview frame.
- void getSupportedVideoSizes(Vector<Size> &sizes) const;
- // Retrieve the preferred preview size (width and height) in pixels
- // for video recording. The given width and height must be one of
- // supported preview sizes returned from getSupportedPreviewSizes().
- // Must not be called if getSupportedVideoSizes() returns an empty
- // Vector of Size. If getSupportedVideoSizes() returns an empty
- // Vector of Size, the width and height returned from this method
- // is invalid, and is "-1x-1".
- void getPreferredPreviewSizeForVideo(int *width, int *height) const;
-
- void setPreviewFrameRate(int fps);
- int getPreviewFrameRate() const;
- void getPreviewFpsRange(int *min_fps, int *max_fps) const;
- void setPreviewFormat(const char *format);
- const char *getPreviewFormat() const;
- void setPictureSize(int width, int height);
- void getPictureSize(int *width, int *height) const;
- void getSupportedPictureSizes(Vector<Size> &sizes) const;
- void setPictureFormat(const char *format);
- const char *getPictureFormat() const;
-
- void dump() const;
- status_t dump(int fd, const Vector<String16>& args) const;
-
- // Parameter keys to communicate between camera application and driver.
- // The access (read/write, read only, or write only) is viewed from the
- // perspective of applications, not driver.
-
- // Preview frame size in pixels (width x height).
- // Example value: "480x320". Read/Write.
- static const char KEY_PREVIEW_SIZE[];
- // Supported preview frame sizes in pixels.
- // Example value: "800x600,480x320". Read only.
- static const char KEY_SUPPORTED_PREVIEW_SIZES[];
- // The current minimum and maximum preview fps. This controls the rate of
- // preview frames received (CAMERA_MSG_PREVIEW_FRAME). The minimum and
- // maximum fps must be one of the elements from
- // KEY_SUPPORTED_PREVIEW_FPS_RANGE parameter.
- // Example value: "10500,26623"
- static const char KEY_PREVIEW_FPS_RANGE[];
- // The supported preview fps (frame-per-second) ranges. Each range contains
- // a minimum fps and maximum fps. If minimum fps equals to maximum fps, the
- // camera outputs frames in fixed frame rate. If not, the camera outputs
- // frames in auto frame rate. The actual frame rate fluctuates between the
- // minimum and the maximum. The list has at least one element. The list is
- // sorted from small to large (first by maximum fps and then minimum fps).
- // Example value: "(10500,26623),(15000,26623),(30000,30000)"
- static const char KEY_SUPPORTED_PREVIEW_FPS_RANGE[];
- // The image format for preview frames. See CAMERA_MSG_PREVIEW_FRAME in
- // frameworks/base/include/camera/Camera.h.
- // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read/write.
- static const char KEY_PREVIEW_FORMAT[];
- // Supported image formats for preview frames.
- // Example value: "yuv420sp,yuv422i-yuyv". Read only.
- static const char KEY_SUPPORTED_PREVIEW_FORMATS[];
- // Number of preview frames per second. This is the target frame rate. The
- // actual frame rate depends on the driver.
- // Example value: "15". Read/write.
- static const char KEY_PREVIEW_FRAME_RATE[];
- // Supported number of preview frames per second.
- // Example value: "24,15,10". Read.
- static const char KEY_SUPPORTED_PREVIEW_FRAME_RATES[];
- // The dimensions for captured pictures in pixels (width x height).
- // Example value: "1024x768". Read/write.
- static const char KEY_PICTURE_SIZE[];
- // Supported dimensions for captured pictures in pixels.
- // Example value: "2048x1536,1024x768". Read only.
- static const char KEY_SUPPORTED_PICTURE_SIZES[];
- // The image format for captured pictures. See CAMERA_MSG_COMPRESSED_IMAGE
- // in frameworks/base/include/camera/Camera.h.
- // Example value: "jpeg" or PIXEL_FORMAT_XXX constants. Read/write.
- static const char KEY_PICTURE_FORMAT[];
- // Supported image formats for captured pictures.
- // Example value: "jpeg,rgb565". Read only.
- static const char KEY_SUPPORTED_PICTURE_FORMATS[];
- // The width (in pixels) of EXIF thumbnail in Jpeg picture.
- // Example value: "512". Read/write.
- static const char KEY_JPEG_THUMBNAIL_WIDTH[];
- // The height (in pixels) of EXIF thumbnail in Jpeg picture.
- // Example value: "384". Read/write.
- static const char KEY_JPEG_THUMBNAIL_HEIGHT[];
- // Supported EXIF thumbnail sizes (width x height). 0x0 means not thumbnail
- // in EXIF.
- // Example value: "512x384,320x240,0x0". Read only.
- static const char KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES[];
- // The quality of the EXIF thumbnail in Jpeg picture. The range is 1 to 100,
- // with 100 being the best.
- // Example value: "90". Read/write.
- static const char KEY_JPEG_THUMBNAIL_QUALITY[];
- // Jpeg quality of captured picture. The range is 1 to 100, with 100 being
- // the best.
- // Example value: "90". Read/write.
- static const char KEY_JPEG_QUALITY[];
- // The rotation angle in degrees relative to the orientation of the camera.
- // This affects the pictures returned from CAMERA_MSG_COMPRESSED_IMAGE. The
- // camera driver may set orientation in the EXIF header without rotating the
- // picture. Or the driver may rotate the picture and the EXIF thumbnail. If
- // the Jpeg picture is rotated, the orientation in the EXIF header will be
- // missing or 1 (row #0 is top and column #0 is left side).
- //
- // Note that the JPEG pictures of front-facing cameras are not mirrored
- // as in preview display.
- //
- // For example, suppose the natural orientation of the device is portrait.
- // The device is rotated 270 degrees clockwise, so the device orientation is
- // 270. Suppose a back-facing camera sensor is mounted in landscape and the
- // top side of the camera sensor is aligned with the right edge of the
- // display in natural orientation. So the camera orientation is 90. The
- // rotation should be set to 0 (270 + 90).
- //
- // Example value: "0" or "90" or "180" or "270". Write only.
- static const char KEY_ROTATION[];
- // GPS latitude coordinate. GPSLatitude and GPSLatitudeRef will be stored in
- // JPEG EXIF header.
- // Example value: "25.032146" or "-33.462809". Write only.
- static const char KEY_GPS_LATITUDE[];
- // GPS longitude coordinate. GPSLongitude and GPSLongitudeRef will be stored
- // in JPEG EXIF header.
- // Example value: "121.564448" or "-70.660286". Write only.
- static const char KEY_GPS_LONGITUDE[];
- // GPS altitude. GPSAltitude and GPSAltitudeRef will be stored in JPEG EXIF
- // header.
- // Example value: "21.0" or "-5". Write only.
- static const char KEY_GPS_ALTITUDE[];
- // GPS timestamp (UTC in seconds since January 1, 1970). This should be
- // stored in JPEG EXIF header.
- // Example value: "1251192757". Write only.
- static const char KEY_GPS_TIMESTAMP[];
- // GPS Processing Method
- // Example value: "GPS" or "NETWORK". Write only.
- static const char KEY_GPS_PROCESSING_METHOD[];
- // Current white balance setting.
- // Example value: "auto" or WHITE_BALANCE_XXX constants. Read/write.
- static const char KEY_WHITE_BALANCE[];
- // Supported white balance settings.
- // Example value: "auto,incandescent,daylight". Read only.
- static const char KEY_SUPPORTED_WHITE_BALANCE[];
- // Current color effect setting.
- // Example value: "none" or EFFECT_XXX constants. Read/write.
- static const char KEY_EFFECT[];
- // Supported color effect settings.
- // Example value: "none,mono,sepia". Read only.
- static const char KEY_SUPPORTED_EFFECTS[];
- // Current antibanding setting.
- // Example value: "auto" or ANTIBANDING_XXX constants. Read/write.
- static const char KEY_ANTIBANDING[];
- // Supported antibanding settings.
- // Example value: "auto,50hz,60hz,off". Read only.
- static const char KEY_SUPPORTED_ANTIBANDING[];
- // Current scene mode.
- // Example value: "auto" or SCENE_MODE_XXX constants. Read/write.
- static const char KEY_SCENE_MODE[];
- // Supported scene mode settings.
- // Example value: "auto,night,fireworks". Read only.
- static const char KEY_SUPPORTED_SCENE_MODES[];
- // Current flash mode.
- // Example value: "auto" or FLASH_MODE_XXX constants. Read/write.
- static const char KEY_FLASH_MODE[];
- // Supported flash modes.
- // Example value: "auto,on,off". Read only.
- static const char KEY_SUPPORTED_FLASH_MODES[];
- // Current focus mode. This will not be empty. Applications should call
- // CameraHardwareInterface.autoFocus to start the focus if focus mode is
- // FOCUS_MODE_AUTO or FOCUS_MODE_MACRO.
- // Example value: "auto" or FOCUS_MODE_XXX constants. Read/write.
- static const char KEY_FOCUS_MODE[];
- // Supported focus modes.
- // Example value: "auto,macro,fixed". Read only.
- static const char KEY_SUPPORTED_FOCUS_MODES[];
- // The maximum number of focus areas supported. This is the maximum length
- // of KEY_FOCUS_AREAS.
- // Example value: "0" or "2". Read only.
- static const char KEY_MAX_NUM_FOCUS_AREAS[];
- // Current focus areas.
- //
- // Before accessing this parameter, apps should check
- // KEY_MAX_NUM_FOCUS_AREAS first to know the maximum number of focus areas
- // first. If the value is 0, focus area is not supported.
- //
- // Each focus area is a five-element int array. The first four elements are
- // the rectangle of the area (left, top, right, bottom). The direction is
- // relative to the sensor orientation, that is, what the sensor sees. The
- // direction is not affected by the rotation or mirroring of
- // CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates range from -1000 to 1000.
- // (-1000,-1000) is the upper left point. (1000, 1000) is the lower right
- // point. The width and height of focus areas cannot be 0 or negative.
- //
- // The fifth element is the weight. Values for weight must range from 1 to
- // 1000. The weight should be interpreted as a per-pixel weight - all
- // pixels in the area have the specified weight. This means a small area
- // with the same weight as a larger area will have less influence on the
- // focusing than the larger area. Focus areas can partially overlap and the
- // driver will add the weights in the overlap region.
- //
- // A special case of single focus area (0,0,0,0,0) means driver to decide
- // the focus area. For example, the driver may use more signals to decide
- // focus areas and change them dynamically. Apps can set (0,0,0,0,0) if they
- // want the driver to decide focus areas.
- //
- // Focus areas are relative to the current field of view (KEY_ZOOM). No
- // matter what the zoom level is, (-1000,-1000) represents the top of the
- // currently visible camera frame. The focus area cannot be set to be
- // outside the current field of view, even when using zoom.
- //
- // Focus area only has effect if the current focus mode is FOCUS_MODE_AUTO,
- // FOCUS_MODE_MACRO, FOCUS_MODE_CONTINUOUS_VIDEO, or
- // FOCUS_MODE_CONTINUOUS_PICTURE.
- // Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write.
- static const char KEY_FOCUS_AREAS[];
- // Focal length in millimeter.
- // Example value: "4.31". Read only.
- static const char KEY_FOCAL_LENGTH[];
- // Horizontal angle of view in degrees.
- // Example value: "54.8". Read only.
- static const char KEY_HORIZONTAL_VIEW_ANGLE[];
- // Vertical angle of view in degrees.
- // Example value: "42.5". Read only.
- static const char KEY_VERTICAL_VIEW_ANGLE[];
- // Exposure compensation index. 0 means exposure is not adjusted.
- // Example value: "0" or "5". Read/write.
- static const char KEY_EXPOSURE_COMPENSATION[];
- // The maximum exposure compensation index (>=0).
- // Example value: "6". Read only.
- static const char KEY_MAX_EXPOSURE_COMPENSATION[];
- // The minimum exposure compensation index (<=0).
- // Example value: "-6". Read only.
- static const char KEY_MIN_EXPOSURE_COMPENSATION[];
- // The exposure compensation step. Exposure compensation index multiply by
- // step eqals to EV. Ex: if exposure compensation index is 6 and step is
- // 0.3333, EV is -2.
- // Example value: "0.333333333" or "0.5". Read only.
- static const char KEY_EXPOSURE_COMPENSATION_STEP[];
- // The state of the auto-exposure lock. "true" means that
- // auto-exposure is locked to its current value and will not
- // change. "false" means the auto-exposure routine is free to
- // change exposure values. If auto-exposure is already locked,
- // setting this to true again has no effect (the driver will not
- // recalculate exposure values). Changing exposure compensation
- // settings will still affect the exposure settings while
- // auto-exposure is locked. Stopping preview or taking a still
- // image will not change the lock. In conjunction with
- // exposure compensation, this allows for capturing multi-exposure
- // brackets with known relative exposure values. Locking
- // auto-exposure after open but before the first call to
- // startPreview may result in severely over- or under-exposed
- // images. The driver will not change the AE lock after
- // auto-focus completes.
- static const char KEY_AUTO_EXPOSURE_LOCK[];
- // Whether locking the auto-exposure is supported. "true" means it is, and
- // "false" or this key not existing means it is not supported.
- static const char KEY_AUTO_EXPOSURE_LOCK_SUPPORTED[];
- // The state of the auto-white balance lock. "true" means that
- // auto-white balance is locked to its current value and will not
- // change. "false" means the auto-white balance routine is free to
- // change white balance values. If auto-white balance is already
- // locked, setting this to true again has no effect (the driver
- // will not recalculate white balance values). Stopping preview or
- // taking a still image will not change the lock. In conjunction
- // with exposure compensation, this allows for capturing
- // multi-exposure brackets with fixed white balance. Locking
- // auto-white balance after open but before the first call to
- // startPreview may result in severely incorrect color. The
- // driver will not change the AWB lock after auto-focus
- // completes.
- static const char KEY_AUTO_WHITEBALANCE_LOCK[];
- // Whether locking the auto-white balance is supported. "true"
- // means it is, and "false" or this key not existing means it is
- // not supported.
- static const char KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED[];
-
- // The maximum number of metering areas supported. This is the maximum
- // length of KEY_METERING_AREAS.
- // Example value: "0" or "2". Read only.
- static const char KEY_MAX_NUM_METERING_AREAS[];
- // Current metering areas. Camera driver uses these areas to decide
- // exposure.
- //
- // Before accessing this parameter, apps should check
- // KEY_MAX_NUM_METERING_AREAS first to know the maximum number of metering
- // areas first. If the value is 0, metering area is not supported.
- //
- // Each metering area is a rectangle with specified weight. The direction is
- // relative to the sensor orientation, that is, what the sensor sees. The
- // direction is not affected by the rotation or mirroring of
- // CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates of the rectangle range
- // from -1000 to 1000. (-1000, -1000) is the upper left point. (1000, 1000)
- // is the lower right point. The width and height of metering areas cannot
- // be 0 or negative.
- //
- // The fifth element is the weight. Values for weight must range from 1 to
- // 1000. The weight should be interpreted as a per-pixel weight - all
- // pixels in the area have the specified weight. This means a small area
- // with the same weight as a larger area will have less influence on the
- // metering than the larger area. Metering areas can partially overlap and
- // the driver will add the weights in the overlap region.
- //
- // A special case of all-zero single metering area means driver to decide
- // the metering area. For example, the driver may use more signals to decide
- // metering areas and change them dynamically. Apps can set all-zero if they
- // want the driver to decide metering areas.
- //
- // Metering areas are relative to the current field of view (KEY_ZOOM).
- // No matter what the zoom level is, (-1000,-1000) represents the top of the
- // currently visible camera frame. The metering area cannot be set to be
- // outside the current field of view, even when using zoom.
- //
- // No matter what metering areas are, the final exposure are compensated
- // by KEY_EXPOSURE_COMPENSATION.
- // Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write.
- static const char KEY_METERING_AREAS[];
- // Current zoom value.
- // Example value: "0" or "6". Read/write.
- static const char KEY_ZOOM[];
- // Maximum zoom value.
- // Example value: "6". Read only.
- static const char KEY_MAX_ZOOM[];
- // The zoom ratios of all zoom values. The zoom ratio is in 1/100
- // increments. Ex: a zoom of 3.2x is returned as 320. The number of list
- // elements is KEY_MAX_ZOOM + 1. The first element is always 100. The last
- // element is the zoom ratio of zoom value KEY_MAX_ZOOM.
- // Example value: "100,150,200,250,300,350,400". Read only.
- static const char KEY_ZOOM_RATIOS[];
- // Whether zoom is supported. Zoom is supported if the value is "true". Zoom
- // is not supported if the value is not "true" or the key does not exist.
- // Example value: "true". Read only.
- static const char KEY_ZOOM_SUPPORTED[];
- // Whether if smooth zoom is supported. Smooth zoom is supported if the
- // value is "true". It is not supported if the value is not "true" or the
- // key does not exist.
- // See CAMERA_CMD_START_SMOOTH_ZOOM, CAMERA_CMD_STOP_SMOOTH_ZOOM, and
- // CAMERA_MSG_ZOOM in frameworks/base/include/camera/Camera.h.
- // Example value: "true". Read only.
- static const char KEY_SMOOTH_ZOOM_SUPPORTED[];
-
- // The distances (in meters) from the camera to where an object appears to
- // be in focus. The object is sharpest at the optimal focus distance. The
- // depth of field is the far focus distance minus near focus distance.
- //
- // Focus distances may change after starting auto focus, canceling auto
- // focus, or starting the preview. Applications can read this anytime to get
- // the latest focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS,
- // focus distances may change from time to time.
- //
- // This is intended to estimate the distance between the camera and the
- // subject. After autofocus, the subject distance may be within near and far
- // focus distance. However, the precision depends on the camera hardware,
- // autofocus algorithm, the focus area, and the scene. The error can be
- // large and it should be only used as a reference.
- //
- // Far focus distance > optimal focus distance > near focus distance. If
- // the far focus distance is infinity, the value should be "Infinity" (case
- // sensitive). The format is three float values separated by commas. The
- // first is near focus distance. The second is optimal focus distance. The
- // third is far focus distance.
- // Example value: "0.95,1.9,Infinity" or "0.049,0.05,0.051". Read only.
- static const char KEY_FOCUS_DISTANCES[];
-
- // The current dimensions in pixels (width x height) for video frames.
- // The width and height must be one of the supported sizes retrieved
- // via KEY_SUPPORTED_VIDEO_SIZES.
- // Example value: "1280x720". Read/write.
- static const char KEY_VIDEO_SIZE[];
- // A list of the supported dimensions in pixels (width x height)
- // for video frames. See CAMERA_MSG_VIDEO_FRAME for details in
- // frameworks/base/include/camera/Camera.h.
- // Example: "176x144,1280x720". Read only.
- static const char KEY_SUPPORTED_VIDEO_SIZES[];
-
- // The maximum number of detected faces supported by hardware face
- // detection. If the value is 0, hardware face detection is not supported.
- // Example: "5". Read only
- static const char KEY_MAX_NUM_DETECTED_FACES_HW[];
-
- // The maximum number of detected faces supported by software face
- // detection. If the value is 0, software face detection is not supported.
- // Example: "5". Read only
- static const char KEY_MAX_NUM_DETECTED_FACES_SW[];
-
- // Preferred preview frame size in pixels for video recording.
- // The width and height must be one of the supported sizes retrieved
- // via KEY_SUPPORTED_PREVIEW_SIZES. This key can be used only when
- // getSupportedVideoSizes() does not return an empty Vector of Size.
- // Camcorder applications are recommended to set the preview size
- // to a value that is not larger than the preferred preview size.
- // In other words, the product of the width and height of the
- // preview size should not be larger than that of the preferred
- // preview size. In addition, we recommend to choos a preview size
- // that has the same aspect ratio as the resolution of video to be
- // recorded.
- // Example value: "800x600". Read only.
- static const char KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[];
-
- // The image format for video frames. See CAMERA_MSG_VIDEO_FRAME in
- // frameworks/base/include/camera/Camera.h.
- // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read only.
- static const char KEY_VIDEO_FRAME_FORMAT[];
-
- // Sets the hint of the recording mode. If this is true, MediaRecorder.start
- // may be faster or has less glitches. This should be called before starting
- // the preview for the best result. But it is allowed to change the hint
- // while the preview is active. The default value is false.
- //
- // The apps can still call Camera.takePicture when the hint is true. The
- // apps can call MediaRecorder.start when the hint is false. But the
- // performance may be worse.
- // Example value: "true" or "false". Read/write.
- static const char KEY_RECORDING_HINT[];
-
- // Returns true if video snapshot is supported. That is, applications
- // can call Camera.takePicture during recording. Applications do not need to
- // call Camera.startPreview after taking a picture. The preview will be
- // still active. Other than that, taking a picture during recording is
- // identical to taking a picture normally. All settings and methods related
- // to takePicture work identically. Ex: KEY_PICTURE_SIZE,
- // KEY_SUPPORTED_PICTURE_SIZES, KEY_JPEG_QUALITY, KEY_ROTATION, and etc.
- // The picture will have an EXIF header. FLASH_MODE_AUTO and FLASH_MODE_ON
- // also still work, but the video will record the flash.
- //
- // Applications can set shutter callback as null to avoid the shutter
- // sound. It is also recommended to set raw picture and post view callbacks
- // to null to avoid the interrupt of preview display.
- //
- // Field-of-view of the recorded video may be different from that of the
- // captured pictures.
- // Example value: "true" or "false". Read only.
- static const char KEY_VIDEO_SNAPSHOT_SUPPORTED[];
-
- // The state of the video stabilization. If set to true, both the
- // preview stream and the recorded video stream are stabilized by
- // the camera. Only valid to set if KEY_VIDEO_STABILIZATION_SUPPORTED is
- // set to true.
- //
- // The value of this key can be changed any time the camera is
- // open. If preview or recording is active, it is acceptable for
- // there to be a slight video glitch when video stabilization is
- // toggled on and off.
- //
- // This only stabilizes video streams (between-frames stabilization), and
- // has no effect on still image capture.
- static const char KEY_VIDEO_STABILIZATION[];
-
- // Returns true if video stabilization is supported. That is, applications
- // can set KEY_VIDEO_STABILIZATION to true and have a stabilized preview
- // stream and record stabilized videos.
- static const char KEY_VIDEO_STABILIZATION_SUPPORTED[];
-
- // Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED.
- static const char TRUE[];
- static const char FALSE[];
-
- // Value for KEY_FOCUS_DISTANCES.
- static const char FOCUS_DISTANCE_INFINITY[];
-
- // Values for white balance settings.
- static const char WHITE_BALANCE_AUTO[];
- static const char WHITE_BALANCE_INCANDESCENT[];
- static const char WHITE_BALANCE_FLUORESCENT[];
- static const char WHITE_BALANCE_WARM_FLUORESCENT[];
- static const char WHITE_BALANCE_DAYLIGHT[];
- static const char WHITE_BALANCE_CLOUDY_DAYLIGHT[];
- static const char WHITE_BALANCE_TWILIGHT[];
- static const char WHITE_BALANCE_SHADE[];
-
- // Values for effect settings.
- static const char EFFECT_NONE[];
- static const char EFFECT_MONO[];
- static const char EFFECT_NEGATIVE[];
- static const char EFFECT_SOLARIZE[];
- static const char EFFECT_SEPIA[];
- static const char EFFECT_POSTERIZE[];
- static const char EFFECT_WHITEBOARD[];
- static const char EFFECT_BLACKBOARD[];
- static const char EFFECT_AQUA[];
-
- // Values for antibanding settings.
- static const char ANTIBANDING_AUTO[];
- static const char ANTIBANDING_50HZ[];
- static const char ANTIBANDING_60HZ[];
- static const char ANTIBANDING_OFF[];
-
- // Values for flash mode settings.
- // Flash will not be fired.
- static const char FLASH_MODE_OFF[];
- // Flash will be fired automatically when required. The flash may be fired
- // during preview, auto-focus, or snapshot depending on the driver.
- static const char FLASH_MODE_AUTO[];
- // Flash will always be fired during snapshot. The flash may also be
- // fired during preview or auto-focus depending on the driver.
- static const char FLASH_MODE_ON[];
- // Flash will be fired in red-eye reduction mode.
- static const char FLASH_MODE_RED_EYE[];
- // Constant emission of light during preview, auto-focus and snapshot.
- // This can also be used for video recording.
- static const char FLASH_MODE_TORCH[];
-
- // Values for scene mode settings.
- static const char SCENE_MODE_AUTO[];
- static const char SCENE_MODE_ACTION[];
- static const char SCENE_MODE_PORTRAIT[];
- static const char SCENE_MODE_LANDSCAPE[];
- static const char SCENE_MODE_NIGHT[];
- static const char SCENE_MODE_NIGHT_PORTRAIT[];
- static const char SCENE_MODE_THEATRE[];
- static const char SCENE_MODE_BEACH[];
- static const char SCENE_MODE_SNOW[];
- static const char SCENE_MODE_SUNSET[];
- static const char SCENE_MODE_STEADYPHOTO[];
- static const char SCENE_MODE_FIREWORKS[];
- static const char SCENE_MODE_SPORTS[];
- static const char SCENE_MODE_PARTY[];
- static const char SCENE_MODE_CANDLELIGHT[];
- // Applications are looking for a barcode. Camera driver will be optimized
- // for barcode reading.
- static const char SCENE_MODE_BARCODE[];
-
- // Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT,
- // and KEY_VIDEO_FRAME_FORMAT
- static const char PIXEL_FORMAT_YUV422SP[];
- static const char PIXEL_FORMAT_YUV420SP[]; // NV21
- static const char PIXEL_FORMAT_YUV422I[]; // YUY2
- static const char PIXEL_FORMAT_YUV420P[]; // YV12
- static const char PIXEL_FORMAT_RGB565[];
- static const char PIXEL_FORMAT_RGBA8888[];
- static const char PIXEL_FORMAT_JPEG[];
- // Raw bayer format used for images, which is 10 bit precision samples
- // stored in 16 bit words. The filter pattern is RGGB.
- static const char PIXEL_FORMAT_BAYER_RGGB[];
-
- // Values for focus mode settings.
- // Auto-focus mode. Applications should call
- // CameraHardwareInterface.autoFocus to start the focus in this mode.
- static const char FOCUS_MODE_AUTO[];
- // Focus is set at infinity. Applications should not call
- // CameraHardwareInterface.autoFocus in this mode.
- static const char FOCUS_MODE_INFINITY[];
- // Macro (close-up) focus mode. Applications should call
- // CameraHardwareInterface.autoFocus to start the focus in this mode.
- static const char FOCUS_MODE_MACRO[];
- // Focus is fixed. The camera is always in this mode if the focus is not
- // adjustable. If the camera has auto-focus, this mode can fix the
- // focus, which is usually at hyperfocal distance. Applications should
- // not call CameraHardwareInterface.autoFocus in this mode.
- static const char FOCUS_MODE_FIXED[];
- // Extended depth of field (EDOF). Focusing is done digitally and
- // continuously. Applications should not call
- // CameraHardwareInterface.autoFocus in this mode.
- static const char FOCUS_MODE_EDOF[];
- // Continuous auto focus mode intended for video recording. The camera
- // continuously tries to focus. This is the best choice for video
- // recording because the focus changes smoothly . Applications still can
- // call CameraHardwareInterface.takePicture in this mode but the subject may
- // not be in focus. Auto focus starts when the parameter is set.
- //
- // Applications can call CameraHardwareInterface.autoFocus in this mode. The
- // focus callback will immediately return with a boolean that indicates
- // whether the focus is sharp or not. The focus position is locked after
- // autoFocus call. If applications want to resume the continuous focus,
- // cancelAutoFocus must be called. Restarting the preview will not resume
- // the continuous autofocus. To stop continuous focus, applications should
- // change the focus mode to other modes.
- static const char FOCUS_MODE_CONTINUOUS_VIDEO[];
- // Continuous auto focus mode intended for taking pictures. The camera
- // continuously tries to focus. The speed of focus change is more aggressive
- // than FOCUS_MODE_CONTINUOUS_VIDEO. Auto focus starts when the parameter is
- // set.
- //
- // Applications can call CameraHardwareInterface.autoFocus in this mode. If
- // the autofocus is in the middle of scanning, the focus callback will
- // return when it completes. If the autofocus is not scanning, focus
- // callback will immediately return with a boolean that indicates whether
- // the focus is sharp or not. The apps can then decide if they want to take
- // a picture immediately or to change the focus mode to auto, and run a full
- // autofocus cycle. The focus position is locked after autoFocus call. If
- // applications want to resume the continuous focus, cancelAutoFocus must be
- // called. Restarting the preview will not resume the continuous autofocus.
- // To stop continuous focus, applications should change the focus mode to
- // other modes.
- static const char FOCUS_MODE_CONTINUOUS_PICTURE[];
-
-private:
- DefaultKeyedVector<String8,String8> mMap;
-};
-
-}; // namespace android
-
-#endif
diff --git a/include/camera/ICameraService.h b/include/camera/ICameraService.h
index 7d70c1e..97e3169 100644
--- a/include/camera/ICameraService.h
+++ b/include/camera/ICameraService.h
@@ -42,7 +42,7 @@
virtual status_t getCameraInfo(int cameraId,
struct CameraInfo* cameraInfo) = 0;
virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient,
- int cameraId) = 0;
+ int cameraId, bool force, bool keep) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/include/common_time/local_clock.h b/include/common_time/local_clock.h
index 845d1c21..384c3de 100644
--- a/include/common_time/local_clock.h
+++ b/include/common_time/local_clock.h
@@ -28,7 +28,7 @@
class LocalClock {
public:
- LocalClock();
+ LocalClock();
bool initCheck();
diff --git a/include/cpustats/CentralTendencyStatistics.h b/include/cpustats/CentralTendencyStatistics.h
deleted file mode 100644
index 21b6981..0000000
--- a/include/cpustats/CentralTendencyStatistics.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _CENTRAL_TENDENCY_STATISTICS_H
-#define _CENTRAL_TENDENCY_STATISTICS_H
-
-#include <math.h>
-
-// Not multithread safe
-class CentralTendencyStatistics {
-
-public:
-
- CentralTendencyStatistics() :
- mMean(NAN), mMedian(NAN), mMinimum(INFINITY), mMaximum(-INFINITY), mN(0), mM2(0),
- mVariance(NAN), mVarianceKnownForN(0), mStddev(NAN), mStddevKnownForN(0) { }
-
- ~CentralTendencyStatistics() { }
-
- // add x to the set of samples
- void sample(double x);
-
- // return the arithmetic mean of all samples so far
- double mean() const { return mMean; }
-
- // return the minimum of all samples so far
- double minimum() const { return mMinimum; }
-
- // return the maximum of all samples so far
- double maximum() const { return mMaximum; }
-
- // return the variance of all samples so far
- double variance() const;
-
- // return the standard deviation of all samples so far
- double stddev() const;
-
- // return the number of samples added so far
- unsigned n() const { return mN; }
-
- // reset the set of samples to be empty
- void reset();
-
-private:
- double mMean;
- double mMedian;
- double mMinimum;
- double mMaximum;
- unsigned mN; // number of samples so far
- double mM2;
-
- // cached variance, and n at time of caching
- mutable double mVariance;
- mutable unsigned mVarianceKnownForN;
-
- // cached standard deviation, and n at time of caching
- mutable double mStddev;
- mutable unsigned mStddevKnownForN;
-
-};
-
-#endif // _CENTRAL_TENDENCY_STATISTICS_H
diff --git a/include/cpustats/README.txt b/include/cpustats/README.txt
deleted file mode 100644
index 14439f0..0000000
--- a/include/cpustats/README.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-This is a static library of CPU usage statistics, originally written
-for audio but most are not actually specific to audio.
-
-Requirements to be here:
- * should be related to CPU usage statistics
- * should be portable to host; avoid Android OS dependencies without a conditional
diff --git a/include/cpustats/ThreadCpuUsage.h b/include/cpustats/ThreadCpuUsage.h
deleted file mode 100644
index 24012a4..0000000
--- a/include/cpustats/ThreadCpuUsage.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef _THREAD_CPU_USAGE_H
-#define _THREAD_CPU_USAGE_H
-
-#include <cpustats/CentralTendencyStatistics.h>
-
-// Track CPU usage for the current thread, and maintain statistics on
-// the CPU usage. Units are in per-thread CPU ns, as reported by
-// clock_gettime(CLOCK_THREAD_CPUTIME_ID). Simple usage: for cyclic
-// threads where you want to measure the execution time of the whole
-// cycle, just call sampleAndEnable() at the start of each cycle.
-// Then call statistics() to get the results, and resetStatistics()
-// to start a new set of measurements.
-// For acyclic threads, or for cyclic threads where you want to measure
-// only part of each cycle, call enable(), disable(), and/or setEnabled()
-// to demarcate the region(s) of interest, and then call sample() periodically.
-// This class is not thread-safe for concurrent calls from multiple threads;
-// the methods of this class may only be called by the current thread
-// which constructed the object.
-
-class ThreadCpuUsage
-{
-
-public:
- ThreadCpuUsage() :
- mIsEnabled(false),
- mWasEverEnabled(false),
- mAccumulator(0),
- // mPreviousTs
- // mMonotonicTs
- mMonotonicKnown(false)
- // mStatistics
- { }
-
- ~ThreadCpuUsage() { }
-
- // Return whether currently tracking CPU usage by current thread
- bool isEnabled() { return mIsEnabled; }
-
- // Enable tracking of CPU usage by current thread;
- // any CPU used from this point forward will be tracked.
- // Returns the previous enabled status.
- bool enable() { return setEnabled(true); }
-
- // Disable tracking of CPU usage by current thread;
- // any CPU used from this point forward will be ignored.
- // Returns the previous enabled status.
- bool disable() { return setEnabled(false); }
-
- // Set the enabled status and return the previous enabled status.
- // This method is intended to be used for safe nested enable/disabling.
- bool setEnabled(bool isEnabled);
-
- // Add a sample point for central tendency statistics, and also
- // enable tracking if needed. If tracking has never been enabled, then
- // enables tracking but does not add a sample (it is not possible to add
- // a sample the first time because no previous). Otherwise if tracking is
- // enabled, then adds a sample for tracked CPU ns since the previous
- // sample, or since the first call to sampleAndEnable(), enable(), or
- // setEnabled(true). If there was a previous sample but tracking is
- // now disabled, then adds a sample for the tracked CPU ns accumulated
- // up until the most recent disable(), resets this accumulator, and then
- // enables tracking. Calling this method rather than enable() followed
- // by sample() avoids a race condition for the first sample.
- void sampleAndEnable();
-
- // Add a sample point for central tendency statistics, but do not
- // change the tracking enabled status. If tracking has either never been
- // enabled, or has never been enabled since the last sample, then log a warning
- // and don't add sample. Otherwise, adds a sample for tracked CPU ns since
- // the previous sample or since the first call to sampleAndEnable(),
- // enable(), or setEnabled(true) if no previous sample.
- void sample();
-
- // Return the elapsed delta wall clock ns since initial enable or statistics reset,
- // as reported by clock_gettime(CLOCK_MONOTONIC).
- long long elapsed() const;
-
- // Reset statistics and elapsed. Has no effect on tracking or accumulator.
- void resetStatistics();
-
- // Return a const reference to the central tendency statistics.
- // Note that only the const methods can be called on this object.
- const CentralTendencyStatistics& statistics() const {
- return mStatistics;
- }
-
-private:
- bool mIsEnabled; // whether tracking is currently enabled
- bool mWasEverEnabled; // whether tracking was ever enabled
- long long mAccumulator; // accumulated thread CPU time since last sample, in ns
- struct timespec mPreviousTs; // most recent thread CPU time, valid only if mIsEnabled is true
- struct timespec mMonotonicTs; // most recent monotonic time
- bool mMonotonicKnown; // whether mMonotonicTs has been set
- CentralTendencyStatistics mStatistics;
-};
-
-#endif // _THREAD_CPU_USAGE_H
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index 7df6668..5bfb65b 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -354,7 +354,6 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
audio_io_handle_t input);
audio_io_handle_t getInput_l();
status_t restoreRecord_l(audio_track_cblk_t*& cblk);
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 552e829..7d5d772 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -169,7 +169,7 @@
callback_t cbf = 0,
void* user = 0,
int notificationFrames = 0,
- int sessionId = 0);
+ int sessionId = 0);
/* Creates an audio track and registers it with AudioFlinger. With this constructor,
* the PCM data to be rendered by AudioTrack is passed in a shared memory buffer
@@ -215,7 +215,7 @@
int notificationFrames = 0,
const sp<IMemory>& sharedBuffer = 0,
bool threadCanCallJava = false,
- int sessionId = 0);
+ int sessionId = 0);
/* Result of constructing the AudioTrack. This must be checked
@@ -468,6 +468,7 @@
// body of AudioTrackThread::threadLoop()
bool processAudioBuffer(const sp<AudioTrackThread>& thread);
+
status_t createTrack_l(audio_stream_type_t streamType,
uint32_t sampleRate,
audio_format_t format,
@@ -475,8 +476,7 @@
int frameCount,
audio_policy_output_flags_t flags,
const sp<IMemory>& sharedBuffer,
- audio_io_handle_t output,
- bool enforceFrameCount);
+ audio_io_handle_t output);
void flush_l();
status_t setLoop_l(uint32_t loopStart, uint32_t loopEnd, int loopCount);
audio_io_handle_t getOutput_l();
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 0f39cf3..8239b0e 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -43,6 +43,14 @@
public:
DECLARE_META_INTERFACE(AudioFlinger);
+ // or-able bits shared by createTrack and openRecord, but not all combinations make sense
+ enum {
+ TRACK_DEFAULT = 0, // client requests a default AudioTrack
+ TRACK_TIMED = 1, // client requests a TimedAudioTrack
+ TRACK_FAST = 2, // client requests a fast AudioTrack
+ };
+ typedef uint32_t track_flags_t;
+
/* create an audio track and registers it with AudioFlinger.
* return null if the track cannot be created.
*/
@@ -53,10 +61,9 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
+ track_flags_t flags,
const sp<IMemory>& sharedBuffer,
audio_io_handle_t output,
- bool isTimed,
int *sessionId,
status_t *status) = 0;
@@ -67,7 +74,7 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
+ track_flags_t flags,
int *sessionId,
status_t *status) = 0;
diff --git a/include/media/ICrypto.h b/include/media/ICrypto.h
new file mode 100644
index 0000000..916abe0
--- /dev/null
+++ b/include/media/ICrypto.h
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+#include <binder/IInterface.h>
+#include <media/stagefright/foundation/ABase.h>
+
+#ifndef ANDROID_ICRYPTO_H_
+
+#define ANDROID_ICRYPTO_H_
+
+namespace android {
+
+struct ICrypto : public IInterface {
+ DECLARE_META_INTERFACE(Crypto);
+
+ virtual status_t initialize() = 0;
+ virtual status_t terminate() = 0;
+
+ virtual status_t setEntitlementKey(
+ const void *key, size_t keyLength) = 0;
+
+ virtual status_t setEntitlementControlMessage(
+ const void *msg, size_t msgLength) = 0;
+
+ // "dstData" is in media_server's address space (but inaccessible).
+ virtual ssize_t decryptVideo(
+ const void *iv, size_t ivLength,
+ const void *srcData, size_t srcDataSize,
+ void *dstData, size_t dstDataOffset) = 0;
+
+ // "dstData" is in the calling process' address space.
+ virtual ssize_t decryptAudio(
+ const void *iv, size_t ivLength,
+ const void *srcData, size_t srcDataSize,
+ void *dstData, size_t dstDataSize) = 0;
+
+private:
+ DISALLOW_EVIL_CONSTRUCTORS(ICrypto);
+};
+
+struct BnCrypto : public BnInterface<ICrypto> {
+ virtual status_t onTransact(
+ uint32_t code, const Parcel &data, Parcel *reply,
+ uint32_t flags = 0);
+};
+
+} // namespace android
+
+#endif // ANDROID_ICRYPTO_H_
+
diff --git a/include/media/IMediaPlayerService.h b/include/media/IMediaPlayerService.h
index 4f46fcd..76c45a0 100644
--- a/include/media/IMediaPlayerService.h
+++ b/include/media/IMediaPlayerService.h
@@ -31,6 +31,7 @@
namespace android {
+struct ICrypto;
class IMediaRecorder;
class IOMX;
struct IStreamSource;
@@ -47,6 +48,7 @@
virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0;
virtual sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0;
virtual sp<IOMX> getOMX() = 0;
+ virtual sp<ICrypto> makeCrypto() = 0;
// codecs and audio devices usage tracking for the battery app
enum BatteryDataBits {
diff --git a/include/media/IOMX.h b/include/media/IOMX.h
index a295e9a..be1b2fc 100644
--- a/include/media/IOMX.h
+++ b/include/media/IOMX.h
@@ -26,8 +26,6 @@
#include <OMX_Core.h>
#include <OMX_Video.h>
-#include "jni.h"
-
namespace android {
class IMemory;
diff --git a/include/media/JetPlayer.h b/include/media/JetPlayer.h
index 38a3e44..0616bf0 100644
--- a/include/media/JetPlayer.h
+++ b/include/media/JetPlayer.h
@@ -18,7 +18,6 @@
#define JETPLAYER_H_
#include <utils/threads.h>
-#include <nativehelper/jni.h>
#include <libsonivox/jet.h>
#include <libsonivox/eas_types.h>
@@ -40,7 +39,7 @@
static const int JET_NUMQUEUEDSEGMENT_UPDATE = 3;
static const int JET_PAUSE_UPDATE = 4;
- JetPlayer(jobject javaJetPlayer,
+ JetPlayer(void *javaJetPlayer,
int maxTracks = 32,
int trackBufferSize = 1200);
~JetPlayer();
@@ -75,7 +74,7 @@
jetevent_callback mEventCallback;
- jobject mJavaJetPlayerRef;
+ void* mJavaJetPlayerRef;
Mutex mMutex; // mutex to sync the render and playback thread with the JET calls
pid_t mTid;
Condition mCondition;
diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h
index 662dd13af..a68ab4e 100644
--- a/include/media/mediaplayer.h
+++ b/include/media/mediaplayer.h
@@ -120,6 +120,9 @@
MEDIA_INFO_NOT_SEEKABLE = 801,
// New media metadata is available.
MEDIA_INFO_METADATA_UPDATE = 802,
+
+ //9xx
+ MEDIA_INFO_TIMED_TEXT_ERROR = 900,
};
@@ -140,9 +143,6 @@
// The same enum space is used for both set and get, in case there are future keys that
// can be both set and get. But as of now, all parameters are either set only or get only.
enum media_parameter_keys {
- KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX = 1000, // set only
- KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE = 1001, // set only
-
// Streaming/buffering parameters
KEY_PARAMETER_CACHE_STAT_COLLECT_FREQ_MS = 1100, // set only
@@ -155,6 +155,23 @@
KEY_PARAMETER_PLAYBACK_RATE_PERMILLE = 1300, // set only
};
+// Keep INVOKE_ID_* in sync with MediaPlayer.java.
+enum media_player_invoke_ids {
+ INVOKE_ID_GET_TRACK_INFO = 1,
+ INVOKE_ID_ADD_EXTERNAL_SOURCE = 2,
+ INVOKE_ID_ADD_EXTERNAL_SOURCE_FD = 3,
+ INVOKE_ID_SELECT_TRACK = 4,
+ INVOKE_ID_UNSELECT_TRACK = 5,
+};
+
+// Keep MEDIA_TRACK_TYPE_* in sync with MediaPlayer.java.
+enum media_track_type {
+ MEDIA_TRACK_TYPE_UNKNOWN = 0,
+ MEDIA_TRACK_TYPE_VIDEO = 1,
+ MEDIA_TRACK_TYPE_AUDIO = 2,
+ MEDIA_TRACK_TYPE_TIMEDTEXT = 3,
+};
+
// ----------------------------------------------------------------------------
// ref-counted object for callbacks
class MediaPlayerListener: virtual public RefBase
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index fa1a416..7d7af63 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -89,6 +89,10 @@
kPortIndexOutput = 1
};
+ enum {
+ kFlagIsSecure = 1,
+ };
+
struct BufferInfo {
enum Status {
OWNED_BY_US,
@@ -118,6 +122,7 @@
sp<FlushingState> mFlushingState;
AString mComponentName;
+ uint32_t mFlags;
uint32_t mQuirks;
sp<IOMX> mOMX;
IOMX::node_id mNode;
@@ -176,7 +181,8 @@
status_t setupAACCodec(
bool encoder,
- int32_t numChannels, int32_t sampleRate, int32_t bitRate);
+ int32_t numChannels, int32_t sampleRate, int32_t bitRate,
+ bool isADTS);
status_t selectAudioPortFormat(
OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE desiredFormat);
diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h
index 72ac56a..0fc88e1 100644
--- a/include/media/stagefright/MediaCodec.h
+++ b/include/media/stagefright/MediaCodec.h
@@ -27,18 +27,21 @@
struct ABuffer;
struct ACodec;
struct AMessage;
+struct ICrypto;
struct SoftwareRenderer;
struct SurfaceTextureClient;
struct MediaCodec : public AHandler {
enum ConfigureFlags {
CONFIGURE_FLAG_ENCODE = 1,
+ CONFIGURE_FLAG_SECURE = 2,
};
enum BufferFlags {
BUFFER_FLAG_SYNCFRAME = 1,
BUFFER_FLAG_CODECCONFIG = 2,
BUFFER_FLAG_EOS = 4,
+ BUFFER_FLAG_ENCRYPTED = 8,
};
static sp<MediaCodec> CreateByType(
@@ -137,11 +140,13 @@
kFlagStickyError = 8,
kFlagDequeueInputPending = 16,
kFlagDequeueOutputPending = 32,
+ kFlagIsSecure = 64,
};
struct BufferInfo {
void *mBufferID;
sp<ABuffer> mData;
+ sp<ABuffer> mEncryptedData;
sp<AMessage> mNotify;
bool mOwnedByClient;
};
@@ -165,6 +170,8 @@
int32_t mDequeueOutputTimeoutGeneration;
uint32_t mDequeueOutputReplyID;
+ sp<ICrypto> mCrypto;
+
MediaCodec(const sp<ALooper> &looper);
static status_t PostAndAwaitResponse(
diff --git a/include/media/stagefright/MediaDefs.h b/include/media/stagefright/MediaDefs.h
index 2eb259e..457d5d7 100644
--- a/include/media/stagefright/MediaDefs.h
+++ b/include/media/stagefright/MediaDefs.h
@@ -54,6 +54,7 @@
extern const char *MEDIA_MIMETYPE_CONTAINER_WVM;
extern const char *MEDIA_MIMETYPE_TEXT_3GPP;
+extern const char *MEDIA_MIMETYPE_TEXT_SUBRIP;
} // namespace android
diff --git a/include/media/stagefright/MetaData.h b/include/media/stagefright/MetaData.h
index 8b4b8ed..639446e 100644
--- a/include/media/stagefright/MetaData.h
+++ b/include/media/stagefright/MetaData.h
@@ -24,6 +24,7 @@
#include <utils/RefBase.h>
#include <utils/KeyedVector.h>
+#include <utils/String8.h>
namespace android {
@@ -70,6 +71,8 @@
kKeyThumbnailTime = 'thbT', // int64_t (usecs)
kKeyTrackID = 'trID',
kKeyIsDRM = 'idrm', // int32_t (bool)
+ kKeyEncoderDelay = 'encd', // int32_t (frames)
+ kKeyEncoderPadding = 'encp', // int32_t (frames)
kKeyAlbum = 'albu', // cstring
kKeyArtist = 'arti', // cstring
@@ -125,6 +128,12 @@
kKeyTextFormatData = 'text', // raw data
kKeyRequiresSecureBuffers = 'secu', // bool (int32_t)
+
+ kKeyScrambling = 'scrm', // int32_t
+ kKeyEMM = 'emm ', // raw data
+ kKeyECM = 'ecm ', // raw data
+
+ kKeyIsADTS = 'adts', // bool (int32_t)
};
enum {
@@ -178,6 +187,8 @@
bool findData(uint32_t key, uint32_t *type,
const void **data, size_t *size) const;
+ void dumpToLog() const;
+
protected:
virtual ~MetaData();
@@ -192,6 +203,7 @@
void clear();
void setData(uint32_t type, const void *data, size_t size);
void getData(uint32_t *type, const void **data, size_t *size) const;
+ String8 asString() const;
private:
uint32_t mType;
diff --git a/include/media/stagefright/NuMediaExtractor.h b/include/media/stagefright/NuMediaExtractor.h
index 96efdff..07c7be5 100644
--- a/include/media/stagefright/NuMediaExtractor.h
+++ b/include/media/stagefright/NuMediaExtractor.h
@@ -31,6 +31,11 @@
struct MediaSource;
struct NuMediaExtractor : public RefBase {
+ enum SampleFlags {
+ SAMPLE_FLAG_SYNC = 1,
+ SAMPLE_FLAG_ENCRYPTED = 2,
+ };
+
NuMediaExtractor();
status_t setDataSource(const char *path);
@@ -46,6 +51,7 @@
status_t readSampleData(const sp<ABuffer> &buffer);
status_t getSampleTrackIndex(size_t *trackIndex);
status_t getSampleTime(int64_t *sampleTimeUs);
+ status_t getSampleFlags(uint32_t *sampleFlags);
protected:
virtual ~NuMediaExtractor();
@@ -61,7 +67,9 @@
status_t mFinalResult;
MediaBuffer *mSample;
int64_t mSampleTimeUs;
- uint32_t mFlags; // bitmask of "TrackFlags"
+ uint32_t mSampleFlags;
+
+ uint32_t mTrackFlags; // bitmask of "TrackFlags"
};
sp<MediaExtractor> mImpl;
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h
index 392ea87..7d51dee 100644
--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -30,6 +30,7 @@
class MemoryDealer;
struct OMXCodecObserver;
struct CodecProfileLevel;
+class SkipCutBuffer;
struct OMXCodec : public MediaSource,
public MediaBufferObserver {
@@ -201,6 +202,7 @@
ReadOptions::SeekMode mSeekMode;
int64_t mTargetTimeUs;
bool mOutputPortSettingsChangedPending;
+ SkipCutBuffer *mSkipCutBuffer;
MediaBuffer *mLeftOverBuffer;
@@ -236,7 +238,11 @@
void setComponentRole();
void setAMRFormat(bool isWAMR, int32_t bitRate);
- status_t setAACFormat(int32_t numChannels, int32_t sampleRate, int32_t bitRate);
+
+ status_t setAACFormat(
+ int32_t numChannels, int32_t sampleRate, int32_t bitRate,
+ bool isADTS);
+
void setG711Format(int32_t numChannels);
status_t setVideoPortFormatType(
@@ -378,6 +384,7 @@
const char *mimeType, bool queryDecoders,
Vector<CodecCapabilities> *results);
+
} // namespace android
#endif // OMX_CODEC_H_
diff --git a/include/media/stagefright/SkipCutBuffer.h b/include/media/stagefright/SkipCutBuffer.h
new file mode 100644
index 0000000..5c7cd47
--- /dev/null
+++ b/include/media/stagefright/SkipCutBuffer.h
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+#ifndef SKIP_CUT_BUFFER_H_
+
+#define SKIP_CUT_BUFFER_H_
+
+#include <media/stagefright/MediaBuffer.h>
+
+namespace android {
+
+/**
+ * utility class to cut the start and end off a stream of data in MediaBuffers
+ *
+ */
+class SkipCutBuffer {
+ public:
+ // 'skip' is the number of bytes to skip from the beginning
+ // 'cut' is the number of bytes to cut from the end
+ // 'output_size' is the size in bytes of the MediaBuffers that will be used
+ SkipCutBuffer(int32_t skip, int32_t cut, int32_t output_size);
+ virtual ~SkipCutBuffer();
+
+ // Submit one MediaBuffer for skipping and cutting. This may consume all or
+ // some of the data in the buffer, or it may add data to it.
+ // After this, the caller should continue processing the buffer as usual.
+ void submit(MediaBuffer *buffer);
+ void clear();
+ size_t size(); // how many bytes are currently stored in the buffer
+
+ private:
+ void write(const char *src, size_t num);
+ size_t read(char *dst, size_t num);
+ int32_t mFrontPadding;
+ int32_t mBackPadding;
+ int32_t mWriteHead;
+ int32_t mReadHead;
+ int32_t mCapacity;
+ char* mCutBuffer;
+ DISALLOW_EVIL_CONSTRUCTORS(SkipCutBuffer);
+};
+
+} // namespace android
+
+#endif // OMX_CODEC_H_
diff --git a/include/media/stagefright/SurfaceMediaSource.h b/include/media/stagefright/SurfaceMediaSource.h
index 54baab6..936b057 100644
--- a/include/media/stagefright/SurfaceMediaSource.h
+++ b/include/media/stagefright/SurfaceMediaSource.h
@@ -111,7 +111,7 @@
// Make sure this is called when the mutex is locked
virtual status_t onFrameReceivedLocked();
- virtual status_t setScalingMode(int mode) { } // no op for encoding
+ virtual status_t setScalingMode(int mode) { return OK; } // no op for encoding
virtual int query(int what, int* value);
// Just confirming to the ISurfaceTexture interface as of now
diff --git a/include/media/stagefright/foundation/AString.h b/include/media/stagefright/foundation/AString.h
index 55ade64..0f8f1e1 100644
--- a/include/media/stagefright/foundation/AString.h
+++ b/include/media/stagefright/foundation/AString.h
@@ -73,6 +73,7 @@
int compare(const AString &other) const;
bool startsWith(const char *prefix) const;
+ bool endsWith(const char *suffix) const;
void tolower();
diff --git a/include/media/stagefright/timedtext/TimedTextDriver.h b/include/media/stagefright/timedtext/TimedTextDriver.h
index efedb6e..b9752df 100644
--- a/include/media/stagefright/timedtext/TimedTextDriver.h
+++ b/include/media/stagefright/timedtext/TimedTextDriver.h
@@ -37,26 +37,26 @@
~TimedTextDriver();
- // TODO: pause-resume pair seems equivalent to stop-start pair.
- // Check if it is replaceable with stop-start.
status_t start();
- status_t stop();
status_t pause();
- status_t resume();
+ status_t selectTrack(int32_t index);
+ status_t unselectTrack(int32_t index);
status_t seekToAsync(int64_t timeUs);
status_t addInBandTextSource(const sp<MediaSource>& source);
- status_t addOutOfBandTextSource(const Parcel &request);
+ status_t addOutOfBandTextSource(const char *uri, const char *mimeType);
+ // Caller owns the file desriptor and caller is responsible for closing it.
+ status_t addOutOfBandTextSource(
+ int fd, off64_t offset, size_t length, const char *mimeType);
- status_t setTimedTextTrackIndex(int32_t index);
+ void getTrackInfo(Parcel *parcel);
private:
Mutex mLock;
enum State {
UNINITIALIZED,
- STOPPED,
PLAYING,
PAUSED,
};
@@ -67,11 +67,11 @@
// Variables to be guarded by mLock.
State mState;
- Vector<sp<TimedTextSource> > mTextInBandVector;
- Vector<sp<TimedTextSource> > mTextOutOfBandVector;
+ int32_t mCurrentTrackIndex;
+ Vector<sp<TimedTextSource> > mTextSourceVector;
// -- End of variables to be guarded by mLock
- status_t setTimedTextTrackIndex_l(int32_t index);
+ status_t selectTrack_l(int32_t index);
DISALLOW_EVIL_CONSTRUCTORS(TimedTextDriver);
};
diff --git a/keystore/java/android/security/KeyChain.java b/keystore/java/android/security/KeyChain.java
index fba5bab..fe03437 100644
--- a/keystore/java/android/security/KeyChain.java
+++ b/keystore/java/android/security/KeyChain.java
@@ -169,7 +169,6 @@
/**
- * @hide TODO This is temporary and will be removed
* Broadcast Action: Indicates the trusted storage has changed. Sent when
* one of this happens:
*
diff --git a/libs/androidfw/Android.mk b/libs/androidfw/Android.mk
index 4e89d87..a3f92cb 100644
--- a/libs/androidfw/Android.mk
+++ b/libs/androidfw/Android.mk
@@ -24,10 +24,7 @@
AssetManager.cpp \
ObbFile.cpp \
ResourceTypes.cpp \
- StreamingZipInflater.cpp \
- ZipFileCRO.cpp \
- ZipFileRO.cpp \
- ZipUtils.cpp
+ StreamingZipInflater.cpp
# formerly in libui
commonUiSources:= \
diff --git a/libs/androidfw/Asset.cpp b/libs/androidfw/Asset.cpp
index cb7628d..fd5b3e4 100644
--- a/libs/androidfw/Asset.cpp
+++ b/libs/androidfw/Asset.cpp
@@ -23,11 +23,11 @@
#include <androidfw/Asset.h>
#include <androidfw/StreamingZipInflater.h>
-#include <androidfw/ZipFileRO.h>
-#include <androidfw/ZipUtils.h>
#include <utils/Atomic.h>
#include <utils/FileMap.h>
#include <utils/Log.h>
+#include <utils/ZipFileRO.h>
+#include <utils/ZipUtils.h>
#include <utils/threads.h>
#include <assert.h>
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index 4829add..8d59d8e 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -25,13 +25,13 @@
#include <androidfw/AssetDir.h>
#include <androidfw/AssetManager.h>
#include <androidfw/ResourceTypes.h>
-#include <androidfw/ZipFileRO.h>
#include <utils/Atomic.h>
#include <utils/Log.h>
#include <utils/String8.h>
#include <utils/String8.h>
#include <utils/threads.h>
#include <utils/Timers.h>
+#include <utils/ZipFileRO.h>
#include <assert.h>
#include <dirent.h>
diff --git a/libs/androidfw/ZipFileCRO.cpp b/libs/androidfw/ZipFileCRO.cpp
deleted file mode 100644
index c8df845..0000000
--- a/libs/androidfw/ZipFileCRO.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#include <androidfw/ZipFileCRO.h>
-#include <androidfw/ZipFileRO.h>
-
-using namespace android;
-
-ZipFileCRO ZipFileXRO_open(const char* path) {
- ZipFileRO* zip = new ZipFileRO();
- if (zip->open(path) == NO_ERROR) {
- return (ZipFileCRO)zip;
- }
- return NULL;
-}
-
-void ZipFileCRO_destroy(ZipFileCRO zipToken) {
- ZipFileRO* zip = (ZipFileRO*)zipToken;
- delete zip;
-}
-
-ZipEntryCRO ZipFileCRO_findEntryByName(ZipFileCRO zipToken,
- const char* fileName) {
- ZipFileRO* zip = (ZipFileRO*)zipToken;
- return (ZipEntryCRO)zip->findEntryByName(fileName);
-}
-
-bool ZipFileCRO_getEntryInfo(ZipFileCRO zipToken, ZipEntryRO entryToken,
- int* pMethod, size_t* pUncompLen,
- size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32) {
- ZipFileRO* zip = (ZipFileRO*)zipToken;
- ZipEntryRO entry = (ZipEntryRO)entryToken;
- return zip->getEntryInfo(entry, pMethod, pUncompLen, pCompLen, pOffset,
- pModWhen, pCrc32);
-}
-
-bool ZipFileCRO_uncompressEntry(ZipFileCRO zipToken, ZipEntryRO entryToken, int fd) {
- ZipFileRO* zip = (ZipFileRO*)zipToken;
- ZipEntryRO entry = (ZipEntryRO)entryToken;
- return zip->uncompressEntry(entry, fd);
-}
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp
deleted file mode 100644
index 4b7f1e7..0000000
--- a/libs/androidfw/ZipFileRO.cpp
+++ /dev/null
@@ -1,931 +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.
- */
-
-//
-// Read-only access to Zip archives, with minimal heap allocation.
-//
-#define LOG_TAG "zipro"
-//#define LOG_NDEBUG 0
-#include <androidfw/ZipFileRO.h>
-#include <utils/Log.h>
-#include <utils/misc.h>
-#include <utils/threads.h>
-
-#include <zlib.h>
-
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <assert.h>
-#include <unistd.h>
-
-#if HAVE_PRINTF_ZD
-# define ZD "%zd"
-# define ZD_TYPE ssize_t
-#else
-# define ZD "%ld"
-# define ZD_TYPE long
-#endif
-
-/*
- * We must open binary files using open(path, ... | O_BINARY) under Windows.
- * Otherwise strange read errors will happen.
- */
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
-
-/*
- * TEMP_FAILURE_RETRY is defined by some, but not all, versions of
- * <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's
- * not already defined, then define it here.
- */
-#ifndef TEMP_FAILURE_RETRY
-/* Used to retry syscalls that can return EINTR. */
-#define TEMP_FAILURE_RETRY(exp) ({ \
- typeof (exp) _rc; \
- do { \
- _rc = (exp); \
- } while (_rc == -1 && errno == EINTR); \
- _rc; })
-#endif
-
-using namespace android;
-
-/*
- * Zip file constants.
- */
-#define kEOCDSignature 0x06054b50
-#define kEOCDLen 22
-#define kEOCDNumEntries 8 // offset to #of entries in file
-#define kEOCDSize 12 // size of the central directory
-#define kEOCDFileOffset 16 // offset to central directory
-
-#define kMaxCommentLen 65535 // longest possible in ushort
-#define kMaxEOCDSearch (kMaxCommentLen + kEOCDLen)
-
-#define kLFHSignature 0x04034b50
-#define kLFHLen 30 // excluding variable-len fields
-#define kLFHNameLen 26 // offset to filename length
-#define kLFHExtraLen 28 // offset to extra length
-
-#define kCDESignature 0x02014b50
-#define kCDELen 46 // excluding variable-len fields
-#define kCDEMethod 10 // offset to compression method
-#define kCDEModWhen 12 // offset to modification timestamp
-#define kCDECRC 16 // offset to entry CRC
-#define kCDECompLen 20 // offset to compressed length
-#define kCDEUncompLen 24 // offset to uncompressed length
-#define kCDENameLen 28 // offset to filename length
-#define kCDEExtraLen 30 // offset to extra length
-#define kCDECommentLen 32 // offset to comment length
-#define kCDELocalOffset 42 // offset to local hdr
-
-/*
- * The values we return for ZipEntryRO use 0 as an invalid value, so we
- * want to adjust the hash table index by a fixed amount. Using a large
- * value helps insure that people don't mix & match arguments, e.g. to
- * findEntryByIndex().
- */
-#define kZipEntryAdj 10000
-
-ZipFileRO::~ZipFileRO() {
- free(mHashTable);
- if (mDirectoryMap)
- mDirectoryMap->release();
- if (mFd >= 0)
- TEMP_FAILURE_RETRY(close(mFd));
- if (mFileName)
- free(mFileName);
-}
-
-/*
- * Convert a ZipEntryRO to a hash table index, verifying that it's in a
- * valid range.
- */
-int ZipFileRO::entryToIndex(const ZipEntryRO entry) const
-{
- long ent = ((long) entry) - kZipEntryAdj;
- if (ent < 0 || ent >= mHashTableSize || mHashTable[ent].name == NULL) {
- ALOGW("Invalid ZipEntryRO %p (%ld)\n", entry, ent);
- return -1;
- }
- return ent;
-}
-
-
-/*
- * Open the specified file read-only. We memory-map the entire thing and
- * close the file before returning.
- */
-status_t ZipFileRO::open(const char* zipFileName)
-{
- int fd = -1;
-
- assert(mDirectoryMap == NULL);
-
- /*
- * Open and map the specified file.
- */
- fd = ::open(zipFileName, O_RDONLY | O_BINARY);
- if (fd < 0) {
- ALOGW("Unable to open zip '%s': %s\n", zipFileName, strerror(errno));
- return NAME_NOT_FOUND;
- }
-
- mFileLength = lseek64(fd, 0, SEEK_END);
- if (mFileLength < kEOCDLen) {
- TEMP_FAILURE_RETRY(close(fd));
- return UNKNOWN_ERROR;
- }
-
- if (mFileName != NULL) {
- free(mFileName);
- }
- mFileName = strdup(zipFileName);
-
- mFd = fd;
-
- /*
- * Find the Central Directory and store its size and number of entries.
- */
- if (!mapCentralDirectory()) {
- goto bail;
- }
-
- /*
- * Verify Central Directory and create data structures for fast access.
- */
- if (!parseZipArchive()) {
- goto bail;
- }
-
- return OK;
-
-bail:
- free(mFileName);
- mFileName = NULL;
- TEMP_FAILURE_RETRY(close(fd));
- return UNKNOWN_ERROR;
-}
-
-/*
- * Parse the Zip archive, verifying its contents and initializing internal
- * data structures.
- */
-bool ZipFileRO::mapCentralDirectory(void)
-{
- ssize_t readAmount = kMaxEOCDSearch;
- if (readAmount > (ssize_t) mFileLength)
- readAmount = mFileLength;
-
- unsigned char* scanBuf = (unsigned char*) malloc(readAmount);
- if (scanBuf == NULL) {
- ALOGW("couldn't allocate scanBuf: %s", strerror(errno));
- free(scanBuf);
- return false;
- }
-
- /*
- * Make sure this is a Zip archive.
- */
- if (lseek64(mFd, 0, SEEK_SET) != 0) {
- ALOGW("seek to start failed: %s", strerror(errno));
- free(scanBuf);
- return false;
- }
-
- ssize_t actual = TEMP_FAILURE_RETRY(read(mFd, scanBuf, sizeof(int32_t)));
- if (actual != (ssize_t) sizeof(int32_t)) {
- ALOGI("couldn't read first signature from zip archive: %s", strerror(errno));
- free(scanBuf);
- return false;
- }
-
- {
- unsigned int header = get4LE(scanBuf);
- if (header == kEOCDSignature) {
- ALOGI("Found Zip archive, but it looks empty\n");
- free(scanBuf);
- return false;
- } else if (header != kLFHSignature) {
- ALOGV("Not a Zip archive (found 0x%08x)\n", header);
- free(scanBuf);
- return false;
- }
- }
-
- /*
- * Perform the traditional EOCD snipe hunt.
- *
- * We're searching for the End of Central Directory magic number,
- * which appears at the start of the EOCD block. It's followed by
- * 18 bytes of EOCD stuff and up to 64KB of archive comment. We
- * need to read the last part of the file into a buffer, dig through
- * it to find the magic number, parse some values out, and use those
- * to determine the extent of the CD.
- *
- * We start by pulling in the last part of the file.
- */
- off64_t searchStart = mFileLength - readAmount;
-
- if (lseek64(mFd, searchStart, SEEK_SET) != searchStart) {
- ALOGW("seek %ld failed: %s\n", (long) searchStart, strerror(errno));
- free(scanBuf);
- return false;
- }
- actual = TEMP_FAILURE_RETRY(read(mFd, scanBuf, readAmount));
- if (actual != (ssize_t) readAmount) {
- ALOGW("Zip: read " ZD ", expected " ZD ". Failed: %s\n",
- (ZD_TYPE) actual, (ZD_TYPE) readAmount, strerror(errno));
- free(scanBuf);
- return false;
- }
-
- /*
- * Scan backward for the EOCD magic. In an archive without a trailing
- * comment, we'll find it on the first try. (We may want to consider
- * doing an initial minimal read; if we don't find it, retry with a
- * second read as above.)
- */
- int i;
- for (i = readAmount - kEOCDLen; i >= 0; i--) {
- if (scanBuf[i] == 0x50 && get4LE(&scanBuf[i]) == kEOCDSignature) {
- ALOGV("+++ Found EOCD at buf+%d\n", i);
- break;
- }
- }
- if (i < 0) {
- ALOGD("Zip: EOCD not found, %s is not zip\n", mFileName);
- free(scanBuf);
- return false;
- }
-
- off64_t eocdOffset = searchStart + i;
- const unsigned char* eocdPtr = scanBuf + i;
-
- assert(eocdOffset < mFileLength);
-
- /*
- * Grab the CD offset and size, and the number of entries in the
- * archive. After that, we can release our EOCD hunt buffer.
- */
- unsigned int numEntries = get2LE(eocdPtr + kEOCDNumEntries);
- unsigned int dirSize = get4LE(eocdPtr + kEOCDSize);
- unsigned int dirOffset = get4LE(eocdPtr + kEOCDFileOffset);
- free(scanBuf);
-
- // Verify that they look reasonable.
- if ((long long) dirOffset + (long long) dirSize > (long long) eocdOffset) {
- ALOGW("bad offsets (dir %ld, size %u, eocd %ld)\n",
- (long) dirOffset, dirSize, (long) eocdOffset);
- return false;
- }
- if (numEntries == 0) {
- ALOGW("empty archive?\n");
- return false;
- }
-
- ALOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n",
- numEntries, dirSize, dirOffset);
-
- mDirectoryMap = new FileMap();
- if (mDirectoryMap == NULL) {
- ALOGW("Unable to create directory map: %s", strerror(errno));
- return false;
- }
-
- if (!mDirectoryMap->create(mFileName, mFd, dirOffset, dirSize, true)) {
- ALOGW("Unable to map '%s' (" ZD " to " ZD "): %s\n", mFileName,
- (ZD_TYPE) dirOffset, (ZD_TYPE) (dirOffset + dirSize), strerror(errno));
- return false;
- }
-
- mNumEntries = numEntries;
- mDirectoryOffset = dirOffset;
-
- return true;
-}
-
-bool ZipFileRO::parseZipArchive(void)
-{
- bool result = false;
- const unsigned char* cdPtr = (const unsigned char*) mDirectoryMap->getDataPtr();
- size_t cdLength = mDirectoryMap->getDataLength();
- int numEntries = mNumEntries;
-
- /*
- * Create hash table. We have a minimum 75% load factor, possibly as
- * low as 50% after we round off to a power of 2.
- */
- mHashTableSize = roundUpPower2(1 + (numEntries * 4) / 3);
- mHashTable = (HashEntry*) calloc(mHashTableSize, sizeof(HashEntry));
-
- /*
- * Walk through the central directory, adding entries to the hash
- * table.
- */
- const unsigned char* ptr = cdPtr;
- for (int i = 0; i < numEntries; i++) {
- if (get4LE(ptr) != kCDESignature) {
- ALOGW("Missed a central dir sig (at %d)\n", i);
- goto bail;
- }
- if (ptr + kCDELen > cdPtr + cdLength) {
- ALOGW("Ran off the end (at %d)\n", i);
- goto bail;
- }
-
- long localHdrOffset = (long) get4LE(ptr + kCDELocalOffset);
- if (localHdrOffset >= mDirectoryOffset) {
- ALOGW("bad LFH offset %ld at entry %d\n", localHdrOffset, i);
- goto bail;
- }
-
- unsigned int fileNameLen, extraLen, commentLen, hash;
-
- fileNameLen = get2LE(ptr + kCDENameLen);
- extraLen = get2LE(ptr + kCDEExtraLen);
- commentLen = get2LE(ptr + kCDECommentLen);
-
- /* add the CDE filename to the hash table */
- hash = computeHash((const char*)ptr + kCDELen, fileNameLen);
- addToHash((const char*)ptr + kCDELen, fileNameLen, hash);
-
- ptr += kCDELen + fileNameLen + extraLen + commentLen;
- if ((size_t)(ptr - cdPtr) > cdLength) {
- ALOGW("bad CD advance (%d vs " ZD ") at entry %d\n",
- (int) (ptr - cdPtr), (ZD_TYPE) cdLength, i);
- goto bail;
- }
- }
- ALOGV("+++ zip good scan %d entries\n", numEntries);
- result = true;
-
-bail:
- return result;
-}
-
-/*
- * Simple string hash function for non-null-terminated strings.
- */
-/*static*/ unsigned int ZipFileRO::computeHash(const char* str, int len)
-{
- unsigned int hash = 0;
-
- while (len--)
- hash = hash * 31 + *str++;
-
- return hash;
-}
-
-/*
- * Add a new entry to the hash table.
- */
-void ZipFileRO::addToHash(const char* str, int strLen, unsigned int hash)
-{
- int ent = hash & (mHashTableSize-1);
-
- /*
- * We over-allocate the table, so we're guaranteed to find an empty slot.
- */
- while (mHashTable[ent].name != NULL)
- ent = (ent + 1) & (mHashTableSize-1);
-
- mHashTable[ent].name = str;
- mHashTable[ent].nameLen = strLen;
-}
-
-/*
- * Find a matching entry.
- *
- * Returns NULL if not found.
- */
-ZipEntryRO ZipFileRO::findEntryByName(const char* fileName) const
-{
- /*
- * If the ZipFileRO instance is not initialized, the entry number will
- * end up being garbage since mHashTableSize is -1.
- */
- if (mHashTableSize <= 0) {
- return NULL;
- }
-
- int nameLen = strlen(fileName);
- unsigned int hash = computeHash(fileName, nameLen);
- int ent = hash & (mHashTableSize-1);
-
- while (mHashTable[ent].name != NULL) {
- if (mHashTable[ent].nameLen == nameLen &&
- memcmp(mHashTable[ent].name, fileName, nameLen) == 0)
- {
- /* match */
- return (ZipEntryRO)(long)(ent + kZipEntryAdj);
- }
-
- ent = (ent + 1) & (mHashTableSize-1);
- }
-
- return NULL;
-}
-
-/*
- * Find the Nth entry.
- *
- * This currently involves walking through the sparse hash table, counting
- * non-empty entries. If we need to speed this up we can either allocate
- * a parallel lookup table or (perhaps better) provide an iterator interface.
- */
-ZipEntryRO ZipFileRO::findEntryByIndex(int idx) const
-{
- if (idx < 0 || idx >= mNumEntries) {
- ALOGW("Invalid index %d\n", idx);
- return NULL;
- }
-
- for (int ent = 0; ent < mHashTableSize; ent++) {
- if (mHashTable[ent].name != NULL) {
- if (idx-- == 0)
- return (ZipEntryRO) (ent + kZipEntryAdj);
- }
- }
-
- return NULL;
-}
-
-/*
- * Get the useful fields from the zip entry.
- *
- * Returns "false" if the offsets to the fields or the contents of the fields
- * appear to be bogus.
- */
-bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen,
- size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32) const
-{
- bool ret = false;
-
- const int ent = entryToIndex(entry);
- if (ent < 0)
- return false;
-
- HashEntry hashEntry = mHashTable[ent];
-
- /*
- * Recover the start of the central directory entry from the filename
- * pointer. The filename is the first entry past the fixed-size data,
- * so we can just subtract back from that.
- */
- const unsigned char* ptr = (const unsigned char*) hashEntry.name;
- off64_t cdOffset = mDirectoryOffset;
-
- ptr -= kCDELen;
-
- int method = get2LE(ptr + kCDEMethod);
- if (pMethod != NULL)
- *pMethod = method;
-
- if (pModWhen != NULL)
- *pModWhen = get4LE(ptr + kCDEModWhen);
- if (pCrc32 != NULL)
- *pCrc32 = get4LE(ptr + kCDECRC);
-
- size_t compLen = get4LE(ptr + kCDECompLen);
- if (pCompLen != NULL)
- *pCompLen = compLen;
- size_t uncompLen = get4LE(ptr + kCDEUncompLen);
- if (pUncompLen != NULL)
- *pUncompLen = uncompLen;
-
- /*
- * If requested, determine the offset of the start of the data. All we
- * have is the offset to the Local File Header, which is variable size,
- * so we have to read the contents of the struct to figure out where
- * the actual data starts.
- *
- * We also need to make sure that the lengths are not so large that
- * somebody trying to map the compressed or uncompressed data runs
- * off the end of the mapped region.
- *
- * Note we don't verify compLen/uncompLen if they don't request the
- * dataOffset, because dataOffset is expensive to determine. However,
- * if they don't have the file offset, they're not likely to be doing
- * anything with the contents.
- */
- if (pOffset != NULL) {
- long localHdrOffset = get4LE(ptr + kCDELocalOffset);
- if (localHdrOffset + kLFHLen >= cdOffset) {
- ALOGE("ERROR: bad local hdr offset in zip\n");
- return false;
- }
-
- unsigned char lfhBuf[kLFHLen];
-
-#ifdef HAVE_PREAD
- /*
- * This file descriptor might be from zygote's preloaded assets,
- * so we need to do an pread64() instead of a lseek64() + read() to
- * guarantee atomicity across the processes with the shared file
- * descriptors.
- */
- ssize_t actual =
- TEMP_FAILURE_RETRY(pread64(mFd, lfhBuf, sizeof(lfhBuf), localHdrOffset));
-
- if (actual != sizeof(lfhBuf)) {
- ALOGW("failed reading lfh from offset %ld\n", localHdrOffset);
- return false;
- }
-
- if (get4LE(lfhBuf) != kLFHSignature) {
- ALOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; "
- "got: data=0x%08lx\n",
- localHdrOffset, kLFHSignature, get4LE(lfhBuf));
- return false;
- }
-#else /* HAVE_PREAD */
- /*
- * For hosts don't have pread64() we cannot guarantee atomic reads from
- * an offset in a file. Android should never run on those platforms.
- * File descriptors inherited from a fork() share file offsets and
- * there would be nothing to protect from two different processes
- * calling lseek64() concurrently.
- */
-
- {
- AutoMutex _l(mFdLock);
-
- if (lseek64(mFd, localHdrOffset, SEEK_SET) != localHdrOffset) {
- ALOGW("failed seeking to lfh at offset %ld\n", localHdrOffset);
- return false;
- }
-
- ssize_t actual =
- TEMP_FAILURE_RETRY(read(mFd, lfhBuf, sizeof(lfhBuf)));
- if (actual != sizeof(lfhBuf)) {
- ALOGW("failed reading lfh from offset %ld\n", localHdrOffset);
- return false;
- }
-
- if (get4LE(lfhBuf) != kLFHSignature) {
- off64_t actualOffset = lseek64(mFd, 0, SEEK_CUR);
- ALOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; "
- "got: offset=" ZD " data=0x%08lx\n",
- localHdrOffset, kLFHSignature, (ZD_TYPE) actualOffset, get4LE(lfhBuf));
- return false;
- }
- }
-#endif /* HAVE_PREAD */
-
- off64_t dataOffset = localHdrOffset + kLFHLen
- + get2LE(lfhBuf + kLFHNameLen) + get2LE(lfhBuf + kLFHExtraLen);
- if (dataOffset >= cdOffset) {
- ALOGW("bad data offset %ld in zip\n", (long) dataOffset);
- return false;
- }
-
- /* check lengths */
- if ((off64_t)(dataOffset + compLen) > cdOffset) {
- ALOGW("bad compressed length in zip (%ld + " ZD " > %ld)\n",
- (long) dataOffset, (ZD_TYPE) compLen, (long) cdOffset);
- return false;
- }
-
- if (method == kCompressStored &&
- (off64_t)(dataOffset + uncompLen) > cdOffset)
- {
- ALOGE("ERROR: bad uncompressed length in zip (%ld + " ZD " > %ld)\n",
- (long) dataOffset, (ZD_TYPE) uncompLen, (long) cdOffset);
- return false;
- }
-
- *pOffset = dataOffset;
- }
-
- return true;
-}
-
-/*
- * Copy the entry's filename to the buffer.
- */
-int ZipFileRO::getEntryFileName(ZipEntryRO entry, char* buffer, int bufLen)
- const
-{
- int ent = entryToIndex(entry);
- if (ent < 0)
- return -1;
-
- int nameLen = mHashTable[ent].nameLen;
- if (bufLen < nameLen+1)
- return nameLen+1;
-
- memcpy(buffer, mHashTable[ent].name, nameLen);
- buffer[nameLen] = '\0';
- return 0;
-}
-
-/*
- * Create a new FileMap object that spans the data in "entry".
- */
-FileMap* ZipFileRO::createEntryFileMap(ZipEntryRO entry) const
-{
- /*
- * TODO: the efficient way to do this is to modify FileMap to allow
- * sub-regions of a file to be mapped. A reference-counting scheme
- * can manage the base memory mapping. For now, we just create a brand
- * new mapping off of the Zip archive file descriptor.
- */
-
- FileMap* newMap;
- size_t compLen;
- off64_t offset;
-
- if (!getEntryInfo(entry, NULL, NULL, &compLen, &offset, NULL, NULL))
- return NULL;
-
- newMap = new FileMap();
- if (!newMap->create(mFileName, mFd, offset, compLen, true)) {
- newMap->release();
- return NULL;
- }
-
- return newMap;
-}
-
-/*
- * Uncompress an entry, in its entirety, into the provided output buffer.
- *
- * This doesn't verify the data's CRC, which might be useful for
- * uncompressed data. The caller should be able to manage it.
- */
-bool ZipFileRO::uncompressEntry(ZipEntryRO entry, void* buffer) const
-{
- const size_t kSequentialMin = 32768;
- bool result = false;
- int ent = entryToIndex(entry);
- if (ent < 0)
- return -1;
-
- int method;
- size_t uncompLen, compLen;
- off64_t offset;
- const unsigned char* ptr;
-
- getEntryInfo(entry, &method, &uncompLen, &compLen, &offset, NULL, NULL);
-
- FileMap* file = createEntryFileMap(entry);
- if (file == NULL) {
- goto bail;
- }
-
- ptr = (const unsigned char*) file->getDataPtr();
-
- /*
- * Experiment with madvise hint. When we want to uncompress a file,
- * we pull some stuff out of the central dir entry and then hit a
- * bunch of compressed or uncompressed data sequentially. The CDE
- * visit will cause a limited amount of read-ahead because it's at
- * the end of the file. We could end up doing lots of extra disk
- * access if the file we're prying open is small. Bottom line is we
- * probably don't want to turn MADV_SEQUENTIAL on and leave it on.
- *
- * So, if the compressed size of the file is above a certain minimum
- * size, temporarily boost the read-ahead in the hope that the extra
- * pair of system calls are negated by a reduction in page faults.
- */
- if (compLen > kSequentialMin)
- file->advise(FileMap::SEQUENTIAL);
-
- if (method == kCompressStored) {
- memcpy(buffer, ptr, uncompLen);
- } else {
- if (!inflateBuffer(buffer, ptr, uncompLen, compLen))
- goto unmap;
- }
-
- if (compLen > kSequentialMin)
- file->advise(FileMap::NORMAL);
-
- result = true;
-
-unmap:
- file->release();
-bail:
- return result;
-}
-
-/*
- * Uncompress an entry, in its entirety, to an open file descriptor.
- *
- * This doesn't verify the data's CRC, but probably should.
- */
-bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const
-{
- bool result = false;
- int ent = entryToIndex(entry);
- if (ent < 0)
- return -1;
-
- int method;
- size_t uncompLen, compLen;
- off64_t offset;
- const unsigned char* ptr;
-
- getEntryInfo(entry, &method, &uncompLen, &compLen, &offset, NULL, NULL);
-
- FileMap* file = createEntryFileMap(entry);
- if (file == NULL) {
- goto bail;
- }
-
- ptr = (const unsigned char*) file->getDataPtr();
-
- if (method == kCompressStored) {
- ssize_t actual = write(fd, ptr, uncompLen);
- if (actual < 0) {
- ALOGE("Write failed: %s\n", strerror(errno));
- goto unmap;
- } else if ((size_t) actual != uncompLen) {
- ALOGE("Partial write during uncompress (" ZD " of " ZD ")\n",
- (ZD_TYPE) actual, (ZD_TYPE) uncompLen);
- goto unmap;
- } else {
- ALOGI("+++ successful write\n");
- }
- } else {
- if (!inflateBuffer(fd, ptr, uncompLen, compLen))
- goto unmap;
- }
-
- result = true;
-
-unmap:
- file->release();
-bail:
- return result;
-}
-
-/*
- * Uncompress "deflate" data from one buffer to another.
- */
-/*static*/ bool ZipFileRO::inflateBuffer(void* outBuf, const void* inBuf,
- size_t uncompLen, size_t compLen)
-{
- bool result = false;
- z_stream zstream;
- int zerr;
-
- /*
- * Initialize the zlib stream struct.
- */
- memset(&zstream, 0, sizeof(zstream));
- zstream.zalloc = Z_NULL;
- zstream.zfree = Z_NULL;
- zstream.opaque = Z_NULL;
- zstream.next_in = (Bytef*)inBuf;
- zstream.avail_in = compLen;
- zstream.next_out = (Bytef*) outBuf;
- zstream.avail_out = uncompLen;
- zstream.data_type = Z_UNKNOWN;
-
- /*
- * Use the undocumented "negative window bits" feature to tell zlib
- * that there's no zlib header waiting for it.
- */
- zerr = inflateInit2(&zstream, -MAX_WBITS);
- if (zerr != Z_OK) {
- if (zerr == Z_VERSION_ERROR) {
- ALOGE("Installed zlib is not compatible with linked version (%s)\n",
- ZLIB_VERSION);
- } else {
- ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr);
- }
- goto bail;
- }
-
- /*
- * Expand data.
- */
- zerr = inflate(&zstream, Z_FINISH);
- if (zerr != Z_STREAM_END) {
- ALOGW("Zip inflate failed, zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n",
- zerr, zstream.next_in, zstream.avail_in,
- zstream.next_out, zstream.avail_out);
- goto z_bail;
- }
-
- /* paranoia */
- if (zstream.total_out != uncompLen) {
- ALOGW("Size mismatch on inflated file (%ld vs " ZD ")\n",
- zstream.total_out, (ZD_TYPE) uncompLen);
- goto z_bail;
- }
-
- result = true;
-
-z_bail:
- inflateEnd(&zstream); /* free up any allocated structures */
-
-bail:
- return result;
-}
-
-/*
- * Uncompress "deflate" data from one buffer to an open file descriptor.
- */
-/*static*/ bool ZipFileRO::inflateBuffer(int fd, const void* inBuf,
- size_t uncompLen, size_t compLen)
-{
- bool result = false;
- const size_t kWriteBufSize = 32768;
- unsigned char writeBuf[kWriteBufSize];
- z_stream zstream;
- int zerr;
-
- /*
- * Initialize the zlib stream struct.
- */
- memset(&zstream, 0, sizeof(zstream));
- zstream.zalloc = Z_NULL;
- zstream.zfree = Z_NULL;
- zstream.opaque = Z_NULL;
- zstream.next_in = (Bytef*)inBuf;
- zstream.avail_in = compLen;
- zstream.next_out = (Bytef*) writeBuf;
- zstream.avail_out = sizeof(writeBuf);
- zstream.data_type = Z_UNKNOWN;
-
- /*
- * Use the undocumented "negative window bits" feature to tell zlib
- * that there's no zlib header waiting for it.
- */
- zerr = inflateInit2(&zstream, -MAX_WBITS);
- if (zerr != Z_OK) {
- if (zerr == Z_VERSION_ERROR) {
- ALOGE("Installed zlib is not compatible with linked version (%s)\n",
- ZLIB_VERSION);
- } else {
- ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr);
- }
- goto bail;
- }
-
- /*
- * Loop while we have more to do.
- */
- do {
- /*
- * Expand data.
- */
- zerr = inflate(&zstream, Z_NO_FLUSH);
- if (zerr != Z_OK && zerr != Z_STREAM_END) {
- ALOGW("zlib inflate: zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n",
- zerr, zstream.next_in, zstream.avail_in,
- zstream.next_out, zstream.avail_out);
- goto z_bail;
- }
-
- /* write when we're full or when we're done */
- if (zstream.avail_out == 0 ||
- (zerr == Z_STREAM_END && zstream.avail_out != sizeof(writeBuf)))
- {
- long writeSize = zstream.next_out - writeBuf;
- int cc = write(fd, writeBuf, writeSize);
- if (cc != (int) writeSize) {
- ALOGW("write failed in inflate (%d vs %ld)\n", cc, writeSize);
- goto z_bail;
- }
-
- zstream.next_out = writeBuf;
- zstream.avail_out = sizeof(writeBuf);
- }
- } while (zerr == Z_OK);
-
- assert(zerr == Z_STREAM_END); /* other errors should've been caught */
-
- /* paranoia */
- if (zstream.total_out != uncompLen) {
- ALOGW("Size mismatch on inflated file (%ld vs " ZD ")\n",
- zstream.total_out, (ZD_TYPE) uncompLen);
- goto z_bail;
- }
-
- result = true;
-
-z_bail:
- inflateEnd(&zstream); /* free up any allocated structures */
-
-bail:
- return result;
-}
diff --git a/libs/androidfw/ZipUtils.cpp b/libs/androidfw/ZipUtils.cpp
deleted file mode 100644
index db3479d..0000000
--- a/libs/androidfw/ZipUtils.cpp
+++ /dev/null
@@ -1,343 +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.
- */
-
-//
-// Misc zip/gzip utility functions.
-//
-
-#define LOG_TAG "ziputil"
-
-#include <androidfw/ZipUtils.h>
-#include <androidfw/ZipFileRO.h>
-#include <utils/Log.h>
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#include <zlib.h>
-
-using namespace android;
-
-/*
- * Utility function that expands zip/gzip "deflate" compressed data
- * into a buffer.
- *
- * "fd" is an open file positioned at the start of the "deflate" data
- * "buf" must hold at least "uncompressedLen" bytes.
- */
-/*static*/ bool ZipUtils::inflateToBuffer(int fd, void* buf,
- long uncompressedLen, long compressedLen)
-{
- bool result = false;
- const unsigned long kReadBufSize = 32768;
- unsigned char* readBuf = NULL;
- z_stream zstream;
- int zerr;
- unsigned long compRemaining;
-
- assert(uncompressedLen >= 0);
- assert(compressedLen >= 0);
-
- readBuf = new unsigned char[kReadBufSize];
- if (readBuf == NULL)
- goto bail;
- compRemaining = compressedLen;
-
- /*
- * Initialize the zlib stream.
- */
- memset(&zstream, 0, sizeof(zstream));
- zstream.zalloc = Z_NULL;
- zstream.zfree = Z_NULL;
- zstream.opaque = Z_NULL;
- zstream.next_in = NULL;
- zstream.avail_in = 0;
- zstream.next_out = (Bytef*) buf;
- zstream.avail_out = uncompressedLen;
- zstream.data_type = Z_UNKNOWN;
-
- /*
- * Use the undocumented "negative window bits" feature to tell zlib
- * that there's no zlib header waiting for it.
- */
- zerr = inflateInit2(&zstream, -MAX_WBITS);
- if (zerr != Z_OK) {
- if (zerr == Z_VERSION_ERROR) {
- ALOGE("Installed zlib is not compatible with linked version (%s)\n",
- ZLIB_VERSION);
- } else {
- ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr);
- }
- goto bail;
- }
-
- /*
- * Loop while we have data.
- */
- do {
- unsigned long getSize;
-
- /* read as much as we can */
- if (zstream.avail_in == 0) {
- getSize = (compRemaining > kReadBufSize) ?
- kReadBufSize : compRemaining;
- ALOGV("+++ reading %ld bytes (%ld left)\n",
- getSize, compRemaining);
-
- int cc = read(fd, readBuf, getSize);
- if (cc != (int) getSize) {
- ALOGD("inflate read failed (%d vs %ld)\n",
- cc, getSize);
- goto z_bail;
- }
-
- compRemaining -= getSize;
-
- zstream.next_in = readBuf;
- zstream.avail_in = getSize;
- }
-
- /* uncompress the data */
- zerr = inflate(&zstream, Z_NO_FLUSH);
- if (zerr != Z_OK && zerr != Z_STREAM_END) {
- ALOGD("zlib inflate call failed (zerr=%d)\n", zerr);
- goto z_bail;
- }
-
- /* output buffer holds all, so no need to write the output */
- } while (zerr == Z_OK);
-
- assert(zerr == Z_STREAM_END); /* other errors should've been caught */
-
- if ((long) zstream.total_out != uncompressedLen) {
- ALOGW("Size mismatch on inflated file (%ld vs %ld)\n",
- zstream.total_out, uncompressedLen);
- goto z_bail;
- }
-
- // success!
- result = true;
-
-z_bail:
- inflateEnd(&zstream); /* free up any allocated structures */
-
-bail:
- delete[] readBuf;
- return result;
-}
-
-/*
- * Utility function that expands zip/gzip "deflate" compressed data
- * into a buffer.
- *
- * (This is a clone of the previous function, but it takes a FILE* instead
- * of an fd. We could pass fileno(fd) to the above, but we can run into
- * trouble when "fp" has a different notion of what fd's file position is.)
- *
- * "fp" is an open file positioned at the start of the "deflate" data
- * "buf" must hold at least "uncompressedLen" bytes.
- */
-/*static*/ bool ZipUtils::inflateToBuffer(FILE* fp, void* buf,
- long uncompressedLen, long compressedLen)
-{
- bool result = false;
- const unsigned long kReadBufSize = 32768;
- unsigned char* readBuf = NULL;
- z_stream zstream;
- int zerr;
- unsigned long compRemaining;
-
- assert(uncompressedLen >= 0);
- assert(compressedLen >= 0);
-
- readBuf = new unsigned char[kReadBufSize];
- if (readBuf == NULL)
- goto bail;
- compRemaining = compressedLen;
-
- /*
- * Initialize the zlib stream.
- */
- memset(&zstream, 0, sizeof(zstream));
- zstream.zalloc = Z_NULL;
- zstream.zfree = Z_NULL;
- zstream.opaque = Z_NULL;
- zstream.next_in = NULL;
- zstream.avail_in = 0;
- zstream.next_out = (Bytef*) buf;
- zstream.avail_out = uncompressedLen;
- zstream.data_type = Z_UNKNOWN;
-
- /*
- * Use the undocumented "negative window bits" feature to tell zlib
- * that there's no zlib header waiting for it.
- */
- zerr = inflateInit2(&zstream, -MAX_WBITS);
- if (zerr != Z_OK) {
- if (zerr == Z_VERSION_ERROR) {
- ALOGE("Installed zlib is not compatible with linked version (%s)\n",
- ZLIB_VERSION);
- } else {
- ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr);
- }
- goto bail;
- }
-
- /*
- * Loop while we have data.
- */
- do {
- unsigned long getSize;
-
- /* read as much as we can */
- if (zstream.avail_in == 0) {
- getSize = (compRemaining > kReadBufSize) ?
- kReadBufSize : compRemaining;
- ALOGV("+++ reading %ld bytes (%ld left)\n",
- getSize, compRemaining);
-
- int cc = fread(readBuf, 1, getSize, fp);
- if (cc != (int) getSize) {
- ALOGD("inflate read failed (%d vs %ld)\n",
- cc, getSize);
- goto z_bail;
- }
-
- compRemaining -= getSize;
-
- zstream.next_in = readBuf;
- zstream.avail_in = getSize;
- }
-
- /* uncompress the data */
- zerr = inflate(&zstream, Z_NO_FLUSH);
- if (zerr != Z_OK && zerr != Z_STREAM_END) {
- ALOGD("zlib inflate call failed (zerr=%d)\n", zerr);
- goto z_bail;
- }
-
- /* output buffer holds all, so no need to write the output */
- } while (zerr == Z_OK);
-
- assert(zerr == Z_STREAM_END); /* other errors should've been caught */
-
- if ((long) zstream.total_out != uncompressedLen) {
- ALOGW("Size mismatch on inflated file (%ld vs %ld)\n",
- zstream.total_out, uncompressedLen);
- goto z_bail;
- }
-
- // success!
- result = true;
-
-z_bail:
- inflateEnd(&zstream); /* free up any allocated structures */
-
-bail:
- delete[] readBuf;
- return result;
-}
-
-/*
- * Look at the contents of a gzip archive. We want to know where the
- * data starts, and how long it will be after it is uncompressed.
- *
- * We expect to find the CRC and length as the last 8 bytes on the file.
- * This is a pretty reasonable thing to expect for locally-compressed
- * files, but there's a small chance that some extra padding got thrown
- * on (the man page talks about compressed data written to tape). We
- * don't currently deal with that here. If "gzip -l" whines, we're going
- * to fail too.
- *
- * On exit, "fp" is pointing at the start of the compressed data.
- */
-/*static*/ bool ZipUtils::examineGzip(FILE* fp, int* pCompressionMethod,
- long* pUncompressedLen, long* pCompressedLen, unsigned long* pCRC32)
-{
- enum { // flags
- FTEXT = 0x01,
- FHCRC = 0x02,
- FEXTRA = 0x04,
- FNAME = 0x08,
- FCOMMENT = 0x10,
- };
- int ic;
- int method, flags;
- int i;
-
- ic = getc(fp);
- if (ic != 0x1f || getc(fp) != 0x8b)
- return false; // not gzip
- method = getc(fp);
- flags = getc(fp);
-
- /* quick sanity checks */
- if (method == EOF || flags == EOF)
- return false;
- if (method != ZipFileRO::kCompressDeflated)
- return false;
-
- /* skip over 4 bytes of mod time, 1 byte XFL, 1 byte OS */
- for (i = 0; i < 6; i++)
- (void) getc(fp);
- /* consume "extra" field, if present */
- if ((flags & FEXTRA) != 0) {
- int len;
-
- len = getc(fp);
- len |= getc(fp) << 8;
- while (len-- && getc(fp) != EOF)
- ;
- }
- /* consume filename, if present */
- if ((flags & FNAME) != 0) {
- do {
- ic = getc(fp);
- } while (ic != 0 && ic != EOF);
- }
- /* consume comment, if present */
- if ((flags & FCOMMENT) != 0) {
- do {
- ic = getc(fp);
- } while (ic != 0 && ic != EOF);
- }
- /* consume 16-bit header CRC, if present */
- if ((flags & FHCRC) != 0) {
- (void) getc(fp);
- (void) getc(fp);
- }
-
- if (feof(fp) || ferror(fp))
- return false;
-
- /* seek to the end; CRC and length are in the last 8 bytes */
- long curPosn = ftell(fp);
- unsigned char buf[8];
- fseek(fp, -8, SEEK_END);
- *pCompressedLen = ftell(fp) - curPosn;
-
- if (fread(buf, 1, 8, fp) != 8)
- return false;
- /* seek back to start of compressed data */
- fseek(fp, curPosn, SEEK_SET);
-
- *pCompressionMethod = method;
- *pCRC32 = ZipFileRO::get4LE(&buf[0]);
- *pUncompressedLen = ZipFileRO::get4LE(&buf[4]);
-
- return true;
-}
diff --git a/libs/androidfw/tests/Android.mk b/libs/androidfw/tests/Android.mk
index d85009b..39009b8 100644
--- a/libs/androidfw/tests/Android.mk
+++ b/libs/androidfw/tests/Android.mk
@@ -7,8 +7,7 @@
InputChannel_test.cpp \
InputEvent_test.cpp \
InputPublisherAndConsumer_test.cpp \
- ObbFile_test.cpp \
- ZipFileRO_test.cpp
+ ObbFile_test.cpp
shared_libraries := \
libandroidfw \
diff --git a/libs/androidfw/tests/ZipFileRO_test.cpp b/libs/androidfw/tests/ZipFileRO_test.cpp
deleted file mode 100644
index 344f974..0000000
--- a/libs/androidfw/tests/ZipFileRO_test.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.
- */
-
-#define LOG_TAG "ZipFileRO_test"
-#include <androidfw/ZipFileRO.h>
-#include <utils/Log.h>
-
-#include <gtest/gtest.h>
-
-#include <fcntl.h>
-#include <string.h>
-
-namespace android {
-
-class ZipFileROTest : public testing::Test {
-protected:
- virtual void SetUp() {
- }
-
- virtual void TearDown() {
- }
-};
-
-TEST_F(ZipFileROTest, ZipTimeConvertSuccess) {
- struct tm t;
-
- // 2011-06-29 14:40:40
- long when = 0x3EDD7514;
-
- ZipFileRO::zipTimeToTimespec(when, &t);
-
- EXPECT_EQ(2011, t.tm_year + 1900)
- << "Year was improperly converted.";
-
- EXPECT_EQ(6, t.tm_mon)
- << "Month was improperly converted.";
-
- EXPECT_EQ(29, t.tm_mday)
- << "Day was improperly converted.";
-
- EXPECT_EQ(14, t.tm_hour)
- << "Hour was improperly converted.";
-
- EXPECT_EQ(40, t.tm_min)
- << "Minute was improperly converted.";
-
- EXPECT_EQ(40, t.tm_sec)
- << "Second was improperly converted.";
-}
-
-}
diff --git a/libs/camera/Camera.cpp b/libs/camera/Camera.cpp
index d43cb0b..b81fe86 100644
--- a/libs/camera/Camera.cpp
+++ b/libs/camera/Camera.cpp
@@ -116,13 +116,13 @@
return cs->getCameraInfo(cameraId, cameraInfo);
}
-sp<Camera> Camera::connect(int cameraId)
+sp<Camera> Camera::connect(int cameraId, bool force, bool keep)
{
ALOGV("connect");
sp<Camera> c = new Camera();
const sp<ICameraService>& cs = getCameraService();
if (cs != 0) {
- c->mCamera = cs->connect(c, cameraId);
+ c->mCamera = cs->connect(c, cameraId, force, keep);
}
if (c->mCamera != 0) {
c->mCamera->asBinder()->linkToDeath(c);
diff --git a/libs/camera/ICameraService.cpp b/libs/camera/ICameraService.cpp
index 85f1a29..c74298a 100644
--- a/libs/camera/ICameraService.cpp
+++ b/libs/camera/ICameraService.cpp
@@ -56,12 +56,15 @@
}
// connect to camera service
- virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId)
+ virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId,
+ bool force, bool keep)
{
Parcel data, reply;
data.writeInterfaceToken(ICameraService::getInterfaceDescriptor());
data.writeStrongBinder(cameraClient->asBinder());
data.writeInt32(cameraId);
+ data.writeInt32(force);
+ data.writeInt32(keep);
remote()->transact(BnCameraService::CONNECT, data, &reply);
return interface_cast<ICamera>(reply.readStrongBinder());
}
@@ -93,7 +96,10 @@
case CONNECT: {
CHECK_INTERFACE(ICameraService, data, reply);
sp<ICameraClient> cameraClient = interface_cast<ICameraClient>(data.readStrongBinder());
- sp<ICamera> camera = connect(cameraClient, data.readInt32());
+ const int cameraId = data.readInt32();
+ const int force = data.readInt32();
+ const int keep = data.readInt32();
+ sp<ICamera> camera = connect(cameraClient, cameraId, force, keep);
reply->writeStrongBinder(camera->asBinder());
return NO_ERROR;
} break;
@@ -105,4 +111,3 @@
// ----------------------------------------------------------------------------
}; // namespace android
-
diff --git a/libs/cpustats/Android.mk b/libs/cpustats/Android.mk
deleted file mode 100644
index 21bacbb..0000000
--- a/libs/cpustats/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- CentralTendencyStatistics.cpp \
- ThreadCpuUsage.cpp
-
-LOCAL_MODULE := libcpustats
-
-include $(BUILD_STATIC_LIBRARY)
-
-#include $(CLEAR_VARS)
-#
-#LOCAL_SRC_FILES := \
-# CentralTendencyStatistics.cpp \
-# ThreadCpuUsage.cpp
-#
-#LOCAL_MODULE := libcpustats
-#
-#include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/libs/cpustats/CentralTendencyStatistics.cpp b/libs/cpustats/CentralTendencyStatistics.cpp
deleted file mode 100644
index 42ab62b..0000000
--- a/libs/cpustats/CentralTendencyStatistics.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdlib.h>
-
-#include <cpustats/CentralTendencyStatistics.h>
-
-void CentralTendencyStatistics::sample(double x)
-{
- // update min and max
- if (x < mMinimum)
- mMinimum = x;
- if (x > mMaximum)
- mMaximum = x;
- // Knuth
- if (mN == 0) {
- mMean = 0;
- }
- ++mN;
- double delta = x - mMean;
- mMean += delta / mN;
- mM2 += delta * (x - mMean);
-}
-
-void CentralTendencyStatistics::reset()
-{
- mMean = NAN;
- mMedian = NAN;
- mMinimum = INFINITY;
- mMaximum = -INFINITY;
- mN = 0;
- mM2 = 0;
- mVariance = NAN;
- mVarianceKnownForN = 0;
- mStddev = NAN;
- mStddevKnownForN = 0;
-}
-
-double CentralTendencyStatistics::variance() const
-{
- double variance;
- if (mVarianceKnownForN != mN) {
- if (mN > 1) {
- // double variance_n = M2/n;
- variance = mM2 / (mN - 1);
- } else {
- variance = NAN;
- }
- mVariance = variance;
- mVarianceKnownForN = mN;
- } else {
- variance = mVariance;
- }
- return variance;
-}
-
-double CentralTendencyStatistics::stddev() const
-{
- double stddev;
- if (mStddevKnownForN != mN) {
- stddev = sqrt(variance());
- mStddev = stddev;
- mStddevKnownForN = mN;
- } else {
- stddev = mStddev;
- }
- return stddev;
-}
diff --git a/libs/cpustats/ThreadCpuUsage.cpp b/libs/cpustats/ThreadCpuUsage.cpp
deleted file mode 100644
index ffee039..0000000
--- a/libs/cpustats/ThreadCpuUsage.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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.
- */
-
-#include <errno.h>
-#include <time.h>
-
-#include <utils/Log.h>
-
-#include <cpustats/ThreadCpuUsage.h>
-
-bool ThreadCpuUsage::setEnabled(bool isEnabled)
-{
- bool wasEnabled = mIsEnabled;
- // only do something if there is a change
- if (isEnabled != wasEnabled) {
- int rc;
- // enabling
- if (isEnabled) {
- rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &mPreviousTs);
- if (rc) {
- ALOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno);
- isEnabled = false;
- } else {
- mWasEverEnabled = true;
- // record wall clock time at first enable
- if (!mMonotonicKnown) {
- rc = clock_gettime(CLOCK_MONOTONIC, &mMonotonicTs);
- if (rc) {
- ALOGE("clock_gettime(CLOCK_MONOTONIC) errno=%d", errno);
- } else {
- mMonotonicKnown = true;
- }
- }
- }
- // disabling
- } else {
- struct timespec ts;
- rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
- if (rc) {
- ALOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno);
- } else {
- long long delta = (ts.tv_sec - mPreviousTs.tv_sec) * 1000000000LL +
- (ts.tv_nsec - mPreviousTs.tv_nsec);
- mAccumulator += delta;
-#if 0
- mPreviousTs = ts;
-#endif
- }
- }
- mIsEnabled = isEnabled;
- }
- return wasEnabled;
-}
-
-void ThreadCpuUsage::sampleAndEnable()
-{
- bool wasEverEnabled = mWasEverEnabled;
- if (enable()) {
- // already enabled, so add a new sample relative to previous
- sample();
- } else if (wasEverEnabled) {
- // was disabled, but add sample for accumulated time while enabled
- mStatistics.sample((double) mAccumulator);
- mAccumulator = 0;
- }
-}
-
-void ThreadCpuUsage::sample()
-{
- if (mWasEverEnabled) {
- if (mIsEnabled) {
- struct timespec ts;
- int rc;
- rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
- if (rc) {
- ALOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno);
- } else {
- long long delta = (ts.tv_sec - mPreviousTs.tv_sec) * 1000000000LL +
- (ts.tv_nsec - mPreviousTs.tv_nsec);
- mAccumulator += delta;
- mPreviousTs = ts;
- }
- } else {
- mWasEverEnabled = false;
- }
- mStatistics.sample((double) mAccumulator);
- mAccumulator = 0;
- } else {
- ALOGW("Can't add sample because measurements have never been enabled");
- }
-}
-
-long long ThreadCpuUsage::elapsed() const
-{
- long long elapsed;
- if (mMonotonicKnown) {
- struct timespec ts;
- int rc;
- rc = clock_gettime(CLOCK_MONOTONIC, &ts);
- if (rc) {
- ALOGE("clock_gettime(CLOCK_MONOTONIC) errno=%d", errno);
- elapsed = 0;
- } else {
- // mMonotonicTs is updated only at first enable and resetStatistics
- elapsed = (ts.tv_sec - mMonotonicTs.tv_sec) * 1000000000LL +
- (ts.tv_nsec - mMonotonicTs.tv_nsec);
- }
- } else {
- ALOGW("Can't compute elapsed time because measurements have never been enabled");
- elapsed = 0;
- }
- return elapsed;
-}
-
-void ThreadCpuUsage::resetStatistics()
-{
- mStatistics.reset();
- if (mMonotonicKnown) {
- int rc;
- rc = clock_gettime(CLOCK_MONOTONIC, &mMonotonicTs);
- if (rc) {
- ALOGE("clock_gettime(CLOCK_MONOTONIC) errno=%d", errno);
- mMonotonicKnown = false;
- }
- }
-}
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index a884d8e..118608d 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -671,18 +671,6 @@
if (mLeft != 0 || mTop != 0) {
ALOGD("%s%s %d, %d", indent, "Translate", mLeft, mTop);
}
- if (mAlpha < 1) {
- // TODO: should be able to store the size of a DL at record time and not
- // have to pass it into this call. In fact, this information might be in the
- // location/size info that we store with the new native transform data.
- int flags = SkCanvas::kHasAlphaLayer_SaveFlag;
- if (mClipChildren) {
- flags |= SkCanvas::kClipToLayer_SaveFlag;
- }
- ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha",
- (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop,
- mMultipliedAlpha, flags);
- }
if (mMatrixFlags != 0) {
if (mMatrixFlags == TRANSLATION) {
ALOGD("%s%s %f, %f", indent, "Translate", mTranslationX, mTranslationY);
@@ -696,6 +684,18 @@
mTransformMatrix->get(8));
}
}
+ if (mAlpha < 1) {
+ // TODO: should be able to store the size of a DL at record time and not
+ // have to pass it into this call. In fact, this information might be in the
+ // location/size info that we store with the new native transform data.
+ int flags = SkCanvas::kHasAlphaLayer_SaveFlag;
+ if (mClipChildren) {
+ flags |= SkCanvas::kClipToLayer_SaveFlag;
+ }
+ ALOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha",
+ (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop,
+ mMultipliedAlpha, flags);
+ }
if (mClipChildren) {
ALOGD("%s%s %.2f, %.2f, %.2f, %.2f", indent, "ClipRect", 0.0f, 0.0f,
(float) mRight - mLeft, (float) mBottom - mTop);
@@ -724,20 +724,6 @@
mApplicationScale, mApplicationScale);
renderer.scale(mApplicationScale, mApplicationScale);
}
- if (mAlpha < 1 && !mCaching) {
- // TODO: should be able to store the size of a DL at record time and not
- // have to pass it into this call. In fact, this information might be in the
- // location/size info that we store with the new native transform data.
- int flags = SkCanvas::kHasAlphaLayer_SaveFlag;
- if (mClipChildren) {
- flags |= SkCanvas::kClipToLayer_SaveFlag;
- }
- DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha",
- (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop,
- mMultipliedAlpha, flags);
- renderer.saveLayerAlpha(0, 0, mRight - mLeft, mBottom - mTop,
- mMultipliedAlpha, flags);
- }
if (mMatrixFlags != 0) {
if (mMatrixFlags == TRANSLATION) {
DISPLAY_LIST_LOGD("%s%s %f, %f", indent, "Translate", mTranslationX, mTranslationY);
@@ -754,6 +740,20 @@
renderer.concatMatrix(mTransformMatrix);
}
}
+ if (mAlpha < 1 && !mCaching) {
+ // TODO: should be able to store the size of a DL at record time and not
+ // have to pass it into this call. In fact, this information might be in the
+ // location/size info that we store with the new native transform data.
+ int flags = SkCanvas::kHasAlphaLayer_SaveFlag;
+ if (mClipChildren) {
+ flags |= SkCanvas::kClipToLayer_SaveFlag;
+ }
+ DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f, %d, 0x%x", indent, "SaveLayerAlpha",
+ (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop,
+ mMultipliedAlpha, flags);
+ renderer.saveLayerAlpha(0, 0, mRight - mLeft, mBottom - mTop,
+ mMultipliedAlpha, flags);
+ }
if (mClipChildren) {
DISPLAY_LIST_LOGD("%s%s %.2f, %.2f, %.2f, %.2f", indent, "ClipRect", 0.0f, 0.0f,
(float) mRight - mLeft, (float) mBottom - mTop);
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 43617e7..4bbb04f 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -574,7 +574,7 @@
virtual void drawLines(float* points, int count, SkPaint* paint);
virtual void drawPoints(float* points, int count, SkPaint* paint);
virtual void drawText(const char* text, int bytesCount, int count, float x, float y,
- SkPaint* paint, float length = 1.0f);
+ SkPaint* paint, float length = -1.0f);
virtual void drawTextOnPath(const char* text, int bytesCount, int count, SkPath* path,
float hOffset, float vOffset, SkPaint* paint);
virtual void drawPosText(const char* text, int bytesCount, int count, const float* positions,
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index 92a7573..493dc1b 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -518,6 +518,10 @@
mCacheLines.clear();
if (mInitialized) {
+ // Unbinding the buffer shouldn't be necessary but it crashes with some drivers
+ Caches::getInstance().unbindIndicesBuffer();
+ glDeleteBuffers(1, &mIndexBufferID);
+
delete[] mTextMeshPtr;
delete mCacheTextureSmall;
delete mCacheTexture128;
diff --git a/libs/rs/Allocation.cpp b/libs/rs/Allocation.cpp
index d69c55f..e37d5de 100644
--- a/libs/rs/Allocation.cpp
+++ b/libs/rs/Allocation.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2012 The Android Open Source Project
+ * 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.
@@ -51,17 +51,14 @@
RS_ALLOCATION_USAGE_GRAPHICS_VERTEX |
RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS |
RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET |
- RS_ALLOCATION_USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE |
RS_ALLOCATION_USAGE_IO_INPUT |
RS_ALLOCATION_USAGE_IO_OUTPUT)) != 0) {
ALOGE("Unknown usage specified.");
}
- if ((usage & (RS_ALLOCATION_USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE |
- RS_ALLOCATION_USAGE_IO_INPUT)) != 0) {
+ if ((usage & RS_ALLOCATION_USAGE_IO_INPUT) != 0) {
mWriteAllowed = false;
- if ((usage & ~(RS_ALLOCATION_USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE |
- RS_ALLOCATION_USAGE_IO_INPUT |
+ if ((usage & ~(RS_ALLOCATION_USAGE_IO_INPUT |
RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE |
RS_ALLOCATION_USAGE_SCRIPT)) != 0) {
ALOGE("Invalid usage combination.");
diff --git a/libs/rs/Script.cpp b/libs/rs/Script.cpp
index 25fa673..c87d460 100644
--- a/libs/rs/Script.cpp
+++ b/libs/rs/Script.cpp
@@ -25,12 +25,12 @@
#include "Allocation.h"
#include "Script.h"
-void Script::invoke(uint32_t slot, const void *v, size_t len) {
+void Script::invoke(uint32_t slot, const void *v, size_t len) const {
rsScriptInvokeV(mRS->mContext, getID(), slot, v, len);
}
void Script::forEach(uint32_t slot, const Allocation *ain, const Allocation *aout,
- const void *usr, size_t usrLen) {
+ const void *usr, size_t usrLen) const {
if ((ain == NULL) && (aout == NULL)) {
mRS->throwError("At least one of ain or aout is required to be non-null.");
}
@@ -44,16 +44,16 @@
}
-void Script::bindAllocation(const Allocation *va, uint32_t slot) {
+void Script::bindAllocation(const Allocation *va, uint32_t slot) const {
rsScriptBindAllocation(mRS->mContext, getID(), BaseObj::getObjID(va), slot);
}
-void Script::setVar(uint32_t index, const BaseObj *o) {
+void Script::setVar(uint32_t index, const BaseObj *o) const {
rsScriptSetVarObj(mRS->mContext, getID(), index, (o == NULL) ? 0 : o->getID());
}
-void Script::setVar(uint32_t index, const void *v, size_t len) {
+void Script::setVar(uint32_t index, const void *v, size_t len) const {
rsScriptSetVarV(mRS->mContext, getID(), index, v, len);
}
diff --git a/libs/rs/Script.h b/libs/rs/Script.h
index 54d1e40..0700898 100644
--- a/libs/rs/Script.h
+++ b/libs/rs/Script.h
@@ -30,29 +30,29 @@
class Script : public BaseObj {
protected:
Script(void *id, RenderScript *rs);
- void forEach(uint32_t slot, const Allocation *in, const Allocation *out, const void *v, size_t);
- void bindAllocation(const Allocation *va, uint32_t slot);
- void setVar(uint32_t index, const void *, size_t len);
- void setVar(uint32_t index, const BaseObj *o);
- void invoke(uint32_t slot, const void *v, size_t len);
+ void forEach(uint32_t slot, const Allocation *in, const Allocation *out, const void *v, size_t) const;
+ void bindAllocation(const Allocation *va, uint32_t slot) const;
+ void setVar(uint32_t index, const void *, size_t len) const;
+ void setVar(uint32_t index, const BaseObj *o) const;
+ void invoke(uint32_t slot, const void *v, size_t len) const;
- void invoke(uint32_t slot) {
+ void invoke(uint32_t slot) const {
invoke(slot, NULL, 0);
}
- void setVar(uint32_t index, float v) {
+ void setVar(uint32_t index, float v) const {
setVar(index, &v, sizeof(v));
}
- void setVar(uint32_t index, double v) {
+ void setVar(uint32_t index, double v) const {
setVar(index, &v, sizeof(v));
}
- void setVar(uint32_t index, int32_t v) {
+ void setVar(uint32_t index, int32_t v) const {
setVar(index, &v, sizeof(v));
}
- void setVar(uint32_t index, int64_t v) {
+ void setVar(uint32_t index, int64_t v) const {
setVar(index, &v, sizeof(v));
}
- void setVar(uint32_t index, bool v) {
+ void setVar(uint32_t index, bool v) const {
setVar(index, &v, sizeof(v));
}
diff --git a/libs/rs/ScriptC.cpp b/libs/rs/ScriptC.cpp
index ad82ff4..80e8efc 100644
--- a/libs/rs/ScriptC.cpp
+++ b/libs/rs/ScriptC.cpp
@@ -22,11 +22,11 @@
#include "ScriptC.h"
ScriptC::ScriptC(RenderScript *rs,
- const char *codeTxt, size_t codeLength,
+ const void *codeTxt, size_t codeLength,
const char *cachedName, size_t cachedNameLength,
const char *cacheDir, size_t cacheDirLength)
: Script(NULL, rs) {
mID = rsScriptCCreate(rs->mContext, cachedName, cachedNameLength,
- cacheDir, cacheDirLength, codeTxt, codeLength);
+ cacheDir, cacheDirLength, (const char *)codeTxt, codeLength);
}
diff --git a/libs/rs/ScriptC.h b/libs/rs/ScriptC.h
index dcbbe10..b68f61c 100644
--- a/libs/rs/ScriptC.h
+++ b/libs/rs/ScriptC.h
@@ -25,7 +25,7 @@
class ScriptC : public Script {
protected:
ScriptC(RenderScript *rs,
- const char *codeTxt, size_t codeLength,
+ const void *codeTxt, size_t codeLength,
const char *cachedName, size_t cachedNameLength,
const char *cacheDir, size_t cacheDirLength);
diff --git a/libs/rs/driver/rsdAllocation.cpp b/libs/rs/driver/rsdAllocation.cpp
index fb93d82..f358f93 100644
--- a/libs/rs/driver/rsdAllocation.cpp
+++ b/libs/rs/driver/rsdAllocation.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2011-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.
@@ -27,6 +27,7 @@
#include "hardware/gralloc.h"
#include "ui/Rect.h"
#include "ui/GraphicBufferMapper.h"
+#include "gui/SurfaceTexture.h"
#include <GLES/gl.h>
#include <GLES2/gl2.h>
@@ -139,7 +140,7 @@
static void UploadToTexture(const Context *rsc, const Allocation *alloc) {
DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
- if (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE) {
+ if (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_IO_INPUT) {
if (!drv->textureID) {
RSD_CALL_GL(glGenTextures, 1, &drv->textureID);
}
@@ -475,7 +476,8 @@
}
void rsdAllocationIoReceive(const Context *rsc, Allocation *alloc) {
- ALOGE("not implemented");
+ DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
+ alloc->mHal.state.surfaceTexture->updateTexImage();
}
diff --git a/libs/rs/driver/rsdCore.cpp b/libs/rs/driver/rsdCore.cpp
index 403393f..6a532e9 100644
--- a/libs/rs/driver/rsdCore.cpp
+++ b/libs/rs/driver/rsdCore.cpp
@@ -227,8 +227,13 @@
int cpu = sysconf(_SC_NPROCESSORS_ONLN);
+ if(rsc->props.mDebugMaxThreads && (cpu > (int)rsc->props.mDebugMaxThreads)) {
+ cpu = rsc->props.mDebugMaxThreads;
+ }
+ if (cpu < 2) {
+ cpu = 0;
+ }
ALOGV("%p Launching thread(s), CPUs %i", rsc, cpu);
- if (cpu < 2) cpu = 0;
dc->mWorkers.mCount = (uint32_t)cpu;
dc->mWorkers.mThreadId = (pthread_t *) calloc(dc->mWorkers.mCount, sizeof(pthread_t));
diff --git a/libs/rs/driver/rsdProgram.cpp b/libs/rs/driver/rsdProgram.cpp
index fa4cb0f..30a4c5f 100644
--- a/libs/rs/driver/rsdProgram.cpp
+++ b/libs/rs/driver/rsdProgram.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2011-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.
@@ -41,7 +41,7 @@
textureNames, textureNamesCount, textureNamesLength);
pv->mHal.drv = drv;
- return drv->createShader();
+ return true;
}
static void SyncProgramConstants(const Context *rsc, const Program *p) {
@@ -88,7 +88,7 @@
textureNames, textureNamesCount, textureNamesLength);
pf->mHal.drv = drv;
- return drv->createShader();
+ return true;
}
void rsdProgramFragmentSetActive(const Context *rsc, const ProgramFragment *pf) {
diff --git a/libs/rs/driver/rsdShader.cpp b/libs/rs/driver/rsdShader.cpp
index 1e73b95..a386735 100644
--- a/libs/rs/driver/rsdShader.cpp
+++ b/libs/rs/driver/rsdShader.cpp
@@ -39,7 +39,10 @@
initMemberVars();
initAttribAndUniformArray();
init(textureNames, textureNamesCount, textureNamesLength);
- createTexturesString(textureNames, textureNamesCount, textureNamesLength);
+
+ for(size_t i=0; i < textureNamesCount; i++) {
+ mTextureNames.push(String8(textureNames[i], textureNamesLength[i]));
+ }
}
RsdShader::~RsdShader() {
@@ -138,37 +141,42 @@
}
}
-void RsdShader::createTexturesString(const char** textureNames, size_t textureNamesCount,
- const size_t *textureNamesLength) {
- mShaderTextures.setTo("");
+void RsdShader::appendTextures() {
+
+ // TODO: this does not yet handle cases where the texture changes between IO
+ // input and local
+ bool appendUsing = true;
for (uint32_t ct = 0; ct < mRSProgram->mHal.state.texturesCount; ct ++) {
if (mRSProgram->mHal.state.textureTargets[ct] == RS_TEXTURE_2D) {
Allocation *a = mRSProgram->mHal.state.textures[ct];
if (a && a->mHal.state.surfaceTextureID) {
- mShaderTextures.append("uniform samplerExternalOES UNI_");
+ if(appendUsing) {
+ mShader.append("#extension GL_OES_EGL_image_external : require\n");
+ appendUsing = false;
+ }
+ mShader.append("uniform samplerExternalOES UNI_");
+ mTextureTargets[ct] = GL_TEXTURE_EXTERNAL_OES;
} else {
- mShaderTextures.append("uniform sampler2D UNI_");
+ mShader.append("uniform sampler2D UNI_");
+ mTextureTargets[ct] = GL_TEXTURE_2D;
}
- mTextureTargets[ct] = GL_TEXTURE_2D;
} else {
- mShaderTextures.append("uniform samplerCube UNI_");
+ mShader.append("uniform samplerCube UNI_");
mTextureTargets[ct] = GL_TEXTURE_CUBE_MAP;
}
- mShaderTextures.append(textureNames[ct], textureNamesLength[ct]);
- mShaderTextures.append(";\n");
+ mShader.append(mTextureNames[ct]);
+ mShader.append(";\n");
}
}
bool RsdShader::createShader() {
-
if (mType == GL_FRAGMENT_SHADER) {
mShader.append("precision mediump float;\n");
}
appendUserConstants();
appendAttributes();
- mShader.append(mShaderTextures);
-
+ appendTextures();
mShader.append(mUserShader);
return true;
@@ -178,6 +186,10 @@
mShaderID = glCreateShader(mType);
rsAssert(mShaderID);
+ if(!mShader.length()) {
+ createShader();
+ }
+
if (rsc->props.mLogShaders) {
ALOGV("Loading shader type %x, ID %i", mType, mShaderID);
ALOGV("%s", mShader.string());
@@ -423,7 +435,9 @@
}
DrvAllocation *drvTex = (DrvAllocation *)mRSProgram->mHal.state.textures[ct]->mHal.drv;
- if (drvTex->glTarget != GL_TEXTURE_2D && drvTex->glTarget != GL_TEXTURE_CUBE_MAP) {
+ if (drvTex->glTarget != GL_TEXTURE_2D &&
+ drvTex->glTarget != GL_TEXTURE_CUBE_MAP &&
+ drvTex->glTarget != GL_TEXTURE_EXTERNAL_OES) {
ALOGE("Attempting to bind unknown texture to shader id %u, texture unit %u",
(uint)this, ct);
rsc->setError(RS_ERROR_BAD_SHADER, "Non-texture allocation bound to a shader");
diff --git a/libs/rs/driver/rsdShader.h b/libs/rs/driver/rsdShader.h
index e32145f..6c0b616 100644
--- a/libs/rs/driver/rsdShader.h
+++ b/libs/rs/driver/rsdShader.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2011-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.
@@ -81,15 +81,12 @@
void appendAttributes();
void appendTextures();
- void createTexturesString(const char** textureNames, size_t textureNamesCount,
- const size_t *textureNamesLength);
void initAttribAndUniformArray();
mutable bool mDirty;
android::String8 mShader;
android::String8 mUserShader;
- android::String8 mShaderTextures;
uint32_t mShaderID;
uint32_t mType;
@@ -101,6 +98,8 @@
android::String8 *mUniformNames;
uint32_t *mUniformArraySizes;
+ android::Vector<android::String8> mTextureNames;
+
int32_t mTextureUniformIndexStart;
void logUniform(const android::renderscript::Element *field,
diff --git a/libs/rs/driver/rsdShaderCache.cpp b/libs/rs/driver/rsdShaderCache.cpp
index 89d3c45..50cb9f9 100644
--- a/libs/rs/driver/rsdShaderCache.cpp
+++ b/libs/rs/driver/rsdShaderCache.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2011-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.
@@ -119,7 +119,6 @@
if (!vtx->getShaderID() || !frag->getShaderID()) {
return false;
}
- //ALOGV("rsdShaderCache lookup vtx %i, frag %i", vtx->getShaderID(), frag->getShaderID());
uint32_t entryCount = mEntries.size();
for (uint32_t ct = 0; ct < entryCount; ct ++) {
if ((mEntries[ct]->vtx == vtx->getShaderID()) &&
@@ -134,8 +133,6 @@
}
}
- //ALOGV("RsdShaderCache miss");
- //ALOGE("e0 %x", glGetError());
ProgramEntry *e = new ProgramEntry(vtx->getAttribCount(),
vtx->getUniformCount(),
frag->getUniformCount());
diff --git a/libs/rs/driver/rsdShaderCache.h b/libs/rs/driver/rsdShaderCache.h
index 0beecae..1192916 100644
--- a/libs/rs/driver/rsdShaderCache.h
+++ b/libs/rs/driver/rsdShaderCache.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2011-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.
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index cf4a391..b373056 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -69,6 +69,12 @@
ret int32_t
}
+AllocationGetSurfaceTextureID2 {
+ param RsAllocation alloc
+ param void *st
+ sync
+}
+
AllocationSetSurface {
param RsAllocation alloc
param RsNativeWindow sur
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index a404c49..cdff49c 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -20,6 +20,7 @@
#include "rs_hal.h"
#include "system/window.h"
+#include "gui/SurfaceTexture.h"
using namespace android;
using namespace android::renderscript;
@@ -64,6 +65,7 @@
Allocation::~Allocation() {
freeChildrenUnlocked();
+ setSurfaceTexture(mRSC, NULL);
mRSC->mHal.funcs.allocation.destroy(mRSC, this);
}
@@ -424,6 +426,18 @@
return id;
}
+void Allocation::setSurfaceTexture(const Context *rsc, SurfaceTexture *st) {
+ if(st != mHal.state.surfaceTexture) {
+ if(mHal.state.surfaceTexture != NULL) {
+ mHal.state.surfaceTexture->decStrong(NULL);
+ }
+ mHal.state.surfaceTexture = st;
+ if(mHal.state.surfaceTexture != NULL) {
+ mHal.state.surfaceTexture->incStrong(NULL);
+ }
+ }
+}
+
void Allocation::setSurface(const Context *rsc, RsNativeWindow sur) {
ANativeWindow *nw = (ANativeWindow *)sur;
ANativeWindow *old = mHal.state.wndSurface;
@@ -696,6 +710,11 @@
return alloc->getSurfaceTextureID(rsc);
}
+void rsi_AllocationGetSurfaceTextureID2(Context *rsc, RsAllocation valloc, void *vst, size_t len) {
+ Allocation *alloc = static_cast<Allocation *>(valloc);
+ alloc->setSurfaceTexture(rsc, static_cast<SurfaceTexture *>(vst));
+}
+
void rsi_AllocationSetSurface(Context *rsc, RsAllocation valloc, RsNativeWindow sur) {
Allocation *alloc = static_cast<Allocation *>(valloc);
alloc->setSurface(rsc, sur);
diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h
index 58a6fca..e2783d2 100644
--- a/libs/rs/rsAllocation.h
+++ b/libs/rs/rsAllocation.h
@@ -23,6 +23,8 @@
// ---------------------------------------------------------------------------
namespace android {
+class SurfaceTexture;
+
namespace renderscript {
class Program;
@@ -60,6 +62,7 @@
void * usrPtr;
int32_t surfaceTextureID;
ANativeWindow *wndSurface;
+ SurfaceTexture *surfaceTexture;
};
State state;
@@ -130,6 +133,7 @@
}
int32_t getSurfaceTextureID(const Context *rsc);
+ void setSurfaceTexture(const Context *rsc, SurfaceTexture *st);
void setSurface(const Context *rsc, RsNativeWindow sur);
void ioSend(const Context *rsc);
void ioReceive(const Context *rsc);
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 1b51872..5e21763 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -178,10 +178,10 @@
mFragmentStore->setup(this, &mStateFragmentStore);
}
-static bool getProp(const char *str) {
+static uint32_t getProp(const char *str) {
char buf[PROPERTY_VALUE_MAX];
property_get(str, buf, "0");
- return 0 != strcmp(buf, "0");
+ return atoi(buf);
}
void Context::displayDebugStats() {
@@ -211,13 +211,14 @@
setpriority(PRIO_PROCESS, rsc->mNativeThreadId, ANDROID_PRIORITY_DISPLAY);
rsc->mThreadPriority = ANDROID_PRIORITY_DISPLAY;
#endif //ANDROID_RS_SERIALIZE
- rsc->props.mLogTimes = getProp("debug.rs.profile");
- rsc->props.mLogScripts = getProp("debug.rs.script");
- rsc->props.mLogObjects = getProp("debug.rs.object");
- rsc->props.mLogShaders = getProp("debug.rs.shader");
- rsc->props.mLogShadersAttr = getProp("debug.rs.shader.attributes");
- rsc->props.mLogShadersUniforms = getProp("debug.rs.shader.uniforms");
- rsc->props.mLogVisual = getProp("debug.rs.visual");
+ rsc->props.mLogTimes = getProp("debug.rs.profile") != 0;
+ rsc->props.mLogScripts = getProp("debug.rs.script") != 0;
+ rsc->props.mLogObjects = getProp("debug.rs.object") != 0;
+ rsc->props.mLogShaders = getProp("debug.rs.shader") != 0;
+ rsc->props.mLogShadersAttr = getProp("debug.rs.shader.attributes") != 0;
+ rsc->props.mLogShadersUniforms = getProp("debug.rs.shader.uniforms") != 0;
+ rsc->props.mLogVisual = getProp("debug.rs.visual") != 0;
+ rsc->props.mDebugMaxThreads = getProp("debug.rs.max-threads");
if (!rsdHalInit(rsc, 0, 0)) {
rsc->setError(RS_ERROR_FATAL_DRIVER, "Failed initializing GL");
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 0f44267..de110c6 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -184,6 +184,7 @@
bool mLogShadersAttr;
bool mLogShadersUniforms;
bool mLogVisual;
+ uint32_t mDebugMaxThreads;
} props;
mutable struct {
diff --git a/libs/rs/rsDefines.h b/libs/rs/rsDefines.h
index 990ef26..0e0cd8d 100644
--- a/libs/rs/rsDefines.h
+++ b/libs/rs/rsDefines.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 The Android Open Source Project
+ * Copyright (C) 2007-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.
@@ -100,9 +100,8 @@
RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004,
RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008,
RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010,
- RS_ALLOCATION_USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE = 0x0020,
- RS_ALLOCATION_USAGE_IO_INPUT = 0x0040,
- RS_ALLOCATION_USAGE_IO_OUTPUT = 0x0080,
+ RS_ALLOCATION_USAGE_IO_INPUT = 0x0020,
+ RS_ALLOCATION_USAGE_IO_OUTPUT = 0x0040,
RS_ALLOCATION_USAGE_ALL = 0x00FF
};
diff --git a/libs/rs/scriptc/rs_allocation.rsh b/libs/rs/scriptc/rs_allocation.rsh
index 89696b8..b0840a0 100644
--- a/libs/rs/scriptc/rs_allocation.rsh
+++ b/libs/rs/scriptc/rs_allocation.rsh
@@ -14,31 +14,6 @@
* limitations under the License.
*/
-/*! \mainpage notitle
- *
- * Renderscript is a high-performance runtime that provides graphics rendering and
- * compute operations at the native level. Renderscript code is compiled on devices
- * at runtime to allow platform-independence as well.
- * This reference documentation describes the Renderscript runtime APIs, which you
- * can utilize to write Renderscript code in C99. The Renderscript header
- * files are automatically included for you, except for the rs_graphics.rsh header. If
- * you are doing graphics rendering, include the graphics header file like this:
- *
- * <code>#include "rs_graphics.rsh"</code>
- *
- * To use Renderscript, you need to utilize the Renderscript runtime APIs documented here
- * as well as the Android framework APIs for Renderscript.
- * For documentation on the Android framework APIs, see the <a target="_parent" href=
- * "http://developer.android.com/reference/android/renderscript/package-summary.html">
- * android.renderscript</a> package reference.
- * For more information on how to develop with Renderscript and how the runtime and
- * Android framework APIs interact, see the <a target="_parent" href=
- * "http://developer.android.com/guide/topics/renderscript/index.html">Renderscript
- * developer guide</a> and the <a target="_parent" href=
- * "http://developer.android.com/resources/samples/RenderScript/index.html">
- * Renderscript samples</a>.
- */
-
/** @file rs_allocation.rsh
* \brief Allocation routines
*
@@ -168,6 +143,8 @@
extern const void * __attribute__((overloadable))
rsGetElementAt(rs_allocation, uint32_t x, uint32_t y, uint32_t z);
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+
/**
* @param a allocation to get data from
* @return element describing allocation layout
@@ -176,129 +153,6 @@
rsAllocationGetElement(rs_allocation a);
/**
- * @param m mesh to get data from
- * @return number of allocations in the mesh that contain vertex
- * data
- */
-extern uint32_t __attribute__((overloadable))
- rsMeshGetVertexAllocationCount(rs_mesh m);
-
-/**
- * @param m mesh to get data from
- * @return number of primitive groups in the mesh. This would
- * include simple primitives as well as allocations
- * containing index data
- */
-extern uint32_t __attribute__((overloadable))
- rsMeshGetPrimitiveCount(rs_mesh m);
-
-/**
- * @param m mesh to get data from
- * @param index index of the vertex allocation
- * @return allocation containing vertex data
- */
-extern rs_allocation __attribute__((overloadable))
- rsMeshGetVertexAllocation(rs_mesh m, uint32_t index);
-
-/**
- * @param m mesh to get data from
- * @param index index of the index allocation
- * @return allocation containing index data
- */
-extern rs_allocation __attribute__((overloadable))
- rsMeshGetIndexAllocation(rs_mesh m, uint32_t index);
-
-/**
- * @param m mesh to get data from
- * @param index index of the primitive
- * @return primitive describing how the mesh is rendered
- */
-extern rs_primitive __attribute__((overloadable))
- rsMeshGetPrimitive(rs_mesh m, uint32_t index);
-
-/**
- * @param e element to get data from
- * @return number of sub-elements in this element
- */
-extern uint32_t __attribute__((overloadable))
- rsElementGetSubElementCount(rs_element e);
-
-/**
- * @param e element to get data from
- * @param index index of the sub-element to return
- * @return sub-element in this element at given index
- */
-extern rs_element __attribute__((overloadable))
- rsElementGetSubElement(rs_element, uint32_t index);
-
-/**
- * @param e element to get data from
- * @param index index of the sub-element to return
- * @return length of the sub-element name including the null
- * terminator (size of buffer needed to write the name)
- */
-extern uint32_t __attribute__((overloadable))
- rsElementGetSubElementNameLength(rs_element e, uint32_t index);
-
-/**
- * @param e element to get data from
- * @param index index of the sub-element
- * @param name array to store the name into
- * @param nameLength length of the provided name array
- * @return number of characters actually written, excluding the
- * null terminator
- */
-extern uint32_t __attribute__((overloadable))
- rsElementGetSubElementName(rs_element e, uint32_t index, char *name, uint32_t nameLength);
-
-/**
- * @param e element to get data from
- * @param index index of the sub-element
- * @return array size of sub-element in this element at given
- * index
- */
-extern uint32_t __attribute__((overloadable))
- rsElementGetSubElementArraySize(rs_element e, uint32_t index);
-
-/**
- * @param e element to get data from
- * @param index index of the sub-element
- * @return offset in bytes of sub-element in this element at
- * given index
- */
-extern uint32_t __attribute__((overloadable))
- rsElementGetSubElementOffsetBytes(rs_element e, uint32_t index);
-
-/**
- * @param e element to get data from
- * @return total size of the element in bytes
- */
-extern uint32_t __attribute__((overloadable))
- rsElementGetSizeBytes(rs_element e);
-
-/**
- * @param e element to get data from
- * @return element's data type
- */
-extern rs_data_type __attribute__((overloadable))
- rsElementGetDataType(rs_element e);
-
-/**
- * @param e element to get data from
- * @return element's data size
- */
-extern rs_data_kind __attribute__((overloadable))
- rsElementGetDataKind(rs_element e);
-
-/**
- * @param e element to get data from
- * @return length of the element vector (for float2, float3,
- * etc.)
- */
-extern uint32_t __attribute__((overloadable))
- rsElementGetVectorSize(rs_element e);
-
-/**
* Fetch allocation in a way described by the sampler
* @param a 1D allocation to sample from
* @param s sampler state
@@ -339,26 +193,7 @@
extern const float4 __attribute__((overloadable))
rsSample(rs_allocation a, rs_sampler s, float2 location, float lod);
-/**
- * Fetch allocation in a way described by the sampler
- * @param a 3D allocation to sample from
- * @param s sampler state
- * @param location to sample from
- */
-extern const float4 __attribute__((overloadable))
- rsSample(rs_allocation a, rs_sampler s, float3 location);
-
-/**
- * Fetch allocation in a way described by the sampler
- * @param a 3D allocation to sample from
- * @param s sampler state
- * @param location to sample from
- * @param lod mip level to sample from, for fractional values
- * mip levels will be interpolated if
- * RS_SAMPLER_LINEAR_MIP_LINEAR is used
- */
-extern const float4 __attribute__((overloadable))
- rsSample(rs_allocation a, rs_sampler s, float3 location, float lod);
+#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
#endif
diff --git a/libs/rs/scriptc/rs_core.rsh b/libs/rs/scriptc/rs_core.rsh
index be900cb..1b0f9db 100644
--- a/libs/rs/scriptc/rs_core.rsh
+++ b/libs/rs/scriptc/rs_core.rsh
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2011-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.
@@ -14,6 +14,31 @@
* limitations under the License.
*/
+ /*! \mainpage notitle
+ *
+ * Renderscript is a high-performance runtime that provides graphics rendering and
+ * compute operations at the native level. Renderscript code is compiled on devices
+ * at runtime to allow platform-independence as well.
+ * This reference documentation describes the Renderscript runtime APIs, which you
+ * can utilize to write Renderscript code in C99. The Renderscript header
+ * files are automatically included for you, except for the rs_graphics.rsh header. If
+ * you are doing graphics rendering, include the graphics header file like this:
+ *
+ * <code>#include "rs_graphics.rsh"</code>
+ *
+ * To use Renderscript, you need to utilize the Renderscript runtime APIs documented here
+ * as well as the Android framework APIs for Renderscript.
+ * For documentation on the Android framework APIs, see the <a target="_parent" href=
+ * "http://developer.android.com/reference/android/renderscript/package-summary.html">
+ * android.renderscript</a> package reference.
+ * For more information on how to develop with Renderscript and how the runtime and
+ * Android framework APIs interact, see the <a target="_parent" href=
+ * "http://developer.android.com/guide/topics/renderscript/index.html">Renderscript
+ * developer guide</a> and the <a target="_parent" href=
+ * "http://developer.android.com/resources/samples/RenderScript/index.html">
+ * Renderscript samples</a>.
+ */
+
/** @file rs_core.rsh
* \brief todo-jsams
*
@@ -31,14 +56,14 @@
#include "rs_atomic.rsh"
#include "rs_cl.rsh"
#include "rs_debug.rsh"
+#include "rs_element.rsh"
#include "rs_math.rsh"
#include "rs_matrix.rsh"
#include "rs_object.rsh"
#include "rs_quaternion.rsh"
+#include "rs_sampler.rsh"
#include "rs_time.rsh"
-
-
/**
* Send a message back to the client. Will not block and returns true
* if the message was sendable and false if the fifo was full.
diff --git a/libs/rs/scriptc/rs_element.rsh b/libs/rs/scriptc/rs_element.rsh
new file mode 100644
index 0000000..1a4cdb75
--- /dev/null
+++ b/libs/rs/scriptc/rs_element.rsh
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+
+/** @file rs_element.rsh
+ * \brief Element routines
+ *
+ *
+ */
+
+#ifndef __RS_ELEMENT_RSH__
+#define __RS_ELEMENT_RSH__
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+
+/**
+ * @param e element to get data from
+ * @return number of sub-elements in this element
+ */
+extern uint32_t __attribute__((overloadable))
+ rsElementGetSubElementCount(rs_element e);
+
+/**
+ * @param e element to get data from
+ * @param index index of the sub-element to return
+ * @return sub-element in this element at given index
+ */
+extern rs_element __attribute__((overloadable))
+ rsElementGetSubElement(rs_element, uint32_t index);
+
+/**
+ * @param e element to get data from
+ * @param index index of the sub-element to return
+ * @return length of the sub-element name including the null
+ * terminator (size of buffer needed to write the name)
+ */
+extern uint32_t __attribute__((overloadable))
+ rsElementGetSubElementNameLength(rs_element e, uint32_t index);
+
+/**
+ * @param e element to get data from
+ * @param index index of the sub-element
+ * @param name array to store the name into
+ * @param nameLength length of the provided name array
+ * @return number of characters actually written, excluding the
+ * null terminator
+ */
+extern uint32_t __attribute__((overloadable))
+ rsElementGetSubElementName(rs_element e, uint32_t index, char *name, uint32_t nameLength);
+
+/**
+ * @param e element to get data from
+ * @param index index of the sub-element
+ * @return array size of sub-element in this element at given
+ * index
+ */
+extern uint32_t __attribute__((overloadable))
+ rsElementGetSubElementArraySize(rs_element e, uint32_t index);
+
+/**
+ * @param e element to get data from
+ * @param index index of the sub-element
+ * @return offset in bytes of sub-element in this element at
+ * given index
+ */
+extern uint32_t __attribute__((overloadable))
+ rsElementGetSubElementOffsetBytes(rs_element e, uint32_t index);
+
+/**
+ * @param e element to get data from
+ * @return total size of the element in bytes
+ */
+extern uint32_t __attribute__((overloadable))
+ rsElementGetSizeBytes(rs_element e);
+
+/**
+ * @param e element to get data from
+ * @return element's data type
+ */
+extern rs_data_type __attribute__((overloadable))
+ rsElementGetDataType(rs_element e);
+
+/**
+ * @param e element to get data from
+ * @return element's data size
+ */
+extern rs_data_kind __attribute__((overloadable))
+ rsElementGetDataKind(rs_element e);
+
+/**
+ * @param e element to get data from
+ * @return length of the element vector (for float2, float3,
+ * etc.)
+ */
+extern uint32_t __attribute__((overloadable))
+ rsElementGetVectorSize(rs_element e);
+
+#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
+
+#endif // __RS_ELEMENT_RSH__
+
diff --git a/libs/rs/scriptc/rs_graphics.rsh b/libs/rs/scriptc/rs_graphics.rsh
index e3fde828..44ee99f 100644
--- a/libs/rs/scriptc/rs_graphics.rsh
+++ b/libs/rs/scriptc/rs_graphics.rsh
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2011-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.
@@ -23,6 +23,9 @@
#ifndef __RS_GRAPHICS_RSH__
#define __RS_GRAPHICS_RSH__
+#include "rs_mesh.rsh"
+#include "rs_program.rsh"
+
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
/**
* Set the color target used for all subsequent rendering calls
@@ -83,88 +86,6 @@
extern void __attribute__((overloadable))
rsgBindProgramStore(rs_program_store ps);
-
-/**
- * @hide
- * Get program store depth function
- *
- * @param ps
- */
-extern rs_depth_func __attribute__((overloadable))
- rsgProgramStoreGetDepthFunc(rs_program_store ps);
-
-/**
- * @hide
- * Get program store depth mask
- *
- * @param ps
- */
-extern bool __attribute__((overloadable))
- rsgProgramStoreGetDepthMask(rs_program_store ps);
-/**
- * @hide
- * Get program store red component color mask
- *
- * @param ps
- */
-extern bool __attribute__((overloadable))
- rsgProgramStoreGetColorMaskR(rs_program_store ps);
-
-/**
- * @hide
- * Get program store green component color mask
- *
- * @param ps
- */
-extern bool __attribute__((overloadable))
- rsgProgramStoreGetColorMaskG(rs_program_store ps);
-
-/**
- * @hide
- * Get program store blur component color mask
- *
- * @param ps
- */
-extern bool __attribute__((overloadable))
- rsgProgramStoreGetColorMaskB(rs_program_store ps);
-
-/**
- * @hide
- * Get program store alpha component color mask
- *
- * @param ps
- */
-extern bool __attribute__((overloadable))
- rsgProgramStoreGetColorMaskA(rs_program_store ps);
-
-/**
- * @hide
- * Get program store blend source function
- *
- * @param ps
- */
-extern rs_blend_src_func __attribute__((overloadable))
- rsgProgramStoreGetBlendSrcFunc(rs_program_store ps);
-
-/**
- * @hide
- * Get program store blend destination function
- *
- * @param ps
- */
-extern rs_blend_dst_func __attribute__((overloadable))
- rsgProgramStoreGetBlendDstFunc(rs_program_store ps);
-
-/**
- * @hide
- * Get program store dither state
- *
- * @param ps
- */
-extern bool __attribute__((overloadable))
- rsgProgramStoreGetDitherEnabled(rs_program_store ps);
-
-
/**
* Bind a new ProgramVertex to the rendering context.
*
@@ -182,24 +103,6 @@
rsgBindProgramRaster(rs_program_raster pr);
/**
- * @hide
- * Get program raster point sprite state
- *
- * @param pr
- */
-extern bool __attribute__((overloadable))
- rsgProgramRasterGetPointSpriteEnabled(rs_program_raster pr);
-
-/**
- * @hide
- * Get program raster cull mode
- *
- * @param pr
- */
-extern rs_cull_mode __attribute__((overloadable))
- rsgProgramRasterGetCullMode(rs_program_raster pr);
-
-/**
* Bind a new Sampler object to a ProgramFragment. The sampler will
* operate on the texture bound at the matching slot.
*
@@ -209,51 +112,6 @@
rsgBindSampler(rs_program_fragment, uint slot, rs_sampler);
/**
- * @hide
- * Get sampler minification value
- *
- * @param pr
- */
-extern rs_sampler_value __attribute__((overloadable))
- rsgSamplerGetMinification(rs_sampler s);
-
-/**
- * @hide
- * Get sampler magnification value
- *
- * @param pr
- */
-extern rs_sampler_value __attribute__((overloadable))
- rsgSamplerGetMagnification(rs_sampler s);
-
-/**
- * @hide
- * Get sampler wrap S value
- *
- * @param pr
- */
-extern rs_sampler_value __attribute__((overloadable))
- rsgSamplerGetWrapS(rs_sampler s);
-
-/**
- * @hide
- * Get sampler wrap T value
- *
- * @param pr
- */
-extern rs_sampler_value __attribute__((overloadable))
- rsgSamplerGetWrapT(rs_sampler s);
-
-/**
- * @hide
- * Get sampler anisotropy
- *
- * @param pr
- */
-extern float __attribute__((overloadable))
- rsgSamplerGetAnisotropy(rs_sampler s);
-
-/**
* Bind a new Allocation object to a ProgramFragment. The
* Allocation must be a valid texture for the Program. The sampling
* of the texture will be controled by the Sampler bound at the
diff --git a/libs/rs/scriptc/rs_mesh.rsh b/libs/rs/scriptc/rs_mesh.rsh
new file mode 100644
index 0000000..87ffd33
--- /dev/null
+++ b/libs/rs/scriptc/rs_mesh.rsh
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+/** @file rs_mesh.rsh
+ * \brief Mesh routines
+ *
+ *
+ */
+
+#ifndef __RS_MESH_RSH__
+#define __RS_MESH_RSH__
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+
+/**
+ * @param m mesh to get data from
+ * @return number of allocations in the mesh that contain vertex
+ * data
+ */
+extern uint32_t __attribute__((overloadable))
+ rsgMeshGetVertexAllocationCount(rs_mesh m);
+
+/**
+ * @param m mesh to get data from
+ * @return number of primitive groups in the mesh. This would
+ * include simple primitives as well as allocations
+ * containing index data
+ */
+extern uint32_t __attribute__((overloadable))
+ rsgMeshGetPrimitiveCount(rs_mesh m);
+
+/**
+ * @param m mesh to get data from
+ * @param index index of the vertex allocation
+ * @return allocation containing vertex data
+ */
+extern rs_allocation __attribute__((overloadable))
+ rsgMeshGetVertexAllocation(rs_mesh m, uint32_t index);
+
+/**
+ * @param m mesh to get data from
+ * @param index index of the index allocation
+ * @return allocation containing index data
+ */
+extern rs_allocation __attribute__((overloadable))
+ rsgMeshGetIndexAllocation(rs_mesh m, uint32_t index);
+
+/**
+ * @param m mesh to get data from
+ * @param index index of the primitive
+ * @return primitive describing how the mesh is rendered
+ */
+extern rs_primitive __attribute__((overloadable))
+ rsgMeshGetPrimitive(rs_mesh m, uint32_t index);
+
+#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
+
+#endif // __RS_MESH_RSH__
+
diff --git a/libs/rs/scriptc/rs_program.rsh b/libs/rs/scriptc/rs_program.rsh
new file mode 100644
index 0000000..6a9929e
--- /dev/null
+++ b/libs/rs/scriptc/rs_program.rsh
@@ -0,0 +1,129 @@
+/*
+ * 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.
+ */
+
+/** @file rs_program.rsh
+ * \brief Program object routines
+ *
+ *
+ */
+
+#ifndef __RS_PROGRAM_RSH__
+#define __RS_PROGRAM_RSH__
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+
+/**
+ * @hide
+ * Get program store depth function
+ *
+ * @param ps
+ */
+extern rs_depth_func __attribute__((overloadable))
+ rsgProgramStoreGetDepthFunc(rs_program_store ps);
+
+/**
+ * @hide
+ * Get program store depth mask
+ *
+ * @param ps
+ */
+extern bool __attribute__((overloadable))
+ rsgProgramStoreGetDepthMask(rs_program_store ps);
+/**
+ * @hide
+ * Get program store red component color mask
+ *
+ * @param ps
+ */
+extern bool __attribute__((overloadable))
+ rsgProgramStoreGetColorMaskR(rs_program_store ps);
+
+/**
+ * @hide
+ * Get program store green component color mask
+ *
+ * @param ps
+ */
+extern bool __attribute__((overloadable))
+ rsgProgramStoreGetColorMaskG(rs_program_store ps);
+
+/**
+ * @hide
+ * Get program store blur component color mask
+ *
+ * @param ps
+ */
+extern bool __attribute__((overloadable))
+ rsgProgramStoreGetColorMaskB(rs_program_store ps);
+
+/**
+ * @hide
+ * Get program store alpha component color mask
+ *
+ * @param ps
+ */
+extern bool __attribute__((overloadable))
+ rsgProgramStoreGetColorMaskA(rs_program_store ps);
+
+/**
+ * @hide
+ * Get program store blend source function
+ *
+ * @param ps
+ */
+extern rs_blend_src_func __attribute__((overloadable))
+ rsgProgramStoreGetBlendSrcFunc(rs_program_store ps);
+
+/**
+ * @hide
+ * Get program store blend destination function
+ *
+ * @param ps
+ */
+extern rs_blend_dst_func __attribute__((overloadable))
+ rsgProgramStoreGetBlendDstFunc(rs_program_store ps);
+
+/**
+ * @hide
+ * Get program store dither state
+ *
+ * @param ps
+ */
+extern bool __attribute__((overloadable))
+ rsgProgramStoreGetDitherEnabled(rs_program_store ps);
+
+/**
+ * @hide
+ * Get program raster point sprite state
+ *
+ * @param pr
+ */
+extern bool __attribute__((overloadable))
+ rsgProgramRasterGetPointSpriteEnabled(rs_program_raster pr);
+
+/**
+ * @hide
+ * Get program raster cull mode
+ *
+ * @param pr
+ */
+extern rs_cull_mode __attribute__((overloadable))
+ rsgProgramRasterGetCullMode(rs_program_raster pr);
+
+#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
+
+#endif // __RS_PROGRAM_RSH__
+
diff --git a/libs/rs/scriptc/rs_sampler.rsh b/libs/rs/scriptc/rs_sampler.rsh
new file mode 100644
index 0000000..c8948c7
--- /dev/null
+++ b/libs/rs/scriptc/rs_sampler.rsh
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+/** @file rs_sampler.rsh
+ * \brief Sampler routines
+ *
+ *
+ */
+
+#ifndef __RS_SAMPLER_RSH__
+#define __RS_SAMPLER_RSH__
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+
+/**
+ * @hide
+ * Get sampler minification value
+ *
+ * @param pr
+ */
+extern rs_sampler_value __attribute__((overloadable))
+ rsSamplerGetMinification(rs_sampler s);
+
+/**
+ * @hide
+ * Get sampler magnification value
+ *
+ * @param pr
+ */
+extern rs_sampler_value __attribute__((overloadable))
+ rsSamplerGetMagnification(rs_sampler s);
+
+/**
+ * @hide
+ * Get sampler wrap S value
+ *
+ * @param pr
+ */
+extern rs_sampler_value __attribute__((overloadable))
+ rsSamplerGetWrapS(rs_sampler s);
+
+/**
+ * @hide
+ * Get sampler wrap T value
+ *
+ * @param pr
+ */
+extern rs_sampler_value __attribute__((overloadable))
+ rsSamplerGetWrapT(rs_sampler s);
+
+/**
+ * @hide
+ * Get sampler anisotropy
+ *
+ * @param pr
+ */
+extern float __attribute__((overloadable))
+ rsSamplerGetAnisotropy(rs_sampler s);
+
+#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
+
+#endif // __RS_SAMPLER_RSH__
+
diff --git a/libs/rs/scriptc/rs_types.rsh b/libs/rs/scriptc/rs_types.rsh
index f8c2657..10617d8 100644
--- a/libs/rs/scriptc/rs_types.rsh
+++ b/libs/rs/scriptc/rs_types.rsh
@@ -402,6 +402,8 @@
#endif //defined(RS_VERSION) && (RS_VERSION >= 14)
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+
/**
* Describes the way mesh vertex data is interpreted when rendering
*
@@ -552,4 +554,6 @@
RS_SAMPLER_INVALID = 100,
} rs_sampler_value;
-#endif
+#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
+
+#endif // __RS_TYPES_RSH__
diff --git a/libs/rs/tests/ScriptC_mono.cpp b/libs/rs/tests/ScriptC_mono.cpp
index 7f83616..a6c63a8 100644
--- a/libs/rs/tests/ScriptC_mono.cpp
+++ b/libs/rs/tests/ScriptC_mono.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2012 The Android Open Source Project
+ * 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.
@@ -14,74 +14,105 @@
* limitations under the License.
*/
+
+/*
+ * This file is auto-generated. DO NOT MODIFY!
+ * The source Renderscript file: mono.rs
+ */
+
+
#include "ScriptC_mono.h"
-static const char mono[] = \
- "\xDE\xC0\x17\x0B\x00\x00\x00\x00\x18\x00\x00\x00\xFC\x03\x00\x00\x00\x00\x00\x00" \
- "\x10\x00\x00\x00\x42\x43\xC0\xDE\x21\x0C\x00\x00\xFC\x00\x00\x00\x01\x10\x00\x00" \
- "\x12\x00\x00\x00\x07\x81\x23\x91\x41\xC8\x04\x49\x06\x10\x32\x39\x92\x01\x84\x0C" \
- "\x25\x05\x08\x19\x1E\x04\x8B\x62\x80\x14\x45\x02\x42\x92\x0B\x42\xA4\x10\x32\x14" \
- "\x38\x08\x18\x49\x0A\x32\x44\x24\x48\x0A\x90\x21\x23\xC4\x52\x80\x0C\x19\x21\x72" \
- "\x24\x07\xC8\x48\x11\x62\xA8\xA0\xA8\x40\xC6\xF0\x01\x00\x00\x00\x49\x18\x00\x00" \
- "\x08\x00\x00\x00\x0B\x8C\x00\x04\x41\x10\x04\x09\x01\x04\x41\x10\x04\x89\xFF\xFF" \
- "\xFF\xFF\x1F\xC0\x60\x81\xF0\xFF\xFF\xFF\xFF\x03\x18\x00\x00\x00\x89\x20\x00\x00" \
- "\x13\x00\x00\x00\x32\x22\x48\x09\x20\x64\x85\x04\x93\x22\xA4\x84\x04\x93\x22\xE3" \
- "\x84\xA1\x90\x14\x12\x4C\x8A\x8C\x0B\x84\xA4\x4C\x10\x48\x23\x00\x73\x04\xC8\x30" \
- "\x02\x11\x90\x28\x03\x18\x83\xC8\x0C\xC0\x30\x02\x61\x14\xE1\x08\x42\xC3\x08\x83" \
- "\x51\x06\xA3\x14\xAD\x22\x08\x45\x6D\x20\x60\x8E\x00\x0C\x86\x11\x06\x08\x00\x00" \
- "\x13\xB0\x70\x90\x87\x76\xB0\x87\x3B\x68\x03\x77\x78\x07\x77\x28\x87\x36\x60\x87" \
- "\x74\x70\x87\x7A\xC0\x87\x36\x38\x07\x77\xA8\x87\x72\x08\x07\x71\x48\x87\x0D\xF2" \
- "\x50\x0E\x6D\x00\x0F\x7A\x30\x07\x72\xA0\x07\x73\x20\x07\x7A\x30\x07\x72\xD0\x06" \
- "\xE9\x10\x07\x7A\x80\x07\x7A\x80\x07\x6D\x90\x0E\x78\xA0\x07\x78\xA0\x07\x78\xD0" \
- "\x06\xE9\x10\x07\x76\xA0\x07\x71\x60\x07\x7A\x10\x07\x76\xD0\x06\xE9\x30\x07\x72" \
- "\xA0\x07\x73\x20\x07\x7A\x30\x07\x72\xD0\x06\xE9\x60\x07\x74\xA0\x07\x76\x40\x07" \
- "\x7A\x60\x07\x74\xD0\x06\xE6\x30\x07\x72\xA0\x07\x73\x20\x07\x7A\x30\x07\x72\xD0" \
- "\x06\xE6\x60\x07\x74\xA0\x07\x76\x40\x07\x7A\x60\x07\x74\xD0\x06\xF6\x60\x07\x74" \
- "\xA0\x07\x76\x40\x07\x7A\x60\x07\x74\xD0\x06\xF6\x10\x07\x72\x80\x07\x7A\x60\x07" \
- "\x74\xA0\x07\x71\x20\x07\x78\xD0\x06\xE1\x00\x07\x7A\x00\x07\x7A\x60\x07\x74\xD0" \
- "\x06\xEE\x30\x07\x72\xD0\x06\xB3\x60\x07\x74\x30\x44\x29\x00\x00\x08\x00\x00\x00" \
- "\x80\x21\x4A\x02\x04\x00\x00\x00\x00\x00\x0C\x51\x18\x20\x00\x00\x00\x00\x00\x60" \
- "\x88\xE2\x00\x01\x00\x00\x00\x00\x00\x79\x18\x00\x45\x00\x00\x00\x43\x88\x27\x78" \
- "\x84\x05\x87\x3D\x94\x83\x3C\xCC\x43\x3A\xBC\x83\x3B\x2C\x08\xE2\x60\x08\xF1\x10" \
- "\x4F\xB1\x20\x52\x87\x70\xB0\x87\x70\xF8\x05\x78\x08\x87\x71\x58\x87\x70\x38\x87" \
- "\x72\xF8\x05\x77\x08\x87\x76\x28\x87\x05\x63\x30\x0E\xEF\xD0\x0E\x6E\x50\x0E\xF8" \
- "\x10\x0E\xED\x00\x0F\xEC\x50\x0E\x6E\x10\x0E\xEE\x40\x0E\xF2\xF0\x0E\xE9\x40\x0E" \
- "\x6E\x20\x0F\xF3\xE0\x06\xE8\x50\x0E\xEC\xC0\x0E\xEF\x30\x0E\xEF\xD0\x0E\xF0\x50" \
- "\x0F\xF4\x50\x0E\x43\x84\xE7\x58\x40\xC8\xC3\x3B\xBC\x03\x3D\x0C\x11\x9E\x64\x41" \
- "\x30\x07\x43\x88\x67\x79\x98\x05\xCF\x3B\xB4\x83\x3B\xA4\x03\x3C\xBC\x03\x3D\x94" \
- "\x83\x3B\xD0\x03\x18\x8C\x03\x3A\x84\x83\x3C\x0C\x21\x9E\x06\x00\x16\x44\xB3\x90" \
- "\x0E\xED\x00\x0F\xEC\x50\x0E\x60\x30\x0A\x6F\x30\x0A\x6B\xB0\x06\x60\x40\x0B\xA2" \
- "\x10\x0A\xA1\x30\xE2\x18\x03\x78\x90\x87\x70\x38\x87\x76\x08\x87\x29\x02\x30\x8C" \
- "\xB8\xC6\x40\x1E\xE6\xE1\x17\xCA\x01\x1F\xE0\xE1\x1D\xE4\x81\x1E\x7E\xC1\x1C\xDE" \
- "\x41\x1E\xCA\x21\x1C\xC6\x01\x1D\x7E\xC1\x1D\xC2\xA1\x1D\xCA\x61\x4A\x60\x8C\x90" \
- "\xC6\x40\x1E\xE6\xE1\x17\xCA\x01\x1F\xE0\xE1\x1D\xE4\x81\x1E\x7E\xC1\x1C\xDE\x41" \
- "\x1E\xCA\x21\x1C\xC6\x01\x1D\xA6\x04\x08\x00\x00\x61\x20\x00\x00\x24\x00\x00\x00" \
- "\x13\x04\x41\x2C\x10\x00\x00\x00\x0C\x00\x00\x00\x04\x8B\xA0\x04\x46\x00\xE8\xCC" \
- "\x00\x90\x9A\x01\x98\x63\x70\x1A\x86\xCC\x18\x41\x6D\xFA\xB2\xEF\x8D\x11\x88\x6D" \
- "\xCC\xC6\xDF\x18\xC1\x49\x97\x72\xFA\x51\x9C\x63\x40\x0E\x63\x04\x00\x00\x00\x00" \
- "\x44\x8C\x11\x03\x42\x08\x82\x68\x90\x41\x4A\x9E\x11\x83\x42\x08\x84\x69\x99\x63" \
- "\x50\x28\x64\x90\xA1\x52\xA0\x11\x03\x42\x08\x06\x6B\x30\xA2\xB8\x06\x00\xC3\x81" \
- "\x00\x00\x00\x00\x03\x00\x00\x00\x46\x40\x54\x3F\xD2\x58\x41\x51\xFD\x0E\x35\x01" \
- "\x01\x31\x00\x00\x03\x00\x00\x00\x5B\x06\x20\x50\xB6\x0C\x47\xA0\x00\x00\x00\x00" \
- "\x00\x00\x00\x00\x79\x18\x00\x00\x0B\x00\x00\x00\x33\x08\x80\x1C\xC4\xE1\x1C\x66" \
- "\x14\x01\x3D\x88\x43\x38\x84\xC3\x8C\x42\x80\x07\x79\x78\x07\x73\x98\xB1\x0C\xE6" \
- "\x00\x0F\xE1\x30\x0E\xE3\x50\x0F\xF2\x10\x0E\xE3\x90\x0F\x00\x00\x71\x20\x00\x00" \
- "\x0E\x00\x00\x00\x06\x40\x44\x8E\x33\x59\x40\x14\x49\x6E\xF3\x00\x82\xC2\x39\x8B" \
- "\x13\xF1\x3C\xCF\x9B\x40\xF3\xCF\xF7\xE0\x4C\x5D\x75\xFF\x05\xFB\xDB\x80\xF6\xCF" \
- "\xF5\x1E\x49\x29\x20\x28\x9C\xB3\x38\x51\xEB\xF0\x3C\xCF\x77\xD5\xFD\x17\x00\x00" \
- "\x00\x00\x00\x00";
-
+static const unsigned char __txt[] = {
+ 0xde,0xc0,0x17,0x0b,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0xd0,0x04,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x42,0x43,0xc0,0xde,0x21,0x0c,0x00,0x00,
+ 0x31,0x01,0x00,0x00,0x01,0x10,0x00,0x00,0x12,0x00,0x00,0x00,0x07,0x81,0x23,0x91,
+ 0x41,0xc8,0x04,0x49,0x06,0x10,0x32,0x39,0x92,0x01,0x84,0x0c,0x25,0x05,0x08,0x19,
+ 0x1e,0x04,0x8b,0x62,0x80,0x14,0x45,0x02,0x42,0x92,0x0b,0x42,0xa4,0x10,0x32,0x14,
+ 0x38,0x08,0x18,0x49,0x0a,0x32,0x44,0x24,0x48,0x0a,0x90,0x21,0x23,0xc4,0x52,0x80,
+ 0x0c,0x19,0x21,0x72,0x24,0x07,0xc8,0x48,0x11,0x62,0xa8,0xa0,0xa8,0x40,0xc6,0xf0,
+ 0x01,0x00,0x00,0x00,0x49,0x18,0x00,0x00,0x08,0x00,0x00,0x00,0x0b,0x8c,0x00,0x04,
+ 0x41,0x10,0x04,0x09,0x01,0x04,0x41,0x10,0x04,0x89,0xff,0xff,0xff,0xff,0x1f,0xc0,
+ 0x60,0x81,0xf0,0xff,0xff,0xff,0xff,0x03,0x18,0x00,0x00,0x00,0x89,0x20,0x00,0x00,
+ 0x14,0x00,0x00,0x00,0x32,0x22,0x48,0x09,0x20,0x64,0x85,0x04,0x93,0x22,0xa4,0x84,
+ 0x04,0x93,0x22,0xe3,0x84,0xa1,0x90,0x14,0x12,0x4c,0x8a,0x8c,0x0b,0x84,0xa4,0x4c,
+ 0x10,0x54,0x73,0x04,0x60,0x40,0x60,0x06,0x80,0xc4,0x1c,0x01,0x42,0x64,0x04,0x60,
+ 0x18,0x81,0x20,0xe8,0x94,0xc1,0x20,0x44,0x69,0x18,0x81,0x10,0x8a,0xb0,0x0e,0xb1,
+ 0x61,0x84,0x41,0x28,0x83,0x70,0x8e,0x5e,0x11,0x8e,0xa3,0x38,0x10,0x30,0x8c,0x30,
+ 0x00,0x00,0x00,0x00,0x13,0xb0,0x70,0x90,0x87,0x76,0xb0,0x87,0x3b,0x68,0x03,0x77,
+ 0x78,0x07,0x77,0x28,0x87,0x36,0x60,0x87,0x74,0x70,0x87,0x7a,0xc0,0x87,0x36,0x38,
+ 0x07,0x77,0xa8,0x87,0x72,0x08,0x07,0x71,0x48,0x87,0x0d,0xf2,0x50,0x0e,0x6d,0x00,
+ 0x0f,0x7a,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,0x06,
+ 0xe9,0x10,0x07,0x7a,0x80,0x07,0x7a,0x80,0x07,0x6d,0x90,0x0e,0x78,0xa0,0x07,0x78,
+ 0xa0,0x07,0x78,0xd0,0x06,0xe9,0x10,0x07,0x76,0xa0,0x07,0x71,0x60,0x07,0x7a,0x10,
+ 0x07,0x76,0xd0,0x06,0xe9,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,
+ 0x72,0xd0,0x06,0xe9,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,
+ 0xd0,0x06,0xe6,0x30,0x07,0x72,0xa0,0x07,0x73,0x20,0x07,0x7a,0x30,0x07,0x72,0xd0,
+ 0x06,0xe6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,
+ 0xf6,0x60,0x07,0x74,0xa0,0x07,0x76,0x40,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xf6,
+ 0x10,0x07,0x72,0x80,0x07,0x7a,0x60,0x07,0x74,0xa0,0x07,0x71,0x20,0x07,0x78,0xd0,
+ 0x06,0xe1,0x00,0x07,0x7a,0x00,0x07,0x7a,0x60,0x07,0x74,0xd0,0x06,0xee,0x30,0x07,
+ 0x72,0xd0,0x06,0xb3,0x60,0x07,0x74,0xa0,0xf3,0x40,0x86,0x04,0x32,0x42,0x44,0x04,
+ 0x60,0x20,0x30,0x77,0x81,0x59,0x0a,0x34,0x44,0x51,0x00,0x00,0x08,0x00,0x00,0x00,
+ 0x80,0x21,0x4a,0x03,0x04,0x00,0x00,0x00,0x00,0x00,0x0c,0x51,0x20,0x20,0x00,0x00,
+ 0x00,0x00,0x00,0x60,0x88,0x22,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x59,0x20,0x00,
+ 0x08,0x00,0x00,0x00,0x32,0x1e,0x98,0x10,0x19,0x11,0x4c,0x90,0x8c,0x09,0x26,0x47,
+ 0xc6,0x04,0x43,0x02,0x85,0x50,0x06,0x44,0x4a,0x80,0xc4,0x18,0x81,0xce,0x9a,0x73,
+ 0xfe,0x01,0x00,0x00,0x79,0x18,0x00,0x00,0x69,0x00,0x00,0x00,0x43,0x88,0x29,0x98,
+ 0x84,0x05,0x87,0x3d,0x94,0x83,0x3c,0xcc,0x43,0x3a,0xbc,0x83,0x3b,0x2c,0x08,0xe2,
+ 0x60,0x08,0x31,0x11,0x53,0xb1,0x20,0x52,0x87,0x70,0xb0,0x87,0x70,0xf8,0x05,0x78,
+ 0x08,0x87,0x71,0x58,0x87,0x70,0x38,0x87,0x72,0xf8,0x05,0x77,0x08,0x87,0x76,0x28,
+ 0x87,0x05,0x63,0x30,0x0e,0xef,0xd0,0x0e,0x6e,0x50,0x0e,0xf8,0x10,0x0e,0xed,0x00,
+ 0x0f,0xec,0x50,0x0e,0x6e,0x10,0x0e,0xee,0x40,0x0e,0xf2,0xf0,0x0e,0xe9,0x40,0x0e,
+ 0x6e,0x20,0x0f,0xf3,0xe0,0x06,0xe8,0x50,0x0e,0xec,0xc0,0x0e,0xef,0x30,0x0e,0xef,
+ 0xd0,0x0e,0xf0,0x50,0x0f,0xf4,0x50,0x0e,0x43,0x04,0x00,0x19,0x42,0x4c,0xc8,0x94,
+ 0x2c,0x20,0xce,0x21,0x15,0xdc,0x81,0x1e,0x16,0x04,0x75,0x30,0x84,0x98,0x96,0x49,
+ 0x58,0x60,0x8c,0x83,0x29,0xb0,0xc3,0x3b,0x84,0x03,0x3d,0x0c,0x21,0xa6,0x66,0x72,
+ 0x16,0x14,0xe7,0x20,0x0a,0xef,0xf0,0x0e,0xec,0xb0,0x40,0x88,0x83,0x38,0x18,0x22,
+ 0x4c,0xd0,0x02,0x42,0x1e,0xde,0xe1,0x1d,0xe8,0x61,0x88,0x30,0x49,0x0b,0x82,0x39,
+ 0x18,0x42,0x4c,0xd4,0x54,0x2d,0x78,0xde,0xa1,0x1d,0xdc,0x21,0x1d,0xe0,0xe1,0x1d,
+ 0xe8,0xa1,0x1c,0xdc,0x81,0x1e,0xc0,0x60,0x1c,0xd0,0x21,0x1c,0xe4,0x61,0x08,0x31,
+ 0x59,0x06,0xb0,0x20,0x9a,0x85,0x74,0x68,0x07,0x78,0x60,0x87,0x72,0x00,0x83,0x51,
+ 0x78,0x83,0x51,0x58,0x83,0x35,0x00,0x03,0x5a,0x10,0x85,0x50,0x08,0x85,0x11,0xc7,
+ 0x18,0xc0,0x83,0x3c,0x84,0xc3,0x39,0xb4,0x43,0x38,0x4c,0x11,0x80,0x61,0xc4,0x34,
+ 0x06,0xef,0x00,0x0f,0xf4,0x90,0x0e,0xed,0x90,0x0e,0xfa,0x10,0x0e,0xf4,0x90,0x0e,
+ 0xef,0xe0,0x0e,0xbf,0xc0,0x0e,0xe5,0x60,0x0f,0xe5,0xc0,0x0e,0x53,0x02,0x63,0x84,
+ 0x33,0x06,0xf2,0x30,0x0f,0xbf,0x50,0x0e,0xf8,0x00,0x0f,0xef,0x20,0x0f,0xf4,0xf0,
+ 0x0b,0xf6,0x10,0x0e,0xf2,0x30,0x65,0x38,0x14,0x66,0x04,0x34,0x06,0xf2,0x30,0x0f,
+ 0xbf,0xf0,0x0e,0xe2,0xa0,0x0e,0xe5,0x30,0x0e,0xf4,0xf0,0x0b,0xf3,0xc0,0x0e,0xef,
+ 0x40,0x0f,0xf3,0x30,0x05,0x18,0x71,0x8d,0x81,0x3c,0xcc,0xc3,0x2f,0x94,0x03,0x3e,
+ 0xc0,0xc3,0x3b,0xc8,0x03,0x3d,0xfc,0x82,0x39,0xbc,0x83,0x3c,0x94,0x43,0x38,0x8c,
+ 0x03,0x3a,0xfc,0x82,0x3b,0x84,0x43,0x3b,0x94,0xc3,0x94,0xe0,0x19,0x21,0x8d,0x81,
+ 0x3c,0xcc,0xc3,0x2f,0x94,0x03,0x3e,0xc0,0xc3,0x3b,0xc8,0x03,0x3d,0xfc,0x82,0x39,
+ 0xbc,0x83,0x3c,0x94,0x43,0x38,0x8c,0x03,0x3a,0x4c,0x09,0x22,0x00,0x00,0x00,0x00,
+ 0x79,0x18,0x00,0x00,0x0b,0x00,0x00,0x00,0x33,0x08,0x80,0x1c,0xc4,0xe1,0x1c,0x66,
+ 0x14,0x01,0x3d,0x88,0x43,0x38,0x84,0xc3,0x8c,0x42,0x80,0x07,0x79,0x78,0x07,0x73,
+ 0x98,0xb1,0x0c,0xe6,0x00,0x0f,0xe1,0x30,0x0e,0xe3,0x50,0x0f,0xf2,0x10,0x0e,0xe3,
+ 0x90,0x0f,0x00,0x00,0x71,0x20,0x00,0x00,0x13,0x00,0x00,0x00,0x06,0x40,0x18,0x62,
+ 0x33,0x99,0x40,0x61,0x6c,0x8e,0xb3,0xd8,0x00,0x11,0x39,0xce,0x64,0x04,0x51,0x24,
+ 0xb9,0xcd,0x03,0x08,0x0a,0xe7,0x2c,0x4e,0xc4,0xf3,0x3c,0x6f,0x05,0xcd,0x3f,0xdf,
+ 0x83,0x33,0x75,0xd5,0xfd,0x17,0xec,0x6f,0x01,0x86,0xf0,0x2d,0x0e,0x30,0x99,0x81,
+ 0xf6,0xcf,0xf5,0x1e,0x49,0x29,0x20,0x28,0x9c,0xb3,0x38,0x51,0xeb,0xf0,0x3c,0xcf,
+ 0x77,0xd5,0xfd,0x17,0x00,0x00,0x00,0x00,0x61,0x20,0x00,0x00,0x21,0x00,0x00,0x00,
+ 0x13,0x04,0x41,0x2c,0x10,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x04,0x46,0x00,0x68,
+ 0xcd,0x00,0x90,0x9b,0x01,0x18,0x6b,0x38,0xe9,0x52,0x4e,0x3f,0xb1,0x8d,0xd9,0xf8,
+ 0xab,0x4d,0x5f,0xf6,0x3d,0xa2,0x63,0x0d,0x40,0x20,0x8c,0x00,0x00,0x00,0x00,0x00,
+ 0xb4,0x8c,0x11,0x03,0x42,0x08,0x88,0x69,0x90,0x81,0x72,0xa2,0x11,0x83,0x42,0x08,
+ 0x8a,0x0a,0x9a,0x63,0x78,0xac,0x66,0x90,0xe1,0x7a,0xa4,0x11,0x03,0x42,0x08,0x0c,
+ 0x6c,0x30,0x82,0xc9,0x06,0x00,0xc3,0x81,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
+ 0xb6,0x40,0x54,0x3f,0xd2,0x18,0x43,0x51,0xfd,0x0e,0x35,0x01,0x01,0x31,0x00,0x00,
+ 0x03,0x00,0x00,0x00,0x5b,0x06,0x20,0x98,0xb6,0x0c,0x47,0x30,0x01,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+};
ScriptC_mono::ScriptC_mono(RenderScript *rs, const char *cacheDir, size_t cacheDirLength) :
- ScriptC(rs, mono, sizeof(mono) - 1, "mono", 4, cacheDir, cacheDirLength) {
-
- printf("sizeof text %i", sizeof(mono));
-
-
-
+ ScriptC(rs, __txt, sizeof(__txt), "mono.rs", 4, cacheDir, cacheDirLength) {
}
-void ScriptC_mono::forEach_root(const Allocation *ain, const Allocation *aout) {
+ScriptC_mono::~ScriptC_mono() {
+}
+
+void ScriptC_mono::forEach_root(const Allocation *ain, const Allocation *aout) const {
forEach(0, ain, aout, NULL, 0);
}
diff --git a/libs/rs/tests/ScriptC_mono.h b/libs/rs/tests/ScriptC_mono.h
index 7e4f601..69c41ac 100644
--- a/libs/rs/tests/ScriptC_mono.h
+++ b/libs/rs/tests/ScriptC_mono.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2012 The Android Open Source Project
+ * 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.
@@ -14,13 +14,42 @@
* limitations under the License.
*/
+
+/*
+ * This file is auto-generated. DO NOT MODIFY!
+ * The source Renderscript file: mono.rs
+ */
+
+
#include "ScriptC.h"
class ScriptC_mono : protected ScriptC {
+private:
+ int32_t __gInt;
+ bool __gBool;
public:
ScriptC_mono(RenderScript *rs, const char *cacheDir, size_t cacheDirLength);
-
- void forEach_root(const Allocation *ain, const Allocation *aout);
-
+ virtual ~ScriptC_mono();
+
+ void set_gInt(int32_t v) {
+ setVar(0, v);
+ __gInt = v;
+ }
+ int32_t get_gInt() const {
+ return __gInt;
+ }
+
+ float get_cFloat() const {
+ return 1.2f;
+ }
+
+ void set_gBool(bool v) {
+ setVar(2, v);
+ __gBool = v;
+ }
+ bool get_gBool() const {
+ return __gBool;
+ }
+
+ void forEach_root(const Allocation *ain, const Allocation *aout) const;
};
-
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 9748d3b..82dd308 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -608,16 +608,15 @@
* Adjusts the master volume for the device's audio amplifier.
* <p>
*
- * @param direction The direction to adjust the volume. One of
- * {@link #ADJUST_LOWER}, {@link #ADJUST_RAISE}, or
- * {@link #ADJUST_SAME}.
+ * @param steps The number of volume steps to adjust. A positive
+ * value will raise the volume.
* @param flags One or more flags.
* @hide
*/
- public void adjustMasterVolume(int direction, int flags) {
+ public void adjustMasterVolume(int steps, int flags) {
IAudioService service = getService();
try {
- service.adjustMasterVolume(direction, flags);
+ service.adjustMasterVolume(steps, flags);
} catch (RemoteException e) {
Log.e(TAG, "Dead object in adjustMasterVolume", e);
}
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index aa60d0a..5f6a61d 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -159,6 +159,9 @@
// but to support integer based AudioManager API we translate it to 0 - 100
private static final int MAX_MASTER_VOLUME = 100;
+ // Maximum volume adjust steps allowed in a single batch call.
+ private static final int MAX_BATCH_VOLUME_ADJUST_STEPS = 4;
+
/* Sound effect file names */
private static final String SOUND_EFFECTS_PATH = "/media/audio/ui/";
private static final String[] SOUND_EFFECT_FILES = new String[] {
@@ -619,29 +622,19 @@
}
/** @see AudioManager#adjustMasterVolume(int) */
- public void adjustMasterVolume(int direction, int flags) {
- ensureValidDirection(direction);
+ public void adjustMasterVolume(int steps, int flags) {
+ ensureValidSteps(steps);
int volume = Math.round(AudioSystem.getMasterVolume() * MAX_MASTER_VOLUME);
int delta = 0;
- for (int i = 0; i < mMasterVolumeRamp.length; i += 2) {
- int testVolume = mMasterVolumeRamp[i];
- int testDelta = mMasterVolumeRamp[i + 1];
- if (direction == AudioManager.ADJUST_RAISE) {
- if (volume >= testVolume) {
- delta = testDelta;
- } else {
- break;
- }
- } else if (direction == AudioManager.ADJUST_LOWER) {
- if (volume - testDelta >= testVolume) {
- delta = -testDelta;
- } else {
- break;
- }
- }
+ int numSteps = Math.abs(steps);
+ int direction = steps > 0 ? AudioManager.ADJUST_RAISE : AudioManager.ADJUST_LOWER;
+ for (int i = 0; i < numSteps; ++i) {
+ delta = findVolumeDelta(direction, volume);
+ volume += delta;
}
-// Log.d(TAG, "adjustMasterVolume volume: " + volume + " delta: " + delta + " direction: " + direction);
- setMasterVolume(volume + delta, flags);
+
+ //Log.d(TAG, "adjustMasterVolume volume: " + volume + " steps: " + steps);
+ setMasterVolume(volume, flags);
}
/** @see AudioManager#setStreamVolume(int, int, int) */
@@ -682,6 +675,41 @@
sendVolumeUpdate(streamType, oldIndex, index, flags);
}
+ private int findVolumeDelta(int direction, int volume) {
+ int delta = 0;
+ if (direction == AudioManager.ADJUST_RAISE) {
+ if (volume == MAX_MASTER_VOLUME) {
+ return 0;
+ }
+ // This is the default value if we make it to the end
+ delta = mMasterVolumeRamp[1];
+ // If we're raising the volume move down the ramp array until we
+ // find the volume we're above and use that groups delta.
+ for (int i = mMasterVolumeRamp.length - 1; i > 1; i -= 2) {
+ if (volume >= mMasterVolumeRamp[i - 1]) {
+ delta = mMasterVolumeRamp[i];
+ break;
+ }
+ }
+ } else if (direction == AudioManager.ADJUST_LOWER){
+ if (volume == 0) {
+ return 0;
+ }
+ int length = mMasterVolumeRamp.length;
+ // This is the default value if we make it to the end
+ delta = -mMasterVolumeRamp[length - 1];
+ // If we're lowering the volume move up the ramp array until we
+ // find the volume we're below and use the group below it's delta
+ for (int i = 2; i < length; i += 2) {
+ if (volume <= mMasterVolumeRamp[i]) {
+ delta = -mMasterVolumeRamp[i - 1];
+ break;
+ }
+ }
+ }
+ return delta;
+ }
+
// UI update and Broadcast Intent
private void sendVolumeUpdate(int streamType, int oldIndex, int index, int flags) {
if (!mVoiceCapable && (streamType == AudioSystem.STREAM_RING)) {
@@ -1862,6 +1890,12 @@
}
}
+ private void ensureValidSteps(int steps) {
+ if (Math.abs(steps) > MAX_BATCH_VOLUME_ADJUST_STEPS) {
+ throw new IllegalArgumentException("Bad volume adjust steps " + steps);
+ }
+ }
+
private void ensureValidStreamType(int streamType) {
if (streamType < 0 || streamType >= mStreamStates.length) {
throw new IllegalArgumentException("Bad stream type " + streamType);
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index bccf1f9..d06e302 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -48,6 +48,7 @@
public static int FLAG_SYNCFRAME = 1;
public static int FLAG_CODECCONFIG = 2;
public static int FLAG_EOS = 4;
+ public static int FLAG_ENCRYPTED = 8;
/** Instantiate a codec component by mime type. For decoder components
this is the mime type of media that this decoder should be able to
@@ -82,6 +83,7 @@
public native final void release();
public static int CONFIGURE_FLAG_ENCODE = 1;
+ public static int CONFIGURE_FLAG_SECURE = 2;
/** Configures a component.
* @param format A map of string/value pairs describing the input format
diff --git a/media/java/android/media/MediaExtractor.java b/media/java/android/media/MediaExtractor.java
index 5732c72..9ea3d0e 100644
--- a/media/java/android/media/MediaExtractor.java
+++ b/media/java/android/media/MediaExtractor.java
@@ -65,6 +65,13 @@
// Returns the current sample's presentation time in microseconds.
public native long getSampleTime();
+ // Keep these in sync with their equivalents in NuMediaExtractor.h
+ public static final int SAMPLE_FLAG_SYNC = 1;
+ public static final int SAMPLE_FLAG_ENCRYPTED = 2;
+
+ // Returns the current sample's flags.
+ public native int getSampleFlags();
+
private static native final void native_init();
private native final void native_setup(String path);
private native final void native_finalize();
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 4e6c174..d92180d 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -24,6 +24,7 @@
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
+import android.os.Parcelable;
import android.os.ParcelFileDescriptor;
import android.os.PowerManager;
import android.util.Log;
@@ -455,6 +456,22 @@
* <td>Successful invoke of this method in a valid state transfers the
* object to the <em>Stopped</em> state. Calling this method in an
* invalid state transfers the object to the <em>Error</em> state.</p></td></tr>
+ * <tr><td>getTrackInfo </p></td>
+ * <td>{Prepared, Started, Stopped, Paused, PlaybackCompleted}</p></td>
+ * <td>{Idle, Initialized, Error}</p></td>
+ * <td>Successful invoke of this method does not change the state.</p></td></tr>
+ * <tr><td>addExternalSource </p></td>
+ * <td>{Prepared, Started, Stopped, Paused, PlaybackCompleted}</p></td>
+ * <td>{Idle, Initialized, Error}</p></td>
+ * <td>Successful invoke of this method does not change the state.</p></td></tr>
+ * <tr><td>selectTrack </p></td>
+ * <td>{Prepared, Started, Stopped, Paused, PlaybackCompleted}</p></td>
+ * <td>{Idle, Initialized, Error}</p></td>
+ * <td>Successful invoke of this method does not change the state.</p></td></tr>
+ * <tr><td>disableTrack </p></td>
+ * <td>{Prepared, Started, Stopped, Paused, PlaybackCompleted}</p></td>
+ * <td>{Idle, Initialized, Error}</p></td>
+ * <td>Successful invoke of this method does not change the state.</p></td></tr>
*
* </table>
*
@@ -572,6 +589,15 @@
*/
private native void _setVideoSurface(Surface surface);
+ /* Do not change these values (starting with INVOKE_ID) without updating
+ * their counterparts in include/media/mediaplayer.h!
+ */
+ private static final int INVOKE_ID_GET_TRACK_INFO = 1;
+ private static final int INVOKE_ID_ADD_EXTERNAL_SOURCE = 2;
+ private static final int INVOKE_ID_ADD_EXTERNAL_SOURCE_FD = 3;
+ private static final int INVOKE_ID_SELECT_TRACK = 4;
+ private static final int INVOKE_ID_UNSELECT_TRACK = 5;
+
/**
* Create a request parcel which can be routed to the native media
* player using {@link #invoke(Parcel, Parcel)}. The Parcel
@@ -1170,7 +1196,6 @@
*
* @param next the player to start after this one completes playback.
*
- * @hide
*/
public native void setNextMediaPlayer(MediaPlayer next);
@@ -1313,23 +1338,6 @@
/* Do not change these values (starting with KEY_PARAMETER) without updating
* their counterparts in include/media/mediaplayer.h!
*/
- /*
- * Key used in setParameter method.
- * Indicates the index of the timed text track to be enabled/disabled.
- * The index includes both the in-band and out-of-band timed text.
- * The index should start from in-band text if any. Application can retrieve the number
- * of in-band text tracks by using MediaMetadataRetriever::extractMetadata().
- * Note it might take a few hundred ms to scan an out-of-band text file
- * before displaying it.
- */
- private static final int KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX = 1000;
- /*
- * Key used in setParameter method.
- * Used to add out-of-band timed text source path.
- * Application can add multiple text sources by calling setParameter() with
- * KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE multiple times.
- */
- private static final int KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE = 1001;
// There are currently no defined keys usable from Java with get*Parameter.
// But if any keys are defined, the order must be kept in sync with include/media/mediaplayer.h.
@@ -1374,7 +1382,7 @@
return ret;
}
- /**
+ /*
* Gets the value of the parameter indicated by key.
* @param key key indicates the parameter to get.
* @param reply value of the parameter to get.
@@ -1436,7 +1444,7 @@
*/
public native void setAuxEffectSendLevel(float level);
- /**
+ /*
* @param request Parcel destinated to the media player. The
* Interface token must be set to the IMediaPlayer
* one to be routed correctly through the system.
@@ -1446,7 +1454,7 @@
private native final int native_invoke(Parcel request, Parcel reply);
- /**
+ /*
* @param update_only If true fetch only the set of metadata that have
* changed since the last invocation of getMetadata.
* The set is built using the unfiltered
@@ -1463,7 +1471,7 @@
boolean apply_filter,
Parcel reply);
- /**
+ /*
* @param request Parcel with the 2 serialized lists of allowed
* metadata types followed by the one to be
* dropped. Each list starts with an integer
@@ -1477,33 +1485,289 @@
private native final void native_finalize();
/**
- * @param index The index of the text track to be turned on.
- * @return true if the text track is enabled successfully.
+ * Class for MediaPlayer to return each audio/video/subtitle track's metadata.
+ *
+ * {@see #getTrackInfo()}.
* {@hide}
*/
- public boolean enableTimedTextTrackIndex(int index) {
- if (index < 0) {
- return false;
+ static public class TrackInfo implements Parcelable {
+ /**
+ * Gets the track type.
+ * @return TrackType which indicates if the track is video, audio, timed text.
+ */
+ public int getTrackType() {
+ return mTrackType;
}
- return setParameter(KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX, index);
+
+ /**
+ * Gets the language code of the track.
+ * @return a language code in either way of ISO-639-1 or ISO-639-2.
+ * When the language is unknown or could not be determined,
+ * ISO-639-2 language code, "und", is returned.
+ */
+ public String getLanguage() {
+ return mLanguage;
+ }
+
+ public static final int MEDIA_TRACK_TYPE_UNKNOWN = 0;
+ public static final int MEDIA_TRACK_TYPE_VIDEO = 1;
+ public static final int MEDIA_TRACK_TYPE_AUDIO = 2;
+ public static final int MEDIA_TRACK_TYPE_TIMEDTEXT = 3;
+
+ final int mTrackType;
+ final String mLanguage;
+
+ TrackInfo(Parcel in) {
+ mTrackType = in.readInt();
+ mLanguage = in.readString();
+ }
+
+ /*
+ * No special parcel contents. Keep it as hide.
+ * {@hide}
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /*
+ * {@hide}
+ */
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mTrackType);
+ dest.writeString(mLanguage);
+ }
+
+ /**
+ * Used to read a TrackInfo from a Parcel.
+ */
+ static final Parcelable.Creator<TrackInfo> CREATOR
+ = new Parcelable.Creator<TrackInfo>() {
+ @Override
+ public TrackInfo createFromParcel(Parcel in) {
+ return new TrackInfo(in);
+ }
+
+ @Override
+ public TrackInfo[] newArray(int size) {
+ return new TrackInfo[size];
+ }
+ };
+
+ };
+
+ /**
+ * Returns an array of track information.
+ *
+ * @return Array of track info. null if an error occured.
+ * {@hide}
+ */
+ // FIXME: It returns timed text tracks' information for now. Other types of tracks will be
+ // supported in future.
+ public TrackInfo[] getTrackInfo() {
+ Parcel request = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ request.writeInterfaceToken(IMEDIA_PLAYER);
+ request.writeInt(INVOKE_ID_GET_TRACK_INFO);
+ invoke(request, reply);
+ TrackInfo trackInfo[] = reply.createTypedArray(TrackInfo.CREATOR);
+ return trackInfo;
+ }
+
+ /*
+ * A helper function to check if the mime type is supported by media framework.
+ */
+ private boolean availableMimeTypeForExternalSource(String mimeType) {
+ if (mimeType == MEDIA_MIMETYPE_TEXT_SUBRIP) {
+ return true;
+ }
+ return false;
+ }
+
+ /* TODO: Limit the total number of external timed text source to a reasonable number.
+ */
+ /**
+ * Adds an external source file.
+ *
+ * Currently supported format is SubRip with the file extension .srt, case insensitive.
+ * Note that a single external source may contain multiple tracks in it.
+ * One can find the total number of available tracks using {@link #getTrackInfo()} to see what
+ * additional tracks become available after this method call.
+ *
+ * @param path The file path of external source file.
+ * {@hide}
+ */
+ // FIXME: define error codes and throws exceptions according to the error codes.
+ // (IllegalStateException, IOException).
+ public void addExternalSource(String path, String mimeType)
+ throws IllegalArgumentException {
+ if (!availableMimeTypeForExternalSource(mimeType)) {
+ throw new IllegalArgumentException("Illegal mimeType for external source: " + mimeType);
+ }
+
+ Parcel request = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ request.writeInterfaceToken(IMEDIA_PLAYER);
+ request.writeInt(INVOKE_ID_ADD_EXTERNAL_SOURCE);
+ request.writeString(path);
+ request.writeString(mimeType);
+ invoke(request, reply);
}
/**
- * Enables the first timed text track if any.
- * @return true if the text track is enabled successfully
+ * Adds an external source file (Uri).
+ *
+ * Currently supported format is SubRip with the file extension .srt, case insensitive.
+ * Note that a single external source may contain multiple tracks in it.
+ * One can find the total number of available tracks using {@link #getTrackInfo()} to see what
+ * additional tracks become available after this method call.
+ *
+ * @param context the Context to use when resolving the Uri
+ * @param uri the Content URI of the data you want to play
* {@hide}
*/
- public boolean enableTimedText() {
- return enableTimedTextTrackIndex(0);
+ // FIXME: define error codes and throws exceptions according to the error codes.
+ // (IllegalStateException, IOException).
+ public void addExternalSource(Context context, Uri uri, String mimeType)
+ throws IOException, IllegalArgumentException {
+ String scheme = uri.getScheme();
+ if(scheme == null || scheme.equals("file")) {
+ addExternalSource(uri.getPath(), mimeType);
+ return;
+ }
+
+ AssetFileDescriptor fd = null;
+ try {
+ ContentResolver resolver = context.getContentResolver();
+ fd = resolver.openAssetFileDescriptor(uri, "r");
+ if (fd == null) {
+ return;
+ }
+ addExternalSource(fd.getFileDescriptor(), mimeType);
+ return;
+ } catch (SecurityException ex) {
+ } catch (IOException ex) {
+ } finally {
+ if (fd != null) {
+ fd.close();
+ }
+ }
+
+ // TODO: try server side.
+ }
+
+ /* Do not change these values without updating their counterparts
+ * in include/media/stagefright/MediaDefs.h and media/libstagefright/MediaDefs.cpp!
+ */
+ /**
+ * MIME type for SubRip (SRT) container. Used in {@link #addExternalSource()} APIs.
+ * {@hide}
+ */
+ public static final String MEDIA_MIMETYPE_TEXT_SUBRIP = "application/x-subrip";
+
+ /**
+ * Adds an external source file (FileDescriptor).
+ * It is the caller's responsibility to close the file descriptor.
+ * It is safe to do so as soon as this call returns.
+ *
+ * Currently supported format is SubRip with the file extension .srt, case insensitive.
+ * Note that a single external source may contain multiple tracks in it.
+ * One can find the total number of available tracks using {@link #getTrackInfo()} to see what
+ * additional tracks become available after this method call.
+ *
+ * @param fd the FileDescriptor for the file you want to play
+ * @param mimeType A MIME type for the content. It can be null.
+ * <ul>
+ * <li>{@link #MEDIA_MIMETYPE_TEXT_SUBRIP}
+ * </ul>
+ * {@hide}
+ */
+ // FIXME: define error codes and throws exceptions according to the error codes.
+ // (IllegalStateException, IOException).
+ public void addExternalSource(FileDescriptor fd, String mimeType)
+ throws IllegalArgumentException {
+ // intentionally less than LONG_MAX
+ addExternalSource(fd, 0, 0x7ffffffffffffffL, mimeType);
}
/**
- * Disables timed text display.
- * @return true if the text track is disabled successfully.
+ * Adds an external timed text file (FileDescriptor).
+ * It is the caller's responsibility to close the file descriptor.
+ * It is safe to do so as soon as this call returns.
+ *
+ * Currently supported format is SubRip with the file extension .srt, case insensitive.
+ * Note that a single external source may contain multiple tracks in it.
+ * One can find the total number of available tracks using {@link #getTrackInfo()} to see what
+ * additional tracks become available after this method call.
+ *
+ * @param fd the FileDescriptor for the file you want to play
+ * @param offset the offset into the file where the data to be played starts, in bytes
+ * @param length the length in bytes of the data to be played
+ * @param mimeType A MIME type for the content. It can be null.
* {@hide}
*/
- public boolean disableTimedText() {
- return setParameter(KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX, -1);
+ // FIXME: define error codes and throws exceptions according to the error codes.
+ // (IllegalStateException, IOException).
+ public void addExternalSource(FileDescriptor fd, long offset, long length, String mimeType)
+ throws IllegalArgumentException {
+ if (!availableMimeTypeForExternalSource(mimeType)) {
+ throw new IllegalArgumentException("Illegal mimeType for external source: " + mimeType);
+ }
+ Parcel request = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ request.writeInterfaceToken(IMEDIA_PLAYER);
+ request.writeInt(INVOKE_ID_ADD_EXTERNAL_SOURCE_FD);
+ request.writeFileDescriptor(fd);
+ request.writeLong(offset);
+ request.writeLong(length);
+ request.writeString(mimeType);
+ invoke(request, reply);
+ }
+
+ /**
+ * Selects a track.
+ * <p>
+ * If a MediaPlayer is in invalid state, it throws exception.
+ * If a MediaPlayer is in Started state, the selected track will be presented immediately.
+ * If a MediaPlayer is not in Started state, it just marks the track to be played.
+ * </p>
+ * <p>
+ * In any valid state, if it is called multiple times on the same type of track (ie. Video,
+ * Audio, Timed Text), the most recent one will be chosen.
+ * </p>
+ * <p>
+ * The first audio and video tracks will be selected by default, even though this function is not
+ * called. However, no timed text track will be selected until this function is called.
+ * </p>
+ * {@hide}
+ */
+ // FIXME: define error codes and throws exceptions according to the error codes.
+ // (IllegalStateException, IOException, IllegalArgumentException).
+ public void selectTrack(int index) {
+ Parcel request = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ request.writeInterfaceToken(IMEDIA_PLAYER);
+ request.writeInt(INVOKE_ID_SELECT_TRACK);
+ request.writeInt(index);
+ invoke(request, reply);
+ }
+
+ /**
+ * Unselect a track.
+ * If the track identified by index has not been selected before, it throws an exception.
+ * {@hide}
+ */
+ // FIXME: define error codes and throws exceptions according to the error codes.
+ // (IllegalStateException, IOException, IllegalArgumentException).
+ public void unselectTrack(int index) {
+ Parcel request = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ request.writeInterfaceToken(IMEDIA_PLAYER);
+ request.writeInt(INVOKE_ID_UNSELECT_TRACK);
+ request.writeInt(index);
+ invoke(request, reply);
}
/**
@@ -1642,14 +1906,14 @@
// No real default action so far.
return;
case MEDIA_TIMED_TEXT:
- if (mOnTimedTextListener != null) {
- if (msg.obj == null) {
- mOnTimedTextListener.onTimedText(mMediaPlayer, null);
- } else {
- if (msg.obj instanceof byte[]) {
- TimedText text = new TimedText((byte[])(msg.obj));
- mOnTimedTextListener.onTimedText(mMediaPlayer, text);
- }
+ if (mOnTimedTextListener == null)
+ return;
+ if (msg.obj == null) {
+ mOnTimedTextListener.onTimedText(mMediaPlayer, null);
+ } else {
+ if (msg.obj instanceof byte[]) {
+ TimedText text = new TimedText((byte[])(msg.obj));
+ mOnTimedTextListener.onTimedText(mMediaPlayer, text);
}
}
return;
@@ -1664,7 +1928,7 @@
}
}
- /**
+ /*
* Called from native code when an interesting event happens. This method
* just uses the EventHandler system to post the event back to the main app thread.
* We use a weak reference to the original MediaPlayer object so that the native
@@ -1978,6 +2242,13 @@
*/
public static final int MEDIA_INFO_METADATA_UPDATE = 802;
+ /** Failed to handle timed text track properly.
+ * @see android.media.MediaPlayer.OnInfoListener
+ *
+ * {@hide}
+ */
+ public static final int MEDIA_INFO_TIMED_TEXT_ERROR = 900;
+
/**
* Interface definition of a callback to be invoked to communicate some
* info and/or warning about the media or its playback.
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 2fe45ec..2175131 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -124,9 +124,15 @@
/**
* Sets a Surface to show a preview of recorded media (video). Calls this
* before prepare() to make sure that the desirable preview display is
- * set.
+ * set. If {@link #setCamera(Camera)} is used and the surface has been
+ * already set to the camera, application do not need to call this. If
+ * this is called with non-null surface, the preview surface of the camera
+ * will be replaced by the new surface. If this method is called with null
+ * surface or not called at all, media recorder will not change the preview
+ * surface of the camera.
*
* @param sv the Surface to use for the preview
+ * @see android.hardware.Camera#setPreviewDisplay(android.view.SurfaceHolder)
*/
public void setPreviewDisplay(Surface sv) {
mSurface = sv;
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index a08d6c3..a8144a7 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -1396,6 +1396,7 @@
}
mMtpObjectHandle = objectHandle;
+ Cursor fileList = null;
try {
if (MediaFile.isPlayListFileType(fileType)) {
// build file cache so we can look up tracks in the playlist
@@ -1403,7 +1404,9 @@
FileEntry entry = makeEntryFor(path);
if (entry != null) {
- processPlayList(entry);
+ fileList = mMediaProvider.query(mFilesUri, FILES_PRESCAN_PROJECTION,
+ null, null, null, null);
+ processPlayList(entry, fileList);
}
} else {
// MTP will create a file entry for us so we don't want to do it in prescan
@@ -1417,6 +1420,9 @@
Log.e(TAG, "RemoteException in MediaScanner.scanFile()", e);
} finally {
mMtpObjectHandle = 0;
+ if (fileList != null) {
+ fileList.close();
+ }
}
}
@@ -1479,7 +1485,7 @@
}
private boolean addPlayListEntry(String entry, String playListDirectory,
- Uri uri, ContentValues values, int index) {
+ Uri uri, ContentValues values, int index, Cursor fileList) {
// watch for trailing whitespace
int entryLength = entry.length();
@@ -1506,19 +1512,20 @@
// number of rightmost file/directory names for bestMatch
int bestMatchLength = 0;
- Cursor c = null;
- try {
- c = mMediaProvider.query(mFilesUri, FILES_PRESCAN_PROJECTION,
- null, null, null, null);
- } catch (RemoteException e1) {
- }
-
- if (c != null) {
- while (c.moveToNext()) {
- long rowId = c.getLong(FILES_PRESCAN_ID_COLUMN_INDEX);
- String path = c.getString(FILES_PRESCAN_PATH_COLUMN_INDEX);
- int format = c.getInt(FILES_PRESCAN_FORMAT_COLUMN_INDEX);
- long lastModified = c.getLong(FILES_PRESCAN_DATE_MODIFIED_COLUMN_INDEX);
+ if (fileList != null) {
+ int count = fileList.getCount();
+ // Backing up a little in the cursor helps when the files in the
+ // playlist are not in the same order as they are in the database
+ // but are still close.
+ fileList.move(-1000);
+ while(--count >= 0) {
+ if (!fileList.moveToNext()) {
+ fileList.moveToFirst();
+ }
+ long rowId = fileList.getLong(FILES_PRESCAN_ID_COLUMN_INDEX);
+ String path = fileList.getString(FILES_PRESCAN_PATH_COLUMN_INDEX);
+ int format = fileList.getInt(FILES_PRESCAN_FORMAT_COLUMN_INDEX);
+ long lastModified = fileList.getLong(FILES_PRESCAN_DATE_MODIFIED_COLUMN_INDEX);
if (path.equalsIgnoreCase(entry)) {
bestMatch = new FileEntry(rowId, path, lastModified, format);
@@ -1531,7 +1538,6 @@
bestMatchLength = matchLength;
}
}
- c.close();
}
if (bestMatch == null) {
@@ -1541,7 +1547,7 @@
try {
// check rowid is set. Rowid may be missing if it is inserted by bulkInsert().
if (bestMatch.mRowId == 0) {
- c = mMediaProvider.query(mAudioUri, ID_PROJECTION,
+ Cursor c = mMediaProvider.query(mAudioUri, ID_PROJECTION,
MediaStore.Files.FileColumns.DATA + "=?",
new String[] { bestMatch.mPath }, null, null);
if (c != null) {
@@ -1567,7 +1573,8 @@
return true;
}
- private void processM3uPlayList(String path, String playListDirectory, Uri uri, ContentValues values) {
+ private void processM3uPlayList(String path, String playListDirectory, Uri uri,
+ ContentValues values, Cursor fileList) {
BufferedReader reader = null;
try {
File f = new File(path);
@@ -1580,7 +1587,7 @@
// ignore comment lines, which begin with '#'
if (line.length() > 0 && line.charAt(0) != '#') {
values.clear();
- if (addPlayListEntry(line, playListDirectory, uri, values, index))
+ if (addPlayListEntry(line, playListDirectory, uri, values, index, fileList))
index++;
}
line = reader.readLine();
@@ -1598,7 +1605,8 @@
}
}
- private void processPlsPlayList(String path, String playListDirectory, Uri uri, ContentValues values) {
+ private void processPlsPlayList(String path, String playListDirectory, Uri uri,
+ ContentValues values, Cursor fileList) {
BufferedReader reader = null;
try {
File f = new File(path);
@@ -1613,7 +1621,8 @@
int equals = line.indexOf('=');
if (equals > 0) {
values.clear();
- if (addPlayListEntry(line.substring(equals + 1), playListDirectory, uri, values, index))
+ if (addPlayListEntry(line.substring(equals + 1), playListDirectory,
+ uri, values, index, fileList))
index++;
}
}
@@ -1637,12 +1646,14 @@
final ContentHandler handler;
String playListDirectory;
Uri uri;
+ Cursor fileList;
ContentValues values = new ContentValues();
int index = 0;
- public WplHandler(String playListDirectory, Uri uri) {
+ public WplHandler(String playListDirectory, Uri uri, Cursor fileList) {
this.playListDirectory = playListDirectory;
this.uri = uri;
+ this.fileList = fileList;
RootElement root = new RootElement("smil");
Element body = root.getChild("body");
@@ -1653,11 +1664,12 @@
this.handler = root.getContentHandler();
}
+ @Override
public void start(Attributes attributes) {
String path = attributes.getValue("", "src");
if (path != null) {
values.clear();
- if (addPlayListEntry(path, playListDirectory, uri, values, index)) {
+ if (addPlayListEntry(path, playListDirectory, uri, values, index, fileList)) {
index++;
}
}
@@ -1671,14 +1683,16 @@
}
}
- private void processWplPlayList(String path, String playListDirectory, Uri uri) {
+ private void processWplPlayList(String path, String playListDirectory, Uri uri,
+ Cursor fileList) {
FileInputStream fis = null;
try {
File f = new File(path);
if (f.exists()) {
fis = new FileInputStream(f);
- Xml.parse(fis, Xml.findEncodingByName("UTF-8"), new WplHandler(playListDirectory, uri).getContentHandler());
+ Xml.parse(fis, Xml.findEncodingByName("UTF-8"),
+ new WplHandler(playListDirectory, uri, fileList).getContentHandler());
}
} catch (SAXException e) {
e.printStackTrace();
@@ -1694,7 +1708,7 @@
}
}
- private void processPlayList(FileEntry entry) throws RemoteException {
+ private void processPlayList(FileEntry entry, Cursor fileList) throws RemoteException {
String path = entry.mPath;
ContentValues values = new ContentValues();
int lastSlash = path.lastIndexOf('/');
@@ -1736,21 +1750,31 @@
int fileType = (mediaFileType == null ? 0 : mediaFileType.fileType);
if (fileType == MediaFile.FILE_TYPE_M3U) {
- processM3uPlayList(path, playListDirectory, membersUri, values);
+ processM3uPlayList(path, playListDirectory, membersUri, values, fileList);
} else if (fileType == MediaFile.FILE_TYPE_PLS) {
- processPlsPlayList(path, playListDirectory, membersUri, values);
+ processPlsPlayList(path, playListDirectory, membersUri, values, fileList);
} else if (fileType == MediaFile.FILE_TYPE_WPL) {
- processWplPlayList(path, playListDirectory, membersUri);
+ processWplPlayList(path, playListDirectory, membersUri, fileList);
}
}
private void processPlayLists() throws RemoteException {
Iterator<FileEntry> iterator = mPlayLists.iterator();
- while (iterator.hasNext()) {
- FileEntry entry = iterator.next();
- // only process playlist files if they are new or have been modified since the last scan
- if (entry.mLastModifiedChanged) {
- processPlayList(entry);
+ Cursor fileList = null;
+ try {
+ fileList = mMediaProvider.query(mFilesUri, FILES_PRESCAN_PROJECTION,
+ null, null, null, null);
+ while (iterator.hasNext()) {
+ FileEntry entry = iterator.next();
+ // only process playlist files if they are new or have been modified since the last scan
+ if (entry.mLastModifiedChanged) {
+ processPlayList(entry, fileList);
+ }
+ }
+ } catch (RemoteException e1) {
+ } finally {
+ if (fileList != null) {
+ fileList.close();
}
}
}
diff --git a/media/jni/Android.mk b/media/jni/Android.mk
index a98275a..079a284 100644
--- a/media/jni/Android.mk
+++ b/media/jni/Android.mk
@@ -22,6 +22,7 @@
libutils \
libbinder \
libmedia \
+ libmedia_native \
libskia \
libui \
libcutils \
diff --git a/media/jni/android_media_MediaExtractor.cpp b/media/jni/android_media_MediaExtractor.cpp
index 0c86fc2..8c661b7 100644
--- a/media/jni/android_media_MediaExtractor.cpp
+++ b/media/jni/android_media_MediaExtractor.cpp
@@ -160,6 +160,10 @@
return mImpl->getSampleTime(sampleTimeUs);
}
+status_t JMediaExtractor::getSampleFlags(uint32_t *sampleFlags) {
+ return mImpl->getSampleFlags(sampleFlags);
+}
+
} // namespace android
////////////////////////////////////////////////////////////////////////////////
@@ -343,6 +347,28 @@
return sampleTimeUs;
}
+static jint android_media_MediaExtractor_getSampleFlags(
+ JNIEnv *env, jobject thiz) {
+ sp<JMediaExtractor> extractor = getMediaExtractor(env, thiz);
+
+ if (extractor == NULL) {
+ jniThrowException(env, "java/lang/IllegalStateException", NULL);
+ return -1ll;
+ }
+
+ uint32_t sampleFlags;
+ status_t err = extractor->getSampleFlags(&sampleFlags);
+
+ if (err == ERROR_END_OF_STREAM) {
+ return -1ll;
+ } else if (err != OK) {
+ jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+ return false;
+ }
+
+ return sampleFlags;
+}
+
static void android_media_MediaExtractor_native_init(JNIEnv *env) {
jclass clazz = env->FindClass("android/media/MediaExtractor");
CHECK(clazz != NULL);
@@ -412,6 +438,9 @@
{ "getSampleTime", "()J",
(void *)android_media_MediaExtractor_getSampleTime },
+ { "getSampleFlags", "()I",
+ (void *)android_media_MediaExtractor_getSampleFlags },
+
{ "native_init", "()V", (void *)android_media_MediaExtractor_native_init },
{ "native_setup", "(Ljava/lang/String;)V",
diff --git a/media/jni/android_media_MediaExtractor.h b/media/jni/android_media_MediaExtractor.h
index 70e58c6..49a64d6 100644
--- a/media/jni/android_media_MediaExtractor.h
+++ b/media/jni/android_media_MediaExtractor.h
@@ -43,6 +43,7 @@
status_t readSampleData(jobject byteBuf, size_t offset, size_t *sampleSize);
status_t getSampleTrackIndex(size_t *trackIndex);
status_t getSampleTime(int64_t *sampleTimeUs);
+ status_t getSampleFlags(uint32_t *sampleFlags);
protected:
virtual ~JMediaExtractor();
diff --git a/media/jni/android_media_Utils.cpp b/media/jni/android_media_Utils.cpp
index 8b2321c..1190448 100644
--- a/media/jni/android_media_Utils.cpp
+++ b/media/jni/android_media_Utils.cpp
@@ -324,7 +324,7 @@
env->DeleteLocalRef(byteArray); byteArray = NULL;
}
- msg->setObject(key.c_str(), buffer);
+ msg->setBuffer(key.c_str(), buffer);
}
}
diff --git a/media/jni/audioeffect/Android.mk b/media/jni/audioeffect/Android.mk
index 3e493b1..0059bb2 100644
--- a/media/jni/audioeffect/Android.mk
+++ b/media/jni/audioeffect/Android.mk
@@ -10,10 +10,11 @@
libutils \
libandroid_runtime \
libnativehelper \
- libmedia
+ libmedia \
+ libmedia_native
LOCAL_C_INCLUDES := \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
LOCAL_MODULE:= libaudioeffect_jni
diff --git a/media/jni/mediaeditor/Android.mk b/media/jni/mediaeditor/Android.mk
index 688e180..d1cf8b5 100755
--- a/media/jni/mediaeditor/Android.mk
+++ b/media/jni/mediaeditor/Android.mk
@@ -38,12 +38,12 @@
$(call include-path-for, corecg graphics) \
$(TOP)/frameworks/native/include/media/editor \
$(TOP)/frameworks/base/core/jni/mediaeditor \
- $(TOP)/frameworks/media/libvideoeditor/vss/inc \
- $(TOP)/frameworks/media/libvideoeditor/vss/common/inc \
- $(TOP)/frameworks/media/libvideoeditor/vss/mcs/inc \
- $(TOP)/frameworks/media/libvideoeditor/vss/stagefrightshells/inc \
- $(TOP)/frameworks/media/libvideoeditor/lvpp \
- $(TOP)/frameworks/media/libvideoeditor/osal/inc \
+ $(TOP)/frameworks/av/libvideoeditor/vss/inc \
+ $(TOP)/frameworks/av/libvideoeditor/vss/common/inc \
+ $(TOP)/frameworks/av/libvideoeditor/vss/mcs/inc \
+ $(TOP)/frameworks/av/libvideoeditor/vss/stagefrightshells/inc \
+ $(TOP)/frameworks/av/libvideoeditor/lvpp \
+ $(TOP)/frameworks/av/libvideoeditor/osal/inc \
$(TOP)/frameworks/native/include/media/openmax
LOCAL_SHARED_LIBRARIES := \
diff --git a/media/jni/mediaeditor/VideoEditorMain.h b/media/jni/mediaeditor/VideoEditorMain.h
deleted file mode 100755
index 4c3b517..0000000
--- a/media/jni/mediaeditor/VideoEditorMain.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef __VIDEO_EDITOR_API_H__
-#define __VIDEO_EDITOR_API_H__
-
-#include "M4OSA_Types.h"
-
-typedef enum
-{
- MSG_TYPE_PROGRESS_INDICATION, // Playback progress indication event
- MSG_TYPE_PLAYER_ERROR, // Playback error
- MSG_TYPE_PREVIEW_END, // Preview of clips is complete
- MSG_TYPE_OVERLAY_UPDATE, // update overlay during preview
- MSG_TYPE_OVERLAY_CLEAR, // clear the overlay
-} progress_callback_msg_type;
-
-typedef struct {
- int overlaySettingsIndex;
- int clipIndex;
-} VideoEditorCurretEditInfo;
-
-typedef struct
-{
- M4OSA_Void *pFile; /** PCM file path */
- M4OSA_Bool bRemoveOriginal; /** If true, the original audio track
- is not taken into account */
- M4OSA_UInt32 uiNbChannels; /** Number of channels (1=mono, 2=stereo) of BGM clip*/
- M4OSA_UInt32 uiSamplingFrequency; /** Sampling audio frequency (8000 for amr, 16000 or
- more for aac) of BGM clip*/
- M4OSA_UInt32 uiExtendedSamplingFrequency; /** Extended frequency for AAC+,
- eAAC+ streams of BGM clip*/
- M4OSA_UInt32 uiAddCts; /** Time, in milliseconds, at which the added
- audio track is inserted */
- M4OSA_UInt32 uiAddVolume; /** Volume, in percentage, of the added audio track */
- M4OSA_UInt32 beginCutMs;
- M4OSA_UInt32 endCutMs;
- M4OSA_Int32 fileType;
- M4OSA_Bool bLoop; /** Looping on/off **/
- /* Audio ducking */
- M4OSA_UInt32 uiInDucking_threshold; /** Threshold value at which
- background music shall duck */
- M4OSA_UInt32 uiInDucking_lowVolume; /** lower the background track to
- this factor of current level */
- M4OSA_Bool bInDucking_enable; /** enable ducking */
- M4OSA_UInt32 uiBTChannelCount; /** channel count for BT */
- M4OSA_Void *pPCMFilePath;
-} M4xVSS_AudioMixingSettings;
-
-typedef struct
-{
- M4OSA_Void *pBuffer; /* YUV420 buffer of frame to be rendered*/
- M4OSA_UInt32 timeMs; /* time stamp of the frame to be rendered*/
- M4OSA_UInt32 uiSurfaceWidth; /* Surface display width*/
- M4OSA_UInt32 uiSurfaceHeight; /* Surface display height*/
- M4OSA_UInt32 uiFrameWidth; /* Frame width*/
- M4OSA_UInt32 uiFrameHeight; /* Frame height*/
- M4OSA_Bool bApplyEffect; /* Apply video effects before render*/
- M4OSA_UInt32 clipBeginCutTime; /* Clip begin cut time relative to storyboard */
- M4OSA_UInt32 clipEndCutTime; /* Clip end cut time relative to storyboard */
- M4OSA_UInt32 videoRotationDegree; /* Video rotation degree */
-
-} VideoEditor_renderPreviewFrameStr;
-#endif /*__VIDEO_EDITOR_API_H__*/
diff --git a/media/jni/soundpool/Android.mk b/media/jni/soundpool/Android.mk
index 9ff2e24..70dbfb3 100644
--- a/media/jni/soundpool/Android.mk
+++ b/media/jni/soundpool/Android.mk
@@ -2,17 +2,18 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- android_media_SoundPool.cpp \
- SoundPool.cpp \
- SoundPoolThread.cpp
+ android_media_SoundPool.cpp
+
+LOCAL_C_INCLUDES := \
+ frameworks/base/media/libmedia
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
- libbinder \
libandroid_runtime \
libnativehelper \
- libmedia
+ libmedia \
+ libmedia_native
LOCAL_MODULE:= libsoundpool
diff --git a/media/jni/soundpool/android_media_SoundPool.cpp b/media/jni/soundpool/android_media_SoundPool.cpp
index da3af9d..c6dee06 100644
--- a/media/jni/soundpool/android_media_SoundPool.cpp
+++ b/media/jni/soundpool/android_media_SoundPool.cpp
@@ -23,7 +23,7 @@
#include <nativehelper/jni.h>
#include <nativehelper/JNIHelp.h>
#include <android_runtime/AndroidRuntime.h>
-#include "SoundPool.h"
+#include <SoundPool.h>
using namespace android;
diff --git a/media/libaah_rtp/Android.mk b/media/libaah_rtp/Android.mk
index 1e87cf0..6c927ba 100644
--- a/media/libaah_rtp/Android.mk
+++ b/media/libaah_rtp/Android.mk
@@ -29,6 +29,7 @@
libcommon_time_client \
libbinder \
libmedia \
+ libmedia_native \
libstagefright \
libstagefright_foundation \
libutils
@@ -37,4 +38,3 @@
-lpthread
include $(BUILD_SHARED_LIBRARY)
-
diff --git a/media/libaah_rtp/aah_decoder_pump.cpp b/media/libaah_rtp/aah_decoder_pump.cpp
index 28b8c7b..bebba54e 100644
--- a/media/libaah_rtp/aah_decoder_pump.cpp
+++ b/media/libaah_rtp/aah_decoder_pump.cpp
@@ -105,9 +105,8 @@
AudioTrack::getMinFrameCount(&frameCount,
AUDIO_STREAM_DEFAULT,
static_cast<int>(format_sample_rate_));
- int ch_format = (format_channels_ == 1)
- ? AUDIO_CHANNEL_OUT_MONO
- : AUDIO_CHANNEL_OUT_STEREO;
+ audio_channel_mask_t ch_format =
+ audio_channel_out_mask_from_count(format_channels_);
res = renderer_->set(AUDIO_STREAM_DEFAULT,
format_sample_rate_,
diff --git a/media/libaah_rtp/aah_decoder_pump.h b/media/libaah_rtp/aah_decoder_pump.h
index f5a6529..4d57e49 100644
--- a/media/libaah_rtp/aah_decoder_pump.h
+++ b/media/libaah_rtp/aah_decoder_pump.h
@@ -75,7 +75,7 @@
void stopAndCleanupRenderer();
sp<MetaData> format_;
- int32_t format_channels_;
+ int32_t format_channels_; // channel count, not channel mask
int32_t format_sample_rate_;
sp<MediaSource> decoder_;
diff --git a/media/libeffects/downmix/Android.mk b/media/libeffects/downmix/Android.mk
index 0348e1e..95ca6fd 100644
--- a/media/libeffects/downmix/Android.mk
+++ b/media/libeffects/downmix/Android.mk
@@ -20,8 +20,8 @@
endif
LOCAL_C_INCLUDES := \
- system/media/audio_effects/include \
- system/media/audio_utils/include
+ $(call include-path-for, audio-effects) \
+ $(call include-path-for, audio-utils)
LOCAL_PRELINK_MODULE := false
diff --git a/media/libeffects/factory/Android.mk b/media/libeffects/factory/Android.mk
index 2f2b974..6e69151 100644
--- a/media/libeffects/factory/Android.mk
+++ b/media/libeffects/factory/Android.mk
@@ -15,6 +15,6 @@
LOCAL_SHARED_LIBRARIES += libdl
LOCAL_C_INCLUDES := \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/lvm/wrapper/Android.mk b/media/libeffects/lvm/wrapper/Android.mk
index f097dd0..4313424 100644
--- a/media/libeffects/lvm/wrapper/Android.mk
+++ b/media/libeffects/lvm/wrapper/Android.mk
@@ -26,7 +26,7 @@
$(LOCAL_PATH)/Bundle \
$(LOCAL_PATH)/../lib/Common/lib/ \
$(LOCAL_PATH)/../lib/Bundle/lib/ \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
include $(BUILD_SHARED_LIBRARY)
@@ -55,6 +55,6 @@
$(LOCAL_PATH)/Reverb \
$(LOCAL_PATH)/../lib/Common/lib/ \
$(LOCAL_PATH)/../lib/Reverb/lib/ \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
-include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
+include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index ca93ce5..40dffd4 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -1493,7 +1493,7 @@
pContext->pBundledContext->firstVolume = LVM_FALSE;
}
return 0;
-} /* end setVolumeLevel */
+} /* end VolumeSetVolumeLevel */
//----------------------------------------------------------------------------
// VolumeGetVolumeLevel()
diff --git a/media/libeffects/preprocessing/Android.mk b/media/libeffects/preprocessing/Android.mk
index 7f7c7e1..c13b9d4 100755
--- a/media/libeffects/preprocessing/Android.mk
+++ b/media/libeffects/preprocessing/Android.mk
@@ -14,7 +14,7 @@
external/webrtc/src \
external/webrtc/src/modules/interface \
external/webrtc/src/modules/audio_processing/interface \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
LOCAL_C_INCLUDES += $(call include-path-for, speex)
diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp
index dc27d38..1d76f62 100755
--- a/media/libeffects/preprocessing/PreProcessing.cpp
+++ b/media/libeffects/preprocessing/PreProcessing.cpp
@@ -956,10 +956,9 @@
memset(config, 0, sizeof(effect_config_t));
config->inputCfg.samplingRate = config->outputCfg.samplingRate = session->samplingRate;
config->inputCfg.format = config->outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
- config->inputCfg.channels = session->inChannelCount == 1 ?
- AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO;
- config->outputCfg.channels = session->outChannelCount == 1 ?
- AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO;
+ config->inputCfg.channels = audio_channel_in_mask_from_count(session->inChannelCount);
+ // "out" doesn't mean output device, so this is the correct API to convert channel count to mask
+ config->outputCfg.channels = audio_channel_in_mask_from_count(session->outChannelCount);
config->inputCfg.mask = config->outputCfg.mask =
(EFFECT_CONFIG_SMP_RATE | EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT);
}
@@ -999,7 +998,7 @@
config->inputCfg.samplingRate = config->outputCfg.samplingRate = session->samplingRate;
config->inputCfg.format = config->outputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
config->inputCfg.channels = config->outputCfg.channels =
- session->revChannelCount == 1 ? AUDIO_CHANNEL_IN_MONO : AUDIO_CHANNEL_IN_STEREO;
+ audio_channel_in_mask_from_count(session->revChannelCount);
config->inputCfg.mask = config->outputCfg.mask =
(EFFECT_CONFIG_SMP_RATE | EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT);
}
diff --git a/media/libeffects/testlibs/Android.mk_ b/media/libeffects/testlibs/Android.mk_
index 249ebf4..2954908 100644
--- a/media/libeffects/testlibs/Android.mk_
+++ b/media/libeffects/testlibs/Android.mk_
@@ -23,7 +23,7 @@
endif
LOCAL_C_INCLUDES := \
- system/media/audio_effects/include \
+ $(call include-path-for, audio-effects) \
$(call include-path-for, graphics corecg)
LOCAL_MODULE_TAGS := optional
@@ -60,7 +60,7 @@
LOCAL_C_INCLUDES := \
$(call include-path-for, graphics corecg) \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
LOCAL_MODULE_TAGS := optional
diff --git a/media/libeffects/visualizer/Android.mk b/media/libeffects/visualizer/Android.mk
index 2160177..76b5110 100644
--- a/media/libeffects/visualizer/Android.mk
+++ b/media/libeffects/visualizer/Android.mk
@@ -17,7 +17,7 @@
LOCAL_C_INCLUDES := \
$(call include-path-for, graphics corecg) \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libeffects/visualizer/EffectVisualizer.cpp b/media/libeffects/visualizer/EffectVisualizer.cpp
index 51c8b68..bdb1a1cd 100644
--- a/media/libeffects/visualizer/EffectVisualizer.cpp
+++ b/media/libeffects/visualizer/EffectVisualizer.cpp
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include <new>
+#include <time.h>
#include <audio_effects/effect_visualizer.h>
@@ -47,9 +48,9 @@
VISUALIZER_STATE_ACTIVE,
};
-// maximum number of reads from same buffer before resetting capture buffer. This means
+// maximum time since last capture buffer update before resetting capture buffer. This means
// that the framework has stopped playing audio and we must start returning silence
-#define MAX_STALL_COUNT 10
+#define MAX_STALL_TIME_MS 1000
struct VisualizerContext {
const struct effect_interface_s *mItfe;
@@ -59,7 +60,7 @@
uint8_t mState;
uint8_t mCurrentBuf;
uint8_t mLastBuf;
- uint8_t mStallCount;
+ struct timespec mBufferUpdateTime;
uint8_t mCaptureBuf[2][VISUALIZER_CAPTURE_SIZE_MAX];
};
@@ -72,7 +73,7 @@
pContext->mCaptureIdx = 0;
pContext->mCurrentBuf = 0;
pContext->mLastBuf = 1;
- pContext->mStallCount = 0;
+ pContext->mBufferUpdateTime.tv_sec = 0;
memset(pContext->mCaptureBuf[0], 0x80, VISUALIZER_CAPTURE_SIZE_MAX);
memset(pContext->mCaptureBuf[1], 0x80, VISUALIZER_CAPTURE_SIZE_MAX);
}
@@ -321,6 +322,11 @@
if (pContext->mCaptureIdx == pContext->mCaptureSize) {
pContext->mCurrentBuf ^= 1;
pContext->mCaptureIdx = 0;
+
+ // update last buffer update time stamp
+ if (clock_gettime(CLOCK_MONOTONIC, &pContext->mBufferUpdateTime) < 0) {
+ pContext->mBufferUpdateTime.tv_sec = 0;
+ }
}
if (inBuffer->raw != outBuffer->raw) {
@@ -453,16 +459,25 @@
pContext->mCaptureSize);
// if audio framework has stopped playing audio although the effect is still
// active we must clear the capture buffer to return silence
- if (pContext->mLastBuf == pContext->mCurrentBuf) {
- if (pContext->mStallCount < MAX_STALL_COUNT) {
- if (++pContext->mStallCount == MAX_STALL_COUNT) {
+ if ((pContext->mLastBuf == pContext->mCurrentBuf) &&
+ (pContext->mBufferUpdateTime.tv_sec != 0)) {
+ struct timespec ts;
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
+ time_t secs = ts.tv_sec - pContext->mBufferUpdateTime.tv_sec;
+ long nsec = ts.tv_nsec - pContext->mBufferUpdateTime.tv_nsec;
+ if (nsec < 0) {
+ --secs;
+ nsec += 1000000000;
+ }
+ uint32_t deltaMs = secs * 1000 + nsec / 1000000;
+ if (deltaMs > MAX_STALL_TIME_MS) {
+ ALOGV("capture going to idle");
+ pContext->mBufferUpdateTime.tv_sec = 0;
memset(pContext->mCaptureBuf[pContext->mCurrentBuf ^ 1],
0x80,
pContext->mCaptureSize);
}
}
- } else {
- pContext->mStallCount = 0;
}
pContext->mLastBuf = pContext->mCurrentBuf;
} else {
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index 5ecc8f5..c8e1dc7 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -17,6 +17,7 @@
IAudioFlingerClient.cpp \
IAudioTrack.cpp \
IAudioRecord.cpp \
+ ICrypto.cpp \
AudioRecord.cpp \
AudioSystem.cpp \
mediaplayer.cpp \
@@ -43,24 +44,25 @@
IEffectClient.cpp \
AudioEffect.cpp \
Visualizer.cpp \
- MemoryLeakTrackUtil.cpp
+ MemoryLeakTrackUtil.cpp \
+ SoundPool.cpp \
+ SoundPoolThread.cpp
LOCAL_SHARED_LIBRARIES := \
libui libcutils libutils libbinder libsonivox libicuuc libexpat \
libcamera_client libstagefright_foundation \
- libgui libdl libaudioutils
+ libgui libdl libaudioutils libmedia_native
LOCAL_WHOLE_STATIC_LIBRARY := libmedia_helper
LOCAL_MODULE:= libmedia
LOCAL_C_INCLUDES := \
- $(JNI_H_INCLUDE) \
$(call include-path-for, graphics corecg) \
$(TOP)/frameworks/native/include/media/openmax \
external/icu4c/common \
external/expat/lib \
- system/media/audio_effects/include \
- system/media/audio_utils/include
+ $(call include-path-for, audio-effects) \
+ $(call include-path-for, audio-utils)
include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 05ade75..70ec593 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -201,7 +201,7 @@
// create the IAudioRecord
status = openRecord_l(sampleRate, format, channelMask,
- frameCount, flags, input);
+ frameCount, input);
if (status != NO_ERROR) {
return status;
}
@@ -458,7 +458,6 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
audio_io_handle_t input)
{
status_t status;
@@ -471,7 +470,7 @@
sampleRate, format,
channelMask,
frameCount,
- ((uint16_t)flags) << 16,
+ IAudioFlinger::TRACK_DEFAULT,
&mSessionId,
&status);
@@ -778,7 +777,7 @@
// following member variables: mAudioRecord, mCblkMemory and mCblk.
// It will also delete the strong references on previous IAudioRecord and IMemory
result = openRecord_l(cblk->sampleRate, mFormat, mChannelMask,
- mFrameCount, mFlags, getInput_l());
+ mFrameCount, getInput_l());
if (result == NO_ERROR) {
result = mAudioRecord->start(0); // callback thread hasn't changed
}
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 048be1d..bafde3a 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -104,9 +104,10 @@
{
mStatus = set(streamType, sampleRate, format, channelMask,
frameCount, flags, cbf, user, notificationFrames,
- 0, false, sessionId);
+ 0 /*sharedBuffer*/, false /*threadCanCallJava*/, sessionId);
}
+// DEPRECATED
AudioTrack::AudioTrack(
int streamType,
uint32_t sampleRate,
@@ -124,7 +125,7 @@
{
mStatus = set((audio_stream_type_t)streamType, sampleRate, (audio_format_t)format, channelMask,
frameCount, (audio_policy_output_flags_t)flags, cbf, user, notificationFrames,
- 0, false, sessionId);
+ 0 /*sharedBuffer*/, false /*threadCanCallJava*/, sessionId);
}
AudioTrack::AudioTrack(
@@ -144,8 +145,8 @@
mPreviousSchedulingGroup(ANDROID_TGROUP_DEFAULT)
{
mStatus = set(streamType, sampleRate, format, channelMask,
- 0, flags, cbf, user, notificationFrames,
- sharedBuffer, false, sessionId);
+ 0 /*frameCount*/, flags, cbf, user, notificationFrames,
+ sharedBuffer, false /*threadCanCallJava*/, sessionId);
}
AudioTrack::~AudioTrack()
@@ -194,6 +195,7 @@
if (AudioSystem::getOutputSamplingRate(&afSampleRate, streamType) != NO_ERROR) {
return NO_INIT;
}
+
uint32_t afLatency;
if (AudioSystem::getOutputLatency(&afLatency, streamType) != NO_ERROR) {
return NO_INIT;
@@ -203,9 +205,11 @@
if (streamType == AUDIO_STREAM_DEFAULT) {
streamType = AUDIO_STREAM_MUSIC;
}
+
if (sampleRate == 0) {
sampleRate = afSampleRate;
}
+
// these below should probably come from the audioFlinger too...
if (format == AUDIO_FORMAT_DEFAULT) {
format = AUDIO_FORMAT_PCM_16_BIT;
@@ -257,8 +261,7 @@
frameCount,
flags,
sharedBuffer,
- output,
- true);
+ output);
if (status != NO_ERROR) {
return status;
@@ -737,8 +740,7 @@
int frameCount,
audio_policy_output_flags_t flags,
const sp<IMemory>& sharedBuffer,
- audio_io_handle_t output,
- bool enforceFrameCount)
+ audio_io_handle_t output)
{
status_t status;
const sp<IAudioFlinger>& audioFlinger = AudioSystem::get_audio_flinger();
@@ -785,7 +787,8 @@
mNotificationFramesAct = frameCount/2;
}
if (frameCount < minFrameCount) {
- ALOGW_IF(enforceFrameCount, "Minimum buffer size corrected from %d to %d",
+ // not ALOGW because it happens all the time when playing key clicks over A2DP
+ ALOGV("Minimum buffer size corrected from %d to %d",
frameCount, minFrameCount);
frameCount = minFrameCount;
}
@@ -800,16 +803,19 @@
}
}
+ IAudioFlinger::track_flags_t trackFlags = IAudioFlinger::TRACK_DEFAULT;
+ if (mIsTimed) {
+ trackFlags |= IAudioFlinger::TRACK_TIMED;
+ }
sp<IAudioTrack> track = audioFlinger->createTrack(getpid(),
streamType,
sampleRate,
format,
channelMask,
frameCount,
- ((uint16_t)flags) << 16,
+ trackFlags,
sharedBuffer,
output,
- mIsTimed,
&mSessionId,
&status);
@@ -1245,8 +1251,7 @@
mFrameCount,
mFlags,
mSharedBuffer,
- getOutput_l(),
- false);
+ getOutput_l());
if (result == NO_ERROR) {
uint32_t user = cblk->user;
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index 07b12e4..ce10c8e 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -87,10 +87,9 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
+ track_flags_t flags,
const sp<IMemory>& sharedBuffer,
audio_io_handle_t output,
- bool isTimed,
int *sessionId,
status_t *status)
{
@@ -103,10 +102,9 @@
data.writeInt32(format);
data.writeInt32(channelMask);
data.writeInt32(frameCount);
- data.writeInt32(flags);
+ data.writeInt32((int32_t) flags);
data.writeStrongBinder(sharedBuffer->asBinder());
data.writeInt32((int32_t) output);
- data.writeInt32(isTimed);
int lSessionId = 0;
if (sessionId != NULL) {
lSessionId = *sessionId;
@@ -136,7 +134,7 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
+ track_flags_t flags,
int *sessionId,
status_t *status)
{
@@ -688,15 +686,14 @@
audio_format_t format = (audio_format_t) data.readInt32();
int channelCount = data.readInt32();
size_t bufferCount = data.readInt32();
- uint32_t flags = data.readInt32();
+ track_flags_t flags = (track_flags_t) data.readInt32();
sp<IMemory> buffer = interface_cast<IMemory>(data.readStrongBinder());
audio_io_handle_t output = (audio_io_handle_t) data.readInt32();
- bool isTimed = data.readInt32();
int sessionId = data.readInt32();
status_t status;
sp<IAudioTrack> track = createTrack(pid,
(audio_stream_type_t) streamType, sampleRate, format,
- channelCount, bufferCount, flags, buffer, output, isTimed, &sessionId, &status);
+ channelCount, bufferCount, flags, buffer, output, &sessionId, &status);
reply->writeInt32(sessionId);
reply->writeInt32(status);
reply->writeStrongBinder(track->asBinder());
@@ -710,7 +707,7 @@
audio_format_t format = (audio_format_t) data.readInt32();
int channelCount = data.readInt32();
size_t bufferCount = data.readInt32();
- uint32_t flags = data.readInt32();
+ track_flags_t flags = (track_flags_t) data.readInt32();
int sessionId = data.readInt32();
status_t status;
sp<IAudioRecord> record = openRecord(pid, input,
diff --git a/media/libmedia/ICrypto.cpp b/media/libmedia/ICrypto.cpp
new file mode 100644
index 0000000..827d7af
--- /dev/null
+++ b/media/libmedia/ICrypto.cpp
@@ -0,0 +1,293 @@
+/*
+ * 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "ICrypto"
+#include <utils/Log.h>
+
+#include <binder/Parcel.h>
+#include <media/ICrypto.h>
+#include <media/stagefright/foundation/ADebug.h>
+
+namespace android {
+
+enum {
+ INITIALIZE = IBinder::FIRST_CALL_TRANSACTION,
+ TERMINATE,
+ SET_ENTITLEMENT_KEY,
+ SET_ECM,
+ DECRYPT_VIDEO,
+ DECRYPT_AUDIO,
+};
+
+struct BpCrypto : public BpInterface<ICrypto> {
+ BpCrypto(const sp<IBinder> &impl)
+ : BpInterface<ICrypto>(impl) {
+ }
+
+ virtual status_t initialize() {
+ Parcel data, reply;
+ data.writeInterfaceToken(ICrypto::getInterfaceDescriptor());
+ remote()->transact(INITIALIZE, data, &reply);
+
+ return reply.readInt32();
+ }
+
+ virtual status_t terminate() {
+ Parcel data, reply;
+ data.writeInterfaceToken(ICrypto::getInterfaceDescriptor());
+ remote()->transact(TERMINATE, data, &reply);
+
+ return reply.readInt32();
+ }
+
+ virtual status_t setEntitlementKey(
+ const void *key, size_t keyLength) {
+ Parcel data, reply;
+ data.writeInterfaceToken(ICrypto::getInterfaceDescriptor());
+ data.writeInt32(keyLength);
+ data.write(key, keyLength);
+ remote()->transact(SET_ENTITLEMENT_KEY, data, &reply);
+
+ return reply.readInt32();
+ }
+
+ virtual status_t setEntitlementControlMessage(
+ const void *msg, size_t msgLength) {
+ Parcel data, reply;
+ data.writeInterfaceToken(ICrypto::getInterfaceDescriptor());
+ data.writeInt32(msgLength);
+ data.write(msg, msgLength);
+ remote()->transact(SET_ECM, data, &reply);
+
+ return reply.readInt32();
+ }
+
+ virtual ssize_t decryptVideo(
+ const void *iv, size_t ivLength,
+ const void *srcData, size_t srcDataSize,
+ void *dstData, size_t dstDataOffset) {
+ Parcel data, reply;
+ data.writeInterfaceToken(ICrypto::getInterfaceDescriptor());
+ if (iv == NULL) {
+ if (ivLength > 0) {
+ return -EINVAL;
+ }
+
+ data.writeInt32(-1);
+ } else {
+ data.writeInt32(ivLength);
+ data.write(iv, ivLength);
+ }
+
+ data.writeInt32(srcDataSize);
+ data.write(srcData, srcDataSize);
+
+ data.writeIntPtr((intptr_t)dstData);
+ data.writeInt32(dstDataOffset);
+
+ remote()->transact(DECRYPT_VIDEO, data, &reply);
+
+ return reply.readInt32();
+ }
+
+ virtual ssize_t decryptAudio(
+ const void *iv, size_t ivLength,
+ const void *srcData, size_t srcDataSize,
+ void *dstData, size_t dstDataSize) {
+ Parcel data, reply;
+ data.writeInterfaceToken(ICrypto::getInterfaceDescriptor());
+ if (iv == NULL) {
+ if (ivLength > 0) {
+ return -EINVAL;
+ }
+
+ data.writeInt32(-1);
+ } else {
+ data.writeInt32(ivLength);
+ data.write(iv, ivLength);
+ }
+
+ data.writeInt32(srcDataSize);
+ data.write(srcData, srcDataSize);
+ data.writeInt32(dstDataSize);
+
+ remote()->transact(DECRYPT_AUDIO, data, &reply);
+
+ ssize_t res = reply.readInt32();
+
+ if (res <= 0) {
+ return res;
+ }
+
+ reply.read(dstData, res);
+
+ return res;
+ }
+
+private:
+ DISALLOW_EVIL_CONSTRUCTORS(BpCrypto);
+};
+
+IMPLEMENT_META_INTERFACE(Crypto, "android.hardware.ICrypto");
+
+////////////////////////////////////////////////////////////////////////////////
+
+status_t BnCrypto::onTransact(
+ uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) {
+ switch (code) {
+ case INITIALIZE:
+ {
+ CHECK_INTERFACE(ICrypto, data, reply);
+ reply->writeInt32(initialize());
+
+ return OK;
+ }
+
+ case TERMINATE:
+ {
+ CHECK_INTERFACE(ICrypto, data, reply);
+ reply->writeInt32(terminate());
+
+ return OK;
+ }
+
+ case SET_ENTITLEMENT_KEY:
+ {
+ CHECK_INTERFACE(ICrypto, data, reply);
+
+ size_t keyLength = data.readInt32();
+ void *key = malloc(keyLength);
+ data.read(key, keyLength);
+
+ reply->writeInt32(setEntitlementKey(key, keyLength));
+
+ free(key);
+ key = NULL;
+
+ return OK;
+ }
+
+ case SET_ECM:
+ {
+ CHECK_INTERFACE(ICrypto, data, reply);
+
+ size_t msgLength = data.readInt32();
+ void *msg = malloc(msgLength);
+ data.read(msg, msgLength);
+
+ reply->writeInt32(setEntitlementControlMessage(msg, msgLength));
+
+ free(msg);
+ msg = NULL;
+
+ return OK;
+ }
+
+ case DECRYPT_VIDEO:
+ {
+ CHECK_INTERFACE(ICrypto, data, reply);
+
+ void *iv = NULL;
+
+ int32_t ivLength = data.readInt32();
+ if (ivLength >= 0) {
+ iv = malloc(ivLength);
+ data.read(iv, ivLength);
+ }
+
+ size_t srcDataSize = data.readInt32();
+ void *srcData = malloc(srcDataSize);
+ data.read(srcData, srcDataSize);
+
+ void *dstData = (void *)data.readIntPtr();
+ size_t dstDataOffset = data.readInt32();
+
+ reply->writeInt32(
+ decryptVideo(
+ iv,
+ ivLength < 0 ? 0 : ivLength,
+ srcData,
+ srcDataSize,
+ dstData,
+ dstDataOffset));
+
+ free(srcData);
+ srcData = NULL;
+
+ if (iv != NULL) {
+ free(iv);
+ iv = NULL;
+ }
+
+ return OK;
+ }
+
+ case DECRYPT_AUDIO:
+ {
+ CHECK_INTERFACE(ICrypto, data, reply);
+
+ void *iv = NULL;
+
+ int32_t ivLength = data.readInt32();
+ if (ivLength >= 0) {
+ iv = malloc(ivLength);
+ data.read(iv, ivLength);
+ }
+
+ size_t srcDataSize = data.readInt32();
+ void *srcData = malloc(srcDataSize);
+ data.read(srcData, srcDataSize);
+
+ size_t dstDataSize = data.readInt32();
+ void *dstData = malloc(dstDataSize);
+
+ ssize_t res =
+ decryptAudio(
+ iv,
+ ivLength < 0 ? 0 : ivLength,
+ srcData,
+ srcDataSize,
+ dstData,
+ dstDataSize);
+
+ reply->writeInt32(res);
+
+ if (res > 0) {
+ reply->write(dstData, res);
+ }
+
+ free(dstData);
+ dstData = NULL;
+
+ free(srcData);
+ srcData = NULL;
+
+ if (iv != NULL) {
+ free(iv);
+ iv = NULL;
+ }
+
+ return OK;
+ }
+
+ default:
+ return BBinder::onTransact(code, data, reply, flags);
+ }
+}
+
+} // namespace android
+
diff --git a/media/libmedia/IMediaMetadataRetriever.cpp b/media/libmedia/IMediaMetadataRetriever.cpp
index 9b8d7c3..7e6d54b 100644
--- a/media/libmedia/IMediaMetadataRetriever.cpp
+++ b/media/libmedia/IMediaMetadataRetriever.cpp
@@ -18,7 +18,6 @@
#include <stdint.h>
#include <sys/types.h>
#include <binder/Parcel.h>
-#include <SkBitmap.h>
#include <media/IMediaMetadataRetriever.h>
#include <utils/String8.h>
diff --git a/media/libmedia/IMediaPlayerService.cpp b/media/libmedia/IMediaPlayerService.cpp
index f5fccef..9120617 100644
--- a/media/libmedia/IMediaPlayerService.cpp
+++ b/media/libmedia/IMediaPlayerService.cpp
@@ -20,6 +20,7 @@
#include <binder/Parcel.h>
#include <binder/IMemory.h>
+#include <media/ICrypto.h>
#include <media/IMediaPlayerService.h>
#include <media/IMediaRecorder.h>
#include <media/IOMX.h>
@@ -36,6 +37,7 @@
CREATE_MEDIA_RECORDER,
CREATE_METADATA_RETRIEVER,
GET_OMX,
+ MAKE_CRYPTO,
ADD_BATTERY_DATA,
PULL_BATTERY_DATA
};
@@ -111,6 +113,13 @@
return interface_cast<IOMX>(reply.readStrongBinder());
}
+ virtual sp<ICrypto> makeCrypto() {
+ Parcel data, reply;
+ data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor());
+ remote()->transact(MAKE_CRYPTO, data, &reply);
+ return interface_cast<ICrypto>(reply.readStrongBinder());
+ }
+
virtual void addBatteryData(uint32_t params) {
Parcel data, reply;
data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor());
@@ -191,6 +200,12 @@
reply->writeStrongBinder(omx->asBinder());
return NO_ERROR;
} break;
+ case MAKE_CRYPTO: {
+ CHECK_INTERFACE(IMediaPlayerService, data, reply);
+ sp<ICrypto> crypto = makeCrypto();
+ reply->writeStrongBinder(crypto->asBinder());
+ return NO_ERROR;
+ } break;
case ADD_BATTERY_DATA: {
CHECK_INTERFACE(IMediaPlayerService, data, reply);
uint32_t params = data.readInt32();
diff --git a/media/libmedia/JetPlayer.cpp b/media/libmedia/JetPlayer.cpp
index 312a493..52aee49 100644
--- a/media/libmedia/JetPlayer.cpp
+++ b/media/libmedia/JetPlayer.cpp
@@ -30,7 +30,7 @@
static const S_EAS_LIB_CONFIG* pLibConfig = NULL;
//-------------------------------------------------------------------------------------------------
-JetPlayer::JetPlayer(jobject javaJetPlayer, int maxTracks, int trackBufferSize) :
+JetPlayer::JetPlayer(void *javaJetPlayer, int maxTracks, int trackBufferSize) :
mEventCallback(NULL),
mJavaJetPlayerRef(javaJetPlayer),
mTid(-1),
@@ -89,10 +89,10 @@
// create the output AudioTrack
mAudioTrack = new AudioTrack();
- mAudioTrack->set(AUDIO_STREAM_MUSIC, //TODO parametrize this
+ mAudioTrack->set(AUDIO_STREAM_MUSIC, //TODO parameterize this
pLibConfig->sampleRate,
AUDIO_FORMAT_PCM_16_BIT,
- (pLibConfig->numChannels == 2) ? AUDIO_CHANNEL_OUT_STEREO : AUDIO_CHANNEL_OUT_MONO,
+ audio_channel_out_mask_from_count(pLibConfig->numChannels),
mTrackBufferSize,
AUDIO_POLICY_OUTPUT_FLAG_NONE);
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/libmedia/SoundPool.cpp
similarity index 99%
rename from media/jni/soundpool/SoundPool.cpp
rename to media/libmedia/SoundPool.cpp
index 5aed8a1..306c57d 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/libmedia/SoundPool.cpp
@@ -685,7 +685,7 @@
void SoundChannel::callback(int event, void* user, void *info)
{
SoundChannel* channel = static_cast<SoundChannel*>((void *)((unsigned long)user & ~1));
-
+
channel->process(event, info, (unsigned long)user & 1);
}
diff --git a/media/jni/soundpool/SoundPool.h b/media/libmedia/SoundPool.h
similarity index 100%
rename from media/jni/soundpool/SoundPool.h
rename to media/libmedia/SoundPool.h
diff --git a/media/jni/soundpool/SoundPoolThread.cpp b/media/libmedia/SoundPoolThread.cpp
similarity index 100%
rename from media/jni/soundpool/SoundPoolThread.cpp
rename to media/libmedia/SoundPoolThread.cpp
diff --git a/media/jni/soundpool/SoundPoolThread.h b/media/libmedia/SoundPoolThread.h
similarity index 100%
rename from media/jni/soundpool/SoundPoolThread.h
rename to media/libmedia/SoundPoolThread.h
diff --git a/media/libmedia_native/Android.mk b/media/libmedia_native/Android.mk
new file mode 100644
index 0000000..065a90f
--- /dev/null
+++ b/media/libmedia_native/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES :=
+
+LOCAL_MODULE:= libmedia_native
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk
index 41bcab0..675c563 100644
--- a/media/libmediaplayerservice/Android.mk
+++ b/media/libmediaplayerservice/Android.mk
@@ -7,6 +7,7 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
+ Crypto.cpp \
MediaRecorderClient.cpp \
MediaPlayerService.cpp \
MetadataRetrieverClient.cpp \
@@ -23,6 +24,7 @@
libvorbisidec \
libsonivox \
libmedia \
+ libmedia_native \
libcamera_client \
libandroid_runtime \
libstagefright \
@@ -37,12 +39,11 @@
libstagefright_rtsp \
LOCAL_C_INCLUDES := \
- $(JNI_H_INCLUDE) \
$(call include-path-for, graphics corecg) \
$(TOP)/frameworks/base/media/libstagefright/include \
$(TOP)/frameworks/base/media/libstagefright/rtsp \
$(TOP)/frameworks/native/include/media/openmax \
- $(TOP)/external/tremolo/Tremolo
+ $(TOP)/external/tremolo/Tremolo \
LOCAL_MODULE:= libmediaplayerservice
diff --git a/media/libmediaplayerservice/Crypto.cpp b/media/libmediaplayerservice/Crypto.cpp
new file mode 100644
index 0000000..e02035f
--- /dev/null
+++ b/media/libmediaplayerservice/Crypto.cpp
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Crypto"
+#include <utils/Log.h>
+
+#include "Crypto.h"
+
+#include <media/stagefright/MediaErrors.h>
+
+namespace android {
+
+Crypto::Crypto() {
+}
+
+Crypto::~Crypto() {
+}
+
+status_t Crypto::initialize() {
+ return ERROR_UNSUPPORTED;
+}
+
+status_t Crypto::terminate() {
+ return ERROR_UNSUPPORTED;
+}
+
+status_t Crypto::setEntitlementKey(
+ const void *key, size_t keyLength) {
+ return ERROR_UNSUPPORTED;
+}
+
+status_t Crypto::setEntitlementControlMessage(
+ const void *msg, size_t msgLength) {
+ return ERROR_UNSUPPORTED;
+}
+
+ssize_t Crypto::decryptVideo(
+ const void *iv, size_t ivLength,
+ const void *srcData, size_t srcDataSize,
+ void *dstData, size_t dstDataOffset) {
+ return ERROR_UNSUPPORTED;
+}
+
+ssize_t Crypto::decryptAudio(
+ const void *iv, size_t ivLength,
+ const void *srcData, size_t srcDataSize,
+ void *dstData, size_t dstDataSize) {
+ return ERROR_UNSUPPORTED;
+}
+
+} // namespace android
diff --git a/media/libmediaplayerservice/Crypto.h b/media/libmediaplayerservice/Crypto.h
new file mode 100644
index 0000000..9855496
--- /dev/null
+++ b/media/libmediaplayerservice/Crypto.h
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+#ifndef CRYPTO_H_
+
+#define CRYPTO_H_
+
+#include <media/ICrypto.h>
+#include <utils/threads.h>
+
+namespace android {
+
+struct Crypto : public BnCrypto {
+ Crypto();
+
+ virtual status_t initialize();
+ virtual status_t terminate();
+
+ virtual status_t setEntitlementKey(
+ const void *key, size_t keyLength);
+
+ virtual status_t setEntitlementControlMessage(
+ const void *msg, size_t msgLength);
+
+ virtual ssize_t decryptVideo(
+ const void *iv, size_t ivLength,
+ const void *srcData, size_t srcDataSize,
+ void *dstData, size_t dstDataOffset);
+
+ virtual ssize_t decryptAudio(
+ const void *iv, size_t ivLength,
+ const void *srcData, size_t srcDataSize,
+ void *dstData, size_t dstDataSize);
+
+protected:
+ virtual ~Crypto();
+
+private:
+ DISALLOW_EVIL_CONSTRUCTORS(Crypto);
+};
+
+} // namespace android
+
+#endif // CRYPTO_H_
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 1cc120c..123d07ff 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -70,6 +70,8 @@
#include <OMX.h>
+#include "Crypto.h"
+
namespace android {
sp<MediaPlayerBase> createAAH_TXPlayer();
sp<MediaPlayerBase> createAAH_RXPlayer();
@@ -292,6 +294,16 @@
return mOMX;
}
+sp<ICrypto> MediaPlayerService::makeCrypto() {
+ Mutex::Autolock autoLock(mLock);
+
+ if (mCrypto == NULL) {
+ mCrypto = new Crypto;
+ }
+
+ return mCrypto;
+}
+
status_t MediaPlayerService::AudioCache::dump(int fd, const Vector<String16>& args) const
{
const size_t SIZE = 256;
@@ -541,6 +553,12 @@
}
static player_type getDefaultPlayerType() {
+ char value[PROPERTY_VALUE_MAX];
+ if (property_get("media.stagefright.use-nuplayer", value, NULL)
+ && (!strcmp("1", value) || !strcasecmp("true", value))) {
+ return NU_PLAYER;
+ }
+
return STAGEFRIGHT_PLAYER;
}
@@ -1514,7 +1532,7 @@
frameCount = (sampleRate*afFrameCount*bufferCount)/afSampleRate;
if (channelMask == CHANNEL_MASK_USE_CHANNEL_ORDER) {
- channelMask = audio_channel_mask_from_count(channelCount);
+ channelMask = audio_channel_out_mask_from_count(channelCount);
if (0 == channelMask) {
ALOGE("open() error, can\'t derive mask for %d audio channels", channelCount);
return NO_INIT;
@@ -1571,7 +1589,7 @@
AUDIO_POLICY_OUTPUT_FLAG_NONE,
CallbackWrapper,
mCallbackData,
- 0,
+ 0, // notification frames
mSessionId);
} else {
t = new AudioTrack(
diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h
index d4e0eb1..b08dd6c 100644
--- a/media/libmediaplayerservice/MediaPlayerService.h
+++ b/media/libmediaplayerservice/MediaPlayerService.h
@@ -240,6 +240,7 @@
virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat);
virtual sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat);
virtual sp<IOMX> getOMX();
+ virtual sp<ICrypto> makeCrypto();
virtual status_t dump(int fd, const Vector<String16>& args);
@@ -419,6 +420,7 @@
SortedVector< wp<MediaRecorderClient> > mMediaRecorderClients;
int32_t mNextConnId;
sp<IOMX> mOMX;
+ sp<ICrypto> mCrypto;
};
// ----------------------------------------------------------------------------
diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.cpp b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
index 7dbb57f..776d288 100644
--- a/media/libmediaplayerservice/MetadataRetrieverClient.cpp
+++ b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
@@ -87,6 +87,7 @@
sp<MediaMetadataRetrieverBase> p;
switch (playerType) {
case STAGEFRIGHT_PLAYER:
+ case NU_PLAYER:
{
p = new StagefrightMetadataRetriever;
break;
diff --git a/media/libmediaplayerservice/StagefrightPlayer.cpp b/media/libmediaplayerservice/StagefrightPlayer.cpp
index 052ebf0..619c149 100644
--- a/media/libmediaplayerservice/StagefrightPlayer.cpp
+++ b/media/libmediaplayerservice/StagefrightPlayer.cpp
@@ -166,7 +166,8 @@
}
status_t StagefrightPlayer::invoke(const Parcel &request, Parcel *reply) {
- return INVALID_OPERATION;
+ ALOGV("invoke()");
+ return mPlayer->invoke(request, reply);
}
void StagefrightPlayer::setAudioSink(const sp<AudioSink> &audioSink) {
diff --git a/media/libmediaplayerservice/nuplayer/Android.mk b/media/libmediaplayerservice/nuplayer/Android.mk
index 9b485d7..73336ef 100644
--- a/media/libmediaplayerservice/nuplayer/Android.mk
+++ b/media/libmediaplayerservice/nuplayer/Android.mk
@@ -2,6 +2,7 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
+ GenericSource.cpp \
HTTPLiveSource.cpp \
NuPlayer.cpp \
NuPlayerDecoder.cpp \
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.cpp b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
new file mode 100644
index 0000000..99569c9
--- /dev/null
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
@@ -0,0 +1,265 @@
+/*
+ * 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.
+ */
+
+#include "GenericSource.h"
+
+#include "AnotherPacketSource.h"
+
+#include <media/stagefright/foundation/ABuffer.h>
+#include <media/stagefright/foundation/ADebug.h>
+#include <media/stagefright/foundation/AMessage.h>
+#include <media/stagefright/DataSource.h>
+#include <media/stagefright/FileSource.h>
+#include <media/stagefright/MediaBuffer.h>
+#include <media/stagefright/MediaDefs.h>
+#include <media/stagefright/MediaExtractor.h>
+#include <media/stagefright/MediaSource.h>
+#include <media/stagefright/MetaData.h>
+
+namespace android {
+
+NuPlayer::GenericSource::GenericSource(
+ const char *url,
+ const KeyedVector<String8, String8> *headers,
+ bool uidValid,
+ uid_t uid)
+ : mDurationUs(0ll),
+ mAudioIsVorbis(false) {
+ DataSource::RegisterDefaultSniffers();
+
+ sp<DataSource> dataSource =
+ DataSource::CreateFromURI(url, headers);
+ CHECK(dataSource != NULL);
+
+ initFromDataSource(dataSource);
+}
+
+NuPlayer::GenericSource::GenericSource(
+ int fd, int64_t offset, int64_t length)
+ : mDurationUs(0ll),
+ mAudioIsVorbis(false) {
+ DataSource::RegisterDefaultSniffers();
+
+ sp<DataSource> dataSource = new FileSource(dup(fd), offset, length);
+
+ initFromDataSource(dataSource);
+}
+
+void NuPlayer::GenericSource::initFromDataSource(
+ const sp<DataSource> &dataSource) {
+ sp<MediaExtractor> extractor = MediaExtractor::Create(dataSource);
+
+ CHECK(extractor != NULL);
+
+ for (size_t i = 0; i < extractor->countTracks(); ++i) {
+ sp<MetaData> meta = extractor->getTrackMetaData(i);
+
+ const char *mime;
+ CHECK(meta->findCString(kKeyMIMEType, &mime));
+
+ sp<MediaSource> track;
+
+ if (!strncasecmp(mime, "audio/", 6)) {
+ if (mAudioTrack.mSource == NULL) {
+ mAudioTrack.mSource = track = extractor->getTrack(i);
+
+ if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_VORBIS)) {
+ mAudioIsVorbis = true;
+ } else {
+ mAudioIsVorbis = false;
+ }
+ }
+ } else if (!strncasecmp(mime, "video/", 6)) {
+ if (mVideoTrack.mSource == NULL) {
+ mVideoTrack.mSource = track = extractor->getTrack(i);
+ }
+ }
+
+ if (track != NULL) {
+ int64_t durationUs;
+ if (meta->findInt64(kKeyDuration, &durationUs)) {
+ if (durationUs > mDurationUs) {
+ mDurationUs = durationUs;
+ }
+ }
+ }
+ }
+}
+
+NuPlayer::GenericSource::~GenericSource() {
+}
+
+void NuPlayer::GenericSource::start() {
+ ALOGI("start");
+
+ if (mAudioTrack.mSource != NULL) {
+ CHECK_EQ(mAudioTrack.mSource->start(), (status_t)OK);
+
+ mAudioTrack.mPackets =
+ new AnotherPacketSource(mAudioTrack.mSource->getFormat());
+
+ readBuffer(true /* audio */);
+ }
+
+ if (mVideoTrack.mSource != NULL) {
+ CHECK_EQ(mVideoTrack.mSource->start(), (status_t)OK);
+
+ mVideoTrack.mPackets =
+ new AnotherPacketSource(mVideoTrack.mSource->getFormat());
+
+ readBuffer(false /* audio */);
+ }
+}
+
+status_t NuPlayer::GenericSource::feedMoreTSData() {
+ return OK;
+}
+
+sp<MetaData> NuPlayer::GenericSource::getFormat(bool audio) {
+ sp<MediaSource> source = audio ? mAudioTrack.mSource : mVideoTrack.mSource;
+
+ if (source == NULL) {
+ return NULL;
+ }
+
+ return source->getFormat();
+}
+
+status_t NuPlayer::GenericSource::dequeueAccessUnit(
+ bool audio, sp<ABuffer> *accessUnit) {
+ Track *track = audio ? &mAudioTrack : &mVideoTrack;
+
+ if (track->mSource == NULL) {
+ return -EWOULDBLOCK;
+ }
+
+ status_t finalResult;
+ if (!track->mPackets->hasBufferAvailable(&finalResult)) {
+ return finalResult == OK ? -EWOULDBLOCK : finalResult;
+ }
+
+ status_t result = track->mPackets->dequeueAccessUnit(accessUnit);
+
+ readBuffer(audio, -1ll);
+
+ return result;
+}
+
+status_t NuPlayer::GenericSource::getDuration(int64_t *durationUs) {
+ *durationUs = mDurationUs;
+ return OK;
+}
+
+status_t NuPlayer::GenericSource::seekTo(int64_t seekTimeUs) {
+ if (mVideoTrack.mSource != NULL) {
+ int64_t actualTimeUs;
+ readBuffer(false /* audio */, seekTimeUs, &actualTimeUs);
+
+ seekTimeUs = actualTimeUs;
+ }
+
+ if (mAudioTrack.mSource != NULL) {
+ readBuffer(true /* audio */, seekTimeUs);
+ }
+
+ return OK;
+}
+
+void NuPlayer::GenericSource::readBuffer(
+ bool audio, int64_t seekTimeUs, int64_t *actualTimeUs) {
+ Track *track = audio ? &mAudioTrack : &mVideoTrack;
+ CHECK(track->mSource != NULL);
+
+ if (actualTimeUs) {
+ *actualTimeUs = seekTimeUs;
+ }
+
+ MediaSource::ReadOptions options;
+
+ bool seeking = false;
+
+ if (seekTimeUs >= 0) {
+ options.setSeekTo(seekTimeUs);
+ seeking = true;
+ }
+
+ for (;;) {
+ MediaBuffer *mbuf;
+ status_t err = track->mSource->read(&mbuf, &options);
+
+ options.clearSeekTo();
+
+ if (err == OK) {
+ size_t outLength = mbuf->range_length();
+
+ if (audio && mAudioIsVorbis) {
+ outLength += sizeof(int32_t);
+ }
+
+ sp<ABuffer> buffer = new ABuffer(outLength);
+
+ memcpy(buffer->data(),
+ (const uint8_t *)mbuf->data() + mbuf->range_offset(),
+ mbuf->range_length());
+
+ if (audio && mAudioIsVorbis) {
+ int32_t numPageSamples;
+ if (!mbuf->meta_data()->findInt32(
+ kKeyValidSamples, &numPageSamples)) {
+ numPageSamples = -1;
+ }
+
+ memcpy(buffer->data() + mbuf->range_length(),
+ &numPageSamples,
+ sizeof(numPageSamples));
+ }
+
+ int64_t timeUs;
+ CHECK(mbuf->meta_data()->findInt64(kKeyTime, &timeUs));
+
+ buffer->meta()->setInt64("timeUs", timeUs);
+
+ if (actualTimeUs) {
+ *actualTimeUs = timeUs;
+ }
+
+ mbuf->release();
+ mbuf = NULL;
+
+ if (seeking) {
+ track->mPackets->queueDiscontinuity(
+ ATSParser::DISCONTINUITY_SEEK, NULL);
+ }
+
+ track->mPackets->queueAccessUnit(buffer);
+ break;
+ } else if (err == INFO_FORMAT_CHANGED) {
+#if 0
+ track->mPackets->queueDiscontinuity(
+ ATSParser::DISCONTINUITY_FORMATCHANGE, NULL);
+#endif
+ } else {
+ track->mPackets->signalEOS(err);
+ break;
+ }
+ }
+}
+
+bool NuPlayer::GenericSource::isSeekable() {
+ return true;
+}
+
+} // namespace android
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.h b/media/libmediaplayerservice/nuplayer/GenericSource.h
new file mode 100644
index 0000000..aaa5876
--- /dev/null
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.h
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+#ifndef GENERIC_SOURCE_H_
+
+#define GENERIC_SOURCE_H_
+
+#include "NuPlayer.h"
+#include "NuPlayerSource.h"
+
+#include "ATSParser.h"
+
+namespace android {
+
+struct AnotherPacketSource;
+struct ARTSPController;
+struct DataSource;
+struct MediaSource;
+
+struct NuPlayer::GenericSource : public NuPlayer::Source {
+ GenericSource(
+ const char *url,
+ const KeyedVector<String8, String8> *headers,
+ bool uidValid = false,
+ uid_t uid = 0);
+
+ GenericSource(int fd, int64_t offset, int64_t length);
+
+ virtual void start();
+
+ virtual status_t feedMoreTSData();
+
+ virtual sp<MetaData> getFormat(bool audio);
+ virtual status_t dequeueAccessUnit(bool audio, sp<ABuffer> *accessUnit);
+
+ virtual status_t getDuration(int64_t *durationUs);
+ virtual status_t seekTo(int64_t seekTimeUs);
+ virtual bool isSeekable();
+
+protected:
+ virtual ~GenericSource();
+
+private:
+ struct Track {
+ sp<MediaSource> mSource;
+ sp<AnotherPacketSource> mPackets;
+ };
+
+ Track mAudioTrack;
+ Track mVideoTrack;
+
+ int64_t mDurationUs;
+ bool mAudioIsVorbis;
+
+ void initFromDataSource(const sp<DataSource> &dataSource);
+
+ void readBuffer(
+ bool audio,
+ int64_t seekTimeUs = -1ll, int64_t *actualTimeUs = NULL);
+
+ DISALLOW_EVIL_CONSTRUCTORS(GenericSource);
+};
+
+} // namespace android
+
+#endif // GENERIC_SOURCE_H_
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 526120a..544d501 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -27,6 +27,7 @@
#include "NuPlayerSource.h"
#include "RTSPSource.h"
#include "StreamingSource.h"
+#include "GenericSource.h"
#include "ATSParser.h"
@@ -84,18 +85,44 @@
msg->post();
}
+static bool IsHTTPLiveURL(const char *url) {
+ if (!strncasecmp("http://", url, 7)
+ || !strncasecmp("https://", url, 8)) {
+ size_t len = strlen(url);
+ if (len >= 5 && !strcasecmp(".m3u8", &url[len - 5])) {
+ return true;
+ }
+
+ if (strstr(url,"m3u8")) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
void NuPlayer::setDataSource(
const char *url, const KeyedVector<String8, String8> *headers) {
sp<AMessage> msg = new AMessage(kWhatSetDataSource, id());
- if (!strncasecmp(url, "rtsp://", 7)) {
- msg->setObject(
- "source", new RTSPSource(url, headers, mUIDValid, mUID));
+ sp<Source> source;
+ if (IsHTTPLiveURL(url)) {
+ source = new HTTPLiveSource(url, headers, mUIDValid, mUID);
+ } else if (!strncasecmp(url, "rtsp://", 7)) {
+ source = new RTSPSource(url, headers, mUIDValid, mUID);
} else {
- msg->setObject(
- "source", new HTTPLiveSource(url, headers, mUIDValid, mUID));
+ source = new GenericSource(url, headers, mUIDValid, mUID);
}
+ msg->setObject("source", source);
+ msg->post();
+}
+
+void NuPlayer::setDataSource(int fd, int64_t offset, int64_t length) {
+ sp<AMessage> msg = new AMessage(kWhatSetDataSource, id());
+
+ sp<Source> source = new GenericSource(fd, offset, length);
+ msg->setObject("source", source);
msg->post();
}
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.h b/media/libmediaplayerservice/nuplayer/NuPlayer.h
index 6be14be..25766e0 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.h
@@ -40,6 +40,8 @@
void setDataSource(
const char *url, const KeyedVector<String8, String8> *headers);
+ void setDataSource(int fd, int64_t offset, int64_t length);
+
void setVideoSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture);
void setAudioSink(const sp<MediaPlayerBase::AudioSink> &sink);
void start();
@@ -60,12 +62,13 @@
private:
struct Decoder;
+ struct GenericSource;
struct HTTPLiveSource;
struct NuPlayerStreamListener;
struct Renderer;
+ struct RTSPSource;
struct Source;
struct StreamingSource;
- struct RTSPSource;
enum {
kWhatSetDataSource = '=DaS',
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
index 460fc98..5733229 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
@@ -125,6 +125,11 @@
msg->setInt32("channel-count", numChannels);
msg->setInt32("sample-rate", sampleRate);
+
+ int32_t isADTS;
+ if (meta->findInt32(kKeyIsADTS, &isADTS) && isADTS != 0) {
+ msg->setInt32("is-adts", true);
+ }
}
int32_t maxInputSize;
@@ -228,6 +233,20 @@
buffer->meta()->setInt32("csd", true);
mCSD.push(buffer);
+ } else if (meta->findData(kKeyVorbisInfo, &type, &data, &size)) {
+ sp<ABuffer> buffer = new ABuffer(size);
+ memcpy(buffer->data(), data, size);
+
+ buffer->meta()->setInt32("csd", true);
+ mCSD.push(buffer);
+
+ CHECK(meta->findData(kKeyVorbisBooks, &type, &data, &size));
+
+ buffer = new ABuffer(size);
+ memcpy(buffer->data(), data, size);
+
+ buffer->meta()->setInt32("csd", true);
+ mCSD.push(buffer);
}
return msg;
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
index 5aa99bf..253bc2fa 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
@@ -76,7 +76,13 @@
}
status_t NuPlayerDriver::setDataSource(int fd, int64_t offset, int64_t length) {
- return INVALID_OPERATION;
+ CHECK_EQ((int)mState, (int)UNINITIALIZED);
+
+ mPlayer->setDataSource(fd, offset, length);
+
+ mState = STOPPED;
+
+ return OK;
}
status_t NuPlayerDriver::setDataSource(const sp<IStreamSource> &source) {
@@ -97,13 +103,16 @@
}
status_t NuPlayerDriver::prepare() {
+ sendEvent(MEDIA_SET_VIDEO_SIZE, 320, 240);
return OK;
}
status_t NuPlayerDriver::prepareAsync() {
+ status_t err = prepare();
+
notifyListener(MEDIA_PREPARED);
- return OK;
+ return err;
}
status_t NuPlayerDriver::start() {
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
index 5738ecb..ecbc428 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
@@ -376,7 +376,8 @@
bool tooLate = (mVideoLateByUs > 40000);
if (tooLate) {
- ALOGV("video late by %lld us (%.2f secs)", mVideoLateByUs, mVideoLateByUs / 1E6);
+ ALOGV("video late by %lld us (%.2f secs)",
+ mVideoLateByUs, mVideoLateByUs / 1E6);
} else {
ALOGV("rendering video at media time %.2f secs", mediaTimeUs / 1E6);
}
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 09e4e45..db2beda 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -427,24 +427,34 @@
sp<IMemory> mem = mDealer[portIndex]->allocate(def.nBufferSize);
CHECK(mem.get() != NULL);
- IOMX::buffer_id buffer;
+ BufferInfo info;
+ info.mStatus = BufferInfo::OWNED_BY_US;
uint32_t requiresAllocateBufferBit =
(portIndex == kPortIndexInput)
? OMXCodec::kRequiresAllocateBufferOnInputPorts
: OMXCodec::kRequiresAllocateBufferOnOutputPorts;
- if (mQuirks & requiresAllocateBufferBit) {
+ if (portIndex == kPortIndexInput && (mFlags & kFlagIsSecure)) {
+ mem.clear();
+
+ void *ptr;
+ err = mOMX->allocateBuffer(
+ mNode, portIndex, def.nBufferSize, &info.mBufferID,
+ &ptr);
+
+ info.mData = new ABuffer(ptr, def.nBufferSize);
+ } else if (mQuirks & requiresAllocateBufferBit) {
err = mOMX->allocateBufferWithBackup(
- mNode, portIndex, mem, &buffer);
+ mNode, portIndex, mem, &info.mBufferID);
} else {
- err = mOMX->useBuffer(mNode, portIndex, mem, &buffer);
+ err = mOMX->useBuffer(mNode, portIndex, mem, &info.mBufferID);
}
- BufferInfo info;
- info.mBufferID = buffer;
- info.mStatus = BufferInfo::OWNED_BY_US;
- info.mData = new ABuffer(mem->pointer(), def.nBufferSize);
+ if (mem != NULL) {
+ info.mData = new ABuffer(mem->pointer(), def.nBufferSize);
+ }
+
mBuffers[portIndex].push(info);
}
}
@@ -746,6 +756,10 @@
"audio_decoder.aac", "audio_encoder.aac" },
{ MEDIA_MIMETYPE_AUDIO_VORBIS,
"audio_decoder.vorbis", "audio_encoder.vorbis" },
+ { MEDIA_MIMETYPE_AUDIO_G711_MLAW,
+ "audio_decoder.g711mlaw", "audio_encoder.g711mlaw" },
+ { MEDIA_MIMETYPE_AUDIO_G711_ALAW,
+ "audio_decoder.g711alaw", "audio_encoder.g711alaw" },
{ MEDIA_MIMETYPE_VIDEO_AVC,
"video_decoder.avc", "video_encoder.avc" },
{ MEDIA_MIMETYPE_VIDEO_MPEG4,
@@ -836,7 +850,13 @@
|| !msg->findInt32("sample-rate", &sampleRate)) {
err = INVALID_OPERATION;
} else {
- err = setupAACCodec(encoder, numChannels, sampleRate, bitRate);
+ int32_t isADTS;
+ if (!msg->findInt32("is-adts", &isADTS)) {
+ isADTS = 0;
+ }
+
+ err = setupAACCodec(
+ encoder, numChannels, sampleRate, bitRate, isADTS != 0);
}
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_NB)) {
err = setupAMRCodec(encoder, false /* isWAMR */, bitRate);
@@ -855,10 +875,6 @@
}
}
- if (err != OK) {
- return err;
- }
-
int32_t maxInputSize;
if (msg->findInt32("max-input-size", &maxInputSize)) {
err = setMinBufferSize(kPortIndexInput, (size_t)maxInputSize);
@@ -934,7 +950,11 @@
status_t ACodec::setupAACCodec(
bool encoder,
- int32_t numChannels, int32_t sampleRate, int32_t bitRate) {
+ int32_t numChannels, int32_t sampleRate, int32_t bitRate, bool isADTS) {
+ if (encoder && isADTS) {
+ return -EINVAL;
+ }
+
status_t err = setupRawAudioFormat(
encoder ? kPortIndexInput : kPortIndexOutput,
sampleRate,
@@ -1021,7 +1041,11 @@
profile.nChannels = numChannels;
profile.nSampleRate = sampleRate;
- profile.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4ADTS;
+
+ profile.eAACStreamFormat =
+ isADTS
+ ? OMX_AUDIO_AACStreamFormatMP4ADTS
+ : OMX_AUDIO_AACStreamFormatMP4FF;
return mOMX->setParameter(
mNode, OMX_IndexParamAudioAac, &profile, sizeof(profile));
@@ -2653,6 +2677,12 @@
observer->setNotificationMessage(notify);
mCodec->mComponentName = componentName;
+ mCodec->mFlags = 0;
+
+ if (componentName.endsWith(".secure")) {
+ mCodec->mFlags |= kFlagIsSecure;
+ }
+
mCodec->mQuirks = quirks;
mCodec->mOMX = omx;
mCodec->mNode = node;
@@ -2701,6 +2731,7 @@
mCodec->mNode = NULL;
mCodec->mOMX.clear();
mCodec->mQuirks = 0;
+ mCodec->mFlags = 0;
mCodec->mComponentName.clear();
mCodec->changeState(mCodec->mUninitializedState);
@@ -2770,6 +2801,9 @@
status_t err = mCodec->configureCodec(mime.c_str(), msg);
if (err != OK) {
+ ALOGE("[%s] configureCodec returning error %d",
+ mCodec->mComponentName.c_str(), err);
+
mCodec->signalError(OMX_ErrorUndefined, err);
return false;
}
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 047b4cb..8948abb 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -42,6 +42,7 @@
OggExtractor.cpp \
SampleIterator.cpp \
SampleTable.cpp \
+ SkipCutBuffer.cpp \
StagefrightMediaScanner.cpp \
StagefrightMetadataRetriever.cpp \
SurfaceMediaSource.cpp \
@@ -56,7 +57,6 @@
avc_utils.cpp \
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
$(TOP)/frameworks/base/include/media/stagefright/timedtext \
$(TOP)/frameworks/native/include/media/hardware \
$(TOP)/frameworks/native/include/media/openmax \
@@ -68,7 +68,6 @@
LOCAL_SHARED_LIBRARIES := \
libbinder \
libcamera_client \
- libchromium_net \
libcrypto \
libcutils \
libdl \
@@ -79,6 +78,7 @@
libicuuc \
liblog \
libmedia \
+ libmedia_native \
libsonivox \
libssl \
libstagefright_omx \
@@ -100,14 +100,18 @@
libstagefright_httplive \
libstagefright_id3 \
libFLAC \
- libstagefright_chromium_http \
+
+ifneq ($(TARGET_BUILD_PDK), true)
+LOCAL_STATIC_LIBRARIES += \
+ libstagefright_chromium_http
+LOCAL_SHARED_LIBRARIES += \
+ libchromium_net
+LOCAL_CPPFLAGS += -DCHROMIUM_AVAILABLE=1
+endif
LOCAL_SHARED_LIBRARIES += libstlport
include external/stlport/libstlport.mk
-# TODO: Chromium is always available, so this flag can be removed.
-LOCAL_CPPFLAGS += -DCHROMIUM_AVAILABLE=1
-
LOCAL_SHARED_LIBRARIES += \
libstagefright_enc_common \
libstagefright_avc_common \
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index 9db3c97..0f816e7 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -144,7 +144,7 @@
} else {
// playing to an AudioTrack, set up mask if necessary
audio_channel_mask_t audioMask = channelMask == CHANNEL_MASK_USE_CHANNEL_ORDER ?
- audio_channel_mask_from_count(numChannels) : channelMask;
+ audio_channel_out_mask_from_count(numChannels) : channelMask;
if (0 == audioMask) {
return BAD_VALUE;
}
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index cbe709b..0f1d841 100644
--- a/media/libstagefright/AudioSource.cpp
+++ b/media/libstagefright/AudioSource.cpp
@@ -47,22 +47,22 @@
}
AudioSource::AudioSource(
- audio_source_t inputSource, uint32_t sampleRate, uint32_t channels)
+ audio_source_t inputSource, uint32_t sampleRate, uint32_t channelCount)
: mStarted(false),
mSampleRate(sampleRate),
mPrevSampleTimeUs(0),
mNumFramesReceived(0),
mNumClientOwnedBuffers(0) {
- ALOGV("sampleRate: %d, channels: %d", sampleRate, channels);
- CHECK(channels == 1 || channels == 2);
+ ALOGV("sampleRate: %d, channelCount: %d", sampleRate, channelCount);
+ CHECK(channelCount == 1 || channelCount == 2);
AudioRecord::record_flags flags = (AudioRecord::record_flags)
(AudioRecord::RECORD_AGC_ENABLE |
AudioRecord::RECORD_NS_ENABLE |
AudioRecord::RECORD_IIR_ENABLE);
mRecord = new AudioRecord(
inputSource, sampleRate, AUDIO_FORMAT_PCM_16_BIT,
- channels > 1? AUDIO_CHANNEL_IN_STEREO: AUDIO_CHANNEL_IN_MONO,
+ audio_channel_in_mask_from_count(channelCount),
4 * kMaxBufferSize / sizeof(int16_t), /* Enable ping-pong buffers */
flags,
AudioRecordCallbackFunction,
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 9e00bb3..f96a4df 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -1114,7 +1114,7 @@
modifyFlags(AUDIO_RUNNING, CLEAR);
}
- if (mFlags & TEXTPLAYER_STARTED) {
+ if (mFlags & TEXTPLAYER_INITIALIZED) {
mTextDriver->pause();
modifyFlags(TEXT_RUNNING, CLEAR);
}
@@ -1268,32 +1268,6 @@
return OK;
}
-status_t AwesomePlayer::setTimedTextTrackIndex(int32_t index) {
- if (mTextDriver != NULL) {
- if (index >= 0) { // to turn on a text track
- status_t err = mTextDriver->setTimedTextTrackIndex(index);
- if (err != OK) {
- return err;
- }
-
- modifyFlags(TEXT_RUNNING, SET);
- modifyFlags(TEXTPLAYER_STARTED, SET);
- return OK;
- } else { // to turn off the text track display
- if (mFlags & TEXT_RUNNING) {
- modifyFlags(TEXT_RUNNING, CLEAR);
- }
- if (mFlags & TEXTPLAYER_STARTED) {
- modifyFlags(TEXTPLAYER_STARTED, CLEAR);
- }
-
- return mTextDriver->setTimedTextTrackIndex(index);
- }
- } else {
- return INVALID_OPERATION;
- }
-}
-
status_t AwesomePlayer::seekTo_l(int64_t timeUs) {
if (mFlags & CACHE_UNDERRUN) {
modifyFlags(CACHE_UNDERRUN, CLEAR);
@@ -1315,7 +1289,7 @@
seekAudioIfNecessary_l();
- if (mFlags & TEXTPLAYER_STARTED) {
+ if (mFlags & TEXTPLAYER_INITIALIZED) {
mTextDriver->seekToAsync(mSeekTimeUs);
}
@@ -1691,8 +1665,8 @@
}
}
- if ((mFlags & TEXTPLAYER_STARTED) && !(mFlags & (TEXT_RUNNING | SEEK_PREVIEW))) {
- mTextDriver->resume();
+ if ((mFlags & TEXTPLAYER_INITIALIZED) && !(mFlags & (TEXT_RUNNING | SEEK_PREVIEW))) {
+ mTextDriver->start();
modifyFlags(TEXT_RUNNING, SET);
}
@@ -2232,20 +2206,6 @@
status_t AwesomePlayer::setParameter(int key, const Parcel &request) {
switch (key) {
- case KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX:
- {
- Mutex::Autolock autoLock(mTimedTextLock);
- return setTimedTextTrackIndex(request.readInt32());
- }
- case KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE:
- {
- Mutex::Autolock autoLock(mTimedTextLock);
- if (mTextDriver == NULL) {
- mTextDriver = new TimedTextDriver(mListener);
- }
-
- return mTextDriver->addOutOfBandTextSource(request);
- }
case KEY_PARAMETER_CACHE_STAT_COLLECT_FREQ_MS:
{
return setCacheStatCollectFreq(request);
@@ -2294,6 +2254,90 @@
}
}
+status_t AwesomePlayer::invoke(const Parcel &request, Parcel *reply) {
+ if (NULL == reply) {
+ return android::BAD_VALUE;
+ }
+ int32_t methodId;
+ status_t ret = request.readInt32(&methodId);
+ if (ret != android::OK) {
+ return ret;
+ }
+ switch(methodId) {
+ case INVOKE_ID_GET_TRACK_INFO:
+ {
+ Mutex::Autolock autoLock(mTimedTextLock);
+ if (mTextDriver == NULL) {
+ return INVALID_OPERATION;
+ }
+ mTextDriver->getTrackInfo(reply);
+ return OK;
+ }
+ case INVOKE_ID_ADD_EXTERNAL_SOURCE:
+ {
+ Mutex::Autolock autoLock(mTimedTextLock);
+ if (mTextDriver == NULL) {
+ mTextDriver = new TimedTextDriver(mListener);
+ }
+ // String values written in Parcel are UTF-16 values.
+ String8 uri(request.readString16());
+ String8 mimeType(request.readString16());
+ return mTextDriver->addOutOfBandTextSource(uri, mimeType);
+ }
+ case INVOKE_ID_ADD_EXTERNAL_SOURCE_FD:
+ {
+ Mutex::Autolock autoLock(mTimedTextLock);
+ if (mTextDriver == NULL) {
+ mTextDriver = new TimedTextDriver(mListener);
+ }
+ int fd = request.readFileDescriptor();
+ off64_t offset = request.readInt64();
+ size_t length = request.readInt64();
+ String8 mimeType(request.readString16());
+ return mTextDriver->addOutOfBandTextSource(
+ fd, offset, length, mimeType);
+ }
+ case INVOKE_ID_SELECT_TRACK:
+ {
+ Mutex::Autolock autoLock(mTimedTextLock);
+ if (mTextDriver == NULL) {
+ return INVALID_OPERATION;
+ }
+
+ status_t err = mTextDriver->selectTrack(
+ request.readInt32());
+ if (err == OK) {
+ modifyFlags(TEXTPLAYER_INITIALIZED, SET);
+ if (mFlags & PLAYING && !(mFlags & TEXT_RUNNING)) {
+ mTextDriver->start();
+ modifyFlags(TEXT_RUNNING, SET);
+ }
+ }
+ return err;
+ }
+ case INVOKE_ID_UNSELECT_TRACK:
+ {
+ Mutex::Autolock autoLock(mTimedTextLock);
+ if (mTextDriver == NULL) {
+ return INVALID_OPERATION;
+ }
+ status_t err = mTextDriver->unselectTrack(
+ request.readInt32());
+ if (err == OK) {
+ modifyFlags(TEXTPLAYER_INITIALIZED, CLEAR);
+ modifyFlags(TEXT_RUNNING, CLEAR);
+ }
+ return err;
+ }
+ default:
+ {
+ return ERROR_UNSUPPORTED;
+ }
+ }
+ // It will not reach here.
+ return OK;
+}
+
bool AwesomePlayer::isStreamingHTTP() const {
return mCachedSource != NULL || mWVMExtractor != NULL;
}
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index 2df55282..fd3f892 100755
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -182,7 +182,7 @@
int32_t cameraId) {
if (camera == 0) {
- mCamera = Camera::connect(cameraId);
+ mCamera = Camera::connect(cameraId, false, false);
if (mCamera == 0) return -EBUSY;
mCameraFlags &= ~FLAGS_HOT_CAMERA;
} else {
@@ -515,9 +515,13 @@
return err;
}
- // This CHECK is good, since we just passed the lock/unlock
- // check earlier by calling mCamera->setParameters().
- CHECK_EQ((status_t)OK, mCamera->setPreviewDisplay(mSurface));
+ // Set the preview display. Skip this if mSurface is null because
+ // applications may already set a surface to the camera.
+ if (mSurface != NULL) {
+ // This CHECK is good, since we just passed the lock/unlock
+ // check earlier by calling mCamera->setParameters().
+ CHECK_EQ((status_t)OK, mCamera->setPreviewDisplay(mSurface));
+ }
// By default, do not store metadata in video buffers
mIsMetaDataStoredInVideoBuffers = false;
diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp
index 2215c07..6abaf23 100644
--- a/media/libstagefright/MP3Extractor.cpp
+++ b/media/libstagefright/MP3Extractor.cpp
@@ -311,10 +311,25 @@
mMeta->setInt32(kKeyBitRate, bitrate * 1000);
mMeta->setInt32(kKeyChannelCount, num_channels);
- mSeeker = XINGSeeker::CreateFromSource(mDataSource, mFirstFramePos);
+ sp<XINGSeeker> seeker = XINGSeeker::CreateFromSource(mDataSource, mFirstFramePos);
- if (mSeeker == NULL) {
+ if (seeker == NULL) {
mSeeker = VBRISeeker::CreateFromSource(mDataSource, post_id3_pos);
+ } else {
+ mSeeker = seeker;
+ int encd = seeker->getEncoderDelay();
+ int encp = seeker->getEncoderPadding();
+ if (encd != 0 || encp != 0) {
+ mMeta->setInt32(kKeyEncoderDelay, encd);
+ mMeta->setInt32(kKeyEncoderPadding, encp);
+ }
+ }
+
+ if (mSeeker != NULL) {
+ // While it is safe to send the XING/VBRI frame to the decoder, this will
+ // result in an extra 1152 samples being output. The real first frame to
+ // decode is after the XING/VBRI frame, so skip there.
+ mFirstFramePos += frame_size;
}
int64_t durationUs;
@@ -333,6 +348,37 @@
}
mInitCheck = OK;
+
+ // get iTunes-style gapless info if present
+ ID3 id3(mDataSource);
+ if (id3.isValid()) {
+ ID3::Iterator *com = new ID3::Iterator(id3, "COM");
+ if (com->done()) {
+ delete com;
+ com = new ID3::Iterator(id3, "COMM");
+ }
+ while(!com->done()) {
+ String8 commentdesc;
+ String8 commentvalue;
+ com->getString(&commentdesc, &commentvalue);
+ const char * desc = commentdesc.string();
+ const char * value = commentvalue.string();
+
+ // first 3 characters are the language, which we don't care about
+ if(strlen(desc) > 3 && strcmp(desc + 3, "iTunSMPB") == 0) {
+
+ int32_t delay, padding;
+ if (sscanf(value, " %*x %x %x %*x", &delay, &padding) == 2) {
+ mMeta->setInt32(kKeyEncoderDelay, delay);
+ mMeta->setInt32(kKeyEncoderPadding, padding);
+ }
+ break;
+ }
+ com->next();
+ }
+ delete com;
+ com = NULL;
+ }
}
size_t MP3Extractor::countTracks() {
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index 6c95d4e5..9385b8a 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -373,7 +373,8 @@
if (mInitCheck == OK) {
if (mHasVideo) {
- mFileMetaData->setCString(kKeyMIMEType, "video/mp4");
+ mFileMetaData->setCString(
+ kKeyMIMEType, MEDIA_MIMETYPE_CONTAINER_MPEG4);
} else {
mFileMetaData->setCString(kKeyMIMEType, "audio/mp4");
}
@@ -599,6 +600,7 @@
}
status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
+ ALOGV("entering parseChunk %lld/%d", *offset, depth);
uint32_t hdr[2];
if (mDataSource->readAt(*offset, hdr, 8) < 8) {
return ERROR_IO;
@@ -625,6 +627,7 @@
char chunk[5];
MakeFourCCString(chunk_type, chunk);
+ ALOGV("chunk: %s @ %lld", chunk, *offset);
#if 0
static const char kWhitespace[] = " ";
@@ -1302,6 +1305,8 @@
break;
}
+ case FOURCC('m', 'e', 'a', 'n'):
+ case FOURCC('n', 'a', 'm', 'e'):
case FOURCC('d', 'a', 't', 'a'):
{
if (mPath.size() == 6 && underMetaDataPath(mPath)) {
@@ -1437,6 +1442,15 @@
break;
}
+ case FOURCC('-', '-', '-', '-'):
+ {
+ mLastCommentMean.clear();
+ mLastCommentName.clear();
+ mLastCommentData.clear();
+ *offset += chunk_size;
+ break;
+ }
+
default:
{
*offset += chunk_size;
@@ -1553,6 +1567,9 @@
uint32_t flags = U32_AT(buffer);
uint32_t metadataKey = 0;
+ char chunk[5];
+ MakeFourCCString(mPath[4], chunk);
+ ALOGV("meta: %s @ %lld", chunk, offset);
switch (mPath[4]) {
case FOURCC(0xa9, 'a', 'l', 'b'):
{
@@ -1632,6 +1649,35 @@
}
break;
}
+ case FOURCC('-', '-', '-', '-'):
+ {
+ buffer[size] = '\0';
+ switch (mPath[5]) {
+ case FOURCC('m', 'e', 'a', 'n'):
+ mLastCommentMean.setTo((const char *)buffer + 4);
+ break;
+ case FOURCC('n', 'a', 'm', 'e'):
+ mLastCommentName.setTo((const char *)buffer + 4);
+ break;
+ case FOURCC('d', 'a', 't', 'a'):
+ mLastCommentData.setTo((const char *)buffer + 8);
+ break;
+ }
+ if (mLastCommentMean == "com.apple.iTunes"
+ && mLastCommentName == "iTunSMPB"
+ && mLastCommentData.length() != 0) {
+ int32_t delay, padding;
+ if (sscanf(mLastCommentData,
+ " %*x %x %x %*x", &delay, &padding) == 2) {
+ mLastTrack->meta->setInt32(kKeyEncoderDelay, delay);
+ mLastTrack->meta->setInt32(kKeyEncoderPadding, padding);
+ }
+ mLastCommentMean.clear();
+ mLastCommentName.clear();
+ mLastCommentData.clear();
+ }
+ break;
+ }
default:
break;
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index a9e7f360..42b5c7e 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -22,10 +22,14 @@
#include "include/SoftwareRenderer.h"
+#include <binder/IServiceManager.h>
#include <gui/SurfaceTextureClient.h>
+#include <media/ICrypto.h>
+#include <media/IMediaPlayerService.h>
#include <media/stagefright/foundation/ABuffer.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AMessage.h>
+#include <media/stagefright/foundation/hexdump.h>
#include <media/stagefright/ACodec.h>
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MetaData.h>
@@ -528,6 +532,12 @@
info.mOwnedByClient = false;
CHECK(msg->findBuffer(name.c_str(), &info.mData));
+ if (portIndex == kPortIndexInput
+ && (mFlags & kFlagIsSecure)) {
+ info.mEncryptedData =
+ new ABuffer(info.mData->capacity());
+ }
+
buffers->push_back(info);
}
@@ -742,6 +752,59 @@
format->setInt32("encoder", true);
}
+ if (flags & CONFIGURE_FLAG_SECURE) {
+ mFlags |= kFlagIsSecure;
+
+ sp<IServiceManager> sm = defaultServiceManager();
+
+ sp<IBinder> binder =
+ sm->getService(String16("media.player"));
+
+ sp<IMediaPlayerService> service =
+ interface_cast<IMediaPlayerService>(binder);
+
+ CHECK(service != NULL);
+
+ mCrypto = service->makeCrypto();
+
+ status_t err = mCrypto->initialize();
+
+ if (err == OK) {
+ sp<ABuffer> emm;
+ if (format->findBuffer("emm", &emm)) {
+ err = mCrypto->setEntitlementKey(
+ emm->data(), emm->size());
+ }
+ }
+
+ if (err == OK) {
+ sp<ABuffer> ecm;
+ if (format->findBuffer("ecm", &ecm)) {
+ CHECK_EQ(ecm->size(), 80u);
+
+ // bytes 16..47 of the original ecm stream data.
+ err = mCrypto->setEntitlementControlMessage(
+ ecm->data() + 16, 32);
+ }
+ }
+
+ if (err != OK) {
+ ALOGE("failed to instantiate crypto service.");
+
+ mCrypto.clear();
+
+ setState(INITIALIZED);
+
+ sp<AMessage> response = new AMessage;
+ response->setInt32("err", UNKNOWN_ERROR);
+
+ response->postReply(mReplyID);
+ break;
+ }
+ } else {
+ mFlags &= ~kFlagIsSecure;
+ }
+
mCodec->initiateConfigureComponent(format);
break;
}
@@ -983,7 +1046,10 @@
for (size_t i = 0; i < srcBuffers.size(); ++i) {
const BufferInfo &info = srcBuffers.itemAt(i);
- dstBuffers->push_back(info.mData);
+ dstBuffers->push_back(
+ (portIndex == kPortIndexInput
+ && (mFlags & kFlagIsSecure))
+ ? info.mEncryptedData : info.mData);
}
(new AMessage)->postReply(replyID);
@@ -1037,10 +1103,15 @@
}
void MediaCodec::setState(State newState) {
- if (newState == UNINITIALIZED) {
+ if (newState == INITIALIZED) {
delete mSoftRenderer;
mSoftRenderer = NULL;
+ if (mCrypto != NULL) {
+ mCrypto->terminate();
+ mCrypto.clear();
+ }
+
mNativeWindow.clear();
mOutputFormat.clear();
@@ -1150,6 +1221,43 @@
info->mData->meta()->setInt32("csd", true);
}
+ if (mFlags & kFlagIsSecure) {
+ uint8_t iv[16];
+ memset(iv, 0, sizeof(iv));
+
+ ssize_t outLength;
+
+ if (mFlags & kFlagIsSoftwareCodec) {
+ outLength = mCrypto->decryptAudio(
+ (flags & BUFFER_FLAG_ENCRYPTED) ? iv : NULL,
+ (flags & BUFFER_FLAG_ENCRYPTED) ? sizeof(iv) : 0,
+ info->mEncryptedData->base() + offset,
+ size,
+ info->mData->base(),
+ info->mData->capacity());
+ } else {
+ outLength = mCrypto->decryptVideo(
+ (flags & BUFFER_FLAG_ENCRYPTED) ? iv : NULL,
+ (flags & BUFFER_FLAG_ENCRYPTED) ? sizeof(iv) : 0,
+ info->mEncryptedData->base() + offset,
+ size,
+ info->mData->base(),
+ 0 /* offset */);
+ }
+
+ if (outLength < 0) {
+ return outLength;
+ }
+
+ if ((size_t)outLength > info->mEncryptedData->capacity()) {
+ return -ERANGE;
+ }
+
+ info->mData->setRange(0, outLength);
+ } else if (flags & BUFFER_FLAG_ENCRYPTED) {
+ return -EINVAL;
+ }
+
reply->setBuffer("buffer", info->mData);
reply->post();
diff --git a/media/libstagefright/MediaDefs.cpp b/media/libstagefright/MediaDefs.cpp
index 444e823..2740d6b 100644
--- a/media/libstagefright/MediaDefs.cpp
+++ b/media/libstagefright/MediaDefs.cpp
@@ -41,7 +41,7 @@
const char *MEDIA_MIMETYPE_AUDIO_FLAC = "audio/flac";
const char *MEDIA_MIMETYPE_AUDIO_AAC_ADTS = "audio/aac-adts";
-const char *MEDIA_MIMETYPE_CONTAINER_MPEG4 = "video/mpeg4";
+const char *MEDIA_MIMETYPE_CONTAINER_MPEG4 = "video/mp4";
const char *MEDIA_MIMETYPE_CONTAINER_WAV = "audio/wav";
const char *MEDIA_MIMETYPE_CONTAINER_OGG = "application/ogg";
const char *MEDIA_MIMETYPE_CONTAINER_MATROSKA = "video/x-matroska";
@@ -52,5 +52,6 @@
const char *MEDIA_MIMETYPE_CONTAINER_WVM = "video/wvm";
const char *MEDIA_MIMETYPE_TEXT_3GPP = "text/3gpp-tt";
+const char *MEDIA_MIMETYPE_TEXT_SUBRIP = "application/x-subrip";
} // namespace android
diff --git a/media/libstagefright/MetaData.cpp b/media/libstagefright/MetaData.cpp
index 66dec90..755594a 100644
--- a/media/libstagefright/MetaData.cpp
+++ b/media/libstagefright/MetaData.cpp
@@ -14,6 +14,10 @@
* limitations under the License.
*/
+//#define LOG_NDEBUG 0
+#define LOG_TAG "MetaData"
+#include <utils/Log.h>
+
#include <stdlib.h>
#include <string.h>
@@ -282,5 +286,60 @@
mSize = 0;
}
+String8 MetaData::typed_data::asString() const {
+ String8 out;
+ const void *data = storage();
+ switch(mType) {
+ case TYPE_NONE:
+ out = String8::format("no type, size %d)", mSize);
+ break;
+ case TYPE_C_STRING:
+ out = String8::format("(char*) %s", (const char *)data);
+ break;
+ case TYPE_INT32:
+ out = String8::format("(int32_t) %d", *(int32_t *)data);
+ break;
+ case TYPE_INT64:
+ out = String8::format("(int64_t) %lld", *(int64_t *)data);
+ break;
+ case TYPE_FLOAT:
+ out = String8::format("(float) %f", *(float *)data);
+ break;
+ case TYPE_POINTER:
+ out = String8::format("(void*) %p", *(void **)data);
+ break;
+ case TYPE_RECT:
+ {
+ const Rect *r = (const Rect *)data;
+ out = String8::format("Rect(%d, %d, %d, %d)",
+ r->mLeft, r->mTop, r->mRight, r->mBottom);
+ break;
+ }
+
+ default:
+ out = String8::format("(unknown type %d, size %d)", mType, mSize);
+ break;
+ }
+ return out;
+}
+
+static void MakeFourCCString(uint32_t x, char *s) {
+ s[0] = x >> 24;
+ s[1] = (x >> 16) & 0xff;
+ s[2] = (x >> 8) & 0xff;
+ s[3] = x & 0xff;
+ s[4] = '\0';
+}
+
+void MetaData::dumpToLog() const {
+ for (int i = mItems.size(); --i >= 0;) {
+ int32_t key = mItems.keyAt(i);
+ char cc[5];
+ MakeFourCCString(key, cc);
+ const typed_data &item = mItems.valueAt(i);
+ ALOGI("%s: %s", cc, item.asString().string());
+ }
+}
+
} // namespace android
diff --git a/media/libstagefright/NuMediaExtractor.cpp b/media/libstagefright/NuMediaExtractor.cpp
index afd4763..224ec33 100644
--- a/media/libstagefright/NuMediaExtractor.cpp
+++ b/media/libstagefright/NuMediaExtractor.cpp
@@ -107,6 +107,11 @@
msg->setInt32("channel-count", numChannels);
msg->setInt32("sample-rate", sampleRate);
+
+ int32_t isADTS;
+ if (meta->findInt32(kKeyIsADTS, &isADTS)) {
+ msg->setInt32("is-adts", true);
+ }
}
int32_t maxInputSize;
@@ -232,6 +237,20 @@
msg->setBuffer("csd-1", buffer);
}
+ if (meta->findData(kKeyEMM, &type, &data, &size)) {
+ sp<ABuffer> emm = new ABuffer(size);
+ memcpy(emm->data(), data, size);
+
+ msg->setBuffer("emm", emm);
+ }
+
+ if (meta->findData(kKeyECM, &type, &data, &size)) {
+ sp<ABuffer> ecm = new ABuffer(size);
+ memcpy(ecm->data(), data, size);
+
+ msg->setBuffer("ecm", ecm);
+ }
+
*format = msg;
return OK;
@@ -267,13 +286,14 @@
info->mFinalResult = OK;
info->mSample = NULL;
info->mSampleTimeUs = -1ll;
- info->mFlags = 0;
+ info->mSampleFlags = 0;
+ info->mTrackFlags = 0;
const char *mime;
CHECK(source->getFormat()->findCString(kKeyMIMEType, &mime));
if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_VORBIS)) {
- info->mFlags |= kIsVorbis;
+ info->mTrackFlags |= kIsVorbis;
}
return OK;
@@ -288,6 +308,7 @@
info->mSample = NULL;
info->mSampleTimeUs = -1ll;
+ info->mSampleFlags = 0;
}
}
}
@@ -306,6 +327,7 @@
info->mSample->release();
info->mSample = NULL;
info->mSampleTimeUs = -1ll;
+ info->mSampleFlags = 0;
}
} else if (info->mFinalResult != OK) {
continue;
@@ -323,11 +345,25 @@
info->mFinalResult = err;
info->mSampleTimeUs = -1ll;
+ info->mSampleFlags = 0;
continue;
} else {
CHECK(info->mSample != NULL);
CHECK(info->mSample->meta_data()->findInt64(
kKeyTime, &info->mSampleTimeUs));
+
+ info->mSampleFlags = 0;
+
+ int32_t val;
+ if (info->mSample->meta_data()->findInt32(
+ kKeyIsSyncFrame, &val) && val != 0) {
+ info->mSampleFlags |= SAMPLE_FLAG_SYNC;
+ }
+
+ if (info->mSample->meta_data()->findInt32(
+ kKeyScrambling, &val) && val != 0) {
+ info->mSampleFlags |= SAMPLE_FLAG_ENCRYPTED;
+ }
}
}
@@ -371,7 +407,7 @@
size_t sampleSize = info->mSample->range_length();
- if (info->mFlags & kIsVorbis) {
+ if (info->mTrackFlags & kIsVorbis) {
// Each sample's data is suffixed by the number of page samples
// or -1 if not available.
sampleSize += sizeof(int32_t);
@@ -387,7 +423,7 @@
memcpy((uint8_t *)buffer->data(), src, info->mSample->range_length());
- if (info->mFlags & kIsVorbis) {
+ if (info->mTrackFlags & kIsVorbis) {
int32_t numPageSamples;
if (!info->mSample->meta_data()->findInt32(
kKeyValidSamples, &numPageSamples)) {
@@ -430,4 +466,17 @@
return OK;
}
+status_t NuMediaExtractor::getSampleFlags(uint32_t *sampleFlags) {
+ ssize_t minIndex = fetchTrackSamples();
+
+ if (minIndex < 0) {
+ return ERROR_END_OF_STREAM;
+ }
+
+ TrackInfo *info = &mSelectedTracks.editItemAt(minIndex);
+ *sampleFlags = info->mSampleFlags;
+
+ return OK;
+}
+
} // namespace android
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 278e3a2..9769f21 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -38,6 +38,7 @@
#include <media/stagefright/MetaData.h>
#include <media/stagefright/OMXCodec.h>
#include <media/stagefright/Utils.h>
+#include <media/stagefright/SkipCutBuffer.h>
#include <utils/Vector.h>
#include <OMX_Audio.h>
@@ -514,7 +515,12 @@
CHECK(meta->findInt32(kKeyChannelCount, &numChannels));
CHECK(meta->findInt32(kKeySampleRate, &sampleRate));
- status_t err = setAACFormat(numChannels, sampleRate, bitRate);
+ int32_t isADTS;
+ if (!meta->findInt32(kKeyIsADTS, &isADTS)) {
+ isADTS = false;
+ }
+
+ status_t err = setAACFormat(numChannels, sampleRate, bitRate, isADTS);
if (err != OK) {
CODEC_LOGE("setAACFormat() failed (err = %d)", err);
return err;
@@ -1303,6 +1309,7 @@
mSeekMode(ReadOptions::SEEK_CLOSEST_SYNC),
mTargetTimeUs(-1),
mOutputPortSettingsChangedPending(false),
+ mSkipCutBuffer(NULL),
mLeftOverBuffer(NULL),
mPaused(false),
mNativeWindow(
@@ -1332,8 +1339,6 @@
"audio_decoder.mp1", "audio_encoder.mp1" },
{ MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_II,
"audio_decoder.mp2", "audio_encoder.mp2" },
- { MEDIA_MIMETYPE_AUDIO_MPEG,
- "audio_decoder.mp3", "audio_encoder.mp3" },
{ MEDIA_MIMETYPE_AUDIO_AMR_NB,
"audio_decoder.amrnb", "audio_encoder.amrnb" },
{ MEDIA_MIMETYPE_AUDIO_AMR_WB,
@@ -1342,6 +1347,10 @@
"audio_decoder.aac", "audio_encoder.aac" },
{ MEDIA_MIMETYPE_AUDIO_VORBIS,
"audio_decoder.vorbis", "audio_encoder.vorbis" },
+ { MEDIA_MIMETYPE_AUDIO_G711_MLAW,
+ "audio_decoder.g711mlaw", "audio_encoder.g711mlaw" },
+ { MEDIA_MIMETYPE_AUDIO_G711_ALAW,
+ "audio_decoder.g711alaw", "audio_encoder.g711alaw" },
{ MEDIA_MIMETYPE_VIDEO_AVC,
"video_decoder.avc", "video_encoder.avc" },
{ MEDIA_MIMETYPE_VIDEO_MPEG4,
@@ -1411,6 +1420,9 @@
free(mMIME);
mMIME = NULL;
+
+ delete mSkipCutBuffer;
+ mSkipCutBuffer = NULL;
}
status_t OMXCodec::init() {
@@ -1571,6 +1583,34 @@
portIndex == kPortIndexInput ? "input" : "output");
}
+ if (portIndex == kPortIndexOutput) {
+
+ sp<MetaData> meta = mSource->getFormat();
+ int32_t delay = 0;
+ if (!meta->findInt32(kKeyEncoderDelay, &delay)) {
+ delay = 0;
+ }
+ int32_t padding = 0;
+ if (!meta->findInt32(kKeyEncoderPadding, &padding)) {
+ padding = 0;
+ }
+ int32_t numchannels = 0;
+ if (delay + padding) {
+ if (meta->findInt32(kKeyChannelCount, &numchannels)) {
+ size_t frameSize = numchannels * sizeof(int16_t);
+ if (mSkipCutBuffer) {
+ size_t prevbuffersize = mSkipCutBuffer->size();
+ if (prevbuffersize != 0) {
+ ALOGW("Replacing SkipCutBuffer holding %d bytes", prevbuffersize);
+ }
+ delete mSkipCutBuffer;
+ }
+ mSkipCutBuffer = new SkipCutBuffer(delay * frameSize, padding * frameSize,
+ def.nBufferSize);
+ }
+ }
+ }
+
// dumpPortStatus(portIndex);
if (portIndex == kPortIndexInput && (mFlags & kUseSecureInputBuffers)) {
@@ -2488,6 +2528,10 @@
CHECK_EQ(countBuffersWeOwn(mPortBuffers[portIndex]),
mPortBuffers[portIndex].size());
+ if (mSkipCutBuffer && mPortStatus[kPortIndexOutput] == ENABLED) {
+ mSkipCutBuffer->clear();
+ }
+
if (mState == RECONFIGURING) {
CHECK_EQ(portIndex, (OMX_U32)kPortIndexOutput);
@@ -3347,11 +3391,17 @@
}
}
-status_t OMXCodec::setAACFormat(int32_t numChannels, int32_t sampleRate, int32_t bitRate) {
- if (numChannels > 2)
+status_t OMXCodec::setAACFormat(
+ int32_t numChannels, int32_t sampleRate, int32_t bitRate, bool isADTS) {
+ if (numChannels > 2) {
ALOGW("Number of channels: (%d) \n", numChannels);
+ }
if (mIsEncoder) {
+ if (isADTS) {
+ return -EINVAL;
+ }
+
//////////////// input port ////////////////////
setRawAudioFormat(kPortIndexInput, sampleRate, numChannels);
@@ -3406,7 +3456,9 @@
&profile, sizeof(profile));
if (err != OK) {
- CODEC_LOGE("setParameter('OMX_IndexParamAudioAac') failed (err = %d)", err);
+ CODEC_LOGE("setParameter('OMX_IndexParamAudioAac') failed "
+ "(err = %d)",
+ err);
return err;
}
} else {
@@ -3420,13 +3472,19 @@
profile.nChannels = numChannels;
profile.nSampleRate = sampleRate;
- profile.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4ADTS;
+
+ profile.eAACStreamFormat =
+ isADTS
+ ? OMX_AUDIO_AACStreamFormatMP4ADTS
+ : OMX_AUDIO_AACStreamFormatMP4FF;
err = mOMX->setParameter(
mNode, OMX_IndexParamAudioAac, &profile, sizeof(profile));
if (err != OK) {
- CODEC_LOGE("setParameter('OMX_IndexParamAudioAac') failed (err = %d)", err);
+ CODEC_LOGE("setParameter('OMX_IndexParamAudioAac') failed "
+ "(err = %d)",
+ err);
return err;
}
}
@@ -3798,6 +3856,9 @@
info->mStatus = OWNED_BY_CLIENT;
info->mMediaBuffer->add_ref();
+ if (mSkipCutBuffer) {
+ mSkipCutBuffer->submit(info->mMediaBuffer);
+ }
*buffer = info->mMediaBuffer;
return OK;
diff --git a/media/libstagefright/SkipCutBuffer.cpp b/media/libstagefright/SkipCutBuffer.cpp
new file mode 100755
index 0000000..6d331b0
--- /dev/null
+++ b/media/libstagefright/SkipCutBuffer.cpp
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "SkipCutBuffer"
+#include <utils/Log.h>
+
+#include <media/stagefright/foundation/ADebug.h>
+#include <media/stagefright/MediaBuffer.h>
+#include <media/stagefright/SkipCutBuffer.h>
+
+namespace android {
+
+SkipCutBuffer::SkipCutBuffer(int32_t skip, int32_t cut, int32_t output_size) {
+ mFrontPadding = skip;
+ mBackPadding = cut;
+ mWriteHead = 0;
+ mReadHead = 0;
+ mCapacity = cut + output_size;
+ mCutBuffer = new char[mCapacity];
+ ALOGV("skipcutbuffer %d %d %d", skip, cut, mCapacity);
+}
+
+SkipCutBuffer::~SkipCutBuffer() {
+ delete[] mCutBuffer;
+}
+
+void SkipCutBuffer::submit(MediaBuffer *buffer) {
+ int32_t offset = buffer->range_offset();
+ int32_t buflen = buffer->range_length();
+
+ // drop the initial data from the buffer if needed
+ if (mFrontPadding > 0) {
+ // still data left to drop
+ int32_t to_drop = (buflen < mFrontPadding) ? buflen : mFrontPadding;
+ offset += to_drop;
+ buflen -= to_drop;
+ buffer->set_range(offset, buflen);
+ mFrontPadding -= to_drop;
+ }
+
+
+ // append data to cutbuffer
+ char *src = ((char*) buffer->data()) + offset;
+ write(src, buflen);
+
+
+ // the mediabuffer is now empty. Fill it from cutbuffer, always leaving
+ // at least mBackPadding bytes in the cutbuffer
+ char *dst = (char*) buffer->data();
+ size_t copied = read(dst, buffer->size());
+ buffer->set_range(0, copied);
+}
+
+void SkipCutBuffer::clear() {
+ mWriteHead = mReadHead = 0;
+}
+
+void SkipCutBuffer::write(const char *src, size_t num) {
+ int32_t sizeused = (mWriteHead - mReadHead);
+ if (sizeused < 0) sizeused += mCapacity;
+
+ // everything must fit
+ CHECK_GE((mCapacity - size_t(sizeused)), num);
+
+ size_t copyfirst = (mCapacity - mWriteHead);
+ if (copyfirst > num) copyfirst = num;
+ if (copyfirst) {
+ memcpy(mCutBuffer + mWriteHead, src, copyfirst);
+ num -= copyfirst;
+ src += copyfirst;
+ mWriteHead += copyfirst;
+ CHECK_LE(mWriteHead, mCapacity);
+ if (mWriteHead == mCapacity) mWriteHead = 0;
+ if (num) {
+ memcpy(mCutBuffer, src, num);
+ mWriteHead += num;
+ }
+ }
+}
+
+size_t SkipCutBuffer::read(char *dst, size_t num) {
+ int32_t available = (mWriteHead - mReadHead);
+ if (available < 0) available += mCapacity;
+
+ available -= mBackPadding;
+ if (available <=0) {
+ return 0;
+ }
+ if (available < num) {
+ num = available;
+ }
+
+ size_t copyfirst = (mCapacity - mReadHead);
+ if (copyfirst > num) copyfirst = num;
+ if (copyfirst) {
+ memcpy(dst, mCutBuffer + mReadHead, copyfirst);
+ num -= copyfirst;
+ dst += copyfirst;
+ mReadHead += copyfirst;
+ CHECK_LE(mReadHead, mCapacity);
+ if (mReadHead == mCapacity) mReadHead = 0;
+ if (num) {
+ memcpy(dst, mCutBuffer, num);
+ mReadHead += num;
+ }
+ }
+ return available;
+}
+
+size_t SkipCutBuffer::size() {
+ int32_t available = (mWriteHead - mReadHead);
+ if (available < 0) available += mCapacity;
+ return available;
+}
+
+} // namespace android
diff --git a/media/libstagefright/TimedEventQueue.cpp b/media/libstagefright/TimedEventQueue.cpp
index 6d345bb..9df15eb 100644
--- a/media/libstagefright/TimedEventQueue.cpp
+++ b/media/libstagefright/TimedEventQueue.cpp
@@ -31,10 +31,6 @@
#include <media/stagefright/foundation/ADebug.h>
-#ifdef ANDROID_SIMULATOR
-#include <jni.h>
-#endif
-
namespace android {
TimedEventQueue::TimedEventQueue()
@@ -193,27 +189,10 @@
// static
void *TimedEventQueue::ThreadWrapper(void *me) {
-#ifdef ANDROID_SIMULATOR
- // The simulator runs everything as one process, so any
- // Binder calls happen on this thread instead of a thread
- // in another process. We therefore need to make sure that
- // this thread can do calls into interpreted code.
- // On the device this is not an issue because the remote
- // thread will already be set up correctly for this.
- JavaVM *vm;
- int numvms;
- JNI_GetCreatedJavaVMs(&vm, 1, &numvms);
- JNIEnv *env;
- vm->AttachCurrentThread(&env, NULL);
-#endif
-
androidSetThreadPriority(0, ANDROID_PRIORITY_FOREGROUND);
static_cast<TimedEventQueue *>(me)->threadEntry();
-#ifdef ANDROID_SIMULATOR
- vm->DetachCurrentThread();
-#endif
return NULL;
}
diff --git a/media/libstagefright/VBRISeeker.cpp b/media/libstagefright/VBRISeeker.cpp
index 6ac5a83..bcba874 100644
--- a/media/libstagefright/VBRISeeker.cpp
+++ b/media/libstagefright/VBRISeeker.cpp
@@ -92,7 +92,7 @@
}
sp<VBRISeeker> seeker = new VBRISeeker;
- seeker->mBasePos = post_id3_pos;
+ seeker->mBasePos = post_id3_pos + frameSize;
seeker->mDurationUs = durationUs;
off64_t offset = post_id3_pos;
diff --git a/media/libstagefright/XINGSeeker.cpp b/media/libstagefright/XINGSeeker.cpp
index 2091381..9c91134 100644
--- a/media/libstagefright/XINGSeeker.cpp
+++ b/media/libstagefright/XINGSeeker.cpp
@@ -14,39 +14,22 @@
* limitations under the License.
*/
+#define LOG_TAG "XINGSEEKER"
+#include <utils/Log.h>
+
#include "include/XINGSeeker.h"
+#include "include/avc_utils.h"
#include <media/stagefright/DataSource.h>
#include <media/stagefright/Utils.h>
namespace android {
-static bool parse_xing_header(
- const sp<DataSource> &source, off64_t first_frame_pos,
- int32_t *frame_number = NULL, int32_t *byte_number = NULL,
- unsigned char *table_of_contents = NULL,
- int32_t *quality_indicator = NULL, int64_t *duration = NULL);
-
-// static
-sp<XINGSeeker> XINGSeeker::CreateFromSource(
- const sp<DataSource> &source, off64_t first_frame_pos) {
- sp<XINGSeeker> seeker = new XINGSeeker;
-
- seeker->mFirstFramePos = first_frame_pos;
-
- if (!parse_xing_header(
- source, first_frame_pos,
- NULL, &seeker->mSizeBytes, seeker->mTableOfContents,
- NULL, &seeker->mDurationUs)) {
- return NULL;
- }
-
- return seeker;
-}
-
XINGSeeker::XINGSeeker()
: mDurationUs(-1),
- mSizeBytes(0) {
+ mSizeBytes(0),
+ mEncoderDelay(0),
+ mEncoderPadding(0) {
}
bool XINGSeeker::getDuration(int64_t *durationUs) {
@@ -60,7 +43,7 @@
}
bool XINGSeeker::getOffsetForTime(int64_t *timeUs, off64_t *pos) {
- if (mSizeBytes == 0 || mTableOfContents[0] <= 0 || mDurationUs < 0) {
+ if (mSizeBytes == 0 || !mTOCValid || mDurationUs < 0) {
return false;
}
@@ -76,10 +59,10 @@
if ( a == 0 ) {
fa = 0.0f;
} else {
- fa = (float)mTableOfContents[a-1];
+ fa = (float)mTOC[a-1];
}
if ( a < 99 ) {
- fb = (float)mTableOfContents[a];
+ fb = (float)mTOC[a];
} else {
fb = 256.0f;
}
@@ -91,59 +74,50 @@
return true;
}
-static bool parse_xing_header(
- const sp<DataSource> &source, off64_t first_frame_pos,
- int32_t *frame_number, int32_t *byte_number,
- unsigned char *table_of_contents, int32_t *quality_indicator,
- int64_t *duration) {
- if (frame_number) {
- *frame_number = 0;
- }
- if (byte_number) {
- *byte_number = 0;
- }
- if (table_of_contents) {
- table_of_contents[0] = 0;
- }
- if (quality_indicator) {
- *quality_indicator = 0;
- }
- if (duration) {
- *duration = 0;
- }
+// static
+sp<XINGSeeker> XINGSeeker::CreateFromSource(
+ const sp<DataSource> &source, off64_t first_frame_pos) {
+ sp<XINGSeeker> seeker = new XINGSeeker;
+
+ seeker->mFirstFramePos = first_frame_pos;
+
+ seeker->mSizeBytes = 0;
+ seeker->mTOCValid = false;
+ seeker->mDurationUs = 0;
uint8_t buffer[4];
int offset = first_frame_pos;
if (source->readAt(offset, &buffer, 4) < 4) { // get header
- return false;
+ return NULL;
}
offset += 4;
- uint8_t id, layer, sr_index, mode;
- layer = (buffer[1] >> 1) & 3;
- id = (buffer[1] >> 3) & 3;
- sr_index = (buffer[2] >> 2) & 3;
- mode = (buffer[3] >> 6) & 3;
- if (layer == 0) {
- return false;
+ int header = U32_AT(buffer);;
+ size_t xingframesize = 0;
+ int sampling_rate = 0;
+ int num_channels;
+ int samples_per_frame = 0;
+ if (!GetMPEGAudioFrameSize(header, &xingframesize, &sampling_rate, &num_channels,
+ NULL, &samples_per_frame)) {
+ return NULL;
}
- if (id == 1) {
- return false;
- }
- if (sr_index == 3) {
- return false;
- }
+ seeker->mFirstFramePos += xingframesize;
+
+ uint8_t version = (buffer[1] >> 3) & 3;
+
// determine offset of XING header
- if(id&1) { // mpeg1
- if (mode != 3) offset += 32;
+ if(version & 1) { // mpeg1
+ if (num_channels != 1) offset += 32;
else offset += 17;
- } else { // mpeg2
- if (mode != 3) offset += 17;
+ } else { // mpeg 2 or 2.5
+ if (num_channels != 1) offset += 17;
else offset += 9;
}
+ int xingbase = offset;
+
if (source->readAt(offset, &buffer, 4) < 4) { // XING header ID
- return false;
+ return NULL;
}
offset += 4;
// Check XING ID
@@ -151,70 +125,71 @@
|| (buffer[2] != 'n') || (buffer[3] != 'g')) {
if ((buffer[0] != 'I') || (buffer[1] != 'n')
|| (buffer[2] != 'f') || (buffer[3] != 'o')) {
- return false;
+ return NULL;
}
}
if (source->readAt(offset, &buffer, 4) < 4) { // flags
- return false;
+ return NULL;
}
offset += 4;
uint32_t flags = U32_AT(buffer);
if (flags & 0x0001) { // Frames field is present
if (source->readAt(offset, buffer, 4) < 4) {
- return false;
+ return NULL;
}
- if (frame_number) {
- *frame_number = U32_AT(buffer);
- }
- int32_t frame = U32_AT(buffer);
- // Samples per Frame: 1. index = MPEG Version ID, 2. index = Layer
- const int samplesPerFrames[2][3] =
- {
- { 384, 1152, 576 }, // MPEG 2, 2.5: layer1, layer2, layer3
- { 384, 1152, 1152 }, // MPEG 1: layer1, layer2, layer3
- };
- // sampling rates in hertz: 1. index = MPEG Version ID, 2. index = sampling rate index
- const int samplingRates[4][3] =
- {
- { 11025, 12000, 8000, }, // MPEG 2.5
- { 0, 0, 0, }, // reserved
- { 22050, 24000, 16000, }, // MPEG 2
- { 44100, 48000, 32000, } // MPEG 1
- };
- if (duration) {
- *duration = (int64_t)frame * samplesPerFrames[id&1][3-layer] * 1000000LL
- / samplingRates[id][sr_index];
- }
+ int32_t frames = U32_AT(buffer);
+ seeker->mDurationUs = (int64_t)frames * samples_per_frame * 1000000LL / sampling_rate;
offset += 4;
}
if (flags & 0x0002) { // Bytes field is present
- if (byte_number) {
- if (source->readAt(offset, buffer, 4) < 4) {
- return false;
- }
- *byte_number = U32_AT(buffer);
+ if (source->readAt(offset, buffer, 4) < 4) {
+ return NULL;
}
+ seeker->mSizeBytes = U32_AT(buffer);
offset += 4;
}
if (flags & 0x0004) { // TOC field is present
- if (table_of_contents) {
- if (source->readAt(offset + 1, table_of_contents, 99) < 99) {
- return false;
- }
+ if (source->readAt(offset + 1, seeker->mTOC, 99) < 99) {
+ return NULL;
}
+ seeker->mTOCValid = true;
offset += 100;
}
+
+#if 0
if (flags & 0x0008) { // Quality indicator field is present
- if (quality_indicator) {
- if (source->readAt(offset, buffer, 4) < 4) {
- return false;
- }
- *quality_indicator = U32_AT(buffer);
+ if (source->readAt(offset, buffer, 4) < 4) {
+ return NULL;
}
+ // do something with the quality indicator
+ offset += 4;
}
- return true;
+
+ if (source->readAt(xingbase + 0xaf - 0x24, &buffer, 1) < 1) { // encoding flags
+ return false;
+ }
+
+ ALOGV("nogap preceding: %s, nogap continued in next: %s",
+ (buffer[0] & 0x80) ? "true" : "false",
+ (buffer[0] & 0x40) ? "true" : "false");
+#endif
+
+ if (source->readAt(xingbase + 0xb1 - 0x24, &buffer, 3) == 3) {
+ seeker->mEncoderDelay = (buffer[0] << 4) + (buffer[1] >> 4);
+ seeker->mEncoderPadding = ((buffer[1] & 0xf) << 8) + buffer[2];
+ }
+
+ return seeker;
+}
+
+int32_t XINGSeeker::getEncoderDelay() {
+ return mEncoderDelay;
+}
+
+int32_t XINGSeeker::getEncoderPadding() {
+ return mEncoderPadding;
}
} // namespace android
diff --git a/media/libstagefright/chromium_http/Android.mk b/media/libstagefright/chromium_http/Android.mk
index e37b4a8..d595686 100644
--- a/media/libstagefright/chromium_http/Android.mk
+++ b/media/libstagefright/chromium_http/Android.mk
@@ -1,5 +1,6 @@
LOCAL_PATH:= $(call my-dir)
+ifneq ($(TARGET_BUILD_PDK), true)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
@@ -8,7 +9,6 @@
support.cpp
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
$(TOP)/frameworks/native/include/media/openmax \
external/chromium \
@@ -22,3 +22,4 @@
LOCAL_MODULE:= libstagefright_chromium_http
include $(BUILD_STATIC_LIBRARY)
+endif
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC.cpp b/media/libstagefright/codecs/aacdec/SoftAAC.cpp
index ea6c360..90f96c6 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC.cpp
@@ -23,6 +23,7 @@
#include "pvmp4audiodecoder_api.h"
#include <media/stagefright/foundation/ADebug.h>
+#include <media/stagefright/foundation/hexdump.h>
namespace android {
@@ -42,6 +43,7 @@
OMX_COMPONENTTYPE **component)
: SimpleSoftOMXComponent(name, callbacks, appData, component),
mConfig(new tPVMP4AudioDecoderExternal),
+ mIsADTS(false),
mDecoderBuf(NULL),
mInputBufferCount(0),
mUpsamplingFactor(2),
@@ -140,7 +142,12 @@
aacParams->nAACtools = 0;
aacParams->nAACERtools = 0;
aacParams->eAACProfile = OMX_AUDIO_AACObjectMain;
- aacParams->eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4FF;
+
+ aacParams->eAACStreamFormat =
+ mIsADTS
+ ? OMX_AUDIO_AACStreamFormatMP4ADTS
+ : OMX_AUDIO_AACStreamFormatMP4FF;
+
aacParams->eChannelMode = OMX_AUDIO_ChannelModeStereo;
if (!isConfigured()) {
@@ -215,6 +222,15 @@
return OMX_ErrorUndefined;
}
+ if (aacParams->eAACStreamFormat == OMX_AUDIO_AACStreamFormatMP4FF) {
+ mIsADTS = false;
+ } else if (aacParams->eAACStreamFormat
+ == OMX_AUDIO_AACStreamFormatMP4ADTS) {
+ mIsADTS = true;
+ } else {
+ return OMX_ErrorUndefined;
+ }
+
return OMX_ErrorNone;
}
@@ -299,8 +315,35 @@
mNumSamplesOutput = 0;
}
- mConfig->pInputBuffer = inHeader->pBuffer + inHeader->nOffset;
- mConfig->inputBufferCurrentLength = inHeader->nFilledLen;
+ if (mIsADTS) {
+ // skip 30 bits, aac_frame_length follows.
+ // ssssssss ssssiiip ppffffPc ccohCCll llllllll lll?????
+
+ const uint8_t *adtsHeader = inHeader->pBuffer + inHeader->nOffset;
+
+ CHECK_GE(inHeader->nFilledLen, 7);
+
+ bool protectionAbsent = (adtsHeader[1] & 1);
+
+ unsigned aac_frame_length =
+ ((adtsHeader[3] & 3) << 11)
+ | (adtsHeader[4] << 3)
+ | (adtsHeader[5] >> 5);
+
+ CHECK_GE(inHeader->nFilledLen, aac_frame_length);
+
+ size_t headerSize = (protectionAbsent ? 7 : 9);
+
+ mConfig->pInputBuffer = (UChar *)adtsHeader + headerSize;
+ mConfig->inputBufferCurrentLength = aac_frame_length - headerSize;
+
+ inHeader->nOffset += headerSize;
+ inHeader->nFilledLen -= headerSize;
+ } else {
+ mConfig->pInputBuffer = inHeader->pBuffer + inHeader->nOffset;
+ mConfig->inputBufferCurrentLength = inHeader->nFilledLen;
+ }
+
mConfig->inputBufferMaxLength = 0;
mConfig->inputBufferUsedLength = 0;
mConfig->remainderBits = 0;
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC.h b/media/libstagefright/codecs/aacdec/SoftAAC.h
index 963fd27..da0b8ed 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC.h
+++ b/media/libstagefright/codecs/aacdec/SoftAAC.h
@@ -49,6 +49,7 @@
};
tPVMP4AudioDecoderExternal *mConfig;
+ bool mIsADTS;
void *mDecoderBuf;
size_t mInputBufferCount;
diff --git a/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp b/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
index 7602f2d..796caa4 100644
--- a/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
+++ b/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
@@ -236,6 +236,18 @@
return OMX_ErrorNone;
}
+ case OMX_IndexParamAudioPcm:
+ {
+ const OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
+ (OMX_AUDIO_PARAM_PCMMODETYPE *)params;
+
+ if (pcmParams->nPortIndex != 1) {
+ return OMX_ErrorUndefined;
+ }
+
+ return OMX_ErrorNone;
+ }
+
default:
return SimpleSoftOMXComponent::internalSetParameter(index, params);
}
diff --git a/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp b/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp
deleted file mode 100644
index 27d7e4d..0000000
--- a/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include "AMRNBEncoder.h"
-
-#include "gsmamr_enc.h"
-
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/MediaBufferGroup.h>
-#include <media/stagefright/MediaDefs.h>
-#include <media/stagefright/MediaErrors.h>
-#include <media/stagefright/MetaData.h>
-
-namespace android {
-
-static const int32_t kNumSamplesPerFrame = 160;
-static const int32_t kSampleRate = 8000;
-
-AMRNBEncoder::AMRNBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta)
- : mSource(source),
- mMeta(meta),
- mStarted(false),
- mBufferGroup(NULL),
- mEncState(NULL),
- mSidState(NULL),
- mAnchorTimeUs(0),
- mNumFramesOutput(0),
- mInputBuffer(NULL),
- mMode(MR475),
- mNumInputSamples(0) {
-}
-
-AMRNBEncoder::~AMRNBEncoder() {
- if (mStarted) {
- stop();
- }
-}
-
-static Mode PickModeFromBitrate(int32_t bps) {
- if (bps <= 4750) {
- return MR475;
- } else if (bps <= 5150) {
- return MR515;
- } else if (bps <= 5900) {
- return MR59;
- } else if (bps <= 6700) {
- return MR67;
- } else if (bps <= 7400) {
- return MR74;
- } else if (bps <= 7950) {
- return MR795;
- } else if (bps <= 10200) {
- return MR102;
- } else {
- return MR122;
- }
-}
-
-status_t AMRNBEncoder::start(MetaData *params) {
- if (mStarted) {
- ALOGW("Call start() when encoder already started");
- return OK;
- }
-
- mBufferGroup = new MediaBufferGroup;
- mBufferGroup->add_buffer(new MediaBuffer(32));
-
- CHECK_EQ(AMREncodeInit(
- &mEncState, &mSidState, false /* dtx_enable */),
- 0);
-
- status_t err = mSource->start(params);
- if (err != OK) {
- ALOGE("AudioSource is not available");
- return err;
- }
-
- mAnchorTimeUs = 0;
- mNumFramesOutput = 0;
- mStarted = true;
- mNumInputSamples = 0;
-
- int32_t bitrate;
- if (params && params->findInt32(kKeyBitRate, &bitrate)) {
- mMode = PickModeFromBitrate(bitrate);
- } else {
- mMode = MR475;
- }
-
- return OK;
-}
-
-status_t AMRNBEncoder::stop() {
- if (!mStarted) {
- ALOGW("Call stop() when encoder has not started.");
- return OK;
- }
-
- if (mInputBuffer) {
- mInputBuffer->release();
- mInputBuffer = NULL;
- }
-
- delete mBufferGroup;
- mBufferGroup = NULL;
-
- mSource->stop();
-
- AMREncodeExit(&mEncState, &mSidState);
- mEncState = mSidState = NULL;
-
- mStarted = false;
-
- return OK;
-}
-
-sp<MetaData> AMRNBEncoder::getFormat() {
- sp<MetaData> srcFormat = mSource->getFormat();
-
- mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_AMR_NB);
-
- int64_t durationUs;
- if (srcFormat->findInt64(kKeyDuration, &durationUs)) {
- mMeta->setInt64(kKeyDuration, durationUs);
- }
-
- mMeta->setCString(kKeyDecoderComponent, "AMRNBEncoder");
-
- return mMeta;
-}
-
-status_t AMRNBEncoder::read(
- MediaBuffer **out, const ReadOptions *options) {
- status_t err;
-
- *out = NULL;
-
- int64_t seekTimeUs;
- ReadOptions::SeekMode mode;
- CHECK(options == NULL || !options->getSeekTo(&seekTimeUs, &mode));
- bool readFromSource = false;
- int64_t wallClockTimeUs = -1;
-
- while (mNumInputSamples < kNumSamplesPerFrame) {
- if (mInputBuffer == NULL) {
- err = mSource->read(&mInputBuffer, options);
-
- if (err != OK) {
- if (mNumInputSamples == 0) {
- return ERROR_END_OF_STREAM;
- }
- memset(&mInputFrame[mNumInputSamples],
- 0,
- sizeof(int16_t)
- * (kNumSamplesPerFrame - mNumInputSamples));
- mNumInputSamples = kNumSamplesPerFrame;
- break;
- }
-
- size_t align = mInputBuffer->range_length() % sizeof(int16_t);
- CHECK_EQ(align, 0);
- readFromSource = true;
-
- int64_t timeUs;
- if (mInputBuffer->meta_data()->findInt64(kKeyDriftTime, &timeUs)) {
- wallClockTimeUs = timeUs;
- }
- if (mInputBuffer->meta_data()->findInt64(kKeyAnchorTime, &timeUs)) {
- mAnchorTimeUs = timeUs;
- }
- } else {
- readFromSource = false;
- }
-
- size_t copy =
- (kNumSamplesPerFrame - mNumInputSamples) * sizeof(int16_t);
-
- if (copy > mInputBuffer->range_length()) {
- copy = mInputBuffer->range_length();
- }
-
- memcpy(&mInputFrame[mNumInputSamples],
- (const uint8_t *)mInputBuffer->data()
- + mInputBuffer->range_offset(),
- copy);
-
- mNumInputSamples += copy / sizeof(int16_t);
-
- mInputBuffer->set_range(
- mInputBuffer->range_offset() + copy,
- mInputBuffer->range_length() - copy);
-
- if (mInputBuffer->range_length() == 0) {
- mInputBuffer->release();
- mInputBuffer = NULL;
- }
- }
-
- MediaBuffer *buffer;
- CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), (status_t)OK);
-
- uint8_t *outPtr = (uint8_t *)buffer->data();
-
- Frame_Type_3GPP frameType;
- int res = AMREncode(
- mEncState, mSidState, (Mode)mMode,
- mInputFrame, outPtr, &frameType, AMR_TX_WMF);
-
- CHECK(res >= 0);
- CHECK((size_t)res < buffer->size());
-
- // Convert header byte from WMF to IETF format.
- outPtr[0] = ((outPtr[0] << 3) | 4) & 0x7c;
-
- buffer->set_range(0, res);
-
- // Each frame of 160 samples is 20ms long.
- int64_t mediaTimeUs = mNumFramesOutput * 20000LL;
- buffer->meta_data()->setInt64(
- kKeyTime, mAnchorTimeUs + mediaTimeUs);
-
- if (readFromSource && wallClockTimeUs != -1) {
- buffer->meta_data()->setInt64(kKeyDriftTime,
- mediaTimeUs - wallClockTimeUs);
- }
-
- ++mNumFramesOutput;
-
- *out = buffer;
-
- mNumInputSamples = 0;
-
- return OK;
-}
-
-} // namespace android
diff --git a/media/libstagefright/codecs/amrnb/enc/Android.mk b/media/libstagefright/codecs/amrnb/enc/Android.mk
index 21937bf..28246ae 100644
--- a/media/libstagefright/codecs/amrnb/enc/Android.mk
+++ b/media/libstagefright/codecs/amrnb/enc/Android.mk
@@ -2,7 +2,6 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
- AMRNBEncoder.cpp \
src/amrencode.cpp \
src/autocorr.cpp \
src/c1035pf.cpp \
diff --git a/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp b/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp
deleted file mode 100644
index 7fd3a95..0000000
--- a/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (C) 2010 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_NDEBUG 0
-#define LOG_TAG "AMRWBEncoder"
-#include <utils/Log.h>
-
-#include "AMRWBEncoder.h"
-#include "voAMRWB.h"
-#include "cmnMemory.h"
-
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/MediaBufferGroup.h>
-#include <media/stagefright/MediaDefs.h>
-#include <media/stagefright/MediaErrors.h>
-#include <media/stagefright/MetaData.h>
-
-namespace android {
-
-static const int32_t kNumSamplesPerFrame = 320;
-static const int32_t kBitsPerSample = 16;
-static const int32_t kInputBufferSize = (kBitsPerSample / 8) * kNumSamplesPerFrame;
-static const int32_t kSampleRate = 16000;
-static const int32_t kNumChannels = 1;
-
-AMRWBEncoder::AMRWBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta)
- : mSource(source),
- mMeta(meta),
- mStarted(false),
- mBufferGroup(NULL),
- mInputBuffer(NULL),
- mEncoderHandle(NULL),
- mApiHandle(NULL),
- mMemOperator(NULL),
- mAnchorTimeUs(0),
- mNumFramesOutput(0),
- mNumInputSamples(0) {
-}
-
-static VOAMRWBMODE pickModeFromBitRate(int32_t bps) {
- CHECK(bps >= 0);
- if (bps <= 6600) {
- return VOAMRWB_MD66;
- } else if (bps <= 8850) {
- return VOAMRWB_MD885;
- } else if (bps <= 12650) {
- return VOAMRWB_MD1265;
- } else if (bps <= 14250) {
- return VOAMRWB_MD1425;
- } else if (bps <= 15850) {
- return VOAMRWB_MD1585;
- } else if (bps <= 18250) {
- return VOAMRWB_MD1825;
- } else if (bps <= 19850) {
- return VOAMRWB_MD1985;
- } else if (bps <= 23050) {
- return VOAMRWB_MD2305;
- }
- return VOAMRWB_MD2385;
-}
-
-status_t AMRWBEncoder::initCheck() {
- CHECK(mApiHandle == NULL && mEncoderHandle == NULL);
- CHECK(mMeta->findInt32(kKeyBitRate, &mBitRate));
-
- mApiHandle = new VO_AUDIO_CODECAPI;
- CHECK(mApiHandle);
-
- if (VO_ERR_NONE != voGetAMRWBEncAPI(mApiHandle)) {
- ALOGE("Failed to get api handle");
- return UNKNOWN_ERROR;
- }
-
- mMemOperator = new VO_MEM_OPERATOR;
- CHECK(mMemOperator != NULL);
- mMemOperator->Alloc = cmnMemAlloc;
- mMemOperator->Copy = cmnMemCopy;
- mMemOperator->Free = cmnMemFree;
- mMemOperator->Set = cmnMemSet;
- mMemOperator->Check = cmnMemCheck;
-
- VO_CODEC_INIT_USERDATA userData;
- memset(&userData, 0, sizeof(userData));
- userData.memflag = VO_IMF_USERMEMOPERATOR;
- userData.memData = (VO_PTR) mMemOperator;
- if (VO_ERR_NONE != mApiHandle->Init(&mEncoderHandle, VO_AUDIO_CodingAMRWB, &userData)) {
- ALOGE("Failed to init AMRWB encoder");
- return UNKNOWN_ERROR;
- }
-
- // Configure AMRWB encoder$
- VOAMRWBMODE mode = pickModeFromBitRate(mBitRate);
- if (VO_ERR_NONE != mApiHandle->SetParam(mEncoderHandle, VO_PID_AMRWB_MODE, &mode)) {
- ALOGE("Failed to set AMRWB encoder mode to %d", mode);
- return UNKNOWN_ERROR;
- }
-
- VOAMRWBFRAMETYPE type = VOAMRWB_RFC3267;
- if (VO_ERR_NONE != mApiHandle->SetParam(mEncoderHandle, VO_PID_AMRWB_FRAMETYPE, &type)) {
- ALOGE("Failed to set AMRWB encoder frame type to %d", type);
- return UNKNOWN_ERROR;
- }
-
- return OK;
-}
-
-AMRWBEncoder::~AMRWBEncoder() {
- if (mStarted) {
- stop();
- }
-}
-
-status_t AMRWBEncoder::start(MetaData *params) {
- if (mStarted) {
- ALOGW("Call start() when encoder already started");
- return OK;
- }
-
- mBufferGroup = new MediaBufferGroup;
-
- // The largest buffer size is header + 477 bits
- mBufferGroup->add_buffer(new MediaBuffer(1024));
-
- CHECK_EQ((status_t)OK, initCheck());
-
- mNumFramesOutput = 0;
-
- status_t err = mSource->start(params);
- if (err != OK) {
- ALOGE("AudioSource is not available");
- return err;
- }
- mStarted = true;
-
- return OK;
-}
-
-status_t AMRWBEncoder::stop() {
- if (!mStarted) {
- ALOGW("Call stop() when encoder has not started");
- return OK;
- }
-
- if (mInputBuffer) {
- mInputBuffer->release();
- mInputBuffer = NULL;
- }
-
- delete mBufferGroup;
- mBufferGroup = NULL;
-
-
- CHECK_EQ((VO_U32)VO_ERR_NONE, mApiHandle->Uninit(mEncoderHandle));
- mEncoderHandle = NULL;
-
- delete mApiHandle;
- mApiHandle = NULL;
-
- delete mMemOperator;
- mMemOperator;
-
- mStarted = false;
-
- mSource->stop();
- return OK;
-}
-
-sp<MetaData> AMRWBEncoder::getFormat() {
- sp<MetaData> srcFormat = mSource->getFormat();
-
- mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_AMR_WB);
-
- int64_t durationUs;
- if (srcFormat->findInt64(kKeyDuration, &durationUs)) {
- mMeta->setInt64(kKeyDuration, durationUs);
- }
-
- mMeta->setCString(kKeyDecoderComponent, "AMRWBEncoder");
-
- return mMeta;
-}
-
-status_t AMRWBEncoder::read(
- MediaBuffer **out, const ReadOptions *options) {
- status_t err;
-
- *out = NULL;
-
- int64_t seekTimeUs;
- ReadOptions::SeekMode mode;
- CHECK(options == NULL || !options->getSeekTo(&seekTimeUs, &mode));
- bool readFromSource = false;
- int64_t wallClockTimeUs = -1;
-
- while (mNumInputSamples < kNumSamplesPerFrame) {
- if (mInputBuffer == NULL) {
- err = mSource->read(&mInputBuffer, options);
-
- if (err != OK) {
- if (mNumInputSamples == 0) {
- return ERROR_END_OF_STREAM;
- }
- memset(&mInputFrame[mNumInputSamples],
- 0,
- sizeof(int16_t)
- * (kNumSamplesPerFrame - mNumInputSamples));
- mNumInputSamples = 0;
- break;
- }
-
- size_t align = mInputBuffer->range_length() % sizeof(int16_t);
- CHECK_EQ(align, (size_t)0);
-
- int64_t timeUs;
- if (mInputBuffer->meta_data()->findInt64(kKeyDriftTime, &timeUs)) {
- wallClockTimeUs = timeUs;
- }
- if (mInputBuffer->meta_data()->findInt64(kKeyAnchorTime, &timeUs)) {
- mAnchorTimeUs = timeUs;
- }
- readFromSource = true;
- } else {
- readFromSource = false;
- }
-
- size_t copy =
- (kNumSamplesPerFrame - mNumInputSamples) * sizeof(int16_t);
-
- if (copy > mInputBuffer->range_length()) {
- copy = mInputBuffer->range_length();
- }
-
- memcpy(&mInputFrame[mNumInputSamples],
- (const uint8_t *)mInputBuffer->data()
- + mInputBuffer->range_offset(),
- copy);
-
- mInputBuffer->set_range(
- mInputBuffer->range_offset() + copy,
- mInputBuffer->range_length() - copy);
-
- if (mInputBuffer->range_length() == 0) {
- mInputBuffer->release();
- mInputBuffer = NULL;
- }
-
- mNumInputSamples += copy / sizeof(int16_t);
- if (mNumInputSamples >= kNumSamplesPerFrame) {
- mNumInputSamples %= kNumSamplesPerFrame;
- break; // Get a whole input frame 640 bytes
- }
- }
-
- VO_CODECBUFFER inputData;
- memset(&inputData, 0, sizeof(inputData));
- inputData.Buffer = (unsigned char*) mInputFrame;
- inputData.Length = kInputBufferSize;
- CHECK(VO_ERR_NONE == mApiHandle->SetInputData(mEncoderHandle,&inputData));
-
- MediaBuffer *buffer;
- CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), (status_t)OK);
- uint8_t *outPtr = (uint8_t *)buffer->data();
-
- VO_CODECBUFFER outputData;
- memset(&outputData, 0, sizeof(outputData));
- VO_AUDIO_OUTPUTINFO outputInfo;
- memset(&outputInfo, 0, sizeof(outputInfo));
-
- VO_U32 ret = VO_ERR_NONE;
- outputData.Buffer = outPtr;
- outputData.Length = buffer->size();
- ret = mApiHandle->GetOutputData(mEncoderHandle, &outputData, &outputInfo);
- CHECK(ret == VO_ERR_NONE || ret == VO_ERR_INPUT_BUFFER_SMALL);
-
- buffer->set_range(0, outputData.Length);
- ++mNumFramesOutput;
-
- int64_t mediaTimeUs = mNumFramesOutput * 20000LL;
- buffer->meta_data()->setInt64(kKeyTime, mAnchorTimeUs + mediaTimeUs);
- if (readFromSource && wallClockTimeUs != -1) {
- buffer->meta_data()->setInt64(kKeyDriftTime, mediaTimeUs - wallClockTimeUs);
- }
-
- *out = buffer;
- return OK;
-}
-
-} // namespace android
diff --git a/media/libstagefright/codecs/amrwbenc/Android.mk b/media/libstagefright/codecs/amrwbenc/Android.mk
index 3a46ec8..d3c3041 100644
--- a/media/libstagefright/codecs/amrwbenc/Android.mk
+++ b/media/libstagefright/codecs/amrwbenc/Android.mk
@@ -5,7 +5,6 @@
LOCAL_SRC_FILES := \
- AMRWBEncoder.cpp \
src/autocorr.c \
src/az_isp.c \
src/bits.c \
diff --git a/media/libstagefright/codecs/g711/dec/SoftG711.cpp b/media/libstagefright/codecs/g711/dec/SoftG711.cpp
index 32ef003..bcdd3c7 100644
--- a/media/libstagefright/codecs/g711/dec/SoftG711.cpp
+++ b/media/libstagefright/codecs/g711/dec/SoftG711.cpp
@@ -140,7 +140,7 @@
OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
(OMX_AUDIO_PARAM_PCMMODETYPE *)params;
- if (pcmParams->nPortIndex != 0) {
+ if (pcmParams->nPortIndex != 0 && pcmParams->nPortIndex != 1) {
return OMX_ErrorUndefined;
}
@@ -148,7 +148,9 @@
return OMX_ErrorUndefined;
}
- mNumChannels = pcmParams->nChannels;
+ if(pcmParams->nPortIndex == 0) {
+ mNumChannels = pcmParams->nChannels;
+ }
return OMX_ErrorNone;
}
diff --git a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
index ad55295..92009ee 100644
--- a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
+++ b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
@@ -115,6 +115,7 @@
mDecoderBuf = malloc(memRequirements);
pvmp3_InitDecoder(mConfig, mDecoderBuf);
+ mIsFirst = true;
}
OMX_ERRORTYPE SoftMP3::internalGetParameter(
@@ -190,7 +191,10 @@
inInfo->mOwnedByUs = false;
notifyEmptyBufferDone(inHeader);
- outHeader->nFilledLen = 0;
+ // pad the end of the stream with 529 samples, since that many samples
+ // were trimmed off the beginning when decoding started
+ outHeader->nFilledLen = kPVMP3DecoderDelay * mNumChannels * sizeof(int16_t);
+ memset(outHeader->pBuffer, 0, outHeader->nFilledLen);
outHeader->nFlags = OMX_BUFFERFLAG_EOS;
outQueue.erase(outQueue.begin());
@@ -251,8 +255,17 @@
return;
}
- outHeader->nOffset = 0;
- outHeader->nFilledLen = mConfig->outputFrameSize * sizeof(int16_t);
+ if (mIsFirst) {
+ mIsFirst = false;
+ // The decoder delay is 529 samples, so trim that many samples off
+ // the start of the first output buffer. This essentially makes this
+ // decoder have zero delay, which the rest of the pipeline assumes.
+ outHeader->nOffset = kPVMP3DecoderDelay * mNumChannels * sizeof(int16_t);
+ outHeader->nFilledLen = mConfig->outputFrameSize * sizeof(int16_t) - outHeader->nOffset;
+ } else {
+ outHeader->nOffset = 0;
+ outHeader->nFilledLen = mConfig->outputFrameSize * sizeof(int16_t);
+ }
outHeader->nTimeStamp =
mAnchorTimeUs
@@ -288,6 +301,7 @@
// Make sure that the next buffer output does not still
// depend on fragments from the last one decoded.
pvmp3_InitDecoder(mConfig, mDecoderBuf);
+ mIsFirst = true;
}
}
diff --git a/media/libstagefright/codecs/mp3dec/SoftMP3.h b/media/libstagefright/codecs/mp3dec/SoftMP3.h
index 70d0682..3a05466 100644
--- a/media/libstagefright/codecs/mp3dec/SoftMP3.h
+++ b/media/libstagefright/codecs/mp3dec/SoftMP3.h
@@ -46,7 +46,8 @@
private:
enum {
kNumBuffers = 4,
- kOutputBufferSize = 4608 * 2
+ kOutputBufferSize = 4608 * 2,
+ kPVMP3DecoderDelay = 529 // frames
};
tPVMP3DecoderExternal *mConfig;
@@ -57,8 +58,7 @@
int32_t mNumChannels;
int32_t mSamplingRate;
- bool mConfigured;
-
+ bool mIsFirst;
bool mSignalledError;
enum {
diff --git a/media/libstagefright/foundation/AString.cpp b/media/libstagefright/foundation/AString.cpp
index 61b76cf..dee786d 100644
--- a/media/libstagefright/foundation/AString.cpp
+++ b/media/libstagefright/foundation/AString.cpp
@@ -310,6 +310,16 @@
return !strncmp(mData, prefix, strlen(prefix));
}
+bool AString::endsWith(const char *suffix) const {
+ size_t suffixLen = strlen(suffix);
+
+ if (mSize < suffixLen) {
+ return false;
+ }
+
+ return !strcmp(mData + mSize - suffixLen, suffix);
+}
+
AString StringPrintf(const char *format, ...) {
va_list ap;
va_start(ap, format);
diff --git a/media/libstagefright/httplive/Android.mk b/media/libstagefright/httplive/Android.mk
index a5990c3..90cb448 100644
--- a/media/libstagefright/httplive/Android.mk
+++ b/media/libstagefright/httplive/Android.mk
@@ -8,7 +8,6 @@
M3UParser.cpp \
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
$(TOP)/frameworks/base/media/libstagefright \
$(TOP)/frameworks/native/include/media/openmax \
$(TOP)/external/openssl/include
diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp
index 2e92926..ca14054 100644
--- a/media/libstagefright/id3/ID3.cpp
+++ b/media/libstagefright/id3/ID3.cpp
@@ -463,40 +463,65 @@
tmp = NULL;
}
-void ID3::Iterator::getString(String8 *id) const {
+// the 2nd argument is used to get the data following the \0 in a comment field
+void ID3::Iterator::getString(String8 *id, String8 *comment) const {
+ getstring(id, false);
+ if (comment != NULL) {
+ getstring(comment, true);
+ }
+}
+
+// comment fields (COM/COMM) contain an initial short descriptor, followed by \0,
+// followed by more data. The data following the \0 can be retrieved by setting
+// "otherdata" to true.
+void ID3::Iterator::getstring(String8 *id, bool otherdata) const {
id->setTo("");
- if (mFrameData == NULL) {
+ const uint8_t *frameData = mFrameData;
+ if (frameData == NULL) {
return;
}
+ uint8_t encoding = *frameData;
+
if (mParent.mVersion == ID3_V1 || mParent.mVersion == ID3_V1_1) {
if (mOffset == 126 || mOffset == 127) {
// Special treatment for the track number and genre.
char tmp[16];
- sprintf(tmp, "%d", (int)*mFrameData);
+ sprintf(tmp, "%d", (int)*frameData);
id->setTo(tmp);
return;
}
- convertISO8859ToString8(mFrameData, mFrameSize, id);
+ convertISO8859ToString8(frameData, mFrameSize, id);
return;
}
size_t n = mFrameSize - getHeaderLength() - 1;
+ if (otherdata) {
+ // skip past the encoding, language, and the 0 separator
+ frameData += 4;
+ int32_t i = n - 4;
+ while(--i >= 0 && *++frameData != 0) ;
+ int skipped = (frameData - mFrameData);
+ if (skipped >= n) {
+ return;
+ }
+ n -= skipped;
+ }
- if (*mFrameData == 0x00) {
+ if (encoding == 0x00) {
// ISO 8859-1
- convertISO8859ToString8(mFrameData + 1, n, id);
- } else if (*mFrameData == 0x03) {
+ convertISO8859ToString8(frameData + 1, n, id);
+ } else if (encoding == 0x03) {
// UTF-8
- id->setTo((const char *)(mFrameData + 1), n);
- } else if (*mFrameData == 0x02) {
+ id->setTo((const char *)(frameData + 1), n);
+ } else if (encoding == 0x02) {
// UTF-16 BE, no byte order mark.
// API wants number of characters, not number of bytes...
int len = n / 2;
- const char16_t *framedata = (const char16_t *) (mFrameData + 1);
+ const char16_t *framedata = (const char16_t *) (frameData + 1);
char16_t *framedatacopy = NULL;
#if BYTE_ORDER == LITTLE_ENDIAN
framedatacopy = new char16_t[len];
@@ -513,7 +538,7 @@
// UCS-2
// API wants number of characters, not number of bytes...
int len = n / 2;
- const char16_t *framedata = (const char16_t *) (mFrameData + 1);
+ const char16_t *framedata = (const char16_t *) (frameData + 1);
char16_t *framedatacopy = NULL;
if (*framedata == 0xfffe) {
// endianness marker doesn't match host endianness, convert
diff --git a/media/libstagefright/include/AACDecoder.h b/media/libstagefright/include/AACDecoder.h
deleted file mode 100644
index 886a3b7..0000000
--- a/media/libstagefright/include/AACDecoder.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#ifndef AAC_DECODER_H_
-
-#define AAC_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-struct tPVMP4AudioDecoderExternal;
-
-namespace android {
-
-struct MediaBufferGroup;
-struct MetaData;
-
-struct AACDecoder : public MediaSource {
- AACDecoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~AACDecoder();
-
-private:
- sp<MetaData> mMeta;
- sp<MediaSource> mSource;
- bool mStarted;
-
- MediaBufferGroup *mBufferGroup;
-
- tPVMP4AudioDecoderExternal *mConfig;
- void *mDecoderBuf;
- int64_t mAnchorTimeUs;
- int64_t mNumSamplesOutput;
- status_t mInitCheck;
- int64_t mNumDecodedBuffers;
- int32_t mUpsamplingFactor;
-
- MediaBuffer *mInputBuffer;
-
- status_t initCheck();
- AACDecoder(const AACDecoder &);
- AACDecoder &operator=(const AACDecoder &);
-};
-
-} // namespace android
-
-#endif // AAC_DECODER_H_
diff --git a/media/libstagefright/include/AMRNBDecoder.h b/media/libstagefright/include/AMRNBDecoder.h
deleted file mode 100644
index cf24eda..0000000
--- a/media/libstagefright/include/AMRNBDecoder.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#ifndef AMR_NB_DECODER_H_
-
-#define AMR_NB_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct AMRNBDecoder : public MediaSource {
- AMRNBDecoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~AMRNBDecoder();
-
-private:
- sp<MediaSource> mSource;
- bool mStarted;
-
- MediaBufferGroup *mBufferGroup;
-
- void *mState;
- int64_t mAnchorTimeUs;
- int64_t mNumSamplesOutput;
-
- MediaBuffer *mInputBuffer;
-
- AMRNBDecoder(const AMRNBDecoder &);
- AMRNBDecoder &operator=(const AMRNBDecoder &);
-};
-
-} // namespace android
-
-#endif // AMR_NB_DECODER_H_
diff --git a/media/libstagefright/include/AMRNBEncoder.h b/media/libstagefright/include/AMRNBEncoder.h
deleted file mode 100644
index 71160e6..0000000
--- a/media/libstagefright/include/AMRNBEncoder.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#ifndef AMR_NB_ENCODER_H_
-
-#define AMR_NB_ENCODER_H_
-
-#include <media/stagefright/MediaSource.h>
-#include <media/stagefright/MetaData.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct AMRNBEncoder : public MediaSource {
- AMRNBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~AMRNBEncoder();
-
-private:
- sp<MediaSource> mSource;
- sp<MetaData> mMeta;
- bool mStarted;
-
- MediaBufferGroup *mBufferGroup;
-
- void *mEncState;
- void *mSidState;
- int64_t mAnchorTimeUs;
- int64_t mNumFramesOutput;
-
- MediaBuffer *mInputBuffer;
- int mMode;
-
- int16_t mInputFrame[160];
- int32_t mNumInputSamples;
-
- AMRNBEncoder(const AMRNBEncoder &);
- AMRNBEncoder &operator=(const AMRNBEncoder &);
-};
-
-} // namespace android
-
-#endif // AMR_NB_ENCODER_H_
diff --git a/media/libstagefright/include/AMRWBDecoder.h b/media/libstagefright/include/AMRWBDecoder.h
deleted file mode 100644
index 927c51c..0000000
--- a/media/libstagefright/include/AMRWBDecoder.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#ifndef AMR_WB_DECODER_H_
-
-#define AMR_WB_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct AMRWBDecoder : public MediaSource {
- AMRWBDecoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~AMRWBDecoder();
-
-private:
- sp<MediaSource> mSource;
- bool mStarted;
-
- MediaBufferGroup *mBufferGroup;
-
- void *mState;
- void *mDecoderBuf;
- int16_t *mDecoderCookie;
- int64_t mAnchorTimeUs;
- int64_t mNumSamplesOutput;
- int16_t mInputSampleBuffer[477];
-
- MediaBuffer *mInputBuffer;
-
- AMRWBDecoder(const AMRWBDecoder &);
- AMRWBDecoder &operator=(const AMRWBDecoder &);
-};
-
-} // namespace android
-
-#endif // AMR_WB_DECODER_H_
diff --git a/media/libstagefright/include/AMRWBEncoder.h b/media/libstagefright/include/AMRWBEncoder.h
deleted file mode 100644
index f2d155f..0000000
--- a/media/libstagefright/include/AMRWBEncoder.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef AMR_WB_ENCODER_H
-#define AMR_WB_ENCODER_H
-
-#include <media/stagefright/MediaSource.h>
-#include <media/stagefright/MetaData.h>
-
-struct VO_AUDIO_CODECAPI;
-struct VO_MEM_OPERATOR;
-
-namespace android {
-
-struct MediaBufferGroup;
-
-class AMRWBEncoder: public MediaSource {
- public:
- AMRWBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
- virtual sp<MetaData> getFormat();
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-
- protected:
- virtual ~AMRWBEncoder();
-
- private:
- sp<MediaSource> mSource;
- sp<MetaData> mMeta;
- bool mStarted;
- MediaBufferGroup *mBufferGroup;
- MediaBuffer *mInputBuffer;
- status_t mInitCheck;
- int32_t mBitRate;
- void *mEncoderHandle;
- VO_AUDIO_CODECAPI *mApiHandle;
- VO_MEM_OPERATOR *mMemOperator;
-
- int64_t mAnchorTimeUs;
- int64_t mNumFramesOutput;
-
- int16_t mInputFrame[320];
- int32_t mNumInputSamples;
-
- status_t initCheck();
-
- AMRWBEncoder& operator=(const AMRWBEncoder &rhs);
- AMRWBEncoder(const AMRWBEncoder& copy);
-
-};
-
-}
-
-#endif //#ifndef AMR_WB_ENCODER_H
-
diff --git a/media/libstagefright/include/AVCDecoder.h b/media/libstagefright/include/AVCDecoder.h
deleted file mode 100644
index eb3b142..0000000
--- a/media/libstagefright/include/AVCDecoder.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#ifndef AVC_DECODER_H_
-
-#define AVC_DECODER_H_
-
-#include <media/stagefright/MediaBuffer.h>
-#include <media/stagefright/MediaSource.h>
-#include <utils/Vector.h>
-
-struct tagAVCHandle;
-
-namespace android {
-
-struct AVCDecoder : public MediaSource,
- public MediaBufferObserver {
- AVCDecoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
- virtual void signalBufferReturned(MediaBuffer *buffer);
-
-protected:
- virtual ~AVCDecoder();
-
-private:
- sp<MediaSource> mSource;
- bool mStarted;
-
- sp<MetaData> mFormat;
-
- Vector<MediaBuffer *> mCodecSpecificData;
-
- tagAVCHandle *mHandle;
- Vector<MediaBuffer *> mFrames;
- MediaBuffer *mInputBuffer;
-
- int64_t mAnchorTimeUs;
- int64_t mNumSamplesOutput;
- int64_t mPendingSeekTimeUs;
- MediaSource::ReadOptions::SeekMode mPendingSeekMode;
-
- int64_t mTargetTimeUs;
-
- bool mSPSSeen;
- bool mPPSSeen;
-
- void addCodecSpecificData(const uint8_t *data, size_t size);
-
- static int32_t ActivateSPSWrapper(
- void *userData, unsigned int sizeInMbs, unsigned int numBuffers);
-
- static int32_t BindFrameWrapper(
- void *userData, int32_t index, uint8_t **yuv);
-
- static void UnbindFrame(void *userData, int32_t index);
-
- int32_t activateSPS(
- unsigned int sizeInMbs, unsigned int numBuffers);
-
- int32_t bindFrame(int32_t index, uint8_t **yuv);
-
- void releaseFrames();
-
- MediaBuffer *drainOutputBuffer();
-
- AVCDecoder(const AVCDecoder &);
- AVCDecoder &operator=(const AVCDecoder &);
-};
-
-} // namespace android
-
-#endif // AVC_DECODER_H_
diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h
index 4c7bfa6..06e9468 100644
--- a/media/libstagefright/include/AwesomePlayer.h
+++ b/media/libstagefright/include/AwesomePlayer.h
@@ -90,6 +90,7 @@
status_t setParameter(int key, const Parcel &request);
status_t getParameter(int key, Parcel *reply);
+ status_t invoke(const Parcel &request, Parcel *reply);
status_t setCacheStatCollectFreq(const Parcel &request);
status_t seekTo(int64_t timeUs);
@@ -100,8 +101,6 @@
void postAudioEOS(int64_t delayUs = 0ll);
void postAudioSeekComplete();
- status_t setTimedTextTrackIndex(int32_t index);
-
status_t dump(int fd, const Vector<String16> &args) const;
private:
@@ -136,7 +135,7 @@
INCOGNITO = 0x8000,
TEXT_RUNNING = 0x10000,
- TEXTPLAYER_STARTED = 0x20000,
+ TEXTPLAYER_INITIALIZED = 0x20000,
SLOW_DECODER_HACK = 0x40000,
};
diff --git a/media/libstagefright/include/G711Decoder.h b/media/libstagefright/include/G711Decoder.h
deleted file mode 100644
index 8b5143a..0000000
--- a/media/libstagefright/include/G711Decoder.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef G711_DECODER_H_
-
-#define G711_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct G711Decoder : public MediaSource {
- G711Decoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~G711Decoder();
-
-private:
- sp<MediaSource> mSource;
- bool mStarted;
- bool mIsMLaw;
-
- MediaBufferGroup *mBufferGroup;
-
- static void DecodeALaw(int16_t *out, const uint8_t *in, size_t inSize);
- static void DecodeMLaw(int16_t *out, const uint8_t *in, size_t inSize);
-
- G711Decoder(const G711Decoder &);
- G711Decoder &operator=(const G711Decoder &);
-};
-
-} // namespace android
-
-#endif // G711_DECODER_H_
diff --git a/media/libstagefright/include/ID3.h b/media/libstagefright/include/ID3.h
index 98c82a4..8714008 100644
--- a/media/libstagefright/include/ID3.h
+++ b/media/libstagefright/include/ID3.h
@@ -50,7 +50,7 @@
bool done() const;
void getID(String8 *id) const;
- void getString(String8 *s) const;
+ void getString(String8 *s, String8 *ss = NULL) const;
const uint8_t *getData(size_t *length) const;
void next();
@@ -65,6 +65,7 @@
void findFrame();
size_t getHeaderLength() const;
+ void getstring(String8 *s, bool secondhalf) const;
Iterator(const Iterator &);
Iterator &operator=(const Iterator &);
diff --git a/media/libstagefright/include/M4vH263Decoder.h b/media/libstagefright/include/M4vH263Decoder.h
deleted file mode 100644
index 7d73e30..0000000
--- a/media/libstagefright/include/M4vH263Decoder.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#ifndef M4V_H263_DECODER_H_
-
-#define M4V_H263_DECODER_H_
-
-#include <media/stagefright/MediaBuffer.h>
-#include <media/stagefright/MediaSource.h>
-
-struct tagvideoDecControls;
-
-namespace android {
-
-struct M4vH263Decoder : public MediaSource,
- public MediaBufferObserver {
- M4vH263Decoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
- virtual void signalBufferReturned(MediaBuffer *buffer);
-
-protected:
- virtual ~M4vH263Decoder();
-
-private:
- sp<MediaSource> mSource;
- bool mStarted;
- int32_t mWidth, mHeight;
-
- sp<MetaData> mFormat;
-
- tagvideoDecControls *mHandle;
- MediaBuffer *mFrames[2];
- MediaBuffer *mInputBuffer;
-
- int64_t mNumSamplesOutput;
- int64_t mTargetTimeUs;
-
- void allocateFrames(int32_t width, int32_t height);
- void releaseFrames();
-
- M4vH263Decoder(const M4vH263Decoder &);
- M4vH263Decoder &operator=(const M4vH263Decoder &);
-};
-
-} // namespace android
-
-#endif // M4V_H263_DECODER_H_
diff --git a/media/libstagefright/include/MP3Decoder.h b/media/libstagefright/include/MP3Decoder.h
deleted file mode 100644
index 4086fb6..0000000
--- a/media/libstagefright/include/MP3Decoder.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#ifndef MP3_DECODER_H_
-
-#define MP3_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-struct tPVMP3DecoderExternal;
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct MP3Decoder : public MediaSource {
- MP3Decoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~MP3Decoder();
-
-private:
- sp<MediaSource> mSource;
- sp<MetaData> mMeta;
- int32_t mNumChannels;
-
- bool mStarted;
-
- MediaBufferGroup *mBufferGroup;
-
- tPVMP3DecoderExternal *mConfig;
- void *mDecoderBuf;
- int64_t mAnchorTimeUs;
- int64_t mNumFramesOutput;
-
- MediaBuffer *mInputBuffer;
-
- void init();
-
- MP3Decoder(const MP3Decoder &);
- MP3Decoder &operator=(const MP3Decoder &);
-};
-
-} // namespace android
-
-#endif // MP3_DECODER_H_
diff --git a/media/libstagefright/include/MPEG4Extractor.h b/media/libstagefright/include/MPEG4Extractor.h
index eae62c6..5c549e0 100644
--- a/media/libstagefright/include/MPEG4Extractor.h
+++ b/media/libstagefright/include/MPEG4Extractor.h
@@ -20,6 +20,7 @@
#include <media/stagefright/MediaExtractor.h>
#include <utils/Vector.h>
+#include <utils/String8.h>
namespace android {
@@ -64,6 +65,9 @@
sp<MetaData> mFileMetaData;
Vector<uint32_t> mPath;
+ String8 mLastCommentMean;
+ String8 mLastCommentName;
+ String8 mLastCommentData;
status_t readMetaData();
status_t parseChunk(off64_t *offset, int depth);
diff --git a/media/libstagefright/include/VPXDecoder.h b/media/libstagefright/include/VPXDecoder.h
deleted file mode 100644
index 3b8362d..0000000
--- a/media/libstagefright/include/VPXDecoder.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef VPX_DECODER_H_
-
-#define VPX_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-#include <utils/Vector.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct VPXDecoder : public MediaSource {
- VPXDecoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~VPXDecoder();
-
-private:
- sp<MediaSource> mSource;
- bool mStarted;
- int32_t mWidth, mHeight;
- size_t mBufferSize;
-
- void *mCtx;
- MediaBufferGroup *mBufferGroup;
-
- int64_t mTargetTimeUs;
-
- sp<MetaData> mFormat;
-
- VPXDecoder(const VPXDecoder &);
- VPXDecoder &operator=(const VPXDecoder &);
-};
-
-} // namespace android
-
-#endif // VPX_DECODER_H_
-
diff --git a/media/libstagefright/include/VorbisDecoder.h b/media/libstagefright/include/VorbisDecoder.h
deleted file mode 100644
index 13e8b77..0000000
--- a/media/libstagefright/include/VorbisDecoder.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef VORBIS_DECODER_H_
-
-#define VORBIS_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-struct vorbis_dsp_state;
-struct vorbis_info;
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct VorbisDecoder : public MediaSource {
- VorbisDecoder(const sp<MediaSource> &source);
-
- virtual status_t start(MetaData *params);
- virtual status_t stop();
-
- virtual sp<MetaData> getFormat();
-
- virtual status_t read(
- MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
- virtual ~VorbisDecoder();
-
-private:
- enum {
- kMaxNumSamplesPerBuffer = 8192 * 2
- };
-
- sp<MediaSource> mSource;
- bool mStarted;
-
- MediaBufferGroup *mBufferGroup;
-
- int32_t mNumChannels;
- int32_t mSampleRate;
- int64_t mAnchorTimeUs;
- int64_t mNumFramesOutput;
- int32_t mNumFramesLeftOnPage;
-
- vorbis_dsp_state *mState;
- vorbis_info *mVi;
-
- int decodePacket(MediaBuffer *packet, MediaBuffer *out);
-
- VorbisDecoder(const VorbisDecoder &);
- VorbisDecoder &operator=(const VorbisDecoder &);
-};
-
-} // namespace android
-
-#endif // VORBIS_DECODER_H_
-
diff --git a/media/libstagefright/include/XINGSeeker.h b/media/libstagefright/include/XINGSeeker.h
index ec5bd9b..c408576 100644
--- a/media/libstagefright/include/XINGSeeker.h
+++ b/media/libstagefright/include/XINGSeeker.h
@@ -31,13 +31,19 @@
virtual bool getDuration(int64_t *durationUs);
virtual bool getOffsetForTime(int64_t *timeUs, off64_t *pos);
+ virtual int32_t getEncoderDelay();
+ virtual int32_t getEncoderPadding();
+
private:
int64_t mFirstFramePos;
int64_t mDurationUs;
int32_t mSizeBytes;
+ int32_t mEncoderDelay;
+ int32_t mEncoderPadding;
// TOC entries in XING header. Skip the first one since it's always 0.
- unsigned char mTableOfContents[99];
+ unsigned char mTOC[99];
+ bool mTOCValid;
XINGSeeker();
diff --git a/media/libstagefright/matroska/Android.mk b/media/libstagefright/matroska/Android.mk
index e67da4c..2cccb4f 100644
--- a/media/libstagefright/matroska/Android.mk
+++ b/media/libstagefright/matroska/Android.mk
@@ -5,7 +5,6 @@
MatroskaExtractor.cpp
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
$(TOP)/external/libvpx/mkvparser \
$(TOP)/frameworks/native/include/media/openmax \
diff --git a/media/libstagefright/mpeg2ts/Android.mk b/media/libstagefright/mpeg2ts/Android.mk
index ac4c2a1..eaa139d 100644
--- a/media/libstagefright/mpeg2ts/Android.mk
+++ b/media/libstagefright/mpeg2ts/Android.mk
@@ -10,7 +10,6 @@
MPEG2TSExtractor.cpp \
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
$(TOP)/frameworks/base/media/libstagefright \
$(TOP)/frameworks/native/include/media/openmax
diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp
index d708ba6..e1ac53c 100644
--- a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp
+++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp
@@ -117,6 +117,12 @@
mediaBuffer->meta_data()->setInt64(kKeyTime, timeUs);
+ int32_t scrambling;
+ if (buffer->meta()->findInt32("scrambling", &scrambling)
+ && scrambling != 0) {
+ mediaBuffer->meta_data()->setInt32(kKeyScrambling, scrambling);
+ }
+
*out = mediaBuffer;
return OK;
}
diff --git a/media/libstagefright/omx/Android.mk b/media/libstagefright/omx/Android.mk
index f587a9c..d20ecb6 100644
--- a/media/libstagefright/omx/Android.mk
+++ b/media/libstagefright/omx/Android.mk
@@ -1,11 +1,8 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
-
LOCAL_SRC_FILES:= \
OMX.cpp \
- OMXComponentBase.cpp \
OMXMaster.cpp \
OMXNodeInstance.cpp \
SimpleSoftOMXComponent.cpp \
diff --git a/media/libstagefright/omx/OMXComponentBase.cpp b/media/libstagefright/omx/OMXComponentBase.cpp
deleted file mode 100644
index 7d11dce..0000000
--- a/media/libstagefright/omx/OMXComponentBase.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include "OMXComponentBase.h"
-
-#include <stdlib.h>
-
-#include <media/stagefright/foundation/ADebug.h>
-
-namespace android {
-
-OMXComponentBase::OMXComponentBase(
- const OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData)
- : mCallbacks(callbacks),
- mAppData(appData),
- mComponentHandle(NULL) {
-}
-
-OMXComponentBase::~OMXComponentBase() {}
-
-void OMXComponentBase::setComponentHandle(OMX_COMPONENTTYPE *handle) {
- CHECK(mComponentHandle == NULL);
- mComponentHandle = handle;
-}
-
-void OMXComponentBase::postEvent(
- OMX_EVENTTYPE event, OMX_U32 param1, OMX_U32 param2) {
- (*mCallbacks->EventHandler)(
- mComponentHandle, mAppData, event, param1, param2, NULL);
-}
-
-void OMXComponentBase::postFillBufferDone(OMX_BUFFERHEADERTYPE *bufHdr) {
- (*mCallbacks->FillBufferDone)(mComponentHandle, mAppData, bufHdr);
-}
-
-void OMXComponentBase::postEmptyBufferDone(OMX_BUFFERHEADERTYPE *bufHdr) {
- (*mCallbacks->EmptyBufferDone)(mComponentHandle, mAppData, bufHdr);
-}
-
-static OMXComponentBase *getBase(OMX_HANDLETYPE hComponent) {
- return (OMXComponentBase *)
- ((OMX_COMPONENTTYPE *)hComponent)->pComponentPrivate;
-}
-
-static OMX_ERRORTYPE SendCommandWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_COMMANDTYPE Cmd,
- OMX_IN OMX_U32 nParam1,
- OMX_IN OMX_PTR pCmdData) {
- return getBase(hComponent)->sendCommand(Cmd, nParam1, pCmdData);
-}
-
-static OMX_ERRORTYPE GetParameterWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nParamIndex,
- OMX_INOUT OMX_PTR pComponentParameterStructure) {
- return getBase(hComponent)->getParameter(
- nParamIndex, pComponentParameterStructure);
-}
-
-static OMX_ERRORTYPE SetParameterWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nIndex,
- OMX_IN OMX_PTR pComponentParameterStructure) {
- return getBase(hComponent)->getParameter(
- nIndex, pComponentParameterStructure);
-}
-
-static OMX_ERRORTYPE GetConfigWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nIndex,
- OMX_INOUT OMX_PTR pComponentConfigStructure) {
- return getBase(hComponent)->getConfig(nIndex, pComponentConfigStructure);
-}
-
-static OMX_ERRORTYPE SetConfigWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nIndex,
- OMX_IN OMX_PTR pComponentConfigStructure) {
- return getBase(hComponent)->setConfig(nIndex, pComponentConfigStructure);
-}
-
-static OMX_ERRORTYPE GetExtensionIndexWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_STRING cParameterName,
- OMX_OUT OMX_INDEXTYPE* pIndexType) {
- return getBase(hComponent)->getExtensionIndex(cParameterName, pIndexType);
-}
-
-static OMX_ERRORTYPE GetStateWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_STATETYPE* pState) {
- return getBase(hComponent)->getState(pState);
-}
-
-static OMX_ERRORTYPE UseBufferWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
- OMX_IN OMX_U32 nPortIndex,
- OMX_IN OMX_PTR pAppPrivate,
- OMX_IN OMX_U32 nSizeBytes,
- OMX_IN OMX_U8* pBuffer) {
- return getBase(hComponent)->useBuffer(
- ppBufferHdr, nPortIndex, pAppPrivate, nSizeBytes, pBuffer);
-}
-
-static OMX_ERRORTYPE AllocateBufferWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_INOUT OMX_BUFFERHEADERTYPE** ppBuffer,
- OMX_IN OMX_U32 nPortIndex,
- OMX_IN OMX_PTR pAppPrivate,
- OMX_IN OMX_U32 nSizeBytes) {
- return getBase(hComponent)->allocateBuffer(
- ppBuffer, nPortIndex, pAppPrivate, nSizeBytes);
-}
-
-static OMX_ERRORTYPE FreeBufferWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_U32 nPortIndex,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer) {
- return getBase(hComponent)->freeBuffer(nPortIndex, pBuffer);
-}
-
-static OMX_ERRORTYPE EmptyThisBufferWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer) {
- return getBase(hComponent)->emptyThisBuffer(pBuffer);
-}
-
-static OMX_ERRORTYPE FillThisBufferWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer) {
- return getBase(hComponent)->fillThisBuffer(pBuffer);
-}
-
-static OMX_ERRORTYPE ComponentDeInitWrapper(
- OMX_IN OMX_HANDLETYPE hComponent) {
- delete getBase(hComponent);
- delete (OMX_COMPONENTTYPE *)hComponent;
-
- return OMX_ErrorNone;
-}
-
-static OMX_ERRORTYPE ComponentRoleEnumWrapper(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_U8 *cRole,
- OMX_IN OMX_U32 nIndex) {
- return getBase(hComponent)->enumerateRoles(cRole, nIndex);
-}
-
-// static
-OMX_COMPONENTTYPE *OMXComponentBase::MakeComponent(OMXComponentBase *base) {
- OMX_COMPONENTTYPE *result = new OMX_COMPONENTTYPE;
-
- result->nSize = sizeof(OMX_COMPONENTTYPE);
- result->nVersion.s.nVersionMajor = 1;
- result->nVersion.s.nVersionMinor = 0;
- result->nVersion.s.nRevision = 0;
- result->nVersion.s.nStep = 0;
- result->pComponentPrivate = base;
- result->pApplicationPrivate = NULL;
-
- result->GetComponentVersion = NULL;
- result->SendCommand = SendCommandWrapper;
- result->GetParameter = GetParameterWrapper;
- result->SetParameter = SetParameterWrapper;
- result->GetConfig = GetConfigWrapper;
- result->SetConfig = SetConfigWrapper;
- result->GetExtensionIndex = GetExtensionIndexWrapper;
- result->GetState = GetStateWrapper;
- result->ComponentTunnelRequest = NULL;
- result->UseBuffer = UseBufferWrapper;
- result->AllocateBuffer = AllocateBufferWrapper;
- result->FreeBuffer = FreeBufferWrapper;
- result->EmptyThisBuffer = EmptyThisBufferWrapper;
- result->FillThisBuffer = FillThisBufferWrapper;
- result->SetCallbacks = NULL;
- result->ComponentDeInit = ComponentDeInitWrapper;
- result->UseEGLImage = NULL;
- result->ComponentRoleEnum = ComponentRoleEnumWrapper;
-
- base->setComponentHandle(result);
-
- return result;
-}
-
-} // namespace android
diff --git a/media/libstagefright/omx/OMXComponentBase.h b/media/libstagefright/omx/OMXComponentBase.h
deleted file mode 100644
index fd0df0b..0000000
--- a/media/libstagefright/omx/OMXComponentBase.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#ifndef OMX_COMPONENT_BASE_H_
-
-#define OMX_COMPONENT_BASE_H_
-
-#include <OMX_Component.h>
-
-namespace android {
-
-struct OMXComponentBase {
- OMXComponentBase(
- const OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData);
-
- virtual ~OMXComponentBase();
-
- virtual OMX_ERRORTYPE sendCommand(
- OMX_COMMANDTYPE cmd, OMX_U32 param, OMX_PTR cmdData) = 0;
-
- virtual OMX_ERRORTYPE getParameter(
- OMX_INDEXTYPE index, OMX_PTR params) = 0;
-
- virtual OMX_ERRORTYPE setParameter(
- OMX_INDEXTYPE index, const OMX_PTR params) = 0;
-
- virtual OMX_ERRORTYPE getConfig(
- OMX_INDEXTYPE index, OMX_PTR config) = 0;
-
- virtual OMX_ERRORTYPE setConfig(
- OMX_INDEXTYPE index, const OMX_PTR config) = 0;
-
- virtual OMX_ERRORTYPE getExtensionIndex(
- const OMX_STRING name, OMX_INDEXTYPE *index) = 0;
-
- virtual OMX_ERRORTYPE useBuffer(
- OMX_BUFFERHEADERTYPE **bufHdr,
- OMX_U32 portIndex,
- OMX_PTR appPrivate,
- OMX_U32 size,
- OMX_U8 *buffer) = 0;
-
- virtual OMX_ERRORTYPE allocateBuffer(
- OMX_BUFFERHEADERTYPE **bufHdr,
- OMX_U32 portIndex,
- OMX_PTR appPrivate,
- OMX_U32 size) = 0;
-
- virtual OMX_ERRORTYPE freeBuffer(
- OMX_U32 portIndex,
- OMX_BUFFERHEADERTYPE *buffer) = 0;
-
- virtual OMX_ERRORTYPE emptyThisBuffer(OMX_BUFFERHEADERTYPE *buffer) = 0;
- virtual OMX_ERRORTYPE fillThisBuffer(OMX_BUFFERHEADERTYPE *buffer) = 0;
-
- virtual OMX_ERRORTYPE enumerateRoles(OMX_U8 *role, OMX_U32 index) = 0;
-
- virtual OMX_ERRORTYPE getState(OMX_STATETYPE *state) = 0;
-
- // Wraps a given OMXComponentBase instance into an OMX_COMPONENTTYPE
- // as required by OpenMAX APIs.
- static OMX_COMPONENTTYPE *MakeComponent(OMXComponentBase *base);
-
-protected:
- void postEvent(OMX_EVENTTYPE event, OMX_U32 param1, OMX_U32 param2);
- void postFillBufferDone(OMX_BUFFERHEADERTYPE *bufHdr);
- void postEmptyBufferDone(OMX_BUFFERHEADERTYPE *bufHdr);
-
-private:
- void setComponentHandle(OMX_COMPONENTTYPE *handle);
-
- const OMX_CALLBACKTYPE *mCallbacks;
- OMX_PTR mAppData;
- OMX_COMPONENTTYPE *mComponentHandle;
-
- OMXComponentBase(const OMXComponentBase &);
- OMXComponentBase &operator=(const OMXComponentBase &);
-};
-
-} // namespace android
-
-#endif // OMX_COMPONENT_BASE_H_
diff --git a/media/libstagefright/omx/tests/Android.mk b/media/libstagefright/omx/tests/Android.mk
index 07d47a8..6aa7470 100644
--- a/media/libstagefright/omx/tests/Android.mk
+++ b/media/libstagefright/omx/tests/Android.mk
@@ -8,7 +8,6 @@
libstagefright libbinder libmedia libutils libstagefright_foundation
LOCAL_C_INCLUDES := \
- $(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
$(TOP)/frameworks/native/include/media/openmax
diff --git a/media/libstagefright/rtsp/Android.mk b/media/libstagefright/rtsp/Android.mk
index b3bc37c..e0fe59ba 100644
--- a/media/libstagefright/rtsp/Android.mk
+++ b/media/libstagefright/rtsp/Android.mk
@@ -18,7 +18,6 @@
ASessionDescription.cpp \
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
$(TOP)/frameworks/base/media/libstagefright/include \
$(TOP)/frameworks/native/include/media/openmax \
$(TOP)/external/openssl/include
@@ -45,7 +44,6 @@
libstagefright_rtsp
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
frameworks/base/media/libstagefright \
$(TOP)/frameworks/native/include/media/openmax
diff --git a/media/libstagefright/timedtext/Android.mk b/media/libstagefright/timedtext/Android.mk
index d2d5f7b..58ef9e3 100644
--- a/media/libstagefright/timedtext/Android.mk
+++ b/media/libstagefright/timedtext/Android.mk
@@ -11,7 +11,6 @@
LOCAL_CFLAGS += -Wno-multichar
LOCAL_C_INCLUDES:= \
- $(JNI_H_INCLUDE) \
$(TOP)/frameworks/base/include/media/stagefright/timedtext \
$(TOP)/frameworks/base/media/libstagefright
diff --git a/media/libstagefright/timedtext/TimedText3GPPSource.cpp b/media/libstagefright/timedtext/TimedText3GPPSource.cpp
index 4a3bfd3..4854121 100644
--- a/media/libstagefright/timedtext/TimedText3GPPSource.cpp
+++ b/media/libstagefright/timedtext/TimedText3GPPSource.cpp
@@ -39,19 +39,21 @@
}
status_t TimedText3GPPSource::read(
- int64_t *timeUs, Parcel *parcel, const MediaSource::ReadOptions *options) {
+ int64_t *startTimeUs, int64_t *endTimeUs, Parcel *parcel,
+ const MediaSource::ReadOptions *options) {
MediaBuffer *textBuffer = NULL;
status_t err = mSource->read(&textBuffer, options);
if (err != OK) {
return err;
}
CHECK(textBuffer != NULL);
- textBuffer->meta_data()->findInt64(kKeyTime, timeUs);
- // TODO: this is legacy code. when 'timeUs' can be <= 0?
- if (*timeUs > 0) {
- extractAndAppendLocalDescriptions(*timeUs, textBuffer, parcel);
- }
+ textBuffer->meta_data()->findInt64(kKeyTime, startTimeUs);
+ CHECK_GE(*startTimeUs, 0);
+ extractAndAppendLocalDescriptions(*startTimeUs, textBuffer, parcel);
textBuffer->release();
+ // endTimeUs is a dummy parameter for 3gpp timed text format.
+ // Set a negative value to it to mark it is unavailable.
+ *endTimeUs = -1;
return OK;
}
@@ -110,4 +112,8 @@
return OK;
}
+sp<MetaData> TimedText3GPPSource::getFormat() {
+ return mSource->getFormat();
+}
+
} // namespace android
diff --git a/media/libstagefright/timedtext/TimedText3GPPSource.h b/media/libstagefright/timedtext/TimedText3GPPSource.h
index dfc6418..4170940 100644
--- a/media/libstagefright/timedtext/TimedText3GPPSource.h
+++ b/media/libstagefright/timedtext/TimedText3GPPSource.h
@@ -33,10 +33,12 @@
virtual status_t start() { return mSource->start(); }
virtual status_t stop() { return mSource->stop(); }
virtual status_t read(
- int64_t *timeUs,
+ int64_t *startTimeUs,
+ int64_t *endTimeUs,
Parcel *parcel,
const MediaSource::ReadOptions *options = NULL);
virtual status_t extractGlobalDescriptions(Parcel *parcel);
+ virtual sp<MetaData> getFormat();
protected:
virtual ~TimedText3GPPSource();
diff --git a/media/libstagefright/timedtext/TimedTextDriver.cpp b/media/libstagefright/timedtext/TimedTextDriver.cpp
index c70870e..8ee15f8 100644
--- a/media/libstagefright/timedtext/TimedTextDriver.cpp
+++ b/media/libstagefright/timedtext/TimedTextDriver.cpp
@@ -20,10 +20,13 @@
#include <binder/IPCThreadState.h>
+#include <media/mediaplayer.h>
#include <media/MediaPlayerInterface.h>
+#include <media/stagefright/DataSource.h>
+#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MediaSource.h>
-#include <media/stagefright/DataSource.h>
+#include <media/stagefright/MetaData.h>
#include <media/stagefright/Utils.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/ALooper.h>
@@ -47,24 +50,22 @@
}
TimedTextDriver::~TimedTextDriver() {
- mTextInBandVector.clear();
- mTextOutOfBandVector.clear();
+ mTextSourceVector.clear();
mLooper->stop();
}
-status_t TimedTextDriver::setTimedTextTrackIndex_l(int32_t index) {
- if (index >=
- (int)(mTextInBandVector.size() + mTextOutOfBandVector.size())) {
+status_t TimedTextDriver::selectTrack_l(int32_t index) {
+ if (index >= (int)(mTextSourceVector.size())) {
return BAD_VALUE;
}
sp<TimedTextSource> source;
- if (index < mTextInBandVector.size()) {
- source = mTextInBandVector.itemAt(index);
- } else {
- source = mTextOutOfBandVector.itemAt(index - mTextInBandVector.size());
- }
+ source = mTextSourceVector.itemAt(index);
mPlayer->setDataSource(source);
+ if (mState == UNINITIALIZED) {
+ mState = PAUSED;
+ }
+ mCurrentTrackIndex = index;
return OK;
}
@@ -73,13 +74,10 @@
switch (mState) {
case UNINITIALIZED:
return INVALID_OPERATION;
- case STOPPED:
- mPlayer->start();
- break;
case PLAYING:
return OK;
case PAUSED:
- mPlayer->resume();
+ mPlayer->start();
break;
default:
TRESPASS();
@@ -88,10 +86,6 @@
return OK;
}
-status_t TimedTextDriver::stop() {
- return pause();
-}
-
// TODO: Test if pause() works properly.
// Scenario 1: start - pause - resume
// Scenario 2: start - seek
@@ -101,8 +95,6 @@
switch (mState) {
case UNINITIALIZED:
return INVALID_OPERATION;
- case STOPPED:
- return OK;
case PLAYING:
mPlayer->pause();
break;
@@ -115,45 +107,17 @@
return OK;
}
-status_t TimedTextDriver::resume() {
- return start();
-}
-
-status_t TimedTextDriver::seekToAsync(int64_t timeUs) {
- mPlayer->seekToAsync(timeUs);
- return OK;
-}
-
-status_t TimedTextDriver::setTimedTextTrackIndex(int32_t index) {
- // TODO: This is current implementation for MediaPlayer::disableTimedText().
- // Find better way for readability.
- if (index < 0) {
- mPlayer->pause();
- return OK;
- }
-
+status_t TimedTextDriver::selectTrack(int32_t index) {
status_t ret = OK;
Mutex::Autolock autoLock(mLock);
switch (mState) {
case UNINITIALIZED:
- ret = INVALID_OPERATION;
- break;
case PAUSED:
- ret = setTimedTextTrackIndex_l(index);
+ ret = selectTrack_l(index);
break;
case PLAYING:
mPlayer->pause();
- ret = setTimedTextTrackIndex_l(index);
- if (ret != OK) {
- break;
- }
- mPlayer->start();
- break;
- case STOPPED:
- // TODO: The only difference between STOPPED and PAUSED is this
- // part. Revise the flow from "MediaPlayer::enableTimedText()" and
- // remove one of the status, PAUSED and STOPPED, if possible.
- ret = setTimedTextTrackIndex_l(index);
+ ret = selectTrack_l(index);
if (ret != OK) {
break;
}
@@ -165,6 +129,24 @@
return ret;
}
+status_t TimedTextDriver::unselectTrack(int32_t index) {
+ if (mCurrentTrackIndex != index) {
+ return INVALID_OPERATION;
+ }
+ status_t err = pause();
+ if (err != OK) {
+ return err;
+ }
+ Mutex::Autolock autoLock(mLock);
+ mState = UNINITIALIZED;
+ return OK;
+}
+
+status_t TimedTextDriver::seekToAsync(int64_t timeUs) {
+ mPlayer->seekToAsync(timeUs);
+ return OK;
+}
+
status_t TimedTextDriver::addInBandTextSource(
const sp<MediaSource>& mediaSource) {
sp<TimedTextSource> source =
@@ -173,25 +155,17 @@
return ERROR_UNSUPPORTED;
}
Mutex::Autolock autoLock(mLock);
- mTextInBandVector.add(source);
- if (mState == UNINITIALIZED) {
- mState = STOPPED;
- }
+ mTextSourceVector.add(source);
return OK;
}
status_t TimedTextDriver::addOutOfBandTextSource(
- const Parcel &request) {
+ const char *uri, const char *mimeType) {
// TODO: Define "TimedTextSource::CreateFromURI(uri)"
// and move below lines there..?
- // String values written in Parcel are UTF-16 values.
- const String16 uri16 = request.readString16();
- String8 uri = String8(request.readString16());
-
- uri.toLower();
// To support local subtitle file only for now
- if (strncasecmp("file://", uri.string(), 7)) {
+ if (strncasecmp("file://", uri, 7)) {
return ERROR_UNSUPPORTED;
}
sp<DataSource> dataSource =
@@ -201,7 +175,7 @@
}
sp<TimedTextSource> source;
- if (uri.getPathExtension() == String8(".srt")) {
+ if (strcasecmp(mimeType, MEDIA_MIMETYPE_TEXT_SUBRIP) == 0) {
source = TimedTextSource::CreateTimedTextSource(
dataSource, TimedTextSource::OUT_OF_BAND_FILE_SRT);
}
@@ -211,12 +185,38 @@
}
Mutex::Autolock autoLock(mLock);
-
- mTextOutOfBandVector.add(source);
- if (mState == UNINITIALIZED) {
- mState = STOPPED;
- }
+ mTextSourceVector.add(source);
return OK;
}
+status_t TimedTextDriver::addOutOfBandTextSource(
+ int fd, off64_t offset, size_t length, const char *mimeType) {
+ // Not supported yet. This requires DataSource::sniff to detect various text
+ // formats such as srt/smi/ttml.
+ return ERROR_UNSUPPORTED;
+}
+
+void TimedTextDriver::getTrackInfo(Parcel *parcel) {
+ Mutex::Autolock autoLock(mLock);
+ Vector<sp<TimedTextSource> >::const_iterator iter;
+ parcel->writeInt32(mTextSourceVector.size());
+ for (iter = mTextSourceVector.begin();
+ iter != mTextSourceVector.end(); ++iter) {
+ sp<MetaData> meta = (*iter)->getFormat();
+ if (meta != NULL) {
+ // There are two fields.
+ parcel->writeInt32(2);
+
+ // track type.
+ parcel->writeInt32(MEDIA_TRACK_TYPE_TIMEDTEXT);
+
+ const char *lang = "und";
+ meta->findCString(kKeyMediaLanguage, &lang);
+ parcel->writeString16(String16(lang));
+ } else {
+ parcel->writeInt32(0);
+ }
+ }
+}
+
} // namespace android
diff --git a/media/libstagefright/timedtext/TimedTextPlayer.cpp b/media/libstagefright/timedtext/TimedTextPlayer.cpp
index bda7b46..917c62a9 100644
--- a/media/libstagefright/timedtext/TimedTextPlayer.cpp
+++ b/media/libstagefright/timedtext/TimedTextPlayer.cpp
@@ -31,6 +31,7 @@
namespace android {
static const int64_t kAdjustmentProcessingTimeUs = 100000ll;
+static const int64_t kWaitTimeUsToRetryRead = 100000ll;
TimedTextPlayer::TimedTextPlayer(const wp<MediaPlayerBase> &listener)
: mListener(listener),
@@ -56,10 +57,6 @@
(new AMessage(kWhatPause, id()))->post();
}
-void TimedTextPlayer::resume() {
- start();
-}
-
void TimedTextPlayer::seekToAsync(int64_t timeUs) {
sp<AMessage> msg = new AMessage(kWhatSeek, id());
msg->setInt64("seekTimeUs", timeUs);
@@ -104,9 +101,9 @@
if (obj != NULL) {
sp<ParcelEvent> parcelEvent;
parcelEvent = static_cast<ParcelEvent*>(obj.get());
- notifyListener(MEDIA_TIMED_TEXT, &(parcelEvent->parcel));
+ notifyListener(&(parcelEvent->parcel));
} else {
- notifyListener(MEDIA_TIMED_TEXT);
+ notifyListener();
}
doRead();
break;
@@ -119,14 +116,18 @@
mSource->stop();
}
mSource = static_cast<TimedTextSource*>(obj.get());
- mSource->start();
- Parcel parcel;
- if (mSource->extractGlobalDescriptions(&parcel) == OK &&
- parcel.dataSize() > 0) {
- notifyListener(MEDIA_TIMED_TEXT, &parcel);
- } else {
- notifyListener(MEDIA_TIMED_TEXT);
+ status_t err = mSource->start();
+ if (err != OK) {
+ notifyError(err);
+ break;
}
+ Parcel parcel;
+ err = mSource->extractGlobalDescriptions(&parcel);
+ if (err != OK) {
+ notifyError(err);
+ break;
+ }
+ notifyListener(&parcel);
break;
}
}
@@ -139,10 +140,26 @@
}
void TimedTextPlayer::doRead(MediaSource::ReadOptions* options) {
- int64_t timeUs = 0;
+ int64_t startTimeUs = 0;
+ int64_t endTimeUs = 0;
sp<ParcelEvent> parcelEvent = new ParcelEvent();
- mSource->read(&timeUs, &(parcelEvent->parcel), options);
- postTextEvent(parcelEvent, timeUs);
+ status_t err = mSource->read(&startTimeUs, &endTimeUs,
+ &(parcelEvent->parcel), options);
+ if (err == WOULD_BLOCK) {
+ postTextEventDelayUs(NULL, kWaitTimeUsToRetryRead);
+ return;
+ } else if (err != OK) {
+ notifyError(err);
+ return;
+ }
+
+ postTextEvent(parcelEvent, startTimeUs);
+ if (endTimeUs > 0) {
+ CHECK_GE(endTimeUs, startTimeUs);
+ // send an empty timed text to clear the subtitle when it reaches to the
+ // end time.
+ postTextEvent(NULL, endTimeUs);
+ }
}
void TimedTextPlayer::postTextEvent(const sp<ParcelEvent>& parcel, int64_t timeUs) {
@@ -151,13 +168,20 @@
int64_t positionUs, delayUs;
int32_t positionMs = 0;
listener->getCurrentPosition(&positionMs);
- positionUs = positionMs * 1000;
+ positionUs = positionMs * 1000ll;
if (timeUs <= positionUs + kAdjustmentProcessingTimeUs) {
delayUs = 0;
} else {
delayUs = timeUs - positionUs - kAdjustmentProcessingTimeUs;
}
+ postTextEventDelayUs(parcel, delayUs);
+ }
+}
+
+void TimedTextPlayer::postTextEventDelayUs(const sp<ParcelEvent>& parcel, int64_t delayUs) {
+ sp<MediaPlayerBase> listener = mListener.promote();
+ if (listener != NULL) {
sp<AMessage> msg = new AMessage(kWhatSendSubtitle, id());
msg->setInt32("generation", mSendSubtitleGeneration);
if (parcel != NULL) {
@@ -167,13 +191,20 @@
}
}
-void TimedTextPlayer::notifyListener(int msg, const Parcel *parcel) {
+void TimedTextPlayer::notifyError(int error) {
+ sp<MediaPlayerBase> listener = mListener.promote();
+ if (listener != NULL) {
+ listener->sendEvent(MEDIA_INFO, MEDIA_INFO_TIMED_TEXT_ERROR, error);
+ }
+}
+
+void TimedTextPlayer::notifyListener(const Parcel *parcel) {
sp<MediaPlayerBase> listener = mListener.promote();
if (listener != NULL) {
if (parcel != NULL && (parcel->dataSize() > 0)) {
- listener->sendEvent(msg, 0, 0, parcel);
+ listener->sendEvent(MEDIA_TIMED_TEXT, 0, 0, parcel);
} else { // send an empty timed text to clear the screen
- listener->sendEvent(msg);
+ listener->sendEvent(MEDIA_TIMED_TEXT);
}
}
}
diff --git a/media/libstagefright/timedtext/TimedTextPlayer.h b/media/libstagefright/timedtext/TimedTextPlayer.h
index 837beeb..47aff03 100644
--- a/media/libstagefright/timedtext/TimedTextPlayer.h
+++ b/media/libstagefright/timedtext/TimedTextPlayer.h
@@ -40,7 +40,6 @@
void start();
void pause();
- void resume();
void seekToAsync(int64_t timeUs);
void setDataSource(sp<TimedTextSource> source);
@@ -68,7 +67,9 @@
void doRead(MediaSource::ReadOptions* options = NULL);
void onTextEvent();
void postTextEvent(const sp<ParcelEvent>& parcel = NULL, int64_t timeUs = -1);
- void notifyListener(int msg, const Parcel *parcel = NULL);
+ void postTextEventDelayUs(const sp<ParcelEvent>& parcel = NULL, int64_t delayUs = -1);
+ void notifyError(int error = 0);
+ void notifyListener(const Parcel *parcel = NULL);
DISALLOW_EVIL_CONSTRUCTORS(TimedTextPlayer);
};
diff --git a/media/libstagefright/timedtext/TimedTextSRTSource.cpp b/media/libstagefright/timedtext/TimedTextSRTSource.cpp
index 3752d34..7b1f7f6 100644
--- a/media/libstagefright/timedtext/TimedTextSRTSource.cpp
+++ b/media/libstagefright/timedtext/TimedTextSRTSource.cpp
@@ -19,10 +19,13 @@
#include <utils/Log.h>
#include <binder/Parcel.h>
+#include <media/stagefright/foundation/ADebug.h> // for CHECK_xx
#include <media/stagefright/foundation/AString.h>
#include <media/stagefright/DataSource.h>
+#include <media/stagefright/MediaDefs.h> // for MEDIA_MIMETYPE_xxx
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MediaSource.h>
+#include <media/stagefright/MetaData.h>
#include "TimedTextSRTSource.h"
#include "TextDescriptions.h"
@@ -31,6 +34,7 @@
TimedTextSRTSource::TimedTextSRTSource(const sp<DataSource>& dataSource)
: mSource(dataSource),
+ mMetaData(new MetaData),
mIndex(0) {
}
@@ -42,10 +46,14 @@
if (err != OK) {
reset();
}
+ // TODO: Need to detect the language, because SRT doesn't give language
+ // information explicitly.
+ mMetaData->setCString(kKeyMediaLanguage, "");
return err;
}
void TimedTextSRTSource::reset() {
+ mMetaData->clear();
mTextVector.clear();
mIndex = 0;
}
@@ -56,19 +64,18 @@
}
status_t TimedTextSRTSource::read(
- int64_t *timeUs,
+ int64_t *startTimeUs,
+ int64_t *endTimeUs,
Parcel *parcel,
const MediaSource::ReadOptions *options) {
- int64_t endTimeUs;
AString text;
- status_t err = getText(options, &text, timeUs, &endTimeUs);
+ status_t err = getText(options, &text, startTimeUs, endTimeUs);
if (err != OK) {
return err;
}
- if (*timeUs > 0) {
- extractAndAppendLocalDescriptions(*timeUs, text, parcel);
- }
+ CHECK_GE(*startTimeUs, 0);
+ extractAndAppendLocalDescriptions(*startTimeUs, text, parcel);
return OK;
}
@@ -272,4 +279,8 @@
return OK;
}
+sp<MetaData> TimedTextSRTSource::getFormat() {
+ return mMetaData;
+}
+
} // namespace android
diff --git a/media/libstagefright/timedtext/TimedTextSRTSource.h b/media/libstagefright/timedtext/TimedTextSRTSource.h
index acc01f9..e1371b8 100644
--- a/media/libstagefright/timedtext/TimedTextSRTSource.h
+++ b/media/libstagefright/timedtext/TimedTextSRTSource.h
@@ -36,15 +36,18 @@
virtual status_t start();
virtual status_t stop();
virtual status_t read(
- int64_t *timeUs,
+ int64_t *startTimeUs,
+ int64_t *endTimeUs,
Parcel *parcel,
const MediaSource::ReadOptions *options = NULL);
+ virtual sp<MetaData> getFormat();
protected:
virtual ~TimedTextSRTSource();
private:
sp<DataSource> mSource;
+ sp<MetaData> mMetaData;
struct TextInfo {
int64_t endTimeUs;
diff --git a/media/libstagefright/timedtext/TimedTextSource.cpp b/media/libstagefright/timedtext/TimedTextSource.cpp
index ffbe1c3..953f7b5 100644
--- a/media/libstagefright/timedtext/TimedTextSource.cpp
+++ b/media/libstagefright/timedtext/TimedTextSource.cpp
@@ -59,4 +59,8 @@
return NULL;
}
+sp<MetaData> TimedTextSource::getFormat() {
+ return NULL;
+}
+
} // namespace android
diff --git a/media/libstagefright/timedtext/TimedTextSource.h b/media/libstagefright/timedtext/TimedTextSource.h
index 06bae71..756cc31 100644
--- a/media/libstagefright/timedtext/TimedTextSource.h
+++ b/media/libstagefright/timedtext/TimedTextSource.h
@@ -25,6 +25,7 @@
namespace android {
class DataSource;
+class MetaData;
class Parcel;
class TimedTextSource : public RefBase {
@@ -42,12 +43,14 @@
virtual status_t stop() = 0;
// Returns subtitle parcel and its start time.
virtual status_t read(
- int64_t *timeUs,
+ int64_t *startTimeUs,
+ int64_t *endTimeUs,
Parcel *parcel,
const MediaSource::ReadOptions *options = NULL) = 0;
virtual status_t extractGlobalDescriptions(Parcel *parcel) {
return INVALID_OPERATION;
}
+ virtual sp<MetaData> getFormat();
protected:
virtual ~TimedTextSource() { }
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
index 4f6e7d2..db64b94 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
@@ -101,6 +101,9 @@
protected void setUp() throws Exception {
super.setUp();
+ //Insert a 2 second before launching the test activity. This is
+ //the workaround for the race condition of requesting the updated surface.
+ Thread.sleep(2000);
getActivity();
if (MediaFrameworkPerfTestRunner.mGetNativeHeapDump)
MediaTestUtil.getNativeHeapDump(this.getName() + "_before");
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaPlayerStressTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaPlayerStressTest.java
index b2086d6..25b6e7f 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaPlayerStressTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaPlayerStressTest.java
@@ -43,13 +43,18 @@
/**
* Junit / Instrumentation test case for the media player
*/
-public class MediaPlayerStressTest extends InstrumentationTestCase {
+public class MediaPlayerStressTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
private String TAG = "MediaPlayerStressTest";
public MediaPlayerStressTest() {
+ super("com.android.mediaframeworktest", MediaFrameworkTest.class);
}
protected void setUp() throws Exception {
+ //Insert a 2 second before launching the test activity. This is
+ //the workaround for the race condition of requesting the updated surface.
+ Thread.sleep(2000);
+ getActivity();
super.setUp();
}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java
index 5e649e0..e9bc6f0 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java
@@ -88,7 +88,9 @@
if (! sem.tryAcquire(WAIT_TIMEOUT, TimeUnit.MILLISECONDS)) {
fail("Failed to start the looper.");
}
-
+ //Insert a 2 second before launching the test activity. This is
+ //the workaround for the race condition of requesting the updated surface.
+ Thread.sleep(2000);
getActivity();
super.setUp();
}
diff --git a/media/tests/omxjpegdecoder/Android.mk b/media/tests/omxjpegdecoder/Android.mk
index 3e09a5f..9dcc7ba 100644
--- a/media/tests/omxjpegdecoder/Android.mk
+++ b/media/tests/omxjpegdecoder/Android.mk
@@ -32,7 +32,6 @@
libjpeg
LOCAL_C_INCLUDES := \
- $(JNI_H_INCLUDE) \
$(TOP)/external/jpeg \
$(TOP)/external/skia/include/config \
$(TOP)/external/skia/include/core \
diff --git a/native/copy-to-ndk.sh b/native/copy-to-ndk.sh
index 6470892..90ff556 100644
--- a/native/copy-to-ndk.sh
+++ b/native/copy-to-ndk.sh
@@ -5,7 +5,7 @@
local CURR_PLATFORM=android-9
local ALL_PLATFORMS="$CURR_PLATFORM android-8 android-5 android-4 android-3"
- local SRC_HEADERS=$ANDROID_BUILD_TOP/frameworks/base/native/include/android
+ local SRC_HEADERS=$ANDROID_BUILD_TOP/frameworks/native/include/android
local NDK_PLATFORMS=$ANDROID_BUILD_TOP/development/ndk/platforms
local DST_HEADERS=$NDK_PLATFORMS/$CURR_PLATFORM
diff --git a/native/include/android/asset_manager.h b/native/include/android/asset_manager.h
deleted file mode 100644
index f5df46b..0000000
--- a/native/include/android/asset_manager.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-
-#ifndef ANDROID_ASSET_MANAGER_H
-#define ANDROID_ASSET_MANAGER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct AAssetManager;
-typedef struct AAssetManager AAssetManager;
-
-struct AAssetDir;
-typedef struct AAssetDir AAssetDir;
-
-struct AAsset;
-typedef struct AAsset AAsset;
-
-/* Available modes for opening assets */
-enum {
- AASSET_MODE_UNKNOWN = 0,
- AASSET_MODE_RANDOM = 1,
- AASSET_MODE_STREAMING = 2,
- AASSET_MODE_BUFFER = 3
-};
-
-
-/**
- * Open the named directory within the asset hierarchy. The directory can then
- * be inspected with the AAssetDir functions. To open the top-level directory,
- * pass in "" as the dirName.
- *
- * The object returned here should be freed by calling AAssetDir_close().
- */
-AAssetDir* AAssetManager_openDir(AAssetManager* mgr, const char* dirName);
-
-/**
- * Open an asset.
- *
- * The object returned here should be freed by calling AAsset_close().
- */
-AAsset* AAssetManager_open(AAssetManager* mgr, const char* filename, int mode);
-
-/**
- * Iterate over the files in an asset directory. A NULL string is returned
- * when all the file names have been returned.
- *
- * The returned file name is suitable for passing to AAssetManager_open().
- *
- * The string returned here is owned by the AssetDir implementation and is not
- * guaranteed to remain valid if any other calls are made on this AAssetDir
- * instance.
- */
-const char* AAssetDir_getNextFileName(AAssetDir* assetDir);
-
-/**
- * Reset the iteration state of AAssetDir_getNextFileName() to the beginning.
- */
-void AAssetDir_rewind(AAssetDir* assetDir);
-
-/**
- * Close an opened AAssetDir, freeing any related resources.
- */
-void AAssetDir_close(AAssetDir* assetDir);
-
-/**
- * Attempt to read 'count' bytes of data from the current offset.
- *
- * Returns the number of bytes read, zero on EOF, or < 0 on error.
- */
-int AAsset_read(AAsset* asset, void* buf, size_t count);
-
-/**
- * Seek to the specified offset within the asset data. 'whence' uses the
- * same constants as lseek()/fseek().
- *
- * Returns the new position on success, or (off_t) -1 on error.
- */
-off_t AAsset_seek(AAsset* asset, off_t offset, int whence);
-
-/**
- * Seek to the specified offset within the asset data. 'whence' uses the
- * same constants as lseek()/fseek().
- *
- * Uses 64-bit data type for large files as opposed to the 32-bit type used
- * by AAsset_seek.
- *
- * Returns the new position on success, or (off64_t) -1 on error.
- */
-off64_t AAsset_seek64(AAsset* asset, off64_t offset, int whence);
-
-/**
- * Close the asset, freeing all associated resources.
- */
-void AAsset_close(AAsset* asset);
-
-/**
- * Get a pointer to a buffer holding the entire contents of the assset.
- *
- * Returns NULL on failure.
- */
-const void* AAsset_getBuffer(AAsset* asset);
-
-/**
- * Report the total size of the asset data.
- */
-off_t AAsset_getLength(AAsset* asset);
-
-/**
- * Report the total size of the asset data. Reports the size using a 64-bit
- * number insted of 32-bit as AAsset_getLength.
- */
-off64_t AAsset_getLength64(AAsset* asset);
-
-/**
- * Report the total amount of asset data that can be read from the current position.
- */
-off_t AAsset_getRemainingLength(AAsset* asset);
-
-/**
- * Report the total amount of asset data that can be read from the current position.
- *
- * Uses a 64-bit number instead of a 32-bit number as AAsset_getRemainingLength does.
- */
-off64_t AAsset_getRemainingLength64(AAsset* asset);
-
-/**
- * Open a new file descriptor that can be used to read the asset data. If the
- * start or length cannot be represented by a 32-bit number, it will be
- * truncated. If the file is large, use AAsset_openFileDescriptor64 instead.
- *
- * Returns < 0 if direct fd access is not possible (for example, if the asset is
- * compressed).
- */
-int AAsset_openFileDescriptor(AAsset* asset, off_t* outStart, off_t* outLength);
-
-/**
- * Open a new file descriptor that can be used to read the asset data.
- *
- * Uses a 64-bit number for the offset and length instead of 32-bit instead of
- * as AAsset_openFileDescriptor does.
- *
- * Returns < 0 if direct fd access is not possible (for example, if the asset is
- * compressed).
- */
-int AAsset_openFileDescriptor64(AAsset* asset, off64_t* outStart, off64_t* outLength);
-
-/**
- * Returns whether this asset's internal buffer is allocated in ordinary RAM (i.e. not
- * mmapped).
- */
-int AAsset_isAllocated(AAsset* asset);
-
-
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // ANDROID_ASSET_MANAGER_H
diff --git a/native/include/android/asset_manager_jni.h b/native/include/android/asset_manager_jni.h
deleted file mode 100644
index aec2d3c..0000000
--- a/native/include/android/asset_manager_jni.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-
-#ifndef ANDROID_ASSET_MANAGER_JNI_H
-#define ANDROID_ASSET_MANAGER_JNI_H
-
-#include <android/asset_manager.h>
-#include <jni.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Given a Dalvik AssetManager object, obtain the corresponding native AAssetManager
- * object. Note that the caller is responsible for obtaining and holding a VM reference
- * to the jobject to prevent its being garbage collected while the native object is
- * in use.
- */
-AAssetManager* AAssetManager_fromJava(JNIEnv* env, jobject assetManager);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // ANDROID_ASSET_MANAGER_JNI_H
diff --git a/native/include/android/bitmap.h b/native/include/android/bitmap.h
deleted file mode 100644
index 5078277..0000000
--- a/native/include/android/bitmap.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#ifndef ANDROID_BITMAP_H
-#define ANDROID_BITMAP_H
-
-#include <stdint.h>
-#include <jni.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ANDROID_BITMAP_RESUT_SUCCESS 0
-#define ANDROID_BITMAP_RESULT_BAD_PARAMETER -1
-#define ANDROID_BITMAP_RESULT_JNI_EXCEPTION -2
-#define ANDROID_BITMAP_RESULT_ALLOCATION_FAILED -3
-
-enum AndroidBitmapFormat {
- ANDROID_BITMAP_FORMAT_NONE = 0,
- ANDROID_BITMAP_FORMAT_RGBA_8888 = 1,
- ANDROID_BITMAP_FORMAT_RGB_565 = 4,
- ANDROID_BITMAP_FORMAT_RGBA_4444 = 7,
- ANDROID_BITMAP_FORMAT_A_8 = 8,
-};
-
-typedef struct {
- uint32_t width;
- uint32_t height;
- uint32_t stride;
- int32_t format;
- uint32_t flags; // 0 for now
-} AndroidBitmapInfo;
-
-/**
- * Given a java bitmap object, fill out the AndroidBitmap struct for it.
- * If the call fails, the info parameter will be ignored
- */
-int AndroidBitmap_getInfo(JNIEnv* env, jobject jbitmap,
- AndroidBitmapInfo* info);
-
-/**
- * Given a java bitmap object, attempt to lock the pixel address.
- * Locking will ensure that the memory for the pixels will not move
- * until the unlockPixels call, and ensure that, if the pixels had been
- * previously purged, they will have been restored.
- *
- * If this call succeeds, it must be balanced by a call to
- * AndroidBitmap_unlockPixels, after which time the address of the pixels should
- * no longer be used.
- *
- * If this succeeds, *addrPtr will be set to the pixel address. If the call
- * fails, addrPtr will be ignored.
- */
-int AndroidBitmap_lockPixels(JNIEnv* env, jobject jbitmap, void** addrPtr);
-
-/**
- * Call this to balanace a successful call to AndroidBitmap_lockPixels
- */
-int AndroidBitmap_unlockPixels(JNIEnv* env, jobject jbitmap);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/native/include/android/configuration.h b/native/include/android/configuration.h
deleted file mode 100644
index 06cd3da..0000000
--- a/native/include/android/configuration.h
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef ANDROID_CONFIGURATION_H
-#define ANDROID_CONFIGURATION_H
-
-#include <android/asset_manager.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct AConfiguration;
-typedef struct AConfiguration AConfiguration;
-
-enum {
- ACONFIGURATION_ORIENTATION_ANY = 0x0000,
- ACONFIGURATION_ORIENTATION_PORT = 0x0001,
- ACONFIGURATION_ORIENTATION_LAND = 0x0002,
- ACONFIGURATION_ORIENTATION_SQUARE = 0x0003,
-
- ACONFIGURATION_TOUCHSCREEN_ANY = 0x0000,
- ACONFIGURATION_TOUCHSCREEN_NOTOUCH = 0x0001,
- ACONFIGURATION_TOUCHSCREEN_STYLUS = 0x0002,
- ACONFIGURATION_TOUCHSCREEN_FINGER = 0x0003,
-
- ACONFIGURATION_DENSITY_DEFAULT = 0,
- ACONFIGURATION_DENSITY_LOW = 120,
- ACONFIGURATION_DENSITY_MEDIUM = 160,
- ACONFIGURATION_DENSITY_TV = 213,
- ACONFIGURATION_DENSITY_HIGH = 240,
- ACONFIGURATION_DENSITY_XHIGH = 320,
- ACONFIGURATION_DENSITY_XXHIGH = 480,
- ACONFIGURATION_DENSITY_NONE = 0xffff,
-
- ACONFIGURATION_KEYBOARD_ANY = 0x0000,
- ACONFIGURATION_KEYBOARD_NOKEYS = 0x0001,
- ACONFIGURATION_KEYBOARD_QWERTY = 0x0002,
- ACONFIGURATION_KEYBOARD_12KEY = 0x0003,
-
- ACONFIGURATION_NAVIGATION_ANY = 0x0000,
- ACONFIGURATION_NAVIGATION_NONAV = 0x0001,
- ACONFIGURATION_NAVIGATION_DPAD = 0x0002,
- ACONFIGURATION_NAVIGATION_TRACKBALL = 0x0003,
- ACONFIGURATION_NAVIGATION_WHEEL = 0x0004,
-
- ACONFIGURATION_KEYSHIDDEN_ANY = 0x0000,
- ACONFIGURATION_KEYSHIDDEN_NO = 0x0001,
- ACONFIGURATION_KEYSHIDDEN_YES = 0x0002,
- ACONFIGURATION_KEYSHIDDEN_SOFT = 0x0003,
-
- ACONFIGURATION_NAVHIDDEN_ANY = 0x0000,
- ACONFIGURATION_NAVHIDDEN_NO = 0x0001,
- ACONFIGURATION_NAVHIDDEN_YES = 0x0002,
-
- ACONFIGURATION_SCREENSIZE_ANY = 0x00,
- ACONFIGURATION_SCREENSIZE_SMALL = 0x01,
- ACONFIGURATION_SCREENSIZE_NORMAL = 0x02,
- ACONFIGURATION_SCREENSIZE_LARGE = 0x03,
- ACONFIGURATION_SCREENSIZE_XLARGE = 0x04,
-
- ACONFIGURATION_SCREENLONG_ANY = 0x00,
- ACONFIGURATION_SCREENLONG_NO = 0x1,
- ACONFIGURATION_SCREENLONG_YES = 0x2,
-
- ACONFIGURATION_UI_MODE_TYPE_ANY = 0x00,
- ACONFIGURATION_UI_MODE_TYPE_NORMAL = 0x01,
- ACONFIGURATION_UI_MODE_TYPE_DESK = 0x02,
- ACONFIGURATION_UI_MODE_TYPE_CAR = 0x03,
- ACONFIGURATION_UI_MODE_TYPE_TELEVISION = 0x04,
- ACONFIGURATION_UI_MODE_TYPE_APPLIANCE = 0x05,
-
- ACONFIGURATION_UI_MODE_NIGHT_ANY = 0x00,
- ACONFIGURATION_UI_MODE_NIGHT_NO = 0x1,
- ACONFIGURATION_UI_MODE_NIGHT_YES = 0x2,
-
- ACONFIGURATION_SCREEN_WIDTH_DP_ANY = 0x0000,
-
- ACONFIGURATION_SCREEN_HEIGHT_DP_ANY = 0x0000,
-
- ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = 0x0000,
-
- ACONFIGURATION_MCC = 0x0001,
- ACONFIGURATION_MNC = 0x0002,
- ACONFIGURATION_LOCALE = 0x0004,
- ACONFIGURATION_TOUCHSCREEN = 0x0008,
- ACONFIGURATION_KEYBOARD = 0x0010,
- ACONFIGURATION_KEYBOARD_HIDDEN = 0x0020,
- ACONFIGURATION_NAVIGATION = 0x0040,
- ACONFIGURATION_ORIENTATION = 0x0080,
- ACONFIGURATION_DENSITY = 0x0100,
- ACONFIGURATION_SCREEN_SIZE = 0x0200,
- ACONFIGURATION_VERSION = 0x0400,
- ACONFIGURATION_SCREEN_LAYOUT = 0x0800,
- ACONFIGURATION_UI_MODE = 0x1000,
- ACONFIGURATION_SMALLEST_SCREEN_SIZE = 0x2000,
-};
-
-/**
- * Create a new AConfiguration, initialized with no values set.
- */
-AConfiguration* AConfiguration_new();
-
-/**
- * Free an AConfiguration that was previously created with
- * AConfiguration_new().
- */
-void AConfiguration_delete(AConfiguration* config);
-
-/**
- * Create and return a new AConfiguration based on the current configuration in
- * use in the given AssetManager.
- */
-void AConfiguration_fromAssetManager(AConfiguration* out, AAssetManager* am);
-
-/**
- * Copy the contents of 'src' to 'dest'.
- */
-void AConfiguration_copy(AConfiguration* dest, AConfiguration* src);
-
-/**
- * Return the current MCC set in the configuration. 0 if not set.
- */
-int32_t AConfiguration_getMcc(AConfiguration* config);
-
-/**
- * Set the current MCC in the configuration. 0 to clear.
- */
-void AConfiguration_setMcc(AConfiguration* config, int32_t mcc);
-
-/**
- * Return the current MNC set in the configuration. 0 if not set.
- */
-int32_t AConfiguration_getMnc(AConfiguration* config);
-
-/**
- * Set the current MNC in the configuration. 0 to clear.
- */
-void AConfiguration_setMnc(AConfiguration* config, int32_t mnc);
-
-/**
- * Return the current language code set in the configuration. The output will
- * be filled with an array of two characters. They are not 0-terminated. If
- * a language is not set, they will be 0.
- */
-void AConfiguration_getLanguage(AConfiguration* config, char* outLanguage);
-
-/**
- * Set the current language code in the configuration, from the first two
- * characters in the string.
- */
-void AConfiguration_setLanguage(AConfiguration* config, const char* language);
-
-/**
- * Return the current country code set in the configuration. The output will
- * be filled with an array of two characters. They are not 0-terminated. If
- * a country is not set, they will be 0.
- */
-void AConfiguration_getCountry(AConfiguration* config, char* outCountry);
-
-/**
- * Set the current country code in the configuration, from the first two
- * characters in the string.
- */
-void AConfiguration_setCountry(AConfiguration* config, const char* country);
-
-/**
- * Return the current ACONFIGURATION_ORIENTATION_* set in the configuration.
- */
-int32_t AConfiguration_getOrientation(AConfiguration* config);
-
-/**
- * Set the current orientation in the configuration.
- */
-void AConfiguration_setOrientation(AConfiguration* config, int32_t orientation);
-
-/**
- * Return the current ACONFIGURATION_TOUCHSCREEN_* set in the configuration.
- */
-int32_t AConfiguration_getTouchscreen(AConfiguration* config);
-
-/**
- * Set the current touchscreen in the configuration.
- */
-void AConfiguration_setTouchscreen(AConfiguration* config, int32_t touchscreen);
-
-/**
- * Return the current ACONFIGURATION_DENSITY_* set in the configuration.
- */
-int32_t AConfiguration_getDensity(AConfiguration* config);
-
-/**
- * Set the current density in the configuration.
- */
-void AConfiguration_setDensity(AConfiguration* config, int32_t density);
-
-/**
- * Return the current ACONFIGURATION_KEYBOARD_* set in the configuration.
- */
-int32_t AConfiguration_getKeyboard(AConfiguration* config);
-
-/**
- * Set the current keyboard in the configuration.
- */
-void AConfiguration_setKeyboard(AConfiguration* config, int32_t keyboard);
-
-/**
- * Return the current ACONFIGURATION_NAVIGATION_* set in the configuration.
- */
-int32_t AConfiguration_getNavigation(AConfiguration* config);
-
-/**
- * Set the current navigation in the configuration.
- */
-void AConfiguration_setNavigation(AConfiguration* config, int32_t navigation);
-
-/**
- * Return the current ACONFIGURATION_KEYSHIDDEN_* set in the configuration.
- */
-int32_t AConfiguration_getKeysHidden(AConfiguration* config);
-
-/**
- * Set the current keys hidden in the configuration.
- */
-void AConfiguration_setKeysHidden(AConfiguration* config, int32_t keysHidden);
-
-/**
- * Return the current ACONFIGURATION_NAVHIDDEN_* set in the configuration.
- */
-int32_t AConfiguration_getNavHidden(AConfiguration* config);
-
-/**
- * Set the current nav hidden in the configuration.
- */
-void AConfiguration_setNavHidden(AConfiguration* config, int32_t navHidden);
-
-/**
- * Return the current SDK (API) version set in the configuration.
- */
-int32_t AConfiguration_getSdkVersion(AConfiguration* config);
-
-/**
- * Set the current SDK version in the configuration.
- */
-void AConfiguration_setSdkVersion(AConfiguration* config, int32_t sdkVersion);
-
-/**
- * Return the current ACONFIGURATION_SCREENSIZE_* set in the configuration.
- */
-int32_t AConfiguration_getScreenSize(AConfiguration* config);
-
-/**
- * Set the current screen size in the configuration.
- */
-void AConfiguration_setScreenSize(AConfiguration* config, int32_t screenSize);
-
-/**
- * Return the current ACONFIGURATION_SCREENLONG_* set in the configuration.
- */
-int32_t AConfiguration_getScreenLong(AConfiguration* config);
-
-/**
- * Set the current screen long in the configuration.
- */
-void AConfiguration_setScreenLong(AConfiguration* config, int32_t screenLong);
-
-/**
- * Return the current ACONFIGURATION_UI_MODE_TYPE_* set in the configuration.
- */
-int32_t AConfiguration_getUiModeType(AConfiguration* config);
-
-/**
- * Set the current UI mode type in the configuration.
- */
-void AConfiguration_setUiModeType(AConfiguration* config, int32_t uiModeType);
-
-/**
- * Return the current ACONFIGURATION_UI_MODE_NIGHT_* set in the configuration.
- */
-int32_t AConfiguration_getUiModeNight(AConfiguration* config);
-
-/**
- * Set the current UI mode night in the configuration.
- */
-void AConfiguration_setUiModeNight(AConfiguration* config, int32_t uiModeNight);
-
-/**
- * Return the current configuration screen width in dp units, or
- * ACONFIGURATION_SCREEN_WIDTH_DP_ANY if not set.
- */
-int32_t AConfiguration_getScreenWidthDp(AConfiguration* config);
-
-/**
- * Set the configuration's current screen width in dp units.
- */
-void AConfiguration_setScreenWidthDp(AConfiguration* config, int32_t value);
-
-/**
- * Return the current configuration screen height in dp units, or
- * ACONFIGURATION_SCREEN_HEIGHT_DP_ANY if not set.
- */
-int32_t AConfiguration_getScreenHeightDp(AConfiguration* config);
-
-/**
- * Set the configuration's current screen width in dp units.
- */
-void AConfiguration_setScreenHeightDp(AConfiguration* config, int32_t value);
-
-/**
- * Return the configuration's smallest screen width in dp units, or
- * ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY if not set.
- */
-int32_t AConfiguration_getSmallestScreenWidthDp(AConfiguration* config);
-
-/**
- * Set the configuration's smallest screen width in dp units.
- */
-void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value);
-
-/**
- * Perform a diff between two configurations. Returns a bit mask of
- * ACONFIGURATION_* constants, each bit set meaning that configuration element
- * is different between them.
- */
-int32_t AConfiguration_diff(AConfiguration* config1, AConfiguration* config2);
-
-/**
- * Determine whether 'base' is a valid configuration for use within the
- * environment 'requested'. Returns 0 if there are any values in 'base'
- * that conflict with 'requested'. Returns 1 if it does not conflict.
- */
-int32_t AConfiguration_match(AConfiguration* base, AConfiguration* requested);
-
-/**
- * Determine whether the configuration in 'test' is better than the existing
- * configuration in 'base'. If 'requested' is non-NULL, this decision is based
- * on the overall configuration given there. If it is NULL, this decision is
- * simply based on which configuration is more specific. Returns non-0 if
- * 'test' is better than 'base'.
- *
- * This assumes you have already filtered the configurations with
- * AConfiguration_match().
- */
-int32_t AConfiguration_isBetterThan(AConfiguration* base, AConfiguration* test,
- AConfiguration* requested);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // ANDROID_CONFIGURATION_H
diff --git a/native/include/android/input.h b/native/include/android/input.h
deleted file mode 100644
index f2befa9e..0000000
--- a/native/include/android/input.h
+++ /dev/null
@@ -1,848 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef _ANDROID_INPUT_H
-#define _ANDROID_INPUT_H
-
-/******************************************************************
- *
- * IMPORTANT NOTICE:
- *
- * This file is part of Android's set of stable system headers
- * exposed by the Android NDK (Native Development Kit).
- *
- * Third-party source AND binary code relies on the definitions
- * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
- *
- * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
- * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
- * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
- * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
- */
-
-/*
- * Structures and functions to receive and process input events in
- * native code.
- *
- * NOTE: These functions MUST be implemented by /system/lib/libui.so
- */
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <android/keycodes.h>
-#include <android/looper.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Key states (may be returned by queries about the current state of a
- * particular key code, scan code or switch).
- */
-enum {
- /* The key state is unknown or the requested key itself is not supported. */
- AKEY_STATE_UNKNOWN = -1,
-
- /* The key is up. */
- AKEY_STATE_UP = 0,
-
- /* The key is down. */
- AKEY_STATE_DOWN = 1,
-
- /* The key is down but is a virtual key press that is being emulated by the system. */
- AKEY_STATE_VIRTUAL = 2
-};
-
-/*
- * Meta key / modifer state.
- */
-enum {
- /* No meta keys are pressed. */
- AMETA_NONE = 0,
-
- /* This mask is used to check whether one of the ALT meta keys is pressed. */
- AMETA_ALT_ON = 0x02,
-
- /* This mask is used to check whether the left ALT meta key is pressed. */
- AMETA_ALT_LEFT_ON = 0x10,
-
- /* This mask is used to check whether the right ALT meta key is pressed. */
- AMETA_ALT_RIGHT_ON = 0x20,
-
- /* This mask is used to check whether one of the SHIFT meta keys is pressed. */
- AMETA_SHIFT_ON = 0x01,
-
- /* This mask is used to check whether the left SHIFT meta key is pressed. */
- AMETA_SHIFT_LEFT_ON = 0x40,
-
- /* This mask is used to check whether the right SHIFT meta key is pressed. */
- AMETA_SHIFT_RIGHT_ON = 0x80,
-
- /* This mask is used to check whether the SYM meta key is pressed. */
- AMETA_SYM_ON = 0x04,
-
- /* This mask is used to check whether the FUNCTION meta key is pressed. */
- AMETA_FUNCTION_ON = 0x08,
-
- /* This mask is used to check whether one of the CTRL meta keys is pressed. */
- AMETA_CTRL_ON = 0x1000,
-
- /* This mask is used to check whether the left CTRL meta key is pressed. */
- AMETA_CTRL_LEFT_ON = 0x2000,
-
- /* This mask is used to check whether the right CTRL meta key is pressed. */
- AMETA_CTRL_RIGHT_ON = 0x4000,
-
- /* This mask is used to check whether one of the META meta keys is pressed. */
- AMETA_META_ON = 0x10000,
-
- /* This mask is used to check whether the left META meta key is pressed. */
- AMETA_META_LEFT_ON = 0x20000,
-
- /* This mask is used to check whether the right META meta key is pressed. */
- AMETA_META_RIGHT_ON = 0x40000,
-
- /* This mask is used to check whether the CAPS LOCK meta key is on. */
- AMETA_CAPS_LOCK_ON = 0x100000,
-
- /* This mask is used to check whether the NUM LOCK meta key is on. */
- AMETA_NUM_LOCK_ON = 0x200000,
-
- /* This mask is used to check whether the SCROLL LOCK meta key is on. */
- AMETA_SCROLL_LOCK_ON = 0x400000,
-};
-
-/*
- * Input events.
- *
- * Input events are opaque structures. Use the provided accessors functions to
- * read their properties.
- */
-struct AInputEvent;
-typedef struct AInputEvent AInputEvent;
-
-/*
- * Input event types.
- */
-enum {
- /* Indicates that the input event is a key event. */
- AINPUT_EVENT_TYPE_KEY = 1,
-
- /* Indicates that the input event is a motion event. */
- AINPUT_EVENT_TYPE_MOTION = 2
-};
-
-/*
- * Key event actions.
- */
-enum {
- /* The key has been pressed down. */
- AKEY_EVENT_ACTION_DOWN = 0,
-
- /* The key has been released. */
- AKEY_EVENT_ACTION_UP = 1,
-
- /* Multiple duplicate key events have occurred in a row, or a complex string is
- * being delivered. The repeat_count property of the key event contains the number
- * of times the given key code should be executed.
- */
- AKEY_EVENT_ACTION_MULTIPLE = 2
-};
-
-/*
- * Key event flags.
- */
-enum {
- /* This mask is set if the device woke because of this key event. */
- AKEY_EVENT_FLAG_WOKE_HERE = 0x1,
-
- /* This mask is set if the key event was generated by a software keyboard. */
- AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2,
-
- /* This mask is set if we don't want the key event to cause us to leave touch mode. */
- AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4,
-
- /* This mask is set if an event was known to come from a trusted part
- * of the system. That is, the event is known to come from the user,
- * and could not have been spoofed by a third party component. */
- AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8,
-
- /* This mask is used for compatibility, to identify enter keys that are
- * coming from an IME whose enter key has been auto-labelled "next" or
- * "done". This allows TextView to dispatch these as normal enter keys
- * for old applications, but still do the appropriate action when
- * receiving them. */
- AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10,
-
- /* When associated with up key events, this indicates that the key press
- * has been canceled. Typically this is used with virtual touch screen
- * keys, where the user can slide from the virtual key area on to the
- * display: in that case, the application will receive a canceled up
- * event and should not perform the action normally associated with the
- * key. Note that for this to work, the application can not perform an
- * action for a key until it receives an up or the long press timeout has
- * expired. */
- AKEY_EVENT_FLAG_CANCELED = 0x20,
-
- /* This key event was generated by a virtual (on-screen) hard key area.
- * Typically this is an area of the touchscreen, outside of the regular
- * display, dedicated to "hardware" buttons. */
- AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40,
-
- /* This flag is set for the first key repeat that occurs after the
- * long press timeout. */
- AKEY_EVENT_FLAG_LONG_PRESS = 0x80,
-
- /* Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long
- * press action was executed while it was down. */
- AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100,
-
- /* Set for AKEY_EVENT_ACTION_UP when this event's key code is still being
- * tracked from its initial down. That is, somebody requested that tracking
- * started on the key down and a long press has not caused
- * the tracking to be canceled. */
- AKEY_EVENT_FLAG_TRACKING = 0x200,
-
- /* Set when a key event has been synthesized to implement default behavior
- * for an event that the application did not handle.
- * Fallback key events are generated by unhandled trackball motions
- * (to emulate a directional keypad) and by certain unhandled key presses
- * that are declared in the key map (such as special function numeric keypad
- * keys when numlock is off). */
- AKEY_EVENT_FLAG_FALLBACK = 0x400,
-};
-
-/*
- * Motion event actions.
- */
-
-/* Bit shift for the action bits holding the pointer index as
- * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK.
- */
-#define AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8
-
-enum {
- /* Bit mask of the parts of the action code that are the action itself.
- */
- AMOTION_EVENT_ACTION_MASK = 0xff,
-
- /* Bits in the action code that represent a pointer index, used with
- * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP. Shifting
- * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer
- * index where the data for the pointer going up or down can be found.
- */
- AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00,
-
- /* A pressed gesture has started, the motion contains the initial starting location.
- */
- AMOTION_EVENT_ACTION_DOWN = 0,
-
- /* A pressed gesture has finished, the motion contains the final release location
- * as well as any intermediate points since the last down or move event.
- */
- AMOTION_EVENT_ACTION_UP = 1,
-
- /* A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and
- * AMOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as
- * any intermediate points since the last down or move event.
- */
- AMOTION_EVENT_ACTION_MOVE = 2,
-
- /* The current gesture has been aborted.
- * You will not receive any more points in it. You should treat this as
- * an up event, but not perform any action that you normally would.
- */
- AMOTION_EVENT_ACTION_CANCEL = 3,
-
- /* A movement has happened outside of the normal bounds of the UI element.
- * This does not provide a full gesture, but only the initial location of the movement/touch.
- */
- AMOTION_EVENT_ACTION_OUTSIDE = 4,
-
- /* A non-primary pointer has gone down.
- * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
- */
- AMOTION_EVENT_ACTION_POINTER_DOWN = 5,
-
- /* A non-primary pointer has gone up.
- * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
- */
- AMOTION_EVENT_ACTION_POINTER_UP = 6,
-
- /* A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE).
- * The motion contains the most recent point, as well as any intermediate points since
- * the last hover move event.
- */
- AMOTION_EVENT_ACTION_HOVER_MOVE = 7,
-
- /* The motion event contains relative vertical and/or horizontal scroll offsets.
- * Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL
- * and AMOTION_EVENT_AXIS_HSCROLL.
- * The pointer may or may not be down when this event is dispatched.
- * This action is always delivered to the winder under the pointer, which
- * may not be the window currently touched.
- */
- AMOTION_EVENT_ACTION_SCROLL = 8,
-
- /* The pointer is not down but has entered the boundaries of a window or view.
- */
- AMOTION_EVENT_ACTION_HOVER_ENTER = 9,
-
- /* The pointer is not down but has exited the boundaries of a window or view.
- */
- AMOTION_EVENT_ACTION_HOVER_EXIT = 10,
-};
-
-/*
- * Motion event flags.
- */
-enum {
- /* This flag indicates that the window that received this motion event is partly
- * or wholly obscured by another visible window above it. This flag is set to true
- * even if the event did not directly pass through the obscured area.
- * A security sensitive application can check this flag to identify situations in which
- * a malicious application may have covered up part of its content for the purpose
- * of misleading the user or hijacking touches. An appropriate response might be
- * to drop the suspect touches or to take additional precautions to confirm the user's
- * actual intent.
- */
- AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1,
-};
-
-/*
- * Motion event edge touch flags.
- */
-enum {
- /* No edges intersected */
- AMOTION_EVENT_EDGE_FLAG_NONE = 0,
-
- /* Flag indicating the motion event intersected the top edge of the screen. */
- AMOTION_EVENT_EDGE_FLAG_TOP = 0x01,
-
- /* Flag indicating the motion event intersected the bottom edge of the screen. */
- AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02,
-
- /* Flag indicating the motion event intersected the left edge of the screen. */
- AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04,
-
- /* Flag indicating the motion event intersected the right edge of the screen. */
- AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08
-};
-
-/*
- * Constants that identify each individual axis of a motion event.
- * Refer to the documentation on the MotionEvent class for descriptions of each axis.
- */
-enum {
- AMOTION_EVENT_AXIS_X = 0,
- AMOTION_EVENT_AXIS_Y = 1,
- AMOTION_EVENT_AXIS_PRESSURE = 2,
- AMOTION_EVENT_AXIS_SIZE = 3,
- AMOTION_EVENT_AXIS_TOUCH_MAJOR = 4,
- AMOTION_EVENT_AXIS_TOUCH_MINOR = 5,
- AMOTION_EVENT_AXIS_TOOL_MAJOR = 6,
- AMOTION_EVENT_AXIS_TOOL_MINOR = 7,
- AMOTION_EVENT_AXIS_ORIENTATION = 8,
- AMOTION_EVENT_AXIS_VSCROLL = 9,
- AMOTION_EVENT_AXIS_HSCROLL = 10,
- AMOTION_EVENT_AXIS_Z = 11,
- AMOTION_EVENT_AXIS_RX = 12,
- AMOTION_EVENT_AXIS_RY = 13,
- AMOTION_EVENT_AXIS_RZ = 14,
- AMOTION_EVENT_AXIS_HAT_X = 15,
- AMOTION_EVENT_AXIS_HAT_Y = 16,
- AMOTION_EVENT_AXIS_LTRIGGER = 17,
- AMOTION_EVENT_AXIS_RTRIGGER = 18,
- AMOTION_EVENT_AXIS_THROTTLE = 19,
- AMOTION_EVENT_AXIS_RUDDER = 20,
- AMOTION_EVENT_AXIS_WHEEL = 21,
- AMOTION_EVENT_AXIS_GAS = 22,
- AMOTION_EVENT_AXIS_BRAKE = 23,
- AMOTION_EVENT_AXIS_DISTANCE = 24,
- AMOTION_EVENT_AXIS_TILT = 25,
- AMOTION_EVENT_AXIS_GENERIC_1 = 32,
- AMOTION_EVENT_AXIS_GENERIC_2 = 33,
- AMOTION_EVENT_AXIS_GENERIC_3 = 34,
- AMOTION_EVENT_AXIS_GENERIC_4 = 35,
- AMOTION_EVENT_AXIS_GENERIC_5 = 36,
- AMOTION_EVENT_AXIS_GENERIC_6 = 37,
- AMOTION_EVENT_AXIS_GENERIC_7 = 38,
- AMOTION_EVENT_AXIS_GENERIC_8 = 39,
- AMOTION_EVENT_AXIS_GENERIC_9 = 40,
- AMOTION_EVENT_AXIS_GENERIC_10 = 41,
- AMOTION_EVENT_AXIS_GENERIC_11 = 42,
- AMOTION_EVENT_AXIS_GENERIC_12 = 43,
- AMOTION_EVENT_AXIS_GENERIC_13 = 44,
- AMOTION_EVENT_AXIS_GENERIC_14 = 45,
- AMOTION_EVENT_AXIS_GENERIC_15 = 46,
- AMOTION_EVENT_AXIS_GENERIC_16 = 47,
-
- // NOTE: If you add a new axis here you must also add it to several other files.
- // Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list.
-};
-
-/*
- * Constants that identify buttons that are associated with motion events.
- * Refer to the documentation on the MotionEvent class for descriptions of each button.
- */
-enum {
- AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0,
- AMOTION_EVENT_BUTTON_SECONDARY = 1 << 1,
- AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2,
- AMOTION_EVENT_BUTTON_BACK = 1 << 3,
- AMOTION_EVENT_BUTTON_FORWARD = 1 << 4,
-};
-
-/*
- * Constants that identify tool types.
- * Refer to the documentation on the MotionEvent class for descriptions of each tool type.
- */
-enum {
- AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0,
- AMOTION_EVENT_TOOL_TYPE_FINGER = 1,
- AMOTION_EVENT_TOOL_TYPE_STYLUS = 2,
- AMOTION_EVENT_TOOL_TYPE_MOUSE = 3,
- AMOTION_EVENT_TOOL_TYPE_ERASER = 4,
-};
-
-/*
- * Input sources.
- *
- * Refer to the documentation on android.view.InputDevice for more details about input sources
- * and their correct interpretation.
- */
-enum {
- AINPUT_SOURCE_CLASS_MASK = 0x000000ff,
-
- AINPUT_SOURCE_CLASS_BUTTON = 0x00000001,
- AINPUT_SOURCE_CLASS_POINTER = 0x00000002,
- AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004,
- AINPUT_SOURCE_CLASS_POSITION = 0x00000008,
- AINPUT_SOURCE_CLASS_JOYSTICK = 0x00000010,
-};
-
-enum {
- AINPUT_SOURCE_UNKNOWN = 0x00000000,
-
- AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON,
- AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON,
- AINPUT_SOURCE_GAMEPAD = 0x00000400 | AINPUT_SOURCE_CLASS_BUTTON,
- AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER,
- AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER,
- AINPUT_SOURCE_STYLUS = 0x00004000 | AINPUT_SOURCE_CLASS_POINTER,
- AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION,
- AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION,
- AINPUT_SOURCE_JOYSTICK = 0x01000000 | AINPUT_SOURCE_CLASS_JOYSTICK,
-
- AINPUT_SOURCE_ANY = 0xffffff00,
-};
-
-/*
- * Keyboard types.
- *
- * Refer to the documentation on android.view.InputDevice for more details.
- */
-enum {
- AINPUT_KEYBOARD_TYPE_NONE = 0,
- AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1,
- AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2,
-};
-
-/*
- * Constants used to retrieve information about the range of motion for a particular
- * coordinate of a motion event.
- *
- * Refer to the documentation on android.view.InputDevice for more details about input sources
- * and their correct interpretation.
- *
- * DEPRECATION NOTICE: These constants are deprecated. Use AMOTION_EVENT_AXIS_* constants instead.
- */
-enum {
- AINPUT_MOTION_RANGE_X = AMOTION_EVENT_AXIS_X,
- AINPUT_MOTION_RANGE_Y = AMOTION_EVENT_AXIS_Y,
- AINPUT_MOTION_RANGE_PRESSURE = AMOTION_EVENT_AXIS_PRESSURE,
- AINPUT_MOTION_RANGE_SIZE = AMOTION_EVENT_AXIS_SIZE,
- AINPUT_MOTION_RANGE_TOUCH_MAJOR = AMOTION_EVENT_AXIS_TOUCH_MAJOR,
- AINPUT_MOTION_RANGE_TOUCH_MINOR = AMOTION_EVENT_AXIS_TOUCH_MINOR,
- AINPUT_MOTION_RANGE_TOOL_MAJOR = AMOTION_EVENT_AXIS_TOOL_MAJOR,
- AINPUT_MOTION_RANGE_TOOL_MINOR = AMOTION_EVENT_AXIS_TOOL_MINOR,
- AINPUT_MOTION_RANGE_ORIENTATION = AMOTION_EVENT_AXIS_ORIENTATION,
-} __attribute__ ((deprecated));
-
-
-/*
- * Input event accessors.
- *
- * Note that most functions can only be used on input events that are of a given type.
- * Calling these functions on input events of other types will yield undefined behavior.
- */
-
-/*** Accessors for all input events. ***/
-
-/* Get the input event type. */
-int32_t AInputEvent_getType(const AInputEvent* event);
-
-/* Get the id for the device that an input event came from.
- *
- * Input events can be generated by multiple different input devices.
- * Use the input device id to obtain information about the input
- * device that was responsible for generating a particular event.
- *
- * An input device id of 0 indicates that the event didn't come from a physical device;
- * other numbers are arbitrary and you shouldn't depend on the values.
- * Use the provided input device query API to obtain information about input devices.
- */
-int32_t AInputEvent_getDeviceId(const AInputEvent* event);
-
-/* Get the input event source. */
-int32_t AInputEvent_getSource(const AInputEvent* event);
-
-/*** Accessors for key events only. ***/
-
-/* Get the key event action. */
-int32_t AKeyEvent_getAction(const AInputEvent* key_event);
-
-/* Get the key event flags. */
-int32_t AKeyEvent_getFlags(const AInputEvent* key_event);
-
-/* Get the key code of the key event.
- * This is the physical key that was pressed, not the Unicode character. */
-int32_t AKeyEvent_getKeyCode(const AInputEvent* key_event);
-
-/* Get the hardware key id of this key event.
- * These values are not reliable and vary from device to device. */
-int32_t AKeyEvent_getScanCode(const AInputEvent* key_event);
-
-/* Get the meta key state. */
-int32_t AKeyEvent_getMetaState(const AInputEvent* key_event);
-
-/* Get the repeat count of the event.
- * For both key up an key down events, this is the number of times the key has
- * repeated with the first down starting at 0 and counting up from there. For
- * multiple key events, this is the number of down/up pairs that have occurred. */
-int32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event);
-
-/* Get the time of the most recent key down event, in the
- * java.lang.System.nanoTime() time base. If this is a down event,
- * this will be the same as eventTime.
- * Note that when chording keys, this value is the down time of the most recently
- * pressed key, which may not be the same physical key of this event. */
-int64_t AKeyEvent_getDownTime(const AInputEvent* key_event);
-
-/* Get the time this event occurred, in the
- * java.lang.System.nanoTime() time base. */
-int64_t AKeyEvent_getEventTime(const AInputEvent* key_event);
-
-/*** Accessors for motion events only. ***/
-
-/* Get the combined motion event action code and pointer index. */
-int32_t AMotionEvent_getAction(const AInputEvent* motion_event);
-
-/* Get the motion event flags. */
-int32_t AMotionEvent_getFlags(const AInputEvent* motion_event);
-
-/* Get the state of any meta / modifier keys that were in effect when the
- * event was generated. */
-int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event);
-
-/* Get the button state of all buttons that are pressed. */
-int32_t AMotionEvent_getButtonState(const AInputEvent* motion_event);
-
-/* Get a bitfield indicating which edges, if any, were touched by this motion event.
- * For touch events, clients can use this to determine if the user's finger was
- * touching the edge of the display. */
-int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event);
-
-/* Get the time when the user originally pressed down to start a stream of
- * position events, in the java.lang.System.nanoTime() time base. */
-int64_t AMotionEvent_getDownTime(const AInputEvent* motion_event);
-
-/* Get the time when this specific event was generated,
- * in the java.lang.System.nanoTime() time base. */
-int64_t AMotionEvent_getEventTime(const AInputEvent* motion_event);
-
-/* Get the X coordinate offset.
- * For touch events on the screen, this is the delta that was added to the raw
- * screen coordinates to adjust for the absolute position of the containing windows
- * and views. */
-float AMotionEvent_getXOffset(const AInputEvent* motion_event);
-
-/* Get the precision of the Y coordinates being reported.
- * For touch events on the screen, this is the delta that was added to the raw
- * screen coordinates to adjust for the absolute position of the containing windows
- * and views. */
-float AMotionEvent_getYOffset(const AInputEvent* motion_event);
-
-/* Get the precision of the X coordinates being reported.
- * You can multiply this number with an X coordinate sample to find the
- * actual hardware value of the X coordinate. */
-float AMotionEvent_getXPrecision(const AInputEvent* motion_event);
-
-/* Get the precision of the Y coordinates being reported.
- * You can multiply this number with a Y coordinate sample to find the
- * actual hardware value of the Y coordinate. */
-float AMotionEvent_getYPrecision(const AInputEvent* motion_event);
-
-/* Get the number of pointers of data contained in this event.
- * Always >= 1. */
-size_t AMotionEvent_getPointerCount(const AInputEvent* motion_event);
-
-/* Get the pointer identifier associated with a particular pointer
- * data index in this event. The identifier tells you the actual pointer
- * number associated with the data, accounting for individual pointers
- * going up and down since the start of the current gesture. */
-int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the tool type of a pointer for the given pointer index.
- * The tool type indicates the type of tool used to make contact such as a
- * finger or stylus, if known. */
-int32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the original raw X coordinate of this event.
- * For touch events on the screen, this is the original location of the event
- * on the screen, before it had been adjusted for the containing window
- * and views. */
-float AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the original raw X coordinate of this event.
- * For touch events on the screen, this is the original location of the event
- * on the screen, before it had been adjusted for the containing window
- * and views. */
-float AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the current X coordinate of this event for the given pointer index.
- * Whole numbers are pixels; the value may have a fraction for input devices
- * that are sub-pixel precise. */
-float AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the current Y coordinate of this event for the given pointer index.
- * Whole numbers are pixels; the value may have a fraction for input devices
- * that are sub-pixel precise. */
-float AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the current pressure of this event for the given pointer index.
- * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
- * although values higher than 1 may be generated depending on the calibration of
- * the input device. */
-float AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the current scaled value of the approximate size for the given pointer index.
- * This represents some approximation of the area of the screen being
- * pressed; the actual value in pixels corresponding to the
- * touch is normalized with the device specific range of values
- * and scaled to a value between 0 and 1. The value of size can be used to
- * determine fat touch events. */
-float AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the current length of the major axis of an ellipse that describes the touch area
- * at the point of contact for the given pointer index. */
-float AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the current length of the minor axis of an ellipse that describes the touch area
- * at the point of contact for the given pointer index. */
-float AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the current length of the major axis of an ellipse that describes the size
- * of the approaching tool for the given pointer index.
- * The tool area represents the estimated size of the finger or pen that is
- * touching the device independent of its actual touch area at the point of contact. */
-float AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the current length of the minor axis of an ellipse that describes the size
- * of the approaching tool for the given pointer index.
- * The tool area represents the estimated size of the finger or pen that is
- * touching the device independent of its actual touch area at the point of contact. */
-float AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the current orientation of the touch area and tool area in radians clockwise from
- * vertical for the given pointer index.
- * An angle of 0 degrees indicates that the major axis of contact is oriented
- * upwards, is perfectly circular or is of unknown orientation. A positive angle
- * indicates that the major axis of contact is oriented to the right. A negative angle
- * indicates that the major axis of contact is oriented to the left.
- * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
- * (finger pointing fully right). */
-float AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index);
-
-/* Get the value of the request axis for the given pointer index. */
-float AMotionEvent_getAxisValue(const AInputEvent* motion_event,
- int32_t axis, size_t pointer_index);
-
-/* Get the number of historical points in this event. These are movements that
- * have occurred between this event and the previous event. This only applies
- * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0.
- * Historical samples are indexed from oldest to newest. */
-size_t AMotionEvent_getHistorySize(const AInputEvent* motion_event);
-
-/* Get the time that a historical movement occurred between this event and
- * the previous event, in the java.lang.System.nanoTime() time base. */
-int64_t AMotionEvent_getHistoricalEventTime(AInputEvent* motion_event,
- size_t history_index);
-
-/* Get the historical raw X coordinate of this event for the given pointer index that
- * occurred between this event and the previous motion event.
- * For touch events on the screen, this is the original location of the event
- * on the screen, before it had been adjusted for the containing window
- * and views.
- * Whole numbers are pixels; the value may have a fraction for input devices
- * that are sub-pixel precise. */
-float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index,
- size_t history_index);
-
-/* Get the historical raw Y coordinate of this event for the given pointer index that
- * occurred between this event and the previous motion event.
- * For touch events on the screen, this is the original location of the event
- * on the screen, before it had been adjusted for the containing window
- * and views.
- * Whole numbers are pixels; the value may have a fraction for input devices
- * that are sub-pixel precise. */
-float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index,
- size_t history_index);
-
-/* Get the historical X coordinate of this event for the given pointer index that
- * occurred between this event and the previous motion event.
- * Whole numbers are pixels; the value may have a fraction for input devices
- * that are sub-pixel precise. */
-float AMotionEvent_getHistoricalX(AInputEvent* motion_event, size_t pointer_index,
- size_t history_index);
-
-/* Get the historical Y coordinate of this event for the given pointer index that
- * occurred between this event and the previous motion event.
- * Whole numbers are pixels; the value may have a fraction for input devices
- * that are sub-pixel precise. */
-float AMotionEvent_getHistoricalY(AInputEvent* motion_event, size_t pointer_index,
- size_t history_index);
-
-/* Get the historical pressure of this event for the given pointer index that
- * occurred between this event and the previous motion event.
- * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
- * although values higher than 1 may be generated depending on the calibration of
- * the input device. */
-float AMotionEvent_getHistoricalPressure(AInputEvent* motion_event, size_t pointer_index,
- size_t history_index);
-
-/* Get the current scaled value of the approximate size for the given pointer index that
- * occurred between this event and the previous motion event.
- * This represents some approximation of the area of the screen being
- * pressed; the actual value in pixels corresponding to the
- * touch is normalized with the device specific range of values
- * and scaled to a value between 0 and 1. The value of size can be used to
- * determine fat touch events. */
-float AMotionEvent_getHistoricalSize(AInputEvent* motion_event, size_t pointer_index,
- size_t history_index);
-
-/* Get the historical length of the major axis of an ellipse that describes the touch area
- * at the point of contact for the given pointer index that
- * occurred between this event and the previous motion event. */
-float AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index,
- size_t history_index);
-
-/* Get the historical length of the minor axis of an ellipse that describes the touch area
- * at the point of contact for the given pointer index that
- * occurred between this event and the previous motion event. */
-float AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index,
- size_t history_index);
-
-/* Get the historical length of the major axis of an ellipse that describes the size
- * of the approaching tool for the given pointer index that
- * occurred between this event and the previous motion event.
- * The tool area represents the estimated size of the finger or pen that is
- * touching the device independent of its actual touch area at the point of contact. */
-float AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index,
- size_t history_index);
-
-/* Get the historical length of the minor axis of an ellipse that describes the size
- * of the approaching tool for the given pointer index that
- * occurred between this event and the previous motion event.
- * The tool area represents the estimated size of the finger or pen that is
- * touching the device independent of its actual touch area at the point of contact. */
-float AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index,
- size_t history_index);
-
-/* Get the historical orientation of the touch area and tool area in radians clockwise from
- * vertical for the given pointer index that
- * occurred between this event and the previous motion event.
- * An angle of 0 degrees indicates that the major axis of contact is oriented
- * upwards, is perfectly circular or is of unknown orientation. A positive angle
- * indicates that the major axis of contact is oriented to the right. A negative angle
- * indicates that the major axis of contact is oriented to the left.
- * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
- * (finger pointing fully right). */
-float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index,
- size_t history_index);
-
-/* Get the historical value of the request axis for the given pointer index
- * that occurred between this event and the previous motion event. */
-float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event,
- int32_t axis, size_t pointer_index, size_t history_index);
-
-
-/*
- * Input queue
- *
- * An input queue is the facility through which you retrieve input
- * events.
- */
-struct AInputQueue;
-typedef struct AInputQueue AInputQueue;
-
-/*
- * Add this input queue to a looper for processing. See
- * ALooper_addFd() for information on the ident, callback, and data params.
- */
-void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper,
- int ident, ALooper_callbackFunc callback, void* data);
-
-/*
- * Remove the input queue from the looper it is currently attached to.
- */
-void AInputQueue_detachLooper(AInputQueue* queue);
-
-/*
- * Returns true if there are one or more events available in the
- * input queue. Returns 1 if the queue has events; 0 if
- * it does not have events; and a negative value if there is an error.
- */
-int32_t AInputQueue_hasEvents(AInputQueue* queue);
-
-/*
- * Returns the next available event from the queue. Returns a negative
- * value if no events are available or an error has occurred.
- */
-int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent);
-
-/*
- * Sends the key for standard pre-dispatching -- that is, possibly deliver
- * it to the current IME to be consumed before the app. Returns 0 if it
- * was not pre-dispatched, meaning you can process it right now. If non-zero
- * is returned, you must abandon the current event processing and allow the
- * event to appear again in the event queue (if it does not get consumed during
- * pre-dispatching).
- */
-int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event);
-
-/*
- * Report that dispatching has finished with the given event.
- * This must be called after receiving an event with AInputQueue_get_event().
- */
-void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _ANDROID_INPUT_H
diff --git a/native/include/android/keycodes.h b/native/include/android/keycodes.h
deleted file mode 100644
index 8414ff6..0000000
--- a/native/include/android/keycodes.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef _ANDROID_KEYCODES_H
-#define _ANDROID_KEYCODES_H
-
-/******************************************************************
- *
- * IMPORTANT NOTICE:
- *
- * This file is part of Android's set of stable system headers
- * exposed by the Android NDK (Native Development Kit).
- *
- * Third-party source AND binary code relies on the definitions
- * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
- *
- * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
- * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
- * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
- * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
- */
-
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Key codes.
- */
-enum {
- AKEYCODE_UNKNOWN = 0,
- AKEYCODE_SOFT_LEFT = 1,
- AKEYCODE_SOFT_RIGHT = 2,
- AKEYCODE_HOME = 3,
- AKEYCODE_BACK = 4,
- AKEYCODE_CALL = 5,
- AKEYCODE_ENDCALL = 6,
- AKEYCODE_0 = 7,
- AKEYCODE_1 = 8,
- AKEYCODE_2 = 9,
- AKEYCODE_3 = 10,
- AKEYCODE_4 = 11,
- AKEYCODE_5 = 12,
- AKEYCODE_6 = 13,
- AKEYCODE_7 = 14,
- AKEYCODE_8 = 15,
- AKEYCODE_9 = 16,
- AKEYCODE_STAR = 17,
- AKEYCODE_POUND = 18,
- AKEYCODE_DPAD_UP = 19,
- AKEYCODE_DPAD_DOWN = 20,
- AKEYCODE_DPAD_LEFT = 21,
- AKEYCODE_DPAD_RIGHT = 22,
- AKEYCODE_DPAD_CENTER = 23,
- AKEYCODE_VOLUME_UP = 24,
- AKEYCODE_VOLUME_DOWN = 25,
- AKEYCODE_POWER = 26,
- AKEYCODE_CAMERA = 27,
- AKEYCODE_CLEAR = 28,
- AKEYCODE_A = 29,
- AKEYCODE_B = 30,
- AKEYCODE_C = 31,
- AKEYCODE_D = 32,
- AKEYCODE_E = 33,
- AKEYCODE_F = 34,
- AKEYCODE_G = 35,
- AKEYCODE_H = 36,
- AKEYCODE_I = 37,
- AKEYCODE_J = 38,
- AKEYCODE_K = 39,
- AKEYCODE_L = 40,
- AKEYCODE_M = 41,
- AKEYCODE_N = 42,
- AKEYCODE_O = 43,
- AKEYCODE_P = 44,
- AKEYCODE_Q = 45,
- AKEYCODE_R = 46,
- AKEYCODE_S = 47,
- AKEYCODE_T = 48,
- AKEYCODE_U = 49,
- AKEYCODE_V = 50,
- AKEYCODE_W = 51,
- AKEYCODE_X = 52,
- AKEYCODE_Y = 53,
- AKEYCODE_Z = 54,
- AKEYCODE_COMMA = 55,
- AKEYCODE_PERIOD = 56,
- AKEYCODE_ALT_LEFT = 57,
- AKEYCODE_ALT_RIGHT = 58,
- AKEYCODE_SHIFT_LEFT = 59,
- AKEYCODE_SHIFT_RIGHT = 60,
- AKEYCODE_TAB = 61,
- AKEYCODE_SPACE = 62,
- AKEYCODE_SYM = 63,
- AKEYCODE_EXPLORER = 64,
- AKEYCODE_ENVELOPE = 65,
- AKEYCODE_ENTER = 66,
- AKEYCODE_DEL = 67,
- AKEYCODE_GRAVE = 68,
- AKEYCODE_MINUS = 69,
- AKEYCODE_EQUALS = 70,
- AKEYCODE_LEFT_BRACKET = 71,
- AKEYCODE_RIGHT_BRACKET = 72,
- AKEYCODE_BACKSLASH = 73,
- AKEYCODE_SEMICOLON = 74,
- AKEYCODE_APOSTROPHE = 75,
- AKEYCODE_SLASH = 76,
- AKEYCODE_AT = 77,
- AKEYCODE_NUM = 78,
- AKEYCODE_HEADSETHOOK = 79,
- AKEYCODE_FOCUS = 80, // *Camera* focus
- AKEYCODE_PLUS = 81,
- AKEYCODE_MENU = 82,
- AKEYCODE_NOTIFICATION = 83,
- AKEYCODE_SEARCH = 84,
- AKEYCODE_MEDIA_PLAY_PAUSE= 85,
- AKEYCODE_MEDIA_STOP = 86,
- AKEYCODE_MEDIA_NEXT = 87,
- AKEYCODE_MEDIA_PREVIOUS = 88,
- AKEYCODE_MEDIA_REWIND = 89,
- AKEYCODE_MEDIA_FAST_FORWARD = 90,
- AKEYCODE_MUTE = 91,
- AKEYCODE_PAGE_UP = 92,
- AKEYCODE_PAGE_DOWN = 93,
- AKEYCODE_PICTSYMBOLS = 94,
- AKEYCODE_SWITCH_CHARSET = 95,
- AKEYCODE_BUTTON_A = 96,
- AKEYCODE_BUTTON_B = 97,
- AKEYCODE_BUTTON_C = 98,
- AKEYCODE_BUTTON_X = 99,
- AKEYCODE_BUTTON_Y = 100,
- AKEYCODE_BUTTON_Z = 101,
- AKEYCODE_BUTTON_L1 = 102,
- AKEYCODE_BUTTON_R1 = 103,
- AKEYCODE_BUTTON_L2 = 104,
- AKEYCODE_BUTTON_R2 = 105,
- AKEYCODE_BUTTON_THUMBL = 106,
- AKEYCODE_BUTTON_THUMBR = 107,
- AKEYCODE_BUTTON_START = 108,
- AKEYCODE_BUTTON_SELECT = 109,
- AKEYCODE_BUTTON_MODE = 110,
- AKEYCODE_ESCAPE = 111,
- AKEYCODE_FORWARD_DEL = 112,
- AKEYCODE_CTRL_LEFT = 113,
- AKEYCODE_CTRL_RIGHT = 114,
- AKEYCODE_CAPS_LOCK = 115,
- AKEYCODE_SCROLL_LOCK = 116,
- AKEYCODE_META_LEFT = 117,
- AKEYCODE_META_RIGHT = 118,
- AKEYCODE_FUNCTION = 119,
- AKEYCODE_SYSRQ = 120,
- AKEYCODE_BREAK = 121,
- AKEYCODE_MOVE_HOME = 122,
- AKEYCODE_MOVE_END = 123,
- AKEYCODE_INSERT = 124,
- AKEYCODE_FORWARD = 125,
- AKEYCODE_MEDIA_PLAY = 126,
- AKEYCODE_MEDIA_PAUSE = 127,
- AKEYCODE_MEDIA_CLOSE = 128,
- AKEYCODE_MEDIA_EJECT = 129,
- AKEYCODE_MEDIA_RECORD = 130,
- AKEYCODE_F1 = 131,
- AKEYCODE_F2 = 132,
- AKEYCODE_F3 = 133,
- AKEYCODE_F4 = 134,
- AKEYCODE_F5 = 135,
- AKEYCODE_F6 = 136,
- AKEYCODE_F7 = 137,
- AKEYCODE_F8 = 138,
- AKEYCODE_F9 = 139,
- AKEYCODE_F10 = 140,
- AKEYCODE_F11 = 141,
- AKEYCODE_F12 = 142,
- AKEYCODE_NUM_LOCK = 143,
- AKEYCODE_NUMPAD_0 = 144,
- AKEYCODE_NUMPAD_1 = 145,
- AKEYCODE_NUMPAD_2 = 146,
- AKEYCODE_NUMPAD_3 = 147,
- AKEYCODE_NUMPAD_4 = 148,
- AKEYCODE_NUMPAD_5 = 149,
- AKEYCODE_NUMPAD_6 = 150,
- AKEYCODE_NUMPAD_7 = 151,
- AKEYCODE_NUMPAD_8 = 152,
- AKEYCODE_NUMPAD_9 = 153,
- AKEYCODE_NUMPAD_DIVIDE = 154,
- AKEYCODE_NUMPAD_MULTIPLY = 155,
- AKEYCODE_NUMPAD_SUBTRACT = 156,
- AKEYCODE_NUMPAD_ADD = 157,
- AKEYCODE_NUMPAD_DOT = 158,
- AKEYCODE_NUMPAD_COMMA = 159,
- AKEYCODE_NUMPAD_ENTER = 160,
- AKEYCODE_NUMPAD_EQUALS = 161,
- AKEYCODE_NUMPAD_LEFT_PAREN = 162,
- AKEYCODE_NUMPAD_RIGHT_PAREN = 163,
- AKEYCODE_VOLUME_MUTE = 164,
- AKEYCODE_INFO = 165,
- AKEYCODE_CHANNEL_UP = 166,
- AKEYCODE_CHANNEL_DOWN = 167,
- AKEYCODE_ZOOM_IN = 168,
- AKEYCODE_ZOOM_OUT = 169,
- AKEYCODE_TV = 170,
- AKEYCODE_WINDOW = 171,
- AKEYCODE_GUIDE = 172,
- AKEYCODE_DVR = 173,
- AKEYCODE_BOOKMARK = 174,
- AKEYCODE_CAPTIONS = 175,
- AKEYCODE_SETTINGS = 176,
- AKEYCODE_TV_POWER = 177,
- AKEYCODE_TV_INPUT = 178,
- AKEYCODE_STB_POWER = 179,
- AKEYCODE_STB_INPUT = 180,
- AKEYCODE_AVR_POWER = 181,
- AKEYCODE_AVR_INPUT = 182,
- AKEYCODE_PROG_RED = 183,
- AKEYCODE_PROG_GREEN = 184,
- AKEYCODE_PROG_YELLOW = 185,
- AKEYCODE_PROG_BLUE = 186,
- AKEYCODE_APP_SWITCH = 187,
- AKEYCODE_BUTTON_1 = 188,
- AKEYCODE_BUTTON_2 = 189,
- AKEYCODE_BUTTON_3 = 190,
- AKEYCODE_BUTTON_4 = 191,
- AKEYCODE_BUTTON_5 = 192,
- AKEYCODE_BUTTON_6 = 193,
- AKEYCODE_BUTTON_7 = 194,
- AKEYCODE_BUTTON_8 = 195,
- AKEYCODE_BUTTON_9 = 196,
- AKEYCODE_BUTTON_10 = 197,
- AKEYCODE_BUTTON_11 = 198,
- AKEYCODE_BUTTON_12 = 199,
- AKEYCODE_BUTTON_13 = 200,
- AKEYCODE_BUTTON_14 = 201,
- AKEYCODE_BUTTON_15 = 202,
- AKEYCODE_BUTTON_16 = 203,
- AKEYCODE_LANGUAGE_SWITCH = 204,
- AKEYCODE_MANNER_MODE = 205,
- AKEYCODE_3D_MODE = 206,
- AKEYCODE_CONTACTS = 207,
- AKEYCODE_CALENDAR = 208,
- AKEYCODE_MUSIC = 209,
- AKEYCODE_CALCULATOR = 210,
-
- // NOTE: If you add a new keycode here you must also add it to several other files.
- // Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list.
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _ANDROID_KEYCODES_H
diff --git a/native/include/android/looper.h b/native/include/android/looper.h
deleted file mode 100644
index 24e3967..0000000
--- a/native/include/android/looper.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-
-#ifndef ANDROID_LOOPER_H
-#define ANDROID_LOOPER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * ALooper
- *
- * A looper is the state tracking an event loop for a thread.
- * Loopers do not define event structures or other such things; rather
- * they are a lower-level facility to attach one or more discrete objects
- * listening for an event. An "event" here is simply data available on
- * a file descriptor: each attached object has an associated file descriptor,
- * and waiting for "events" means (internally) polling on all of these file
- * descriptors until one or more of them have data available.
- *
- * A thread can have only one ALooper associated with it.
- */
-struct ALooper;
-typedef struct ALooper ALooper;
-
-/**
- * Returns the looper associated with the calling thread, or NULL if
- * there is not one.
- */
-ALooper* ALooper_forThread();
-
-enum {
- /**
- * Option for ALooper_prepare: this looper will accept calls to
- * ALooper_addFd() that do not have a callback (that is provide NULL
- * for the callback). In this case the caller of ALooper_pollOnce()
- * or ALooper_pollAll() MUST check the return from these functions to
- * discover when data is available on such fds and process it.
- */
- ALOOPER_PREPARE_ALLOW_NON_CALLBACKS = 1<<0
-};
-
-/**
- * Prepares a looper associated with the calling thread, and returns it.
- * If the thread already has a looper, it is returned. Otherwise, a new
- * one is created, associated with the thread, and returned.
- *
- * The opts may be ALOOPER_PREPARE_ALLOW_NON_CALLBACKS or 0.
- */
-ALooper* ALooper_prepare(int opts);
-
-enum {
- /**
- * Result from ALooper_pollOnce() and ALooper_pollAll():
- * The poll was awoken using wake() before the timeout expired
- * and no callbacks were executed and no other file descriptors were ready.
- */
- ALOOPER_POLL_WAKE = -1,
-
- /**
- * Result from ALooper_pollOnce() and ALooper_pollAll():
- * One or more callbacks were executed.
- */
- ALOOPER_POLL_CALLBACK = -2,
-
- /**
- * Result from ALooper_pollOnce() and ALooper_pollAll():
- * The timeout expired.
- */
- ALOOPER_POLL_TIMEOUT = -3,
-
- /**
- * Result from ALooper_pollOnce() and ALooper_pollAll():
- * An error occurred.
- */
- ALOOPER_POLL_ERROR = -4,
-};
-
-/**
- * Acquire a reference on the given ALooper object. This prevents the object
- * from being deleted until the reference is removed. This is only needed
- * to safely hand an ALooper from one thread to another.
- */
-void ALooper_acquire(ALooper* looper);
-
-/**
- * Remove a reference that was previously acquired with ALooper_acquire().
- */
-void ALooper_release(ALooper* looper);
-
-/**
- * Flags for file descriptor events that a looper can monitor.
- *
- * These flag bits can be combined to monitor multiple events at once.
- */
-enum {
- /**
- * The file descriptor is available for read operations.
- */
- ALOOPER_EVENT_INPUT = 1 << 0,
-
- /**
- * The file descriptor is available for write operations.
- */
- ALOOPER_EVENT_OUTPUT = 1 << 1,
-
- /**
- * The file descriptor has encountered an error condition.
- *
- * The looper always sends notifications about errors; it is not necessary
- * to specify this event flag in the requested event set.
- */
- ALOOPER_EVENT_ERROR = 1 << 2,
-
- /**
- * The file descriptor was hung up.
- * For example, indicates that the remote end of a pipe or socket was closed.
- *
- * The looper always sends notifications about hangups; it is not necessary
- * to specify this event flag in the requested event set.
- */
- ALOOPER_EVENT_HANGUP = 1 << 3,
-
- /**
- * The file descriptor is invalid.
- * For example, the file descriptor was closed prematurely.
- *
- * The looper always sends notifications about invalid file descriptors; it is not necessary
- * to specify this event flag in the requested event set.
- */
- ALOOPER_EVENT_INVALID = 1 << 4,
-};
-
-/**
- * For callback-based event loops, this is the prototype of the function
- * that is called when a file descriptor event occurs.
- * It is given the file descriptor it is associated with,
- * a bitmask of the poll events that were triggered (typically ALOOPER_EVENT_INPUT),
- * and the data pointer that was originally supplied.
- *
- * Implementations should return 1 to continue receiving callbacks, or 0
- * to have this file descriptor and callback unregistered from the looper.
- */
-typedef int (*ALooper_callbackFunc)(int fd, int events, void* data);
-
-/**
- * Waits for events to be available, with optional timeout in milliseconds.
- * Invokes callbacks for all file descriptors on which an event occurred.
- *
- * If the timeout is zero, returns immediately without blocking.
- * If the timeout is negative, waits indefinitely until an event appears.
- *
- * Returns ALOOPER_POLL_WAKE if the poll was awoken using wake() before
- * the timeout expired and no callbacks were invoked and no other file
- * descriptors were ready.
- *
- * Returns ALOOPER_POLL_CALLBACK if one or more callbacks were invoked.
- *
- * Returns ALOOPER_POLL_TIMEOUT if there was no data before the given
- * timeout expired.
- *
- * Returns ALOOPER_POLL_ERROR if an error occurred.
- *
- * Returns a value >= 0 containing an identifier if its file descriptor has data
- * and it has no callback function (requiring the caller here to handle it).
- * In this (and only this) case outFd, outEvents and outData will contain the poll
- * events and data associated with the fd, otherwise they will be set to NULL.
- *
- * This method does not return until it has finished invoking the appropriate callbacks
- * for all file descriptors that were signalled.
- */
-int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData);
-
-/**
- * Like ALooper_pollOnce(), but performs all pending callbacks until all
- * data has been consumed or a file descriptor is available with no callback.
- * This function will never return ALOOPER_POLL_CALLBACK.
- */
-int ALooper_pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData);
-
-/**
- * Wakes the poll asynchronously.
- *
- * This method can be called on any thread.
- * This method returns immediately.
- */
-void ALooper_wake(ALooper* looper);
-
-/**
- * Adds a new file descriptor to be polled by the looper.
- * If the same file descriptor was previously added, it is replaced.
- *
- * "fd" is the file descriptor to be added.
- * "ident" is an identifier for this event, which is returned from ALooper_pollOnce().
- * The identifier must be >= 0, or ALOOPER_POLL_CALLBACK if providing a non-NULL callback.
- * "events" are the poll events to wake up on. Typically this is ALOOPER_EVENT_INPUT.
- * "callback" is the function to call when there is an event on the file descriptor.
- * "data" is a private data pointer to supply to the callback.
- *
- * There are two main uses of this function:
- *
- * (1) If "callback" is non-NULL, then this function will be called when there is
- * data on the file descriptor. It should execute any events it has pending,
- * appropriately reading from the file descriptor. The 'ident' is ignored in this case.
- *
- * (2) If "callback" is NULL, the 'ident' will be returned by ALooper_pollOnce
- * when its file descriptor has data available, requiring the caller to take
- * care of processing it.
- *
- * Returns 1 if the file descriptor was added or -1 if an error occurred.
- *
- * This method can be called on any thread.
- * This method may block briefly if it needs to wake the poll.
- */
-int ALooper_addFd(ALooper* looper, int fd, int ident, int events,
- ALooper_callbackFunc callback, void* data);
-
-/**
- * Removes a previously added file descriptor from the looper.
- *
- * When this method returns, it is safe to close the file descriptor since the looper
- * will no longer have a reference to it. However, it is possible for the callback to
- * already be running or for it to run one last time if the file descriptor was already
- * signalled. Calling code is responsible for ensuring that this case is safely handled.
- * For example, if the callback takes care of removing itself during its own execution either
- * by returning 0 or by calling this method, then it can be guaranteed to not be invoked
- * again at any later time unless registered anew.
- *
- * Returns 1 if the file descriptor was removed, 0 if none was previously registered
- * or -1 if an error occurred.
- *
- * This method can be called on any thread.
- * This method may block briefly if it needs to wake the poll.
- */
-int ALooper_removeFd(ALooper* looper, int fd);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // ANDROID_NATIVE_WINDOW_H
diff --git a/native/include/android/native_activity.h b/native/include/android/native_activity.h
deleted file mode 100644
index bc70f88..0000000
--- a/native/include/android/native_activity.h
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-
-#ifndef ANDROID_NATIVE_ACTIVITY_H
-#define ANDROID_NATIVE_ACTIVITY_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include <jni.h>
-
-#include <android/asset_manager.h>
-#include <android/input.h>
-#include <android/native_window.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct ANativeActivityCallbacks;
-
-/**
- * This structure defines the native side of an android.app.NativeActivity.
- * It is created by the framework, and handed to the application's native
- * code as it is being launched.
- */
-typedef struct ANativeActivity {
- /**
- * Pointer to the callback function table of the native application.
- * You can set the functions here to your own callbacks. The callbacks
- * pointer itself here should not be changed; it is allocated and managed
- * for you by the framework.
- */
- struct ANativeActivityCallbacks* callbacks;
-
- /**
- * The global handle on the process's Java VM.
- */
- JavaVM* vm;
-
- /**
- * JNI context for the main thread of the app. Note that this field
- * can ONLY be used from the main thread of the process; that is, the
- * thread that calls into the ANativeActivityCallbacks.
- */
- JNIEnv* env;
-
- /**
- * The NativeActivity object handle.
- *
- * IMPORTANT NOTE: This member is mis-named. It should really be named
- * 'activity' instead of 'clazz', since it's a reference to the
- * NativeActivity instance created by the system for you.
- *
- * We unfortunately cannot change this without breaking NDK
- * source-compatibility.
- */
- jobject clazz;
-
- /**
- * Path to this application's internal data directory.
- */
- const char* internalDataPath;
-
- /**
- * Path to this application's external (removable/mountable) data directory.
- */
- const char* externalDataPath;
-
- /**
- * The platform's SDK version code.
- */
- int32_t sdkVersion;
-
- /**
- * This is the native instance of the application. It is not used by
- * the framework, but can be set by the application to its own instance
- * state.
- */
- void* instance;
-
- /**
- * Pointer to the Asset Manager instance for the application. The application
- * uses this to access binary assets bundled inside its own .apk file.
- */
- AAssetManager* assetManager;
-
- /**
- * Available starting with Honeycomb: path to the directory containing
- * the application's OBB files (if any). If the app doesn't have any
- * OBB files, this directory may not exist.
- */
- const char* obbPath;
-} ANativeActivity;
-
-/**
- * These are the callbacks the framework makes into a native application.
- * All of these callbacks happen on the main thread of the application.
- * By default, all callbacks are NULL; set to a pointer to your own function
- * to have it called.
- */
-typedef struct ANativeActivityCallbacks {
- /**
- * NativeActivity has started. See Java documentation for Activity.onStart()
- * for more information.
- */
- void (*onStart)(ANativeActivity* activity);
-
- /**
- * NativeActivity has resumed. See Java documentation for Activity.onResume()
- * for more information.
- */
- void (*onResume)(ANativeActivity* activity);
-
- /**
- * Framework is asking NativeActivity to save its current instance state.
- * See Java documentation for Activity.onSaveInstanceState() for more
- * information. The returned pointer needs to be created with malloc();
- * the framework will call free() on it for you. You also must fill in
- * outSize with the number of bytes in the allocation. Note that the
- * saved state will be persisted, so it can not contain any active
- * entities (pointers to memory, file descriptors, etc).
- */
- void* (*onSaveInstanceState)(ANativeActivity* activity, size_t* outSize);
-
- /**
- * NativeActivity has paused. See Java documentation for Activity.onPause()
- * for more information.
- */
- void (*onPause)(ANativeActivity* activity);
-
- /**
- * NativeActivity has stopped. See Java documentation for Activity.onStop()
- * for more information.
- */
- void (*onStop)(ANativeActivity* activity);
-
- /**
- * NativeActivity is being destroyed. See Java documentation for Activity.onDestroy()
- * for more information.
- */
- void (*onDestroy)(ANativeActivity* activity);
-
- /**
- * Focus has changed in this NativeActivity's window. This is often used,
- * for example, to pause a game when it loses input focus.
- */
- void (*onWindowFocusChanged)(ANativeActivity* activity, int hasFocus);
-
- /**
- * The drawing window for this native activity has been created. You
- * can use the given native window object to start drawing.
- */
- void (*onNativeWindowCreated)(ANativeActivity* activity, ANativeWindow* window);
-
- /**
- * The drawing window for this native activity has been resized. You should
- * retrieve the new size from the window and ensure that your rendering in
- * it now matches.
- */
- void (*onNativeWindowResized)(ANativeActivity* activity, ANativeWindow* window);
-
- /**
- * The drawing window for this native activity needs to be redrawn. To avoid
- * transient artifacts during screen changes (such resizing after rotation),
- * applications should not return from this function until they have finished
- * drawing their window in its current state.
- */
- void (*onNativeWindowRedrawNeeded)(ANativeActivity* activity, ANativeWindow* window);
-
- /**
- * The drawing window for this native activity is going to be destroyed.
- * You MUST ensure that you do not touch the window object after returning
- * from this function: in the common case of drawing to the window from
- * another thread, that means the implementation of this callback must
- * properly synchronize with the other thread to stop its drawing before
- * returning from here.
- */
- void (*onNativeWindowDestroyed)(ANativeActivity* activity, ANativeWindow* window);
-
- /**
- * The input queue for this native activity's window has been created.
- * You can use the given input queue to start retrieving input events.
- */
- void (*onInputQueueCreated)(ANativeActivity* activity, AInputQueue* queue);
-
- /**
- * The input queue for this native activity's window is being destroyed.
- * You should no longer try to reference this object upon returning from this
- * function.
- */
- void (*onInputQueueDestroyed)(ANativeActivity* activity, AInputQueue* queue);
-
- /**
- * The rectangle in the window in which content should be placed has changed.
- */
- void (*onContentRectChanged)(ANativeActivity* activity, const ARect* rect);
-
- /**
- * The current device AConfiguration has changed. The new configuration can
- * be retrieved from assetManager.
- */
- void (*onConfigurationChanged)(ANativeActivity* activity);
-
- /**
- * The system is running low on memory. Use this callback to release
- * resources you do not need, to help the system avoid killing more
- * important processes.
- */
- void (*onLowMemory)(ANativeActivity* activity);
-} ANativeActivityCallbacks;
-
-/**
- * This is the function that must be in the native code to instantiate the
- * application's native activity. It is called with the activity instance (see
- * above); if the code is being instantiated from a previously saved instance,
- * the savedState will be non-NULL and point to the saved data. You must make
- * any copy of this data you need -- it will be released after you return from
- * this function.
- */
-typedef void ANativeActivity_createFunc(ANativeActivity* activity,
- void* savedState, size_t savedStateSize);
-
-/**
- * The name of the function that NativeInstance looks for when launching its
- * native code. This is the default function that is used, you can specify
- * "android.app.func_name" string meta-data in your manifest to use a different
- * function.
- */
-extern ANativeActivity_createFunc ANativeActivity_onCreate;
-
-/**
- * Finish the given activity. Its finish() method will be called, causing it
- * to be stopped and destroyed. Note that this method can be called from
- * *any* thread; it will send a message to the main thread of the process
- * where the Java finish call will take place.
- */
-void ANativeActivity_finish(ANativeActivity* activity);
-
-/**
- * Change the window format of the given activity. Calls getWindow().setFormat()
- * of the given activity. Note that this method can be called from
- * *any* thread; it will send a message to the main thread of the process
- * where the Java finish call will take place.
- */
-void ANativeActivity_setWindowFormat(ANativeActivity* activity, int32_t format);
-
-/**
- * Change the window flags of the given activity. Calls getWindow().setFlags()
- * of the given activity. Note that this method can be called from
- * *any* thread; it will send a message to the main thread of the process
- * where the Java finish call will take place. See window.h for flag constants.
- */
-void ANativeActivity_setWindowFlags(ANativeActivity* activity,
- uint32_t addFlags, uint32_t removeFlags);
-
-/**
- * Flags for ANativeActivity_showSoftInput; see the Java InputMethodManager
- * API for documentation.
- */
-enum {
- ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT = 0x0001,
- ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED = 0x0002,
-};
-
-/**
- * Show the IME while in the given activity. Calls InputMethodManager.showSoftInput()
- * for the given activity. Note that this method can be called from
- * *any* thread; it will send a message to the main thread of the process
- * where the Java finish call will take place.
- */
-void ANativeActivity_showSoftInput(ANativeActivity* activity, uint32_t flags);
-
-/**
- * Flags for ANativeActivity_hideSoftInput; see the Java InputMethodManager
- * API for documentation.
- */
-enum {
- ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY = 0x0001,
- ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS = 0x0002,
-};
-
-/**
- * Hide the IME while in the given activity. Calls InputMethodManager.hideSoftInput()
- * for the given activity. Note that this method can be called from
- * *any* thread; it will send a message to the main thread of the process
- * where the Java finish call will take place.
- */
-void ANativeActivity_hideSoftInput(ANativeActivity* activity, uint32_t flags);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // ANDROID_NATIVE_ACTIVITY_H
-
diff --git a/native/include/android/native_window.h b/native/include/android/native_window.h
deleted file mode 100644
index 2f4f2d3..0000000
--- a/native/include/android/native_window.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef ANDROID_NATIVE_WINDOW_H
-#define ANDROID_NATIVE_WINDOW_H
-
-#include <android/rect.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Pixel formats that a window can use.
- */
-enum {
- WINDOW_FORMAT_RGBA_8888 = 1,
- WINDOW_FORMAT_RGBX_8888 = 2,
- WINDOW_FORMAT_RGB_565 = 4,
-};
-
-struct ANativeWindow;
-typedef struct ANativeWindow ANativeWindow;
-
-typedef struct ANativeWindow_Buffer {
- // The number of pixels that are show horizontally.
- int32_t width;
-
- // The number of pixels that are shown vertically.
- int32_t height;
-
- // The number of *pixels* that a line in the buffer takes in
- // memory. This may be >= width.
- int32_t stride;
-
- // The format of the buffer. One of WINDOW_FORMAT_*
- int32_t format;
-
- // The actual bits.
- void* bits;
-
- // Do not touch.
- uint32_t reserved[6];
-} ANativeWindow_Buffer;
-
-/**
- * Acquire a reference on the given ANativeWindow object. This prevents the object
- * from being deleted until the reference is removed.
- */
-void ANativeWindow_acquire(ANativeWindow* window);
-
-/**
- * Remove a reference that was previously acquired with ANativeWindow_acquire().
- */
-void ANativeWindow_release(ANativeWindow* window);
-
-/*
- * Return the current width in pixels of the window surface. Returns a
- * negative value on error.
- */
-int32_t ANativeWindow_getWidth(ANativeWindow* window);
-
-/*
- * Return the current height in pixels of the window surface. Returns a
- * negative value on error.
- */
-int32_t ANativeWindow_getHeight(ANativeWindow* window);
-
-/*
- * Return the current pixel format of the window surface. Returns a
- * negative value on error.
- */
-int32_t ANativeWindow_getFormat(ANativeWindow* window);
-
-/*
- * Change the format and size of the window buffers.
- *
- * The width and height control the number of pixels in the buffers, not the
- * dimensions of the window on screen. If these are different than the
- * window's physical size, then it buffer will be scaled to match that size
- * when compositing it to the screen.
- *
- * For all of these parameters, if 0 is supplied then the window's base
- * value will come back in force.
- *
- * width and height must be either both zero or both non-zero.
- *
- */
-int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window,
- int32_t width, int32_t height, int32_t format);
-
-/**
- * Lock the window's next drawing surface for writing.
- * inOutDirtyBounds is used as an in/out parameter, upon entering the
- * function, it contains the dirty region, that is, the region the caller
- * intends to redraw. When the function returns, inOutDirtyBounds is updated
- * with the actual area the caller needs to redraw -- this region is often
- * extended by ANativeWindow_lock.
- */
-int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer,
- ARect* inOutDirtyBounds);
-
-/**
- * Unlock the window's drawing surface after previously locking it,
- * posting the new buffer to the display.
- */
-int32_t ANativeWindow_unlockAndPost(ANativeWindow* window);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // ANDROID_NATIVE_WINDOW_H
diff --git a/native/include/android/native_window_jni.h b/native/include/android/native_window_jni.h
deleted file mode 100644
index b9e72ef..0000000
--- a/native/include/android/native_window_jni.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef ANDROID_NATIVE_WINDOW_JNI_H
-#define ANDROID_NATIVE_WINDOW_JNI_H
-
-#include <android/native_window.h>
-
-#include <jni.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Return the ANativeWindow associated with a Java Surface object,
- * for interacting with it through native code. This acquires a reference
- * on the ANativeWindow that is returned; be sure to use ANativeWindow_release()
- * when done with it so that it doesn't leak.
- */
-ANativeWindow* ANativeWindow_fromSurface(JNIEnv* env, jobject surface);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // ANDROID_NATIVE_WINDOW_H
diff --git a/native/include/android/obb.h b/native/include/android/obb.h
deleted file mode 100644
index 65e9b2a..0000000
--- a/native/include/android/obb.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-
-#ifndef ANDROID_OBB_H
-#define ANDROID_OBB_H
-
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct AObbInfo;
-typedef struct AObbInfo AObbInfo;
-
-enum {
- AOBBINFO_OVERLAY = 0x0001,
-};
-
-/**
- * Scan an OBB and get information about it.
- */
-AObbInfo* AObbScanner_getObbInfo(const char* filename);
-
-/**
- * Destroy the AObbInfo object. You must call this when finished with the object.
- */
-void AObbInfo_delete(AObbInfo* obbInfo);
-
-/**
- * Get the package name for the OBB.
- */
-const char* AObbInfo_getPackageName(AObbInfo* obbInfo);
-
-/**
- * Get the version of an OBB file.
- */
-int32_t AObbInfo_getVersion(AObbInfo* obbInfo);
-
-/**
- * Get the flags of an OBB file.
- */
-int32_t AObbInfo_getFlags(AObbInfo* obbInfo);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // ANDROID_OBB_H
diff --git a/native/include/android/rect.h b/native/include/android/rect.h
deleted file mode 100644
index 64d487d..0000000
--- a/native/include/android/rect.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-
-#ifndef ANDROID_RECT_H
-#define ANDROID_RECT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct ARect {
-#ifdef __cplusplus
- typedef int32_t value_type;
-#endif
- int32_t left;
- int32_t top;
- int32_t right;
- int32_t bottom;
-} ARect;
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // ANDROID_RECT_H
diff --git a/native/include/android/sensor.h b/native/include/android/sensor.h
deleted file mode 100644
index f163f18..0000000
--- a/native/include/android/sensor.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-
-#ifndef ANDROID_SENSOR_H
-#define ANDROID_SENSOR_H
-
-/******************************************************************
- *
- * IMPORTANT NOTICE:
- *
- * This file is part of Android's set of stable system headers
- * exposed by the Android NDK (Native Development Kit).
- *
- * Third-party source AND binary code relies on the definitions
- * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
- *
- * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
- * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
- * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
- * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
- */
-
-/*
- * Structures and functions to receive and process sensor events in
- * native code.
- *
- */
-
-#include <sys/types.h>
-
-#include <android/looper.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
- * Sensor types
- * (keep in sync with hardware/sensor.h)
- */
-
-enum {
- ASENSOR_TYPE_ACCELEROMETER = 1,
- ASENSOR_TYPE_MAGNETIC_FIELD = 2,
- ASENSOR_TYPE_GYROSCOPE = 4,
- ASENSOR_TYPE_LIGHT = 5,
- ASENSOR_TYPE_PROXIMITY = 8
-};
-
-/*
- * Sensor accuracy measure
- */
-enum {
- ASENSOR_STATUS_UNRELIABLE = 0,
- ASENSOR_STATUS_ACCURACY_LOW = 1,
- ASENSOR_STATUS_ACCURACY_MEDIUM = 2,
- ASENSOR_STATUS_ACCURACY_HIGH = 3
-};
-
-/*
- * A few useful constants
- */
-
-/* Earth's gravity in m/s^2 */
-#define ASENSOR_STANDARD_GRAVITY (9.80665f)
-/* Maximum magnetic field on Earth's surface in uT */
-#define ASENSOR_MAGNETIC_FIELD_EARTH_MAX (60.0f)
-/* Minimum magnetic field on Earth's surface in uT*/
-#define ASENSOR_MAGNETIC_FIELD_EARTH_MIN (30.0f)
-
-/*
- * A sensor event.
- */
-
-/* NOTE: Must match hardware/sensors.h */
-typedef struct ASensorVector {
- union {
- float v[3];
- struct {
- float x;
- float y;
- float z;
- };
- struct {
- float azimuth;
- float pitch;
- float roll;
- };
- };
- int8_t status;
- uint8_t reserved[3];
-} ASensorVector;
-
-/* NOTE: Must match hardware/sensors.h */
-typedef struct ASensorEvent {
- int32_t version; /* sizeof(struct ASensorEvent) */
- int32_t sensor;
- int32_t type;
- int32_t reserved0;
- int64_t timestamp;
- union {
- float data[16];
- ASensorVector vector;
- ASensorVector acceleration;
- ASensorVector magnetic;
- float temperature;
- float distance;
- float light;
- float pressure;
- };
- int32_t reserved1[4];
-} ASensorEvent;
-
-
-struct ASensorManager;
-typedef struct ASensorManager ASensorManager;
-
-struct ASensorEventQueue;
-typedef struct ASensorEventQueue ASensorEventQueue;
-
-struct ASensor;
-typedef struct ASensor ASensor;
-typedef ASensor const* ASensorRef;
-typedef ASensorRef const* ASensorList;
-
-/*****************************************************************************/
-
-/*
- * Get a reference to the sensor manager. ASensorManager is a singleton.
- *
- * Example:
- *
- * ASensorManager* sensorManager = ASensorManager_getInstance();
- *
- */
-ASensorManager* ASensorManager_getInstance();
-
-
-/*
- * Returns the list of available sensors.
- */
-int ASensorManager_getSensorList(ASensorManager* manager, ASensorList* list);
-
-/*
- * Returns the default sensor for the given type, or NULL if no sensor
- * of that type exist.
- */
-ASensor const* ASensorManager_getDefaultSensor(ASensorManager* manager, int type);
-
-/*
- * Creates a new sensor event queue and associate it with a looper.
- */
-ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager,
- ALooper* looper, int ident, ALooper_callbackFunc callback, void* data);
-
-/*
- * Destroys the event queue and free all resources associated to it.
- */
-int ASensorManager_destroyEventQueue(ASensorManager* manager, ASensorEventQueue* queue);
-
-
-/*****************************************************************************/
-
-/*
- * Enable the selected sensor. Returns a negative error code on failure.
- */
-int ASensorEventQueue_enableSensor(ASensorEventQueue* queue, ASensor const* sensor);
-
-/*
- * Disable the selected sensor. Returns a negative error code on failure.
- */
-int ASensorEventQueue_disableSensor(ASensorEventQueue* queue, ASensor const* sensor);
-
-/*
- * Sets the delivery rate of events in microseconds for the given sensor.
- * Note that this is a hint only, generally event will arrive at a higher
- * rate. It is an error to set a rate inferior to the value returned by
- * ASensor_getMinDelay().
- * Returns a negative error code on failure.
- */
-int ASensorEventQueue_setEventRate(ASensorEventQueue* queue, ASensor const* sensor, int32_t usec);
-
-/*
- * Returns true if there are one or more events available in the
- * sensor queue. Returns 1 if the queue has events; 0 if
- * it does not have events; and a negative value if there is an error.
- */
-int ASensorEventQueue_hasEvents(ASensorEventQueue* queue);
-
-/*
- * Returns the next available events from the queue. Returns a negative
- * value if no events are available or an error has occurred, otherwise
- * the number of events returned.
- *
- * Examples:
- * ASensorEvent event;
- * ssize_t numEvent = ASensorEventQueue_getEvents(queue, &event, 1);
- *
- * ASensorEvent eventBuffer[8];
- * ssize_t numEvent = ASensorEventQueue_getEvents(queue, eventBuffer, 8);
- *
- */
-ssize_t ASensorEventQueue_getEvents(ASensorEventQueue* queue,
- ASensorEvent* events, size_t count);
-
-
-/*****************************************************************************/
-
-/*
- * Returns this sensor's name (non localized)
- */
-const char* ASensor_getName(ASensor const* sensor);
-
-/*
- * Returns this sensor's vendor's name (non localized)
- */
-const char* ASensor_getVendor(ASensor const* sensor);
-
-/*
- * Return this sensor's type
- */
-int ASensor_getType(ASensor const* sensor);
-
-/*
- * Returns this sensors's resolution
- */
-float ASensor_getResolution(ASensor const* sensor);
-
-/*
- * Returns the minimum delay allowed between events in microseconds.
- * A value of zero means that this sensor doesn't report events at a
- * constant rate, but rather only when a new data is available.
- */
-int ASensor_getMinDelay(ASensor const* sensor);
-
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // ANDROID_SENSOR_H
diff --git a/native/include/android/storage_manager.h b/native/include/android/storage_manager.h
deleted file mode 100644
index bad24913..0000000
--- a/native/include/android/storage_manager.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-
-#ifndef ANDROID_STORAGE_MANAGER_H
-#define ANDROID_STORAGE_MANAGER_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct AStorageManager;
-typedef struct AStorageManager AStorageManager;
-
-enum {
- /*
- * The OBB container is now mounted and ready for use. Can be returned
- * as the status for callbacks made during asynchronous OBB actions.
- */
- AOBB_STATE_MOUNTED = 1,
-
- /*
- * The OBB container is now unmounted and not usable. Can be returned
- * as the status for callbacks made during asynchronous OBB actions.
- */
- AOBB_STATE_UNMOUNTED = 2,
-
- /*
- * There was an internal system error encountered while trying to
- * mount the OBB. Can be returned as the status for callbacks made
- * during asynchronous OBB actions.
- */
- AOBB_STATE_ERROR_INTERNAL = 20,
-
- /*
- * The OBB could not be mounted by the system. Can be returned as the
- * status for callbacks made during asynchronous OBB actions.
- */
- AOBB_STATE_ERROR_COULD_NOT_MOUNT = 21,
-
- /*
- * The OBB could not be unmounted. This most likely indicates that a
- * file is in use on the OBB. Can be returned as the status for
- * callbacks made during asynchronous OBB actions.
- */
- AOBB_STATE_ERROR_COULD_NOT_UNMOUNT = 22,
-
- /*
- * A call was made to unmount the OBB when it was not mounted. Can be
- * returned as the status for callbacks made during asynchronous OBB
- * actions.
- */
- AOBB_STATE_ERROR_NOT_MOUNTED = 23,
-
- /*
- * The OBB has already been mounted. Can be returned as the status for
- * callbacks made during asynchronous OBB actions.
- */
- AOBB_STATE_ERROR_ALREADY_MOUNTED = 24,
-
- /*
- * The current application does not have permission to use this OBB.
- * This could be because the OBB indicates it's owned by a different
- * package. Can be returned as the status for callbacks made during
- * asynchronous OBB actions.
- */
- AOBB_STATE_ERROR_PERMISSION_DENIED = 25,
-};
-
-/**
- * Obtains a new instance of AStorageManager.
- */
-AStorageManager* AStorageManager_new();
-
-/**
- * Release AStorageManager instance.
- */
-void AStorageManager_delete(AStorageManager* mgr);
-
-/**
- * Callback function for asynchronous calls made on OBB files.
- */
-typedef void (*AStorageManager_obbCallbackFunc)(const char* filename, const int32_t state, void* data);
-
-/**
- * Attempts to mount an OBB file. This is an asynchronous operation.
- */
-void AStorageManager_mountObb(AStorageManager* mgr, const char* filename, const char* key,
- AStorageManager_obbCallbackFunc cb, void* data);
-
-/**
- * Attempts to unmount an OBB file. This is an asynchronous operation.
- */
-void AStorageManager_unmountObb(AStorageManager* mgr, const char* filename, const int force,
- AStorageManager_obbCallbackFunc cb, void* data);
-
-/**
- * Check whether an OBB is mounted.
- */
-int AStorageManager_isObbMounted(AStorageManager* mgr, const char* filename);
-
-/**
- * Get the mounted path for an OBB.
- */
-const char* AStorageManager_getMountedObbPath(AStorageManager* mgr, const char* filename);
-
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // ANDROID_STORAGE_MANAGER_H
diff --git a/native/include/android/window.h b/native/include/android/window.h
deleted file mode 100644
index 2ab192b..0000000
--- a/native/include/android/window.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-
-#ifndef ANDROID_WINDOW_H
-#define ANDROID_WINDOW_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Window flags, as per the Java API at android.view.WindowManager.LayoutParams.
- */
-enum {
- AWINDOW_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001,
- AWINDOW_FLAG_DIM_BEHIND = 0x00000002,
- AWINDOW_FLAG_BLUR_BEHIND = 0x00000004,
- AWINDOW_FLAG_NOT_FOCUSABLE = 0x00000008,
- AWINDOW_FLAG_NOT_TOUCHABLE = 0x00000010,
- AWINDOW_FLAG_NOT_TOUCH_MODAL = 0x00000020,
- AWINDOW_FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040,
- AWINDOW_FLAG_KEEP_SCREEN_ON = 0x00000080,
- AWINDOW_FLAG_LAYOUT_IN_SCREEN = 0x00000100,
- AWINDOW_FLAG_LAYOUT_NO_LIMITS = 0x00000200,
- AWINDOW_FLAG_FULLSCREEN = 0x00000400,
- AWINDOW_FLAG_FORCE_NOT_FULLSCREEN = 0x00000800,
- AWINDOW_FLAG_DITHER = 0x00001000,
- AWINDOW_FLAG_SECURE = 0x00002000,
- AWINDOW_FLAG_SCALED = 0x00004000,
- AWINDOW_FLAG_IGNORE_CHEEK_PRESSES = 0x00008000,
- AWINDOW_FLAG_LAYOUT_INSET_DECOR = 0x00010000,
- AWINDOW_FLAG_ALT_FOCUSABLE_IM = 0x00020000,
- AWINDOW_FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000,
- AWINDOW_FLAG_SHOW_WHEN_LOCKED = 0x00080000,
- AWINDOW_FLAG_SHOW_WALLPAPER = 0x00100000,
- AWINDOW_FLAG_TURN_SCREEN_ON = 0x00200000,
- AWINDOW_FLAG_DISMISS_KEYGUARD = 0x00400000,
-};
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif // ANDROID_WINDOW_H
diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java
index 8e2294c..f69fc53 100644
--- a/opengl/java/android/opengl/GLSurfaceView.java
+++ b/opengl/java/android/opengl/GLSurfaceView.java
@@ -1145,11 +1145,15 @@
switch(error) {
case EGL11.EGL_CONTEXT_LOST:
return false;
+ case EGL10.EGL_BAD_CURRENT_SURFACE:
+ // The current surface is bad, probably because the window manager has closed
+ // the associated window. Ignore this error, on the assumption that the
+ // application will be closed soon.
+ break;
case EGL10.EGL_BAD_NATIVE_WINDOW:
- // The native window is bad, probably because the
- // window manager has closed it. Ignore this error,
- // on the expectation that the application will be closed soon.
- Log.e("EglHelper", "eglSwapBuffers returned EGL_BAD_NATIVE_WINDOW. tid=" + Thread.currentThread().getId());
+ // The native window is bad, probably because the window manager has closed it.
+ // Ignore this error, on the assumption that the application will be closed
+ // soon.
break;
default:
throwEglException("eglSwapBuffers", error);
@@ -1841,7 +1845,7 @@
! renderer.startsWith(kMSM7K_RENDERER_PREFIX);
notifyAll();
}
- mLimitedGLESContexts = !mMultipleGLESContextsAllowed || renderer.startsWith(kADRENO);
+ mLimitedGLESContexts = !mMultipleGLESContextsAllowed;
if (LOG_SURFACE) {
Log.w(TAG, "checkGLDriver renderer = \"" + renderer + "\" multipleContextsAllowed = "
+ mMultipleGLESContextsAllowed
@@ -1867,6 +1871,11 @@
}
}
+ /**
+ * This check was required for some pre-Android-3.0 hardware. Android 3.0 provides
+ * support for hardware-accelerated views, therefore multiple EGL contexts are
+ * supported on all Android 3.0+ EGL drivers.
+ */
private boolean mGLESVersionCheckComplete;
private int mGLESVersion;
private boolean mGLESDriverCheckComplete;
@@ -1875,7 +1884,6 @@
private static final int kGLES_20 = 0x20000;
private static final String kMSM7K_RENDERER_PREFIX =
"Q3Dimension MSM7500 ";
- private static final String kADRENO = "Adreno";
private GLThread mEglOwner;
}
diff --git a/opengl/java/com/google/android/gles_jni/GLImpl.java b/opengl/java/com/google/android/gles_jni/GLImpl.java
index 090c0cb7..07f9e91 100644
--- a/opengl/java/com/google/android/gles_jni/GLImpl.java
+++ b/opengl/java/com/google/android/gles_jni/GLImpl.java
@@ -23,6 +23,7 @@
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.os.Build;
+import android.os.UserId;
import android.util.Log;
import java.nio.Buffer;
@@ -67,7 +68,7 @@
int version = 0;
IPackageManager pm = AppGlobals.getPackageManager();
try {
- ApplicationInfo applicationInfo = pm.getApplicationInfo(appName, 0);
+ ApplicationInfo applicationInfo = pm.getApplicationInfo(appName, 0, UserId.myUserId());
if (applicationInfo != null) {
version = applicationInfo.targetSdkVersion;
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 330a189..abf713b 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -84,6 +84,7 @@
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
mContext = context;
+ setWriteAheadLoggingEnabled(true);
}
public static boolean isValidTable(String name) {
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 95fd62d..1fa3695 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -260,7 +260,6 @@
// Watch for external modifications to the database file,
// keeping our cache in sync.
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
- db.enableWriteAheadLogging();
sObserverInstance = new SettingsFileObserver(db.getPath());
sObserverInstance.startWatching();
startAsyncCachePopulation();
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index bb80098..8fbab74 100644
--- a/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/packages/SystemUI/res/layout/navigation_bar.xml
@@ -144,11 +144,11 @@
/>
</LinearLayout>
- <View android:id="@+id/deadzone"
+ <com.android.systemui.statusbar.policy.DeadZone
+ android:id="@+id/deadzone"
android:layout_height="@dimen/navigation_bar_deadzone_size"
android:layout_width="match_parent"
android:layout_gravity="top"
- android:clickable="true"
/>
</FrameLayout>
@@ -272,11 +272,11 @@
/>
</LinearLayout>
- <View android:id="@+id/deadzone"
+ <com.android.systemui.statusbar.policy.DeadZone
+ android:id="@+id/deadzone"
android:layout_width="@dimen/navigation_bar_deadzone_size"
android:layout_height="match_parent"
android:layout_gravity="left"
- android:clickable="true"
/>
</FrameLayout>
diff --git a/packages/SystemUI/res/values-am/strings.xml b/packages/SystemUI/res/values-am/strings.xml
index e2e65b9..13aaacb 100644
--- a/packages/SystemUI/res/values-am/strings.xml
+++ b/packages/SystemUI/res/values-am/strings.xml
@@ -53,7 +53,7 @@
<string name="usb_accessory_permission_prompt" msgid="5171775411178865750">"መተግበሪያ <xliff:g id="APPLICATION">%1$s</xliff:g> የUSB ተቀጥላ ላይ እንዲደርስ ፍቀድ?"</string>
<string name="usb_device_confirm_prompt" msgid="5161205258635253206">"የዚህ USB ተቀጥላ ሲያያዝ <xliff:g id="ACTIVITY">%1$s</xliff:g>ይከፈት?"</string>
<string name="usb_accessory_confirm_prompt" msgid="3808984931830229888">"የዚህ USB ተቀጥላ ሲያያዝ <xliff:g id="ACTIVITY">%1$s</xliff:g> ይከፈት?"</string>
- <string name="usb_accessory_uri_prompt" msgid="513450621413733343">"ምንም የተጫኑ መተግበሪያዎች ከዚህ የUSB ተቀጥላ ጋር አይሰሩም። በ<xliff:g id="URL">%1$s</xliff:g> ስለዚህ ተቀጥላ የበለጠ እወቅ።"</string>
+ <string name="usb_accessory_uri_prompt" msgid="513450621413733343">"ምንም የተጫኑ መተግበሪያዎች ከዚህ የUSB ተቀጥላ ጋር አይሰሩም። በ<xliff:g id="URL">%1$s</xliff:g> ስለዚህ ተቀጥላ የበለጠ ለመረዳት።"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"የUSB ተቀጥላ"</string>
<string name="label_view" msgid="6304565553218192990">"ዕይታ"</string>
<string name="always_use_device" msgid="1450287437017315906">"ለዚህ USB መሣሪያ በነባሪነት ተጠቀም"</string>
diff --git a/packages/SystemUI/res/values-cs/strings.xml b/packages/SystemUI/res/values-cs/strings.xml
index 4d9b2cd..0f48f35 100644
--- a/packages/SystemUI/res/values-cs/strings.xml
+++ b/packages/SystemUI/res/values-cs/strings.xml
@@ -65,7 +65,7 @@
<string name="screenshot_saving_ticker" msgid="7403652894056693515">"Ukládání snímku obrazovky..."</string>
<string name="screenshot_saving_title" msgid="8242282144535555697">"Ukládání snímku obrazovky..."</string>
<string name="screenshot_saving_text" msgid="2419718443411738818">"Probíhá ukládání snímku obrazovky."</string>
- <string name="screenshot_saved_title" msgid="6461865960961414961">"Snímek obrazovky byl zachycen."</string>
+ <string name="screenshot_saved_title" msgid="6461865960961414961">"Snímek obrazovky zachycen."</string>
<string name="screenshot_saved_text" msgid="1152839647677558815">"Snímek obrazovky zobrazíte dotykem."</string>
<string name="screenshot_failed_title" msgid="705781116746922771">"Snímek obrazovky se nepodařilo zachytit."</string>
<string name="screenshot_failed_text" msgid="8134011269572415402">"Snímek obrazovky se nepodařilo uložit. Je možné, že je externí úložiště právě používáno."</string>
diff --git a/packages/SystemUI/res/values-zh-rCN/strings.xml b/packages/SystemUI/res/values-zh-rCN/strings.xml
index 7e0e3c4..1f9c959 100644
--- a/packages/SystemUI/res/values-zh-rCN/strings.xml
+++ b/packages/SystemUI/res/values-zh-rCN/strings.xml
@@ -24,12 +24,12 @@
<string name="status_bar_do_not_disturb_button" msgid="5812628897510997853">"请勿打扰"</string>
<string name="status_bar_please_disturb_button" msgid="3345398298841572813">"显示通知"</string>
<string name="status_bar_recent_remove_item_title" msgid="6026395868129852968">"从列表中删除"</string>
- <string name="status_bar_recent_inspect_item_title" msgid="7793624864528818569">"应用程序信息"</string>
- <string name="status_bar_no_recent_apps" msgid="6576392951053994640">"最近没有运行任何应用程序"</string>
- <string name="status_bar_accessibility_dismiss_recents" msgid="4576076075226540105">"关闭最近运行的应用程序"</string>
+ <string name="status_bar_recent_inspect_item_title" msgid="7793624864528818569">"应用信息"</string>
+ <string name="status_bar_no_recent_apps" msgid="6576392951053994640">"最近没有运行任何应用"</string>
+ <string name="status_bar_accessibility_dismiss_recents" msgid="4576076075226540105">"关闭最近运行的应用"</string>
<plurals name="status_bar_accessibility_recent_apps">
- <item quantity="one" msgid="5854176083865845541">"1 个最近运行的应用程序"</item>
- <item quantity="other" msgid="1040784359794890744">"%d 个最近运行的应用程序"</item>
+ <item quantity="one" msgid="5854176083865845541">"1 个最近运行的应用"</item>
+ <item quantity="other" msgid="1040784359794890744">"%d 个最近运行的应用"</item>
</plurals>
<string name="status_bar_no_notifications_title" msgid="4755261167193833213">"无通知"</string>
<string name="status_bar_ongoing_events_title" msgid="1682504513316879202">"正在进行的"</string>
@@ -49,11 +49,11 @@
<string name="bluetooth_tethered" msgid="7094101612161133267">"已通过蓝牙共享网络"</string>
<string name="status_bar_input_method_settings_configure_input_methods" msgid="3504292471512317827">"设置输入法"</string>
<string name="status_bar_use_physical_keyboard" msgid="3695516942412442936">"使用物理键盘"</string>
- <string name="usb_device_permission_prompt" msgid="834698001271562057">"允许应用程序“<xliff:g id="APPLICATION">%1$s</xliff:g>”访问该 USB 设备吗?"</string>
- <string name="usb_accessory_permission_prompt" msgid="5171775411178865750">"允许应用程序“<xliff:g id="APPLICATION">%1$s</xliff:g>”访问该 USB 配件吗?"</string>
+ <string name="usb_device_permission_prompt" msgid="834698001271562057">"允许应用“<xliff:g id="APPLICATION">%1$s</xliff:g>”访问该 USB 设备吗?"</string>
+ <string name="usb_accessory_permission_prompt" msgid="5171775411178865750">"允许应用“<xliff:g id="APPLICATION">%1$s</xliff:g>”访问该 USB 配件吗?"</string>
<string name="usb_device_confirm_prompt" msgid="5161205258635253206">"要在连接此 USB 设备时打开<xliff:g id="ACTIVITY">%1$s</xliff:g>吗?"</string>
<string name="usb_accessory_confirm_prompt" msgid="3808984931830229888">"要在连接此 USB 配件时打开<xliff:g id="ACTIVITY">%1$s</xliff:g>吗?"</string>
- <string name="usb_accessory_uri_prompt" msgid="513450621413733343">"未安装此 USB 配件适用的应用程序。要了解此配件的详情,请访问:<xliff:g id="URL">%1$s</xliff:g>"</string>
+ <string name="usb_accessory_uri_prompt" msgid="513450621413733343">"未安装此 USB 配件适用的应用。要了解此配件的详情,请访问:<xliff:g id="URL">%1$s</xliff:g>"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"USB 配件"</string>
<string name="label_view" msgid="6304565553218192990">"查看"</string>
<string name="always_use_device" msgid="1450287437017315906">"默认情况下用于该 USB 设备"</string>
@@ -61,7 +61,7 @@
<string name="compat_mode_on" msgid="6623839244840638213">"缩放以填满屏幕"</string>
<string name="compat_mode_off" msgid="4434467572461327898">"拉伸以填满屏幕"</string>
<string name="compat_mode_help_header" msgid="7969493989397529910">"兼容性缩放"</string>
- <string name="compat_mode_help_body" msgid="4946726776359270040">"如果应用程序是针对较小屏幕设计的,则时钟旁会显示缩放控件。"</string>
+ <string name="compat_mode_help_body" msgid="4946726776359270040">"如果应用是针对较小屏幕设计的,则时钟旁会显示缩放控件。"</string>
<string name="screenshot_saving_ticker" msgid="7403652894056693515">"正在保存屏幕截图..."</string>
<string name="screenshot_saving_title" msgid="8242282144535555697">"正在保存屏幕截图..."</string>
<string name="screenshot_saving_text" msgid="2419718443411738818">"正在保存屏幕截图。"</string>
@@ -72,11 +72,11 @@
<string name="usb_preference_title" msgid="6551050377388882787">"USB 文件传输选项"</string>
<string name="use_mtp_button_title" msgid="4333504413563023626">"作为媒体播放器 (MTP) 装载"</string>
<string name="use_ptp_button_title" msgid="7517127540301625751">"作为摄像头 (PTP) 装载"</string>
- <string name="installer_cd_button_title" msgid="2312667578562201583">"安装适用于苹果机的“Android 文件传输”应用程序"</string>
+ <string name="installer_cd_button_title" msgid="2312667578562201583">"安装适用于苹果机的“Android 文件传输”应用"</string>
<string name="accessibility_back" msgid="567011538994429120">"返回"</string>
<string name="accessibility_home" msgid="8217216074895377641">"主屏幕"</string>
<string name="accessibility_menu" msgid="316839303324695949">"菜单"</string>
- <string name="accessibility_recent" msgid="8571350598987952883">"最近运行的应用程序"</string>
+ <string name="accessibility_recent" msgid="8571350598987952883">"最近运行的应用"</string>
<string name="accessibility_ime_switch_button" msgid="5032926134740456424">"输入法切换按钮。"</string>
<string name="accessibility_compatibility_zoom_button" msgid="8461115318742350699">"兼容性缩放按钮。"</string>
<string name="accessibility_compatibility_zoom_example" msgid="4220687294564945780">"将小屏幕的图片放大在较大屏幕上显示。"</string>
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
index 92f4ca9..f5894ea 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java
@@ -242,7 +242,7 @@
// We load in two stages: first, we update progress with just the first screenful
// of items. Then, we update with the rest of the items
final int origPri = Process.getThreadPriority(Process.myTid());
- Process.setThreadPriority(Process.THREAD_GROUP_BG_NONINTERACTIVE);
+ Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
final PackageManager pm = mContext.getPackageManager();
final ActivityManager am = (ActivityManager)
mContext.getSystemService(Context.ACTIVITY_SERVICE);
@@ -326,7 +326,7 @@
@Override
protected Void doInBackground(Void... params) {
final int origPri = Process.getThreadPriority(Process.myTid());
- Process.setThreadPriority(Process.THREAD_GROUP_BG_NONINTERACTIVE);
+ Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
while (true) {
if (isCancelled()) {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 66cb32c..564b07b 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.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
@@ -615,10 +616,11 @@
if (!mFirstScreenful && tasks.size() == 0) {
return;
}
- mNumItemsWaitingForThumbnailsAndIcons =
- mFirstScreenful ? tasks.size() : mRecentTaskDescriptions.size();
+ mNumItemsWaitingForThumbnailsAndIcons = mFirstScreenful
+ ? tasks.size() : mRecentTaskDescriptions == null
+ ? 0 : mRecentTaskDescriptions.size();
if (mRecentTaskDescriptions == null) {
- mRecentTaskDescriptions = new ArrayList(tasks);
+ mRecentTaskDescriptions = new ArrayList<TaskDescription>(tasks);
} else {
mRecentTaskDescriptions.addAll(tasks);
}
@@ -656,22 +658,33 @@
}
public void handleOnClick(View view) {
- TaskDescription ad = ((ViewHolder) view.getTag()).taskDescription;
+ ViewHolder holder = (ViewHolder)view.getTag();
+ TaskDescription ad = holder.taskDescription;
final Context context = view.getContext();
final ActivityManager am = (ActivityManager)
context.getSystemService(Context.ACTIVITY_SERVICE);
+ holder.thumbnailViewImage.setDrawingCacheEnabled(true);
+ Bitmap bm = holder.thumbnailViewImage.getDrawingCache();
+ ActivityOptions opts = ActivityOptions.makeThumbnailScaleUpAnimation(
+ holder.thumbnailViewImage, bm, 0, 0,
+ new ActivityOptions.OnAnimationStartedListener() {
+ @Override public void onAnimationStarted() {
+ hide(true);
+ }
+ });
if (ad.taskId >= 0) {
// This is an active task; it should just go to the foreground.
- am.moveTaskToFront(ad.taskId, ActivityManager.MOVE_TASK_WITH_HOME);
+ am.moveTaskToFront(ad.taskId, ActivityManager.MOVE_TASK_WITH_HOME,
+ opts.toBundle());
} else {
Intent intent = ad.intent;
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
| Intent.FLAG_ACTIVITY_TASK_ON_HOME
| Intent.FLAG_ACTIVITY_NEW_TASK);
if (DEBUG) Log.v(TAG, "Starting activity " + intent);
- context.startActivity(intent);
+ context.startActivity(intent, opts.toBundle());
}
- hide(true);
+ holder.thumbnailViewImage.setDrawingCacheEnabled(false);
}
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
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 b794826..72fdfad 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BrightnessController.java
@@ -31,9 +31,7 @@
public class BrightnessController implements ToggleSlider.Listener {
private static final String TAG = "StatusBar.BrightnessController";
- // Backlight range is from 0 - 255. Need to make sure that user
- // doesn't set the backlight to 0 and get stuck
- private static final int MINIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_DIM + 10;
+ private static final int MINIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_DIM;
private static final int MAXIMUM_BACKLIGHT = android.os.Power.BRIGHTNESS_ON;
private Context mContext;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeadZone.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeadZone.java
new file mode 100644
index 0000000..19fbe96
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeadZone.java
@@ -0,0 +1,41 @@
+/*
+ * 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.systemui.statusbar.policy;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+
+import com.android.systemui.R;
+
+public class DeadZone extends View {
+ public DeadZone(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public DeadZone(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs);
+ }
+
+ // I made you a touch event
+ @Override
+ public boolean onTouchEvent (MotionEvent event) {
+ return true; // but I eated it
+ }
+}
+
diff --git a/packages/VpnDialogs/res/values-zh-rCN/strings.xml b/packages/VpnDialogs/res/values-zh-rCN/strings.xml
index 7fdb368..ed844ad 100644
--- a/packages/VpnDialogs/res/values-zh-rCN/strings.xml
+++ b/packages/VpnDialogs/res/values-zh-rCN/strings.xml
@@ -17,8 +17,8 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="prompt" msgid="8359175999006833462">"“<xliff:g id="APP">%s</xliff:g>”尝试创建 VPN 连接。"</string>
- <string name="warning" msgid="5470743576660160079">"继续操作即表示您授予此应用程序拦截所有网络流量的权限。"<b>"除非您信任此应用程序,否则请勿接受此请求。"</b>"如果您在不信任该应用程序的情况下接受了此请求,则可能会面临数据遭到恶意软件盗用的风险。"</string>
- <string name="accept" msgid="2889226408765810173">"我信任此应用程序。"</string>
+ <string name="warning" msgid="5470743576660160079">"继续操作即表示您授予此应用拦截所有网络流量的权限。"<b>"除非您信任此应用,否则请勿接受此请求。"</b>"如果您在不信任该应用的情况下接受了此请求,则可能会面临数据遭到恶意软件盗用的风险。"</string>
+ <string name="accept" msgid="2889226408765810173">"我信任此应用。"</string>
<string name="legacy_title" msgid="192936250066580964">"已连接 VPN"</string>
<string name="configure" msgid="4905518375574791375">"配置"</string>
<string name="disconnect" msgid="971412338304200056">"断开连接"</string>
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
index 9f3de69..25af2e6 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
@@ -22,6 +22,7 @@
import com.android.internal.widget.DigitalClock;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.TransportControlView;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.InfoCallbackImpl;
import com.android.internal.policy.impl.KeyguardUpdateMonitor.SimStateCallback;
import java.util.ArrayList;
@@ -625,9 +626,9 @@
}
}
- private KeyguardUpdateMonitor.InfoCallback mInfoCallback
- = new KeyguardUpdateMonitor.InfoCallback() {
+ private InfoCallbackImpl mInfoCallback = new InfoCallbackImpl() {
+ @Override
public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn,
int batteryLevel) {
mShowingBatteryInfo = showBatteryInfo;
@@ -637,33 +638,24 @@
update(BATTERY_INFO, getAltTextMessage(tmpIcon));
}
+ @Override
public void onTimeChanged() {
refreshDate();
}
+ @Override
public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
mPlmn = plmn;
mSpn = spn;
updateCarrierStateWithSimStatus(mSimState);
}
- public void onRingerModeChanged(int state) {
-
- }
-
+ @Override
public void onPhoneStateChanged(int phoneState) {
mPhoneState = phoneState;
updateEmergencyCallButtonState(phoneState);
}
- /** {@inheritDoc} */
- public void onClockVisibilityChanged() {
- // ignored
- }
-
- public void onDeviceProvisioned() {
- // ignored
- }
};
private SimStateCallback mSimStateCallback = new SimStateCallback() {
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index 91ab053..804cd9e 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -16,6 +16,7 @@
package com.android.internal.policy.impl;
+import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -103,6 +104,7 @@
private static final int MSG_PHONE_STATE_CHANGED = 306;
private static final int MSG_CLOCK_VISIBILITY_CHANGED = 307;
private static final int MSG_DEVICE_PROVISIONED = 308;
+ protected static final int MSG_DPM_STATE_CHANGED = 309;
/**
* When we receive a
@@ -204,6 +206,9 @@
case MSG_DEVICE_PROVISIONED:
handleDeviceProvisioned();
break;
+ case MSG_DPM_STATE_CHANGED:
+ handleDevicePolicyManagerStateChanged();
+ break;
}
}
};
@@ -262,6 +267,7 @@
filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
filter.addAction(SPN_STRINGS_UPDATED_ACTION);
filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
+ filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
context.registerReceiver(new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
@@ -293,11 +299,20 @@
} else if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action)) {
String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
mHandler.sendMessage(mHandler.obtainMessage(MSG_PHONE_STATE_CHANGED, state));
+ } else if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED
+ .equals(action)) {
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_DPM_STATE_CHANGED));
}
}
}, filter);
}
+ protected void handleDevicePolicyManagerStateChanged() {
+ for (int i = 0; i < mInfoCallbacks.size(); i++) {
+ mInfoCallbacks.get(i).onDevicePolicyManagerStateChanged();
+ }
+ }
+
protected void handleDeviceProvisioned() {
for (int i = 0; i < mInfoCallbacks.size(); i++) {
mInfoCallbacks.get(i).onDeviceProvisioned();
@@ -521,6 +536,40 @@
* Called when the device becomes provisioned
*/
void onDeviceProvisioned();
+
+ /**
+ * Called when the device policy changes.
+ * See {@link DevicePolicyManager#ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED}
+ */
+ void onDevicePolicyManagerStateChanged();
+ }
+
+ // Simple class that allows methods to easily be overwritten
+ public static class InfoCallbackImpl implements InfoCallback {
+ public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn,
+ int batteryLevel) {
+ }
+
+ public void onTimeChanged() {
+ }
+
+ public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
+ }
+
+ public void onRingerModeChanged(int state) {
+ }
+
+ public void onPhoneStateChanged(int phoneState) {
+ }
+
+ public void onClockVisibilityChanged() {
+ }
+
+ public void onDeviceProvisioned() {
+ }
+
+ public void onDevicePolicyManagerStateChanged() {
+ }
}
/**
@@ -653,4 +702,10 @@
public boolean getMaxFaceUnlockAttemptsReached() {
return mFailedFaceUnlockAttempts >= FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP;
}
+
+ public boolean isSimLocked() {
+ return mSimState == IccCard.State.PIN_REQUIRED
+ || mSimState == IccCard.State.PUK_REQUIRED
+ || mSimState == IccCard.State.PERM_DISABLED;
+ }
}
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index 52d6d24..377ea66 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -18,6 +18,7 @@
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.InfoCallbackImpl;
import com.android.internal.telephony.IccCard;
import com.android.internal.widget.LockPatternUtils;
@@ -90,7 +91,7 @@
* thread of the keyguard.
*/
public class KeyguardViewMediator implements KeyguardViewCallback,
- KeyguardUpdateMonitor.InfoCallback, KeyguardUpdateMonitor.SimStateCallback {
+ KeyguardUpdateMonitor.SimStateCallback {
private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000;
private final static boolean DEBUG = false;
private final static boolean DBG_WAKE = false;
@@ -265,6 +266,20 @@
private int mLockSoundStreamId;
private int mMasterStreamMaxVolume;
+ InfoCallbackImpl mInfoCallback = new InfoCallbackImpl() {
+
+ @Override
+ public void onClockVisibilityChanged() {
+ adjustStatusBarLocked();
+ }
+
+ @Override
+ public void onDeviceProvisioned() {
+ mContext.sendBroadcast(mUserPresentIntent);
+ }
+
+ };
+
public KeyguardViewMediator(Context context, PhoneWindowManager callback,
LocalPowerManager powerManager) {
mContext = context;
@@ -293,7 +308,8 @@
mUpdateMonitor = new KeyguardUpdateMonitor(context);
- mUpdateMonitor.registerInfoCallback(this);
+ mUpdateMonitor.registerInfoCallback(mInfoCallback);
+
mUpdateMonitor.registerSimStateCallback(this);
mLockPatternUtils = new LockPatternUtils(mContext);
@@ -750,8 +766,8 @@
case PUK_REQUIRED:
synchronized (this) {
if (!isShowing()) {
- if (DEBUG) Log.d(TAG, "INTENT_VALUE_ICC_LOCKED and keygaurd isn't showing, we need "
- + "to show the keyguard so the user can enter their sim pin");
+ if (DEBUG) Log.d(TAG, "INTENT_VALUE_ICC_LOCKED and keygaurd isn't showing, "
+ + "we need to show keyguard so user can enter their sim pin");
doKeyguardLocked();
} else {
resetStateLocked();
@@ -1306,38 +1322,4 @@
}
}
- /** {@inheritDoc} */
- public void onClockVisibilityChanged() {
- adjustStatusBarLocked();
- }
-
- /** {@inheritDoc} */
- public void onPhoneStateChanged(int phoneState) {
- // ignored
- }
-
- /** {@inheritDoc} */
- public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) {
- // ignored
- }
-
- /** {@inheritDoc} */
- public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {
- // ignored
- }
-
- /** {@inheritDoc} */
- public void onRingerModeChanged(int state) {
- // ignored
- }
-
- /** {@inheritDoc} */
- public void onTimeChanged() {
- // ignored
- }
-
- /** {@inheritDoc} */
- public void onDeviceProvisioned() {
- mContext.sendBroadcast(mUserPresentIntent);
- }
}
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 3ca57c6..2e7769b 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -17,6 +17,8 @@
package com.android.internal.policy.impl;
import com.android.internal.R;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.InfoCallback;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.InfoCallbackImpl;
import com.android.internal.policy.impl.LockPatternKeyguardView.UnlockMode;
import com.android.internal.policy.IFaceLockCallback;
import com.android.internal.policy.IFaceLockInterface;
@@ -80,8 +82,7 @@
* {@link com.android.internal.policy.impl.KeyguardViewManager}
* via its {@link com.android.internal.policy.impl.KeyguardViewCallback}, as appropriate.
*/
-public class LockPatternKeyguardView extends KeyguardViewBase implements Handler.Callback,
- KeyguardUpdateMonitor.InfoCallback {
+public class LockPatternKeyguardView extends KeyguardViewBase implements Handler.Callback {
private static final int TRANSPORT_USERACTIVITY_TIMEOUT = 10000;
@@ -133,12 +134,6 @@
// So the user has a consistent amount of time when brought to the backup method from FaceLock
private final int BACKUP_LOCK_TIMEOUT = 5000;
- /**
- * The current {@link KeyguardScreen} will use this to communicate back to us.
- */
- KeyguardScreenCallback mKeyguardScreenCallback;
-
-
private boolean mRequiresSim;
//True if we have some sort of overlay on top of the Lockscreen
//Also true if we've activated a phone call, either emergency dialing or incoming
@@ -150,6 +145,10 @@
//True if this device is currently plugged in
private boolean mPluggedIn;
+ // The music control widget
+ private TransportControlView mTransportControlView;
+
+ private Parcelable mSavedState;
/**
* Either a lock screen (an informational keyguard screen), or an unlock
@@ -216,7 +215,6 @@
*/
private boolean mIsVerifyUnlockOnly = false;
-
/**
* Used to lookup the state of the lock pattern
*/
@@ -274,10 +272,6 @@
}
};
- private TransportControlView mTransportControlView;
-
- private Parcelable mSavedState;
-
/**
* @return Whether we are stuck on the lock screen because the sim is
* missing.
@@ -290,6 +284,160 @@
}
/**
+ * The current {@link KeyguardScreen} will use this to communicate back to us.
+ */
+ KeyguardScreenCallback mKeyguardScreenCallback = new KeyguardScreenCallback() {
+
+ public void goToLockScreen() {
+ mForgotPattern = false;
+ if (mIsVerifyUnlockOnly) {
+ // navigating away from unlock screen during verify mode means
+ // we are done and the user failed to authenticate.
+ mIsVerifyUnlockOnly = false;
+ getCallback().keyguardDone(false);
+ } else {
+ updateScreen(Mode.LockScreen, false);
+ }
+ }
+
+ public void goToUnlockScreen() {
+ final IccCard.State simState = mUpdateMonitor.getSimState();
+ if (stuckOnLockScreenBecauseSimMissing()
+ || (simState == IccCard.State.PUK_REQUIRED
+ && !mLockPatternUtils.isPukUnlockScreenEnable())){
+ // stuck on lock screen when sim missing or
+ // puk'd but puk unlock screen is disabled
+ return;
+ }
+ if (!isSecure()) {
+ getCallback().keyguardDone(true);
+ } else {
+ updateScreen(Mode.UnlockScreen, false);
+ }
+ }
+
+ public void forgotPattern(boolean isForgotten) {
+ if (mEnableFallback) {
+ mForgotPattern = isForgotten;
+ updateScreen(Mode.UnlockScreen, false);
+ }
+ }
+
+ public boolean isSecure() {
+ return LockPatternKeyguardView.this.isSecure();
+ }
+
+ public boolean isVerifyUnlockOnly() {
+ return mIsVerifyUnlockOnly;
+ }
+
+ public void recreateMe(Configuration config) {
+ removeCallbacks(mRecreateRunnable);
+ post(mRecreateRunnable);
+ }
+
+ public void takeEmergencyCallAction() {
+ mHasOverlay = true;
+
+ // Continue showing FaceLock area until dialer comes up or call is resumed
+ if (usingFaceLock() && mFaceLockServiceRunning) {
+ showFaceLockAreaWithTimeout(FACELOCK_VIEW_AREA_EMERGENCY_DIALER_TIMEOUT);
+ }
+
+ // FaceLock must be stopped if it is running when emergency call is pressed
+ stopAndUnbindFromFaceLock();
+
+ pokeWakelock(EMERGENCY_CALL_TIMEOUT);
+ if (TelephonyManager.getDefault().getCallState()
+ == TelephonyManager.CALL_STATE_OFFHOOK) {
+ mLockPatternUtils.resumeCall();
+ } else {
+ Intent intent = new Intent(ACTION_EMERGENCY_DIAL);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ getContext().startActivity(intent);
+ }
+ }
+
+ public void pokeWakelock() {
+ getCallback().pokeWakelock();
+ }
+
+ public void pokeWakelock(int millis) {
+ getCallback().pokeWakelock(millis);
+ }
+
+ public void keyguardDone(boolean authenticated) {
+ getCallback().keyguardDone(authenticated);
+ mSavedState = null; // clear state so we re-establish when locked again
+ }
+
+ public void keyguardDoneDrawing() {
+ // irrelevant to keyguard screen, they shouldn't be calling this
+ }
+
+ public void reportFailedUnlockAttempt() {
+ mUpdateMonitor.reportFailedAttempt();
+ final int failedAttempts = mUpdateMonitor.getFailedAttempts();
+ if (DEBUG) Log.d(TAG, "reportFailedPatternAttempt: #" + failedAttempts +
+ " (enableFallback=" + mEnableFallback + ")");
+
+ final boolean usingPattern = mLockPatternUtils.getKeyguardStoredPasswordQuality()
+ == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
+
+ final int failedAttemptsBeforeWipe = mLockPatternUtils.getDevicePolicyManager()
+ .getMaximumFailedPasswordsForWipe(null);
+
+ final int failedAttemptWarning = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET
+ - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
+
+ final int remainingBeforeWipe = failedAttemptsBeforeWipe > 0 ?
+ (failedAttemptsBeforeWipe - failedAttempts)
+ : Integer.MAX_VALUE; // because DPM returns 0 if no restriction
+
+ if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) {
+ // If we reach this code, it means the user has installed a DevicePolicyManager
+ // that requests device wipe after N attempts. Once we get below the grace
+ // period, we'll post this dialog every time as a clear warning until the
+ // bombshell hits and the device is wiped.
+ if (remainingBeforeWipe > 0) {
+ showAlmostAtWipeDialog(failedAttempts, remainingBeforeWipe);
+ } else {
+ // Too many attempts. The device will be wiped shortly.
+ Slog.i(TAG, "Too many unlock attempts; device will be wiped!");
+ showWipeDialog(failedAttempts);
+ }
+ } else {
+ boolean showTimeout =
+ (failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0;
+ if (usingPattern && mEnableFallback) {
+ if (failedAttempts == failedAttemptWarning) {
+ showAlmostAtAccountLoginDialog();
+ showTimeout = false; // don't show both dialogs
+ } else if (failedAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET) {
+ mLockPatternUtils.setPermanentlyLocked(true);
+ updateScreen(mMode, false);
+ // don't show timeout dialog because we show account unlock screen next
+ showTimeout = false;
+ }
+ }
+ if (showTimeout) {
+ showTimeoutDialog();
+ }
+ }
+ mLockPatternUtils.reportFailedPasswordAttempt();
+ }
+
+ public boolean doesFallbackUnlockScreenExist() {
+ return mEnableFallback;
+ }
+
+ public void reportSuccessfulUnlockAttempt() {
+ mLockPatternUtils.reportSuccessfulPasswordAttempt();
+ }
+ };
+
+ /**
* @param context Used to inflate, and create views.
* @param callback Keyguard callback object for pokewakelock(), etc.
* @param updateMonitor Knows the state of the world, and passed along to each
@@ -313,158 +461,7 @@
mPluggedIn = mUpdateMonitor.isDevicePluggedIn();
mScreenOn = ((PowerManager)context.getSystemService(Context.POWER_SERVICE)).isScreenOn();
- mUpdateMonitor.registerInfoCallback(this);
-
- mKeyguardScreenCallback = new KeyguardScreenCallback() {
-
- public void goToLockScreen() {
- mForgotPattern = false;
- if (mIsVerifyUnlockOnly) {
- // navigating away from unlock screen during verify mode means
- // we are done and the user failed to authenticate.
- mIsVerifyUnlockOnly = false;
- getCallback().keyguardDone(false);
- } else {
- updateScreen(Mode.LockScreen, false);
- }
- }
-
- public void goToUnlockScreen() {
- final IccCard.State simState = mUpdateMonitor.getSimState();
- if (stuckOnLockScreenBecauseSimMissing()
- || (simState == IccCard.State.PUK_REQUIRED
- && !mLockPatternUtils.isPukUnlockScreenEnable())){
- // stuck on lock screen when sim missing or
- // puk'd but puk unlock screen is disabled
- return;
- }
- if (!isSecure()) {
- getCallback().keyguardDone(true);
- } else {
- updateScreen(Mode.UnlockScreen, false);
- }
- }
-
- public void forgotPattern(boolean isForgotten) {
- if (mEnableFallback) {
- mForgotPattern = isForgotten;
- updateScreen(Mode.UnlockScreen, false);
- }
- }
-
- public boolean isSecure() {
- return LockPatternKeyguardView.this.isSecure();
- }
-
- public boolean isVerifyUnlockOnly() {
- return mIsVerifyUnlockOnly;
- }
-
- public void recreateMe(Configuration config) {
- removeCallbacks(mRecreateRunnable);
- post(mRecreateRunnable);
- }
-
- public void takeEmergencyCallAction() {
- mHasOverlay = true;
-
- // Continue showing FaceLock area until dialer comes up or call is resumed
- if (usingFaceLock() && mFaceLockServiceRunning) {
- showFaceLockAreaWithTimeout(FACELOCK_VIEW_AREA_EMERGENCY_DIALER_TIMEOUT);
- }
-
- // FaceLock must be stopped if it is running when emergency call is pressed
- stopAndUnbindFromFaceLock();
-
- pokeWakelock(EMERGENCY_CALL_TIMEOUT);
- if (TelephonyManager.getDefault().getCallState()
- == TelephonyManager.CALL_STATE_OFFHOOK) {
- mLockPatternUtils.resumeCall();
- } else {
- Intent intent = new Intent(ACTION_EMERGENCY_DIAL);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
- getContext().startActivity(intent);
- }
- }
-
- public void pokeWakelock() {
- getCallback().pokeWakelock();
- }
-
- public void pokeWakelock(int millis) {
- getCallback().pokeWakelock(millis);
- }
-
- public void keyguardDone(boolean authenticated) {
- getCallback().keyguardDone(authenticated);
- mSavedState = null; // clear state so we re-establish when locked again
- }
-
- public void keyguardDoneDrawing() {
- // irrelevant to keyguard screen, they shouldn't be calling this
- }
-
- public void reportFailedUnlockAttempt() {
- mUpdateMonitor.reportFailedAttempt();
- final int failedAttempts = mUpdateMonitor.getFailedAttempts();
- if (DEBUG) Log.d(TAG, "reportFailedPatternAttempt: #" + failedAttempts +
- " (enableFallback=" + mEnableFallback + ")");
-
- final boolean usingPattern = mLockPatternUtils.getKeyguardStoredPasswordQuality()
- == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
-
- final int failedAttemptsBeforeWipe = mLockPatternUtils.getDevicePolicyManager()
- .getMaximumFailedPasswordsForWipe(null);
-
- final int failedAttemptWarning = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET
- - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
-
- final int remainingBeforeWipe = failedAttemptsBeforeWipe > 0 ?
- (failedAttemptsBeforeWipe - failedAttempts)
- : Integer.MAX_VALUE; // because DPM returns 0 if no restriction
-
- if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) {
- // If we reach this code, it means the user has installed a DevicePolicyManager
- // that requests device wipe after N attempts. Once we get below the grace
- // period, we'll post this dialog every time as a clear warning until the
- // bombshell hits and the device is wiped.
- if (remainingBeforeWipe > 0) {
- showAlmostAtWipeDialog(failedAttempts, remainingBeforeWipe);
- } else {
- // Too many attempts. The device will be wiped shortly.
- Slog.i(TAG, "Too many unlock attempts; device will be wiped!");
- showWipeDialog(failedAttempts);
- }
- } else {
- boolean showTimeout =
- (failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0;
- if (usingPattern && mEnableFallback) {
- if (failedAttempts == failedAttemptWarning) {
- showAlmostAtAccountLoginDialog();
- showTimeout = false; // don't show both dialogs
- } else if (failedAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET) {
- mLockPatternUtils.setPermanentlyLocked(true);
- updateScreen(mMode, false);
- // don't show timeout dialog because we show account unlock screen next
- showTimeout = false;
- }
- }
- if (showTimeout) {
- showTimeoutDialog();
- }
- }
- mLockPatternUtils.reportFailedPasswordAttempt();
- }
-
- public boolean doesFallbackUnlockScreenExist() {
- return mEnableFallback;
- }
-
- public void reportSuccessfulUnlockAttempt() {
- mLockPatternUtils.reportSuccessfulPasswordAttempt();
- }
- };
+ mUpdateMonitor.registerInfoCallback(mInfoCallback);
/**
* We'll get key events the current screen doesn't use. see
@@ -707,6 +704,8 @@
@Override
protected void onDetachedFromWindow() {
+ mUpdateMonitor.removeCallback(mInfoCallback);
+
removeCallbacks(mRecreateRunnable);
// When view is hidden, need to unbind from FaceLock service if we are using FaceLock
@@ -726,46 +725,39 @@
post(mRecreateRunnable);
}
- /** When somebody plugs in or unplugs the device, we don't want to display faceunlock */
- @Override
- public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn, int batteryLevel) {
- mHasOverlay |= mPluggedIn != pluggedIn;
- mPluggedIn = pluggedIn;
- //If it's already running, don't close it down: the unplug didn't start it
- if (!mFaceLockServiceRunning) {
- stopAndUnbindFromFaceLock();
- hideFaceLockArea();
+ InfoCallbackImpl mInfoCallback = new InfoCallbackImpl() {
+
+ /** When somebody plugs in or unplugs the device, we don't want to display faceunlock */
+ @Override
+ public void onRefreshBatteryInfo(boolean showBatteryInfo, boolean pluggedIn,
+ int batteryLevel) {
+ mHasOverlay |= mPluggedIn != pluggedIn;
+ mPluggedIn = pluggedIn;
+ //If it's already running, don't close it down: the unplug didn't start it
+ if (!mFaceLockServiceRunning) {
+ stopAndUnbindFromFaceLock();
+ hideFaceLockArea();
+ }
}
- }
- //Ignore these events; they are implemented only because they come from the same interface
- @Override
- public void onTimeChanged() {}
- @Override
- public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {}
- @Override
- public void onRingerModeChanged(int state) {}
-
- @Override
- public void onClockVisibilityChanged() {
- int visFlags = getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_CLOCK;
- setSystemUiVisibility(visFlags
- | (mUpdateMonitor.isClockVisible() ? View.STATUS_BAR_DISABLE_CLOCK : 0));
- }
-
- @Override
- public void onDeviceProvisioned() {}
-
- //We need to stop faceunlock when a phonecall comes in
- @Override
- public void onPhoneStateChanged(int phoneState) {
- if (DEBUG) Log.d(TAG, "phone state: " + phoneState);
- if(phoneState == TelephonyManager.CALL_STATE_RINGING) {
- mHasOverlay = true;
- stopAndUnbindFromFaceLock();
- hideFaceLockArea();
+ @Override
+ public void onClockVisibilityChanged() {
+ int visFlags = getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_CLOCK;
+ setSystemUiVisibility(visFlags
+ | (mUpdateMonitor.isClockVisible() ? View.STATUS_BAR_DISABLE_CLOCK : 0));
}
- }
+
+ //We need to stop faceunlock when a phonecall comes in
+ @Override
+ public void onPhoneStateChanged(int phoneState) {
+ if (DEBUG) Log.d(TAG, "phone state: " + phoneState);
+ if(phoneState == TelephonyManager.CALL_STATE_RINGING) {
+ mHasOverlay = true;
+ stopAndUnbindFromFaceLock();
+ hideFaceLockArea();
+ }
+ }
+ };
@Override
protected boolean dispatchHoverEvent(MotionEvent event) {
diff --git a/policy/src/com/android/internal/policy/impl/LockScreen.java b/policy/src/com/android/internal/policy/impl/LockScreen.java
index edf5199..c9a130b 100644
--- a/policy/src/com/android/internal/policy/impl/LockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/LockScreen.java
@@ -17,6 +17,11 @@
package com.android.internal.policy.impl;
import com.android.internal.R;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.InfoCallback;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.InfoCallbackImpl;
+import com.android.internal.policy.impl.KeyguardUpdateMonitor.SimStateCallback;
+import com.android.internal.policy.impl.LockScreen.MultiWaveViewMethods;
+import com.android.internal.telephony.IccCard.State;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.SlidingTab;
import com.android.internal.widget.WaveView;
@@ -60,6 +65,9 @@
private KeyguardUpdateMonitor mUpdateMonitor;
private KeyguardScreenCallback mCallback;
+ // set to 'true' to show the ring/silence target when camera isn't available
+ private boolean mEnableRingSilenceFallback = false;
+
// current configuration state of keyboard and display
private int mKeyboardHidden;
private int mCreationOrientation;
@@ -71,6 +79,31 @@
private KeyguardStatusViewManager mStatusViewManager;
private UnlockWidgetCommonMethods mUnlockWidgetMethods;
private View mUnlockWidget;
+ public boolean mCameraDisabled;
+
+ InfoCallbackImpl mInfoCallback = new InfoCallbackImpl() {
+
+ @Override
+ public void onRingerModeChanged(int state) {
+ boolean silent = AudioManager.RINGER_MODE_NORMAL != state;
+ if (silent != mSilentMode) {
+ mSilentMode = silent;
+ mUnlockWidgetMethods.updateResources();
+ }
+ }
+
+ @Override
+ public void onDevicePolicyManagerStateChanged() {
+ updateCameraTarget();
+ }
+
+ };
+
+ SimStateCallback mSimStateCallback = new SimStateCallback() {
+ public void onSimStateChanged(State simState) {
+ updateCameraTarget();
+ }
+ };
private interface UnlockWidgetCommonMethods {
// Update resources based on phone state
@@ -84,6 +117,13 @@
// Animate the widget if it supports ping()
public void ping();
+
+ // Enable or disable a target. ResourceId is the id of the *drawable* associated with the
+ // target.
+ public void setEnabled(int resourceId, boolean enabled);
+
+ // Get the target position for the given resource. Returns -1 if not found.
+ public int getTargetPosition(int resourceId);
}
class SlidingTabMethods implements SlidingTab.OnTriggerListener, UnlockWidgetCommonMethods {
@@ -144,6 +184,14 @@
public void ping() {
}
+
+ public void setEnabled(int resourceId, boolean enabled) {
+ // Not used
+ }
+
+ public int getTargetPosition(int resourceId) {
+ return -1; // Not supported
+ }
}
class WaveViewMethods implements WaveView.OnTriggerListener, UnlockWidgetCommonMethods {
@@ -181,39 +229,40 @@
}
public void ping() {
}
+ public void setEnabled(int resourceId, boolean enabled) {
+ // Not used
+ }
+ public int getTargetPosition(int resourceId) {
+ return -1; // Not supported
+ }
}
class MultiWaveViewMethods implements MultiWaveView.OnTriggerListener,
UnlockWidgetCommonMethods {
-
private final MultiWaveView mMultiWaveView;
- private boolean mCameraDisabled;
MultiWaveViewMethods(MultiWaveView multiWaveView) {
mMultiWaveView = multiWaveView;
- final boolean cameraDisabled = mLockPatternUtils.getDevicePolicyManager()
- .getCameraDisabled(null);
- if (cameraDisabled) {
- Log.v(TAG, "Camera disabled by Device Policy");
- mCameraDisabled = true;
- } else {
- // Camera is enabled if resource is initially defined for MultiWaveView
- // in the lockscreen layout file
- mCameraDisabled = mMultiWaveView.getTargetResourceId()
- != R.array.lockscreen_targets_with_camera;
- }
+ }
+
+ public boolean isCameraTargetPresent() {
+ return mMultiWaveView
+ .getTargetPosition(com.android.internal.R.drawable.ic_lockscreen_camera) != -1;
}
public void updateResources() {
int resId;
- if (mCameraDisabled) {
- // Fall back to showing ring/silence if camera is disabled by DPM...
+ if (mCameraDisabled && mEnableRingSilenceFallback) {
+ // Fall back to showing ring/silence if camera is disabled...
resId = mSilentMode ? R.array.lockscreen_targets_when_silent
: R.array.lockscreen_targets_when_soundon;
} else {
resId = R.array.lockscreen_targets_with_camera;
}
- mMultiWaveView.setTargetResources(resId);
+ if (mMultiWaveView.getTargetResourceId() != resId) {
+ mMultiWaveView.setTargetResources(resId);
+ }
+ setEnabled(com.android.internal.R.drawable.ic_lockscreen_camera, !mCameraDisabled);
}
public void onGrabbed(View v, int handle) {
@@ -225,29 +274,39 @@
}
public void onTrigger(View v, int target) {
- if (target == 0 || target == 1) { // 0 = unlock/portrait, 1 = unlock/landscape
- mCallback.goToUnlockScreen();
- } else if (target == 2 || target == 3) { // 2 = alt/portrait, 3 = alt/landscape
- if (!mCameraDisabled) {
- // Start the Camera
- Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
- try {
- ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
- } catch (RemoteException e) {
- Log.w(TAG, "can't dismiss keyguard on launch");
- }
- try {
- mContext.startActivity(intent);
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, "Camera application not found");
- }
- } else {
- toggleRingMode();
- mUnlockWidgetMethods.updateResources();
+ final int resId = mMultiWaveView.getResourceIdForTarget(target);
+ switch (resId) {
+ case com.android.internal.R.drawable.ic_lockscreen_camera:
+ launchCamera();
mCallback.pokeWakelock();
- }
+ break;
+
+ case com.android.internal.R.drawable.ic_lockscreen_silent:
+ toggleRingMode();
+ mCallback.pokeWakelock();
+ break;
+
+ case com.android.internal.R.drawable.ic_lockscreen_unlock:
+ mCallback.goToUnlockScreen();
+ break;
+ }
+ }
+
+ private void launchCamera() {
+ Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
+ intent.setFlags(
+ Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_SINGLE_TOP
+ | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ try {
+ ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
+ } catch (RemoteException e) {
+ Log.w(TAG, "can't dismiss keyguard on launch");
+ }
+ try {
+ mContext.startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ Log.w(TAG, "Camera application not found");
}
}
@@ -271,6 +330,14 @@
public void ping() {
mMultiWaveView.ping();
}
+
+ public void setEnabled(int resourceId, boolean enabled) {
+ mMultiWaveView.setEnableTarget(resourceId, enabled);
+ }
+
+ public int getTargetPosition(int resourceId) {
+ return mMultiWaveView.getTargetPosition(resourceId);
+ }
}
private void requestUnlockScreen() {
@@ -328,11 +395,8 @@
mLockPatternUtils = lockPatternUtils;
mUpdateMonitor = updateMonitor;
mCallback = callback;
-
mEnableMenuKeyInLockScreen = shouldEnableMenuKey();
-
mCreationOrientation = configuration.orientation;
-
mKeyboardHidden = configuration.hardKeyboardHidden;
if (LockPatternKeyguardView.DEBUG_CONFIGURATION) {
@@ -358,10 +422,16 @@
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mSilentMode = isSilentMode();
-
mUnlockWidget = findViewById(R.id.unlock_widget);
- if (mUnlockWidget instanceof SlidingTab) {
- SlidingTab slidingTabView = (SlidingTab) mUnlockWidget;
+ mUnlockWidgetMethods = createUnlockMethods(mUnlockWidget);
+
+ if (DBG) Log.v(TAG, "*** LockScreen accel is "
+ + (mUnlockWidget.isHardwareAccelerated() ? "on":"off"));
+ }
+
+ private UnlockWidgetCommonMethods createUnlockMethods(View unlockWidget) {
+ if (unlockWidget instanceof SlidingTab) {
+ SlidingTab slidingTabView = (SlidingTab) unlockWidget;
slidingTabView.setHoldAfterTrigger(true, false);
slidingTabView.setLeftHintText(R.string.lockscreen_unlock_label);
slidingTabView.setLeftTabResources(
@@ -371,26 +441,35 @@
R.drawable.jog_tab_left_unlock);
SlidingTabMethods slidingTabMethods = new SlidingTabMethods(slidingTabView);
slidingTabView.setOnTriggerListener(slidingTabMethods);
- mUnlockWidgetMethods = slidingTabMethods;
- } else if (mUnlockWidget instanceof WaveView) {
- WaveView waveView = (WaveView) mUnlockWidget;
+ return slidingTabMethods;
+ } else if (unlockWidget instanceof WaveView) {
+ WaveView waveView = (WaveView) unlockWidget;
WaveViewMethods waveViewMethods = new WaveViewMethods(waveView);
waveView.setOnTriggerListener(waveViewMethods);
- mUnlockWidgetMethods = waveViewMethods;
- } else if (mUnlockWidget instanceof MultiWaveView) {
- MultiWaveView multiWaveView = (MultiWaveView) mUnlockWidget;
+ return waveViewMethods;
+ } else if (unlockWidget instanceof MultiWaveView) {
+ MultiWaveView multiWaveView = (MultiWaveView) unlockWidget;
MultiWaveViewMethods multiWaveViewMethods = new MultiWaveViewMethods(multiWaveView);
multiWaveView.setOnTriggerListener(multiWaveViewMethods);
- mUnlockWidgetMethods = multiWaveViewMethods;
+ return multiWaveViewMethods;
} else {
- throw new IllegalStateException("Unrecognized unlock widget: " + mUnlockWidget);
+ throw new IllegalStateException("Unrecognized unlock widget: " + unlockWidget);
}
+ }
- // Update widget with initial ring state
+ private void updateCameraTarget() {
+ boolean disabledByAdmin = mLockPatternUtils.getDevicePolicyManager()
+ .getCameraDisabled(null);
+ boolean disabledBySimState = mUpdateMonitor.isSimLocked();
+ boolean targetPresent = (mUnlockWidgetMethods instanceof MultiWaveViewMethods)
+ ? ((MultiWaveViewMethods) mUnlockWidgetMethods).isCameraTargetPresent() : false;
+ if (disabledByAdmin) {
+ Log.v(TAG, "Camera disabled by Device Policy");
+ } else if (disabledBySimState) {
+ Log.v(TAG, "Camera disabled by Sim State");
+ }
+ mCameraDisabled = disabledByAdmin || disabledBySimState || !targetPresent;
mUnlockWidgetMethods.updateResources();
-
- if (DBG) Log.v(TAG, "*** LockScreen accel is "
- + (mUnlockWidget.isHardwareAccelerated() ? "on":"off"));
}
private boolean isSilentMode() {
@@ -448,6 +527,8 @@
/** {@inheritDoc} */
public void onPause() {
+ mUpdateMonitor.removeCallback(mInfoCallback);
+ mUpdateMonitor.removeCallback(mSimStateCallback);
mStatusViewManager.onPause();
mUnlockWidgetMethods.reset(false);
}
@@ -460,27 +541,21 @@
/** {@inheritDoc} */
public void onResume() {
+ // We don't want to show the camera target if SIM state prevents us from
+ // launching the camera. So watch for SIM changes...
+ mUpdateMonitor.registerSimStateCallback(mSimStateCallback);
+ mUpdateMonitor.registerInfoCallback(mInfoCallback);
+
mStatusViewManager.onResume();
postDelayed(mOnResumePing, ON_RESUME_PING_DELAY);
}
/** {@inheritDoc} */
public void cleanUp() {
- mUpdateMonitor.removeCallback(this); // this must be first
+ mUpdateMonitor.removeCallback(mInfoCallback); // this must be first
+ mUpdateMonitor.removeCallback(mSimStateCallback);
mLockPatternUtils = null;
mUpdateMonitor = null;
mCallback = null;
}
-
- /** {@inheritDoc} */
- public void onRingerModeChanged(int state) {
- boolean silent = AudioManager.RINGER_MODE_NORMAL != state;
- if (silent != mSilentMode) {
- mSilentMode = silent;
- mUnlockWidgetMethods.updateResources();
- }
- }
-
- public void onPhoneStateChanged(String newState) {
- }
}
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index a1f7316..b5dace0 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -463,6 +463,7 @@
// Screenshot trigger states
// Time to volume and power must be pressed within this interval of each other.
private static final long SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS = 150;
+ private boolean mScreenshotChordEnabled;
private boolean mVolumeDownKeyTriggered;
private long mVolumeDownKeyTime;
private boolean mVolumeDownKeyConsumedByScreenshotChord;
@@ -636,7 +637,8 @@
}
private void interceptScreenshotChord() {
- if (mVolumeDownKeyTriggered && mPowerKeyTriggered && !mVolumeUpKeyTriggered) {
+ if (mScreenshotChordEnabled
+ && mVolumeDownKeyTriggered && mPowerKeyTriggered && !mVolumeUpKeyTriggered) {
final long now = SystemClock.uptimeMillis();
if (now <= mVolumeDownKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS
&& now <= mPowerKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS) {
@@ -882,6 +884,9 @@
mSafeModeEnabledVibePattern = getLongIntArray(mContext.getResources(),
com.android.internal.R.array.config_safeModeEnabledVibePattern);
+ mScreenshotChordEnabled = mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_enableScreenshotChord);
+
// Controls rotation and the like.
initializeHdmiState();
@@ -1574,7 +1579,7 @@
// If we think we might have a volume down & power key chord on the way
// but we're not sure, then tell the dispatcher to wait a little while and
// try again later before dispatching.
- if ((flags & KeyEvent.FLAG_FALLBACK) == 0) {
+ if (mScreenshotChordEnabled && (flags & KeyEvent.FLAG_FALLBACK) == 0) {
if (mVolumeDownKeyTriggered && !mPowerKeyTriggered) {
final long now = SystemClock.uptimeMillis();
final long timeoutTime = mVolumeDownKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS;
diff --git a/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java b/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java
index ba06996..f3e7d4a 100644
--- a/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java
+++ b/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java
@@ -106,7 +106,7 @@
mHeaderText.setSelected(true);
mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, updateMonitor,
- lockpatternutils, callback, false);
+ lockpatternutils, callback, true);
mPinText.setFocusableInTouchMode(true);
mPinText.setOnFocusChangeListener(this);
diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
index 86692e7..257f62c 100644
--- a/services/audioflinger/Android.mk
+++ b/services/audioflinger/Android.mk
@@ -12,9 +12,10 @@
# AudioResamplerCubic.cpp.arm
LOCAL_C_INCLUDES := \
- system/media/audio_effects/include \
- system/media/audio_utils/include
+ $(call include-path-for, audio-effects) \
+ $(call include-path-for, audio-utils)
+# FIXME keep libmedia_native but remove libmedia after split
LOCAL_SHARED_LIBRARIES := \
libaudioutils \
libcommon_time_client \
@@ -22,6 +23,7 @@
libutils \
libbinder \
libmedia \
+ libmedia_native \
libhardware \
libhardware_legacy \
libeffects \
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 1d4f12b..c5ad0f5 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -61,9 +61,13 @@
#include <audio_utils/primitives.h>
-#include <cpustats/ThreadCpuUsage.h>
#include <powermanager/PowerManager.h>
+
// #define DEBUG_CPU_USAGE 10 // log statistics every n wall clock seconds
+#ifdef DEBUG_CPU_USAGE
+#include <cpustats/CentralTendencyStatistics.h>
+#include <cpustats/ThreadCpuUsage.h>
+#endif
#include <common_time/cc_helper.h>
#include <common_time/local_clock.h>
@@ -438,11 +442,9 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- // FIXME dead, remove from IAudioFlinger
- uint32_t flags,
+ IAudioFlinger::track_flags_t flags,
const sp<IMemory>& sharedBuffer,
audio_io_handle_t output,
- bool isTimed,
int *sessionId,
status_t *status)
{
@@ -500,6 +502,7 @@
}
ALOGV("createTrack() lSessionId: %d", lSessionId);
+ bool isTimed = (flags & IAudioFlinger::TRACK_TIMED) != 0;
track = thread->createTrack_l(client, streamType, sampleRate, format,
channelMask, frameCount, sharedBuffer, lSessionId, isTimed, &lStatus);
@@ -890,7 +893,8 @@
// indicate output device change to all input threads for pre processing
AudioParameter param = AudioParameter(keyValuePairs);
int value;
- if (param.getInt(String8(AudioParameter::keyRouting), value) == NO_ERROR) {
+ if ((param.getInt(String8(AudioParameter::keyRouting), value) == NO_ERROR) &&
+ (value != 0)) {
for (size_t i = 0; i < mRecordThreads.size(); i++) {
mRecordThreads.valueAt(i)->setParameters(keyValuePairs);
}
@@ -1194,6 +1198,10 @@
write(fd, buffer, strlen(buffer));
}
+ snprintf(buffer, SIZE, "io handle: %d\n", mId);
+ result.append(buffer);
+ snprintf(buffer, SIZE, "TID: %d\n", getTid());
+ result.append(buffer);
snprintf(buffer, SIZE, "standby: %d\n", mStandby);
result.append(buffer);
snprintf(buffer, SIZE, "Sample rate: %d\n", mSampleRate);
@@ -1580,7 +1588,7 @@
}
// PlaybackThread::createTrack_l() must be called with AudioFlinger::mLock held
-sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrack_l(
+sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrack_l(
const sp<AudioFlinger::Client>& client,
audio_stream_type_t streamType,
uint32_t sampleRate,
@@ -1945,30 +1953,83 @@
class CpuStats {
public:
- void sample();
+ CpuStats();
+ void sample(const String8 &title);
#ifdef DEBUG_CPU_USAGE
private:
- ThreadCpuUsage mCpu;
+ ThreadCpuUsage mCpuUsage; // instantaneous thread CPU usage in wall clock ns
+ CentralTendencyStatistics mWcStats; // statistics on thread CPU usage in wall clock ns
+
+ CentralTendencyStatistics mHzStats; // statistics on thread CPU usage in cycles
+
+ int mCpuNum; // thread's current CPU number
+ int mCpukHz; // frequency of thread's current CPU in kHz
#endif
};
-void CpuStats::sample() {
+CpuStats::CpuStats()
#ifdef DEBUG_CPU_USAGE
- const CentralTendencyStatistics& stats = mCpu.statistics();
- mCpu.sampleAndEnable();
- unsigned n = stats.n();
- // mCpu.elapsed() is expensive, so don't call it every loop
+ : mCpuNum(-1), mCpukHz(-1)
+#endif
+{
+}
+
+void CpuStats::sample(const String8 &title) {
+#ifdef DEBUG_CPU_USAGE
+ // get current thread's delta CPU time in wall clock ns
+ double wcNs;
+ bool valid = mCpuUsage.sampleAndEnable(wcNs);
+
+ // record sample for wall clock statistics
+ if (valid) {
+ mWcStats.sample(wcNs);
+ }
+
+ // get the current CPU number
+ int cpuNum = sched_getcpu();
+
+ // get the current CPU frequency in kHz
+ int cpukHz = mCpuUsage.getCpukHz(cpuNum);
+
+ // check if either CPU number or frequency changed
+ if (cpuNum != mCpuNum || cpukHz != mCpukHz) {
+ mCpuNum = cpuNum;
+ mCpukHz = cpukHz;
+ // ignore sample for purposes of cycles
+ valid = false;
+ }
+
+ // if no change in CPU number or frequency, then record sample for cycle statistics
+ if (valid && mCpukHz > 0) {
+ double cycles = wcNs * cpukHz * 0.000001;
+ mHzStats.sample(cycles);
+ }
+
+ unsigned n = mWcStats.n();
+ // mCpuUsage.elapsed() is expensive, so don't call it every loop
if ((n & 127) == 1) {
- long long elapsed = mCpu.elapsed();
+ long long elapsed = mCpuUsage.elapsed();
if (elapsed >= DEBUG_CPU_USAGE * 1000000000LL) {
double perLoop = elapsed / (double) n;
double perLoop100 = perLoop * 0.01;
- double mean = stats.mean();
- double stddev = stats.stddev();
- double minimum = stats.minimum();
- double maximum = stats.maximum();
- mCpu.resetStatistics();
- ALOGI("CPU usage over past %.1f secs (%u mixer loops at %.1f mean ms per loop):\n us per mix loop: mean=%.0f stddev=%.0f min=%.0f max=%.0f\n %% of wall: mean=%.1f stddev=%.1f min=%.1f max=%.1f",
+ double perLoop1k = perLoop * 0.001;
+ double mean = mWcStats.mean();
+ double stddev = mWcStats.stddev();
+ double minimum = mWcStats.minimum();
+ double maximum = mWcStats.maximum();
+ double meanCycles = mHzStats.mean();
+ double stddevCycles = mHzStats.stddev();
+ double minCycles = mHzStats.minimum();
+ double maxCycles = mHzStats.maximum();
+ mCpuUsage.resetElapsed();
+ mWcStats.reset();
+ mHzStats.reset();
+ ALOGD("CPU usage for %s over past %.1f secs\n"
+ " (%u mixer loops at %.1f mean ms per loop):\n"
+ " us per mix loop: mean=%.0f stddev=%.0f min=%.0f max=%.0f\n"
+ " %% of wall: mean=%.1f stddev=%.1f min=%.1f max=%.1f\n"
+ " MHz: mean=%.1f, stddev=%.1f, min=%.1f max=%.1f",
+ title.string(),
elapsed * .000000001, n, perLoop * .000001,
mean * .001,
stddev * .001,
@@ -1977,7 +2038,12 @@
mean / perLoop100,
stddev / perLoop100,
minimum / perLoop100,
- maximum / perLoop100);
+ maximum / perLoop100,
+ meanCycles / perLoop1k,
+ stddevCycles / perLoop1k,
+ minCycles / perLoop1k,
+ maxCycles / perLoop1k);
+
}
}
#endif
@@ -2023,16 +2089,14 @@
sleepTimeShift = 0;
}
- // MIXER
CpuStats cpuStats;
+ const String8 myName(String8::format("thread %p type %d TID %d", this, mType, gettid()));
acquireWakeLock();
while (!exitPending())
{
-if (mType == MIXER) {
- cpuStats.sample();
-}
+ cpuStats.sample(myName);
Vector< sp<EffectChain> > effectChains;
@@ -2069,9 +2133,9 @@
releaseWakeLock_l();
// wait until we have something to do...
- ALOGV("Thread %p type %d TID %d going to sleep", this, mType, gettid());
+ ALOGV("%s going to sleep", myName.string());
mWaitWorkCV.wait(mLock);
- ALOGV("Thread %p type %d TID %d waking up", this, mType, gettid());
+ ALOGV("%s waking up", myName.string());
acquireWakeLock_l();
mPrevMixerStatus = MIXER_IDLE;
@@ -2273,7 +2337,7 @@
size_t tracksWithEffect = 0;
float masterVolume = mMasterVolume;
- bool masterMute = mMasterMute;
+ bool masterMute = mMasterMute;
if (masterMute) {
masterVolume = 0;
@@ -2312,7 +2376,7 @@
// +1 for rounding and +1 for additional sample needed for interpolation
minFrames = (mFrameCount * t->sampleRate()) / mSampleRate + 1 + 1;
// add frames already consumed but not yet released by the resampler
- // because cblk->framesReady() will include these frames
+ // because cblk->framesReady() will include these frames
minFrames += mAudioMixer->getUnreleasedFrames(track->name());
// the minimum track buffer size is normally twice the number of frames necessary
// to fill one buffer and the resampler should not leave more than one buffer worth
@@ -2450,6 +2514,7 @@
// reset retry count
track->mRetryCount = kMaxTrackRetries;
+
// If one track is ready, set the mixer ready if:
// - the mixer was not ready during previous round OR
// - no other track is not ready
@@ -3308,19 +3373,19 @@
}
} else {
mCblk = (audio_track_cblk_t *)(new uint8_t[size]);
- // construct the shared structure in-place.
- new(mCblk) audio_track_cblk_t();
- // clear all buffers
- mCblk->frameCount = frameCount;
- mCblk->sampleRate = sampleRate;
- mChannelCount = channelCount;
- mChannelMask = channelMask;
- mBuffer = (char*)mCblk + sizeof(audio_track_cblk_t);
- memset(mBuffer, 0, frameCount*channelCount*sizeof(int16_t));
- // Force underrun condition to avoid false underrun callback until first data is
- // written to buffer (other flags are cleared)
- mCblk->flags = CBLK_UNDERRUN_ON;
- mBufferEnd = (uint8_t *)mBuffer + bufferSize;
+ // construct the shared structure in-place.
+ new(mCblk) audio_track_cblk_t();
+ // clear all buffers
+ mCblk->frameCount = frameCount;
+ mCblk->sampleRate = sampleRate;
+ mChannelCount = channelCount;
+ mChannelMask = channelMask;
+ mBuffer = (char*)mCblk + sizeof(audio_track_cblk_t);
+ memset(mBuffer, 0, frameCount*channelCount*sizeof(int16_t));
+ // Force underrun condition to avoid false underrun callback until first data is
+ // written to buffer (other flags are cleared)
+ mCblk->flags = CBLK_UNDERRUN_ON;
+ mBufferEnd = (uint8_t *)mBuffer + bufferSize;
}
}
@@ -3415,23 +3480,27 @@
const sp<IMemory>& sharedBuffer,
int sessionId)
: TrackBase(thread, client, sampleRate, format, channelMask, frameCount, sharedBuffer, sessionId),
- mMute(false), mSharedBuffer(sharedBuffer), mName(-1), mMainBuffer(NULL), mAuxBuffer(NULL),
+ mMute(false),
+ // mFillingUpStatus ?
+ // mRetryCount initialized later when needed
+ mSharedBuffer(sharedBuffer),
+ mStreamType(streamType),
+ mName(-1), // see note below
+ mMainBuffer(thread->mixBuffer()),
+ mAuxBuffer(NULL),
mAuxEffectId(0), mHasVolumeController(false)
{
if (mCblk != NULL) {
- if (thread != NULL) {
- mName = thread->getTrackName_l();
- mMainBuffer = thread->mixBuffer();
- }
- ALOGV("Track constructor name %d, calling pid %d", mName, IPCThreadState::self()->getCallingPid());
- if (mName < 0) {
- ALOGE("no more track names available");
- }
- mStreamType = streamType;
// NOTE: audio_track_cblk_t::frameSize for 8 bit PCM data is based on a sample size of
// 16 bit because data is converted to 16 bit before being stored in buffer by AudioTrack
mCblk->frameSize = audio_is_linear_pcm(format) ? mChannelCount * sizeof(int16_t) : sizeof(uint8_t);
+ // to avoid leaking a track name, do not allocate one unless there is an mCblk
+ mName = thread->getTrackName_l();
+ if (mName < 0) {
+ ALOGE("no more track names available");
+ }
}
+ ALOGV("Track constructor name %d, calling pid %d", mName, IPCThreadState::self()->getCallingPid());
}
AudioFlinger::PlaybackThread::Track::~Track()
@@ -3728,16 +3797,9 @@
if (!client->reserveTimedTrack())
return NULL;
- sp<TimedTrack> track = new TimedTrack(
+ return new TimedTrack(
thread, client, streamType, sampleRate, format, channelMask, frameCount,
sharedBuffer, sessionId);
-
- if (track == NULL) {
- client->releaseTimedTrack();
- return NULL;
- }
-
- return track;
}
AudioFlinger::PlaybackThread::TimedTrack::TimedTrack(
@@ -4197,7 +4259,7 @@
RecordThread *recordThread = (RecordThread *)thread.get();
recordThread->stop(this);
TrackBase::reset();
- // Force overerrun condition to avoid false overrun callback until first data is
+ // Force overrun condition to avoid false overrun callback until first data is
// read from buffer
android_atomic_or(CBLK_UNDERRUN_ON, &mCblk->flags);
}
@@ -4613,8 +4675,7 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- // FIXME dead, remove from IAudioFlinger
- uint32_t flags,
+ IAudioFlinger::track_flags_t flags,
int *sessionId,
status_t *status)
{
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 0e4b24aa..795807d 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -87,10 +87,9 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
+ IAudioFlinger::track_flags_t flags,
const sp<IMemory>& sharedBuffer,
audio_io_handle_t output,
- bool isTimed,
int *sessionId,
status_t *status);
@@ -101,7 +100,7 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
+ IAudioFlinger::track_flags_t flags,
int *sessionId,
status_t *status);
@@ -681,9 +680,9 @@
enum {FS_FILLING, FS_FILLED, FS_ACTIVE};
mutable uint8_t mFillingUpStatus;
int8_t mRetryCount;
- sp<IMemory> mSharedBuffer;
+ const sp<IMemory> mSharedBuffer;
bool mResetDone;
- audio_stream_type_t mStreamType;
+ const audio_stream_type_t mStreamType;
int mName;
int16_t *mMainBuffer;
int32_t *mAuxBuffer;
@@ -899,6 +898,7 @@
protected:
SortedVector< wp<Track> > mActiveTracks;
+ // Allocate a track name. Returns name >= 0 if successful, -1 on failure.
virtual int getTrackName_l() = 0;
virtual void deleteTrackName_l(int name) = 0;
virtual uint32_t activeSleepTimeUs();
@@ -1559,9 +1559,10 @@
uint32_t mNewLeftVolume; // new volume on left channel
uint32_t mNewRightVolume; // new volume on right channel
uint32_t mStrategy; // strategy for this effect chain
- // mSuspendedEffects lists all effect currently suspended in the chain
- // use effect type UUID timelow field as key. There is no real risk of identical
+ // mSuspendedEffects lists all effects currently suspended in the chain.
+ // Use effect type UUID timelow field as key. There is no real risk of identical
// timeLow fields among effect type UUIDs.
+ // Updated by updateSuspendedSessions_l() only.
KeyedVector< int, sp<SuspendedEffectDesc> > mSuspendedEffects;
};
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 1ec238b..3f4c19a 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -42,12 +42,15 @@
// ----------------------------------------------------------------------------
-AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate)
- : mTrackNames(0), mSampleRate(sampleRate)
+AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate, uint32_t maxNumTracks)
+ : mTrackNames(0), mConfiguredNames((1 << maxNumTracks) - 1), mSampleRate(sampleRate)
{
// AudioMixer is not yet capable of multi-channel beyond stereo
COMPILE_TIME_ASSERT_FUNCTION_SCOPE(2 == MAX_NUM_CHANNELS);
+ ALOG_ASSERT(maxNumTracks <= MAX_NUM_TRACKS, "maxNumTracks %u > MAX_NUM_TRACKS %u",
+ maxNumTracks, MAX_NUM_TRACKS);
+
LocalClock lc;
mState.enabledTracks= 0;
@@ -57,6 +60,10 @@
mState.outputTemp = NULL;
mState.resampleTemp = NULL;
// mState.reserved
+
+ // FIXME Most of the following initialization is probably redundant since
+ // tracks[i] should only be referenced if (mTrackNames & (1 << i)) != 0
+ // and mTrackNames is initially 0. However, leave it here until that's verified.
track_t* t = mState.tracks;
for (unsigned i=0 ; i < MAX_NUM_TRACKS ; i++) {
t->needs = 0;
@@ -103,7 +110,7 @@
int AudioMixer::getTrackName()
{
- uint32_t names = ~mTrackNames;
+ uint32_t names = (~mTrackNames) & mConfiguredNames;
if (names != 0) {
int n = __builtin_ctz(names);
ALOGV("add track (%d)", n);
@@ -132,7 +139,7 @@
invalidateState(1<<name);
}
if (track.resampler != NULL) {
- // delete the resampler
+ // delete the resampler
delete track.resampler;
track.resampler = NULL;
track.sampleRate = mSampleRate;
diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h
index b210212..856450c 100644
--- a/services/audioflinger/AudioMixer.h
+++ b/services/audioflinger/AudioMixer.h
@@ -31,7 +31,8 @@
class AudioMixer
{
public:
- AudioMixer(size_t frameCount, uint32_t sampleRate);
+ AudioMixer(size_t frameCount, uint32_t sampleRate,
+ uint32_t maxNumTracks = MAX_NUM_TRACKS);
/*virtual*/ ~AudioMixer(); // non-virtual saves a v-table, restore if sub-classed
@@ -70,9 +71,14 @@
// For all APIs with "name": TRACK0 <= name < TRACK0 + MAX_NUM_TRACKS
+
+ // Allocate a track name. Returns new track name if successful, -1 on failure.
int getTrackName();
+
+ // Free an allocated track by name
void deleteTrackName(int name);
+ // Enable or disable an allocated track by name
void enable(int name);
void disable(int name);
@@ -184,11 +190,17 @@
int32_t *outputTemp;
int32_t *resampleTemp;
int32_t reserved[2];
+ // FIXME allocate dynamically to save some memory when maxNumTracks < MAX_NUM_TRACKS
track_t tracks[MAX_NUM_TRACKS]; __attribute__((aligned(32)));
};
// bitmask of allocated track names, where bit 0 corresponds to TRACK0 etc.
uint32_t mTrackNames;
+
+ // bitmask of configured track names; ~0 if maxNumTracks == MAX_NUM_TRACKS,
+ // but will have fewer bits set if maxNumTracks < MAX_NUM_TRACKS
+ const uint32_t mConfiguredNames;
+
const uint32_t mSampleRate;
state_t mState __attribute__((aligned(32)));
diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk
index e35435e..3cae1f5 100644
--- a/services/camera/libcameraservice/Android.mk
+++ b/services/camera/libcameraservice/Android.mk
@@ -15,6 +15,7 @@
libbinder \
libcutils \
libmedia \
+ libmedia_native \
libcamera_client \
libgui \
libhardware
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index adf1d49..22836e3 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <sys/types.h>
#include <pthread.h>
+#include <time.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
@@ -33,6 +34,7 @@
#include <hardware/hardware.h>
#include <media/AudioSystem.h>
#include <media/mediaplayer.h>
+#include <utils/Condition.h>
#include <utils/Errors.h>
#include <utils/Log.h>
#include <utils/String16.h>
@@ -42,6 +44,8 @@
namespace android {
+#define WAIT_RELEASE_TIMEOUT 250 // 250ms
+
// ----------------------------------------------------------------------------
// Logging support -- this is for debugging only
// Use "adb shell dumpsys media.camera -v 1" to change it.
@@ -64,6 +68,13 @@
return IPCThreadState::self()->getCallingUid();
}
+static long long getTimeInMs() {
+ struct timeval t;
+ t.tv_sec = t.tv_usec = 0;
+ gettimeofday(&t, NULL);
+ return t.tv_sec * 1000LL + t.tv_usec / 1000;
+}
+
// ----------------------------------------------------------------------------
// This is ugly and only safe if we never re-create the CameraService, but
@@ -131,7 +142,7 @@
}
sp<ICamera> CameraService::connect(
- const sp<ICameraClient>& cameraClient, int cameraId) {
+ const sp<ICameraClient>& cameraClient, int cameraId, bool force, bool keep) {
int callingPid = getCallingPid();
sp<CameraHardwareInterface> hardware = NULL;
@@ -157,27 +168,73 @@
return NULL;
}
- Mutex::Autolock lock(mServiceLock);
- if (mClient[cameraId] != 0) {
- client = mClient[cameraId].promote();
- if (client != 0) {
- if (cameraClient->asBinder() == client->getCameraClient()->asBinder()) {
- LOG1("CameraService::connect X (pid %d) (the same client)",
- callingPid);
- return client;
- } else {
- ALOGW("CameraService::connect X (pid %d) rejected (existing client).",
- callingPid);
- return NULL;
- }
- }
- mClient[cameraId].clear();
+ if (keep && !checkCallingPermission(String16("android.permission.KEEP_CAMERA"))) {
+ ALOGE("connect X (pid %d) rejected (no KEEP_CAMERA permission).", callingPid);
+ return NULL;
}
- if (mBusy[cameraId]) {
- ALOGW("CameraService::connect X (pid %d) rejected"
- " (camera %d is still busy).", callingPid, cameraId);
- return NULL;
+ Mutex::Autolock lock(mServiceLock);
+ // Check if there is an existing client.
+ client = mClient[cameraId].promote();
+ if (client != 0 &&
+ cameraClient->asBinder() == client->getCameraClient()->asBinder()) {
+ LOG1("connect X (pid %d) (the same client)", callingPid);
+ return client;
+ }
+
+ if (!force) {
+ if (mClient[cameraId].promote() != 0) {
+ ALOGW("connect X (pid %d) rejected (existing client).", callingPid);
+ return NULL;
+ }
+ mClient[cameraId].clear();
+ if (mBusy[cameraId]) {
+ ALOGW("connect X (pid %d) rejected (camera %d is still busy).",
+ callingPid, cameraId);
+ return NULL;
+ }
+ } else { // force == true
+ int i = 0;
+ long long start_time = getTimeInMs();
+ while (i < mNumberOfCameras) {
+ if (getTimeInMs() - start_time >= 3000LL) {
+ ALOGE("connect X (pid %d) rejected (timeout 3s)", callingPid);
+ return NULL;
+ }
+
+ client = mClient[i].promote();
+ if (client != 0) {
+ if (client->keep()) {
+ ALOGW("connect X (pid %d) rejected (existing client wants to keeps the camera)",
+ callingPid);
+ return NULL;
+ } else {
+ ALOGW("New client (pid %d, id=%d). Disconnect the existing client (id=%d).",
+ callingPid, cameraId, i);
+ // Do not hold mServiceLock because disconnect will try to get it.
+ mServiceLock.unlock();
+ client->notifyCallback(CAMERA_MSG_ERROR, CAMERA_ERROR_RELEASED, 0, &i);
+ client->waitRelease(WAIT_RELEASE_TIMEOUT);
+ client->disconnectInternal(false);
+ mServiceLock.lock();
+ // Restart from the first client because a new client may have connected
+ // when mServiceLock is unlocked.
+ i = 0;
+ continue;
+ }
+ }
+
+ if (mBusy[i]) {
+ // Give the client a chance to release the hardware.
+ mServiceLock.unlock();
+ usleep(10 * 1000);
+ mServiceLock.lock();
+ i = 0; // Restart from the first client
+ continue;
+ }
+
+ i++;
+ }
}
struct camera_info info;
@@ -195,9 +252,15 @@
return NULL;
}
- client = new Client(this, cameraClient, hardware, cameraId, info.facing, callingPid);
+ client = new Client(this, cameraClient, hardware, cameraId, info.facing,
+ callingPid, keep);
+ // We need to clear the hardware here. After the destructor of mServiceLock
+ // finishes, a new client may connect and disconnect this client. If this
+ // reference is not cleared, the destructor of CameraHardwareInterface
+ // cannot run. The new client will not be able to connect.
+ hardware.clear();
mClient[cameraId] = client;
- LOG1("CameraService::connect X");
+ LOG1("CameraService::connect X (id %d)", cameraId);
return client;
}
@@ -331,9 +394,9 @@
CameraService::Client::Client(const sp<CameraService>& cameraService,
const sp<ICameraClient>& cameraClient,
const sp<CameraHardwareInterface>& hardware,
- int cameraId, int cameraFacing, int clientPid) {
+ int cameraId, int cameraFacing, int clientPid, bool keep) {
int callingPid = getCallingPid();
- LOG1("Client::Client E (pid %d)", callingPid);
+ LOG1("Client::Client E (pid %d, id %d)", callingPid, cameraId);
mCameraService = cameraService;
mCameraClient = cameraClient;
@@ -341,6 +404,7 @@
mCameraId = cameraId;
mCameraFacing = cameraFacing;
mClientPid = clientPid;
+ mKeep = keep;
mMsgEnabled = 0;
mSurface = 0;
mPreviewWindow = 0;
@@ -359,7 +423,7 @@
mPlayShutterSound = true;
cameraService->setCameraBusy(cameraId);
cameraService->loadSound();
- LOG1("Client::Client X (pid %d)", callingPid);
+ LOG1("Client::Client X (pid %d, id %d)", callingPid, cameraId);
}
// tear down the client
@@ -468,18 +532,24 @@
}
void CameraService::Client::disconnect() {
+ disconnectInternal(true);
+}
+
+void CameraService::Client::disconnectInternal(bool needCheckPid) {
int callingPid = getCallingPid();
- LOG1("disconnect E (pid %d)", callingPid);
+ LOG1("disconnectInternal E (pid %d)", callingPid);
Mutex::Autolock lock(mLock);
- if (checkPid() != NO_ERROR) {
- ALOGW("different client - don't disconnect");
- return;
- }
+ if (needCheckPid) {
+ if (checkPid() != NO_ERROR) {
+ ALOGW("different client - don't disconnect");
+ return;
+ }
- if (mClientPid <= 0) {
- LOG1("camera is unlocked (mClientPid = %d), don't tear down hardware", mClientPid);
- return;
+ if (mClientPid <= 0) {
+ LOG1("camera is unlocked (mClientPid = %d), don't tear down hardware", mClientPid);
+ return;
+ }
}
// Make sure disconnect() is done once and once only, whether it is called
@@ -506,8 +576,16 @@
mCameraService->removeClient(mCameraClient);
mCameraService->setCameraFree(mCameraId);
+ mReleaseCondition.signal();
- LOG1("disconnect X (pid %d)", callingPid);
+ LOG1("disconnectInternal X (pid %d)", callingPid);
+}
+
+void CameraService::Client::waitRelease(int ms) {
+ Mutex::Autolock lock(mLock);
+ if (mHardware != 0) {
+ mReleaseCondition.waitRelative(mLock, ms * 1000000);
+ }
}
// ----------------------------------------------------------------------------
@@ -874,6 +952,9 @@
return OK;
} else if (cmd == CAMERA_CMD_PLAY_RECORDING_SOUND) {
mCameraService->playSound(SOUND_RECORDING);
+ } else if (cmd == CAMERA_CMD_PING) {
+ // If mHardware is 0, checkPidAndHardware will return error.
+ return OK;
}
return mHardware->sendCommand(cmd, arg1, arg2);
@@ -1217,6 +1298,10 @@
return -1;
}
+// Whether the client wants to keep the camera from taking
+bool CameraService::Client::keep() const {
+ return mKeep;
+}
// ----------------------------------------------------------------------------
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index bad41f5..457c79b 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -46,7 +46,8 @@
virtual int32_t getNumberOfCameras();
virtual status_t getCameraInfo(int cameraId,
struct CameraInfo* cameraInfo);
- virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId);
+ virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId,
+ bool force, bool keep);
virtual void removeClient(const sp<ICameraClient>& cameraClient);
virtual sp<Client> getClientById(int cameraId);
@@ -114,7 +115,8 @@
const sp<CameraHardwareInterface>& hardware,
int cameraId,
int cameraFacing,
- int clientPid);
+ int clientPid,
+ bool keep);
~Client();
// return our camera client
@@ -172,12 +174,19 @@
const sp<IBinder>& binder,
const sp<ANativeWindow>& window);
+ void disconnectInternal(bool needCheckPid);
+ bool keep() const;
+ void waitRelease(int ms);
+
+
// these are initialized in the constructor.
sp<CameraService> mCameraService; // immutable after constructor
sp<ICameraClient> mCameraClient;
int mCameraId; // immutable after constructor
int mCameraFacing; // immutable after constructor
pid_t mClientPid;
+ // Client wants to keep the camera from taking by other clients.
+ bool mKeep;
sp<CameraHardwareInterface> mHardware; // cleared after disconnect()
int mPreviewCallbackFlag;
int mOrientation; // Current display orientation
@@ -185,6 +194,8 @@
// Ensures atomicity among the public methods
mutable Mutex mLock;
+ // This will get notified when the hardware is released.
+ Condition mReleaseCondition;
// This is a binder of Surface or SurfaceTexture.
sp<IBinder> mSurface;
sp<ANativeWindow> mPreviewWindow;
diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java
index 081f1f4..a85b605 100644
--- a/services/java/com/android/server/AppWidgetService.java
+++ b/services/java/com/android/server/AppWidgetService.java
@@ -325,9 +325,10 @@
service.onConfigurationChanged();
}
} else {
- // TODO: Verify that this only needs to be delivered for the related user and not
- // all the users
- getImplForUser().onBroadcastReceived(intent);
+ for (int i = 0; i < mAppWidgetServices.size(); i++) {
+ AppWidgetServiceImpl service = mAppWidgetServices.valueAt(i);
+ service.onBroadcastReceived(intent);
+ }
}
}
};
diff --git a/services/java/com/android/server/AppWidgetServiceImpl.java b/services/java/com/android/server/AppWidgetServiceImpl.java
index 9c408c4..182a884 100644
--- a/services/java/com/android/server/AppWidgetServiceImpl.java
+++ b/services/java/com/android/server/AppWidgetServiceImpl.java
@@ -17,6 +17,7 @@
package com.android.server;
import android.app.AlarmManager;
+import android.app.AppGlobals;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
@@ -27,6 +28,7 @@
import android.content.Intent.FilterComparison;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageManager;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@@ -158,7 +160,7 @@
Context mContext;
Locale mLocale;
- PackageManager mPackageManager;
+ IPackageManager mPm;
AlarmManager mAlarmManager;
ArrayList<Provider> mInstalledProviders = new ArrayList<Provider>();
int mNextAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID + 1;
@@ -174,7 +176,7 @@
AppWidgetServiceImpl(Context context, int userId) {
mContext = context;
- mPackageManager = context.getPackageManager();
+ mPm = AppGlobals.getPackageManager();
mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
mUserId = userId;
}
@@ -1009,16 +1011,19 @@
}
void loadAppWidgetList() {
- PackageManager pm = mPackageManager;
-
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
- List<ResolveInfo> broadcastReceivers = pm.queryBroadcastReceivers(intent,
- PackageManager.GET_META_DATA);
+ try {
+ List<ResolveInfo> broadcastReceivers = mPm.queryIntentReceivers(intent,
+ intent.resolveTypeIfNeeded(mContext.getContentResolver()),
+ PackageManager.GET_META_DATA, mUserId);
- final int N = broadcastReceivers == null ? 0 : broadcastReceivers.size();
- for (int i = 0; i < N; i++) {
- ResolveInfo ri = broadcastReceivers.get(i);
- addProviderLocked(ri);
+ final int N = broadcastReceivers == null ? 0 : broadcastReceivers.size();
+ for (int i = 0; i < N; i++) {
+ ResolveInfo ri = broadcastReceivers.get(i);
+ addProviderLocked(ri);
+ }
+ } catch (RemoteException re) {
+ // Shouldn't happen, local call
}
}
@@ -1131,7 +1136,7 @@
ActivityInfo activityInfo = ri.activityInfo;
XmlResourceParser parser = null;
try {
- parser = activityInfo.loadXmlMetaData(mPackageManager,
+ parser = activityInfo.loadXmlMetaData(mContext.getPackageManager(),
AppWidgetManager.META_DATA_APPWIDGET_PROVIDER);
if (parser == null) {
Slog.w(TAG, "No " + AppWidgetManager.META_DATA_APPWIDGET_PROVIDER
@@ -1159,7 +1164,7 @@
info.provider = component;
p.uid = activityInfo.applicationInfo.uid;
- Resources res = mPackageManager
+ Resources res = mContext.getPackageManager()
.getResourcesForApplication(activityInfo.applicationInfo);
TypedArray sa = res.obtainAttributes(attrs,
@@ -1188,7 +1193,7 @@
if (className != null) {
info.configure = new ComponentName(component.getPackageName(), className);
}
- info.label = activityInfo.loadLabel(mPackageManager).toString();
+ info.label = activityInfo.loadLabel(mContext.getPackageManager()).toString();
info.icon = ri.getIconResource();
info.previewImage = sa.getResourceId(
com.android.internal.R.styleable.AppWidgetProviderInfo_previewImage, 0);
@@ -1213,7 +1218,12 @@
}
int getUidForPackage(String packageName) throws PackageManager.NameNotFoundException {
- PackageInfo pkgInfo = mPackageManager.getPackageInfo(packageName, 0);
+ PackageInfo pkgInfo = null;
+ try {
+ pkgInfo = mPm.getPackageInfo(packageName, 0, mUserId);
+ } catch (RemoteException re) {
+ // Shouldn't happen, local call
+ }
if (pkgInfo == null || pkgInfo.applicationInfo == null) {
throw new PackageManager.NameNotFoundException();
}
@@ -1493,9 +1503,15 @@
void addProvidersForPackageLocked(String pkgName) {
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
intent.setPackage(pkgName);
- List<ResolveInfo> broadcastReceivers = mPackageManager.queryBroadcastReceivers(intent,
- PackageManager.GET_META_DATA);
-
+ List<ResolveInfo> broadcastReceivers;
+ try {
+ broadcastReceivers = mPm.queryIntentReceivers(intent,
+ intent.resolveTypeIfNeeded(mContext.getContentResolver()),
+ PackageManager.GET_META_DATA, mUserId);
+ } catch (RemoteException re) {
+ // Shouldn't happen, local call
+ return;
+ }
final int N = broadcastReceivers == null ? 0 : broadcastReceivers.size();
for (int i = 0; i < N; i++) {
ResolveInfo ri = broadcastReceivers.get(i);
@@ -1513,8 +1529,15 @@
HashSet<String> keep = new HashSet<String>();
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
intent.setPackage(pkgName);
- List<ResolveInfo> broadcastReceivers = mPackageManager.queryBroadcastReceivers(intent,
- PackageManager.GET_META_DATA);
+ List<ResolveInfo> broadcastReceivers;
+ try {
+ broadcastReceivers = mPm.queryIntentReceivers(intent,
+ intent.resolveTypeIfNeeded(mContext.getContentResolver()),
+ PackageManager.GET_META_DATA, mUserId);
+ } catch (RemoteException re) {
+ // Shouldn't happen, local call
+ return;
+ }
// add the missing ones and collect which ones to keep
int N = broadcastReceivers == null ? 0 : broadcastReceivers.size();
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index a7b08f5..bd8ae17 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -1986,6 +1986,16 @@
try {
mCurrentPackage = mPackageManager.getPackageInfo(request.packageName,
PackageManager.GET_SIGNATURES);
+ if (mCurrentPackage.applicationInfo.backupAgentName == null) {
+ // The manifest has changed but we had a stale backup request pending.
+ // This won't happen again because the app won't be requesting further
+ // backups.
+ Slog.i(TAG, "Package " + request.packageName
+ + " no longer supports backup; skipping");
+ addBackupTrace("skipping - no agent, completion is noop");
+ executeNextState(BackupState.RUNNING_QUEUE);
+ return;
+ }
IBackupAgent agent = null;
try {
@@ -2547,6 +2557,8 @@
finalizeBackup(out);
} catch (RemoteException e) {
Slog.e(TAG, "App died during full backup");
+ } catch (Exception e) {
+ Slog.e(TAG, "Internal exception during full backup", e);
} finally {
tearDown(pkg);
try {
@@ -4681,6 +4693,8 @@
mTransport.clearBackupData(mPackage);
} catch (RemoteException e) {
// can't happen; the transport is local
+ } catch (Exception e) {
+ Slog.e(TAG, "Transport threw attempting to clear data for " + mPackage);
} finally {
try {
// TODO - need to handle failures
diff --git a/services/java/com/android/server/BootReceiver.java b/services/java/com/android/server/BootReceiver.java
index da65438..22874e6 100644
--- a/services/java/com/android/server/BootReceiver.java
+++ b/services/java/com/android/server/BootReceiver.java
@@ -20,13 +20,13 @@
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.net.Downloads;
import android.os.Build;
import android.os.DropBoxManager;
import android.os.FileObserver;
import android.os.FileUtils;
import android.os.RecoverySystem;
import android.os.SystemProperties;
+import android.provider.Downloads;
import android.util.Slog;
import java.io.File;
@@ -78,9 +78,8 @@
}.start();
}
- private void removeOldUpdatePackages(Context ctx) {
- Downloads.ByUri.removeAllDownloadsByPackage(
- ctx, OLD_UPDATER_PACKAGE, OLD_UPDATER_CLASS);
+ private void removeOldUpdatePackages(Context context) {
+ Downloads.removeAllDownloadsByPackage(context, OLD_UPDATER_PACKAGE, OLD_UPDATER_CLASS);
}
private void logBootEvents(Context ctx) throws IOException {
diff --git a/services/java/com/android/server/IntentResolver.java b/services/java/com/android/server/IntentResolver.java
index b3d7220..f7e841e 100644
--- a/services/java/com/android/server/IntentResolver.java
+++ b/services/java/com/android/server/IntentResolver.java
@@ -201,7 +201,7 @@
}
public List<R> queryIntentFromList(Intent intent, String resolvedType,
- boolean defaultOnly, ArrayList<ArrayList<F>> listCut) {
+ boolean defaultOnly, ArrayList<ArrayList<F>> listCut, int userId) {
ArrayList<R> resultList = new ArrayList<R>();
final boolean debug = localLOGV ||
@@ -212,13 +212,14 @@
int N = listCut.size();
for (int i = 0; i < N; ++i) {
buildResolveList(intent, categories, debug, defaultOnly,
- resolvedType, scheme, listCut.get(i), resultList);
+ resolvedType, scheme, listCut.get(i), resultList, userId);
}
sortResults(resultList);
return resultList;
}
- public List<R> queryIntent(Intent intent, String resolvedType, boolean defaultOnly) {
+ public List<R> queryIntent(Intent intent, String resolvedType, boolean defaultOnly,
+ int userId) {
String scheme = intent.getScheme();
ArrayList<R> finalList = new ArrayList<R>();
@@ -290,19 +291,19 @@
FastImmutableArraySet<String> categories = getFastIntentCategories(intent);
if (firstTypeCut != null) {
buildResolveList(intent, categories, debug, defaultOnly,
- resolvedType, scheme, firstTypeCut, finalList);
+ resolvedType, scheme, firstTypeCut, finalList, userId);
}
if (secondTypeCut != null) {
buildResolveList(intent, categories, debug, defaultOnly,
- resolvedType, scheme, secondTypeCut, finalList);
+ resolvedType, scheme, secondTypeCut, finalList, userId);
}
if (thirdTypeCut != null) {
buildResolveList(intent, categories, debug, defaultOnly,
- resolvedType, scheme, thirdTypeCut, finalList);
+ resolvedType, scheme, thirdTypeCut, finalList, userId);
}
if (schemeCut != null) {
buildResolveList(intent, categories, debug, defaultOnly,
- resolvedType, scheme, schemeCut, finalList);
+ resolvedType, scheme, schemeCut, finalList, userId);
}
sortResults(finalList);
@@ -329,7 +330,7 @@
* "stopped," that is whether it should not be included in the result
* if the intent requests to excluded stopped objects.
*/
- protected boolean isFilterStopped(F filter) {
+ protected boolean isFilterStopped(F filter, int userId) {
return false;
}
@@ -341,7 +342,7 @@
protected abstract String packageForFilter(F filter);
@SuppressWarnings("unchecked")
- protected R newResult(F filter, int match) {
+ protected R newResult(F filter, int match, int userId) {
return (R)filter;
}
@@ -504,7 +505,7 @@
private void buildResolveList(Intent intent, FastImmutableArraySet<String> categories,
boolean debug, boolean defaultOnly,
- String resolvedType, String scheme, List<F> src, List<R> dest) {
+ String resolvedType, String scheme, List<F> src, List<R> dest, int userId) {
final String action = intent.getAction();
final Uri data = intent.getData();
final String packageName = intent.getPackage();
@@ -519,7 +520,7 @@
int match;
if (debug) Slog.v(TAG, "Matching against filter " + filter);
- if (excludingStopped && isFilterStopped(filter)) {
+ if (excludingStopped && isFilterStopped(filter, userId)) {
if (debug) {
Slog.v(TAG, " Filter's target is stopped; skipping");
}
@@ -547,7 +548,7 @@
if (debug) Slog.v(TAG, " Filter matched! match=0x" +
Integer.toHexString(match));
if (!defaultOnly || filter.hasCategory(Intent.CATEGORY_DEFAULT)) {
- final R oneResult = newResult(filter, match);
+ final R oneResult = newResult(filter, match, userId);
if (oneResult != null) {
dest.add(oneResult);
}
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 366160b..510bdb2 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -48,6 +48,7 @@
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
+import android.os.UserId;
import android.os.storage.IMountService;
import android.os.storage.IMountServiceListener;
import android.os.storage.IMountShutdownObserver;
@@ -1674,7 +1675,7 @@
return false;
}
- final int packageUid = mPms.getPackageUid(packageName);
+ final int packageUid = mPms.getPackageUid(packageName, UserId.getUserId(callerUid));
if (DEBUG_OBB) {
Slog.d(TAG, "packageName = " + packageName + ", packageUid = " +
diff --git a/services/java/com/android/server/WiredAccessoryObserver.java b/services/java/com/android/server/WiredAccessoryObserver.java
index 326b940..a7a46dd 100644
--- a/services/java/com/android/server/WiredAccessoryObserver.java
+++ b/services/java/com/android/server/WiredAccessoryObserver.java
@@ -30,8 +30,11 @@
import android.media.AudioManager;
import android.util.Log;
+import java.io.File;
import java.io.FileReader;
import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.List;
/**
* <p>WiredAccessoryObserver monitors for a wired headset on the main board or dock.
@@ -39,17 +42,6 @@
class WiredAccessoryObserver extends UEventObserver {
private static final String TAG = WiredAccessoryObserver.class.getSimpleName();
private static final boolean LOG = true;
- private static final int MAX_AUDIO_PORTS = 3; /* h2w, USB Audio & hdmi */
- private static final String uEventInfo[][] = { {"DEVPATH=/devices/virtual/switch/h2w",
- "/sys/class/switch/h2w/state",
- "/sys/class/switch/h2w/name"},
- {"DEVPATH=/devices/virtual/switch/usb_audio",
- "/sys/class/switch/usb_audio/state",
- "/sys/class/switch/usb_audio/name"},
- {"DEVPATH=/devices/virtual/switch/hdmi",
- "/sys/class/switch/hdmi/state",
- "/sys/class/switch/hdmi/name"} };
-
private static final int BIT_HEADSET = (1 << 0);
private static final int BIT_HEADSET_NO_MIC = (1 << 1);
private static final int BIT_USB_HEADSET_ANLG = (1 << 2);
@@ -60,10 +52,89 @@
BIT_HDMI_AUDIO);
private static final int HEADSETS_WITH_MIC = BIT_HEADSET;
+ private static class UEventInfo {
+ private final String mDevName;
+ private final int mState1Bits;
+ private final int mState2Bits;
+
+ public UEventInfo(String devName, int state1Bits, int state2Bits) {
+ mDevName = devName;
+ mState1Bits = state1Bits;
+ mState2Bits = state2Bits;
+ }
+
+ public String getDevName() { return mDevName; }
+
+ public String getDevPath() {
+ return String.format("DEVPATH=/devices/virtual/switch/%s", mDevName);
+ }
+
+ public String getSwitchStatePath() {
+ return String.format("/sys/class/switch/%s/state", mDevName);
+ }
+
+ public boolean checkSwitchExists() {
+ File f = new File(getSwitchStatePath());
+ return ((null != f) && f.exists());
+ }
+
+ public int computeNewHeadsetState(int headsetState, int switchState) {
+ int preserveMask = ~(mState1Bits | mState2Bits);
+ int setBits = ((switchState == 1) ? mState1Bits :
+ ((switchState == 2) ? mState2Bits : 0));
+
+ return ((headsetState & preserveMask) | setBits);
+ }
+ }
+
+ private static List<UEventInfo> makeObservedUEventList() {
+ List<UEventInfo> retVal = new ArrayList<UEventInfo>();
+ UEventInfo uei;
+
+ // Monitor h2w
+ uei = new UEventInfo("h2w", BIT_HEADSET, BIT_HEADSET_NO_MIC);
+ if (uei.checkSwitchExists()) {
+ retVal.add(uei);
+ } else {
+ Slog.w(TAG, "This kernel does not have wired headset support");
+ }
+
+ // Monitor USB
+ uei = new UEventInfo("usb_audio", BIT_USB_HEADSET_ANLG, BIT_USB_HEADSET_DGTL);
+ if (uei.checkSwitchExists()) {
+ retVal.add(uei);
+ } else {
+ Slog.w(TAG, "This kernel does not have usb audio support");
+ }
+
+ // Monitor HDMI
+ //
+ // If the kernel has support for the "hdmi_audio" switch, use that. It will be signalled
+ // only when the HDMI driver has a video mode configured, and the downstream sink indicates
+ // support for audio in its EDID.
+ //
+ // If the kernel does not have an "hdmi_audio" switch, just fall back on the older "hdmi"
+ // switch instead.
+ uei = new UEventInfo("hdmi_audio", BIT_HDMI_AUDIO, 0);
+ if (uei.checkSwitchExists()) {
+ retVal.add(uei);
+ } else {
+ uei = new UEventInfo("hdmi", BIT_HDMI_AUDIO, 0);
+ if (uei.checkSwitchExists()) {
+ retVal.add(uei);
+ } else {
+ Slog.w(TAG, "This kernel does not have HDMI audio support");
+ }
+ }
+
+ return retVal;
+ }
+
+ private static List<UEventInfo> uEventInfo = makeObservedUEventList();
+
private int mHeadsetState;
private int mPrevHeadsetState;
private String mHeadsetName;
- private int switchState;
private final Context mContext;
private final WakeLock mWakeLock; // held while there is a pending route change
@@ -85,11 +156,12 @@
// one on the board, one on the dock and one on HDMI:
// observe three UEVENTs
init(); // set initial status
- for (int i = 0; i < MAX_AUDIO_PORTS; i++) {
- startObserving(uEventInfo[i][0]);
+ for (int i = 0; i < uEventInfo.size(); ++i) {
+ UEventInfo uei = uEventInfo.get(i);
+ startObserving(uei.getDevPath());
}
}
- }
+ }
@Override
public void onUEvent(UEventObserver.UEvent event) {
@@ -106,50 +178,47 @@
private synchronized final void updateState(String name, int state)
{
- if (name.equals("usb_audio")) {
- switchState = ((mHeadsetState & (BIT_HEADSET|BIT_HEADSET_NO_MIC|BIT_HDMI_AUDIO)) |
- ((state == 1) ? BIT_USB_HEADSET_ANLG :
- ((state == 2) ? BIT_USB_HEADSET_DGTL : 0)));
- } else if (name.equals("hdmi")) {
- switchState = ((mHeadsetState & (BIT_HEADSET|BIT_HEADSET_NO_MIC|
- BIT_USB_HEADSET_DGTL|BIT_USB_HEADSET_ANLG)) |
- ((state == 1) ? BIT_HDMI_AUDIO : 0));
- } else {
- switchState = ((mHeadsetState & (BIT_HDMI_AUDIO|BIT_USB_HEADSET_ANLG|
- BIT_USB_HEADSET_DGTL)) |
- ((state == 1) ? BIT_HEADSET :
- ((state == 2) ? BIT_HEADSET_NO_MIC : 0)));
+ // FIXME: When ueventd informs of a change in state for a switch, it does not have to be
+ // the case that the name reported by /sys/class/switch/<device>/name is the same as
+ // <device>. For normal users of the linux switch class driver, it will be. But it is
+ // technically possible to hook the print_name method in the class driver and return a
+ // different name each and every time the name sysfs entry is queried.
+ //
+ // Right now this is not the case for any of the switch implementations used here. I'm not
+ // certain anyone would ever choose to implement such a dynamic name, or what it would mean
+ // for the implementation at this level, but if it ever happens, we will need to revisit
+ // this code.
+ for (int i = 0; i < uEventInfo.size(); ++i) {
+ UEventInfo uei = uEventInfo.get(i);
+ if (name.equals(uei.getDevName())) {
+ update(name, uei.computeNewHeadsetState(mHeadsetState, state));
+ return;
+ }
}
- update(name, switchState);
}
private synchronized final void init() {
char[] buffer = new char[1024];
-
- String newName = mHeadsetName;
- int newState = mHeadsetState;
mPrevHeadsetState = mHeadsetState;
if (LOG) Slog.v(TAG, "init()");
- for (int i = 0; i < MAX_AUDIO_PORTS; i++) {
+ for (int i = 0; i < uEventInfo.size(); ++i) {
+ UEventInfo uei = uEventInfo.get(i);
try {
- FileReader file = new FileReader(uEventInfo[i][1]);
+ int curState;
+ FileReader file = new FileReader(uei.getSwitchStatePath());
int len = file.read(buffer, 0, 1024);
file.close();
- newState = Integer.valueOf((new String(buffer, 0, len)).trim());
+ curState = Integer.valueOf((new String(buffer, 0, len)).trim());
- file = new FileReader(uEventInfo[i][2]);
- len = file.read(buffer, 0, 1024);
- file.close();
- newName = new String(buffer, 0, len).trim();
-
- if (newState > 0) {
- updateState(newName, newState);
+ if (curState > 0) {
+ updateState(uei.getDevName(), curState);
}
} catch (FileNotFoundException e) {
- Slog.w(TAG, "This kernel does not have wired headset support");
+ Slog.w(TAG, uei.getSwitchStatePath() +
+ " not found while attempting to determine initial switch state");
} catch (Exception e) {
Slog.e(TAG, "" , e);
}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 6f89f6e..37a594e 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -34,6 +34,7 @@
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManagerNative;
+import android.app.ActivityOptions;
import android.app.ActivityThread;
import android.app.AlertDialog;
import android.app.AppGlobals;
@@ -110,6 +111,7 @@
import android.os.SystemProperties;
import android.os.UserId;
import android.provider.Settings;
+import android.text.format.Time;
import android.util.EventLog;
import android.util.Pair;
import android.util.Slog;
@@ -197,6 +199,8 @@
private static final String SYSTEM_DEBUGGABLE = "ro.debuggable";
+ static final boolean IS_USER_BUILD = "user".equals(Build.TYPE);
+
// Maximum number of recent tasks that we can remember.
static final int MAX_RECENT_TASKS = 20;
@@ -1076,7 +1080,8 @@
int uid = msg.arg1;
boolean restart = (msg.arg2 == 1);
String pkg = (String) msg.obj;
- forceStopPackageLocked(pkg, uid, restart, false, true, false);
+ forceStopPackageLocked(pkg, uid, restart, false, true, false,
+ UserId.getUserId(uid));
}
} break;
case FINALIZE_PENDING_INTENT_MSG: {
@@ -1286,7 +1291,7 @@
ApplicationInfo info =
mSelf.mContext.getPackageManager().getApplicationInfo(
- "android", STOCK_PM_FLAGS);
+ "android", STOCK_PM_FLAGS);
mSystemThread.installSystemApplicationInfo(info);
synchronized (mSelf) {
@@ -2255,7 +2260,7 @@
for (int i=0; i<N; i++) {
PendingActivityLaunch pal = mPendingActivityLaunches.get(i);
mMainStack.startActivityUncheckedLocked(pal.r, pal.sourceRecord,
- pal.startFlags, doResume && i == (N-1));
+ pal.startFlags, doResume && i == (N-1), null);
}
mPendingActivityLaunches.clear();
}
@@ -2349,10 +2354,12 @@
synchronized (this) {
ActivityRecord r = mMainStack.isInStackLocked(callingActivity);
if (r == null) {
+ ActivityOptions.abort(options);
return false;
}
if (r.app == null || r.app.thread == null) {
// The caller is not running... d'oh!
+ ActivityOptions.abort(options);
return false;
}
intent = new Intent(intent);
@@ -2366,7 +2373,8 @@
List<ResolveInfo> resolves =
AppGlobals.getPackageManager().queryIntentActivities(
intent, r.resolvedType,
- PackageManager.MATCH_DEFAULT_ONLY | STOCK_PM_FLAGS);
+ PackageManager.MATCH_DEFAULT_ONLY | STOCK_PM_FLAGS,
+ UserId.getCallingUserId());
// Look for the original activity in the list...
final int N = resolves != null ? resolves.size() : 0;
@@ -2388,6 +2396,7 @@
if (aInfo == null) {
// Nobody who is next!
+ ActivityOptions.abort(options);
return false;
}
@@ -2417,8 +2426,6 @@
}
final long origId = Binder.clearCallingIdentity();
- // XXX we are not dealing with propagating grantedUriPermissions...
- // those are not yet exposed to user code, so there is no need.
int res = mMainStack.startActivityLocked(r.app.thread, intent,
r.resolvedType, aInfo, resultTo != null ? resultTo.appToken : null,
resultWho, requestCode, -1, r.launchedFromUid, 0,
@@ -2962,6 +2969,12 @@
return null;
}
+ dumpStackTraces(tracesPath, firstPids, processStats, lastPids);
+ return tracesFile;
+ }
+
+ private static void dumpStackTraces(String tracesPath, ArrayList<Integer> firstPids,
+ ProcessStats processStats, SparseArray<Boolean> lastPids) {
// Use a FileObserver to detect when traces finish writing.
// The order of traces is considered important to maintain for legibility.
FileObserver observer = new FileObserver(tracesPath, FileObserver.CLOSE_WRITE) {
@@ -2972,16 +2985,18 @@
observer.startWatching();
// First collect all of the stacks of the most important pids.
- try {
- int num = firstPids.size();
- for (int i = 0; i < num; i++) {
- synchronized (observer) {
- Process.sendSignal(firstPids.get(i), Process.SIGNAL_QUIT);
- observer.wait(200); // Wait for write-close, give up after 200msec
+ if (firstPids != null) {
+ try {
+ int num = firstPids.size();
+ for (int i = 0; i < num; i++) {
+ synchronized (observer) {
+ Process.sendSignal(firstPids.get(i), Process.SIGNAL_QUIT);
+ observer.wait(200); // Wait for write-close, give up after 200msec
+ }
}
+ } catch (InterruptedException e) {
+ Log.wtf(TAG, e);
}
- } catch (InterruptedException e) {
- Log.wtf(TAG, e);
}
// Next measure CPU usage.
@@ -3017,13 +3032,83 @@
}
}
- return tracesFile;
-
} finally {
observer.stopWatching();
}
}
+ final void logAppTooSlow(ProcessRecord app, long startTime, String msg) {
+ if (true || IS_USER_BUILD) {
+ return;
+ }
+ String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
+ if (tracesPath == null || tracesPath.length() == 0) {
+ return;
+ }
+
+ StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
+ StrictMode.allowThreadDiskWrites();
+ try {
+ final File tracesFile = new File(tracesPath);
+ final File tracesDir = tracesFile.getParentFile();
+ final File tracesTmp = new File(tracesDir, "__tmp__");
+ try {
+ if (!tracesDir.exists()) tracesFile.mkdirs();
+ FileUtils.setPermissions(tracesDir.getPath(), 0775, -1, -1); // drwxrwxr-x
+
+ if (tracesFile.exists()) {
+ tracesTmp.delete();
+ tracesFile.renameTo(tracesTmp);
+ }
+ StringBuilder sb = new StringBuilder();
+ Time tobj = new Time();
+ tobj.set(System.currentTimeMillis());
+ sb.append(tobj.format("%Y-%m-%d %H:%M:%S"));
+ sb.append(": ");
+ TimeUtils.formatDuration(SystemClock.uptimeMillis()-startTime, sb);
+ sb.append(" since ");
+ sb.append(msg);
+ FileOutputStream fos = new FileOutputStream(tracesFile);
+ fos.write(sb.toString().getBytes());
+ if (app == null) {
+ fos.write("\n*** No application process!".getBytes());
+ }
+ fos.close();
+ FileUtils.setPermissions(tracesFile.getPath(), 0666, -1, -1); // -rw-rw-rw-
+ } catch (IOException e) {
+ Slog.w(TAG, "Unable to prepare slow app traces file: " + tracesPath, e);
+ return;
+ }
+
+ if (app != null) {
+ ArrayList<Integer> firstPids = new ArrayList<Integer>();
+ firstPids.add(app.pid);
+ dumpStackTraces(tracesPath, firstPids, null, null);
+ }
+
+ File lastTracesFile = null;
+ File curTracesFile = null;
+ for (int i=9; i>=0; i--) {
+ String name = String.format("slow%02d.txt", i);
+ curTracesFile = new File(tracesDir, name);
+ if (curTracesFile.exists()) {
+ if (lastTracesFile != null) {
+ curTracesFile.renameTo(lastTracesFile);
+ } else {
+ curTracesFile.delete();
+ }
+ }
+ lastTracesFile = curTracesFile;
+ }
+ tracesFile.renameTo(curTracesFile);
+ if (tracesTmp.exists()) {
+ tracesTmp.renameTo(tracesFile);
+ }
+ } finally {
+ StrictMode.setThreadPolicy(oldPolicy);
+ }
+ }
+
final void appNotResponding(ProcessRecord app, ActivityRecord activity,
ActivityRecord parent, final String annotation) {
ArrayList<Integer> firstPids = new ArrayList<Integer>(5);
@@ -3210,7 +3295,7 @@
int pkgUid = -1;
synchronized(this) {
try {
- pkgUid = pm.getPackageUid(packageName);
+ pkgUid = pm.getPackageUid(packageName, userId);
} catch (RemoteException e) {
}
if (pkgUid == -1) {
@@ -3231,7 +3316,7 @@
try {
//clear application user data
- pm.clearApplicationUserData(packageName, observer);
+ pm.clearApplicationUserData(packageName, observer, userId);
Intent intent = new Intent(Intent.ACTION_PACKAGE_DATA_CLEARED,
Uri.fromParts("package", packageName, null));
intent.putExtra(Intent.EXTRA_UID, pkgUid);
@@ -3258,13 +3343,14 @@
throw new SecurityException(msg);
}
+ int userId = UserId.getCallingUserId();
long callingId = Binder.clearCallingIdentity();
try {
IPackageManager pm = AppGlobals.getPackageManager();
int pkgUid = -1;
synchronized(this) {
try {
- pkgUid = pm.getPackageUid(packageName);
+ pkgUid = pm.getPackageUid(packageName, userId);
} catch (RemoteException e) {
}
if (pkgUid == -1) {
@@ -3331,16 +3417,14 @@
Slog.w(TAG, msg);
throw new SecurityException(msg);
}
- final int userId = Binder.getOrigCallingUser();
+ final int userId = UserId.getCallingUserId();
long callingId = Binder.clearCallingIdentity();
try {
IPackageManager pm = AppGlobals.getPackageManager();
int pkgUid = -1;
synchronized(this) {
try {
- pkgUid = pm.getPackageUid(packageName);
- // Convert the uid to the one for the calling user
- pkgUid = UserId.getUid(userId, pkgUid);
+ pkgUid = pm.getPackageUid(packageName, userId);
} catch (RemoteException e) {
}
if (pkgUid == -1) {
@@ -3349,7 +3433,7 @@
}
forceStopPackageLocked(packageName, pkgUid);
try {
- pm.setPackageStoppedState(packageName, true);
+ pm.setPackageStoppedState(packageName, true, userId);
} catch (RemoteException e) {
} catch (IllegalArgumentException e) {
Slog.w(TAG, "Failed trying to unstop package "
@@ -3464,7 +3548,7 @@
}
private void forceStopPackageLocked(final String packageName, int uid) {
- forceStopPackageLocked(packageName, uid, false, false, true, false);
+ forceStopPackageLocked(packageName, uid, false, false, true, false, UserId.getUserId(uid));
Intent intent = new Intent(Intent.ACTION_PACKAGE_RESTARTED,
Uri.fromParts("package", packageName, null));
if (!mProcessesReady) {
@@ -3521,13 +3605,13 @@
private final boolean forceStopPackageLocked(String name, int uid,
boolean callerWillRestart, boolean purgeCache, boolean doit,
- boolean evenPersistent) {
+ boolean evenPersistent, int userId) {
int i;
int N;
if (uid < 0) {
try {
- uid = AppGlobals.getPackageManager().getPackageUid(name);
+ uid = AppGlobals.getPackageManager().getPackageUid(name, userId);
} catch (RemoteException e) {
}
}
@@ -3571,14 +3655,13 @@
}
lastTask = r.task;
if (r.stack.finishActivityLocked(r, i, Activity.RESULT_CANCELED,
- null, "force-stop")) {
+ null, "force-stop", true)) {
i--;
}
}
}
ArrayList<ServiceRecord> services = new ArrayList<ServiceRecord>();
- int userId = UserId.getUserId(uid);
for (ServiceRecord service : mServiceMap.getAllServices(userId)) {
if (service.packageName.equals(name)
&& (service.app == null || evenPersistent || !service.app.persistent)) {
@@ -4026,11 +4109,11 @@
if (pkgs != null) {
for (String pkg : pkgs) {
synchronized (ActivityManagerService.this) {
- if (forceStopPackageLocked(pkg, -1, false, false, false, false)) {
- setResultCode(Activity.RESULT_OK);
- return;
- }
- }
+ if (forceStopPackageLocked(pkg, -1, false, false, false, false, 0)) {
+ setResultCode(Activity.RESULT_OK);
+ return;
+ }
+ }
}
}
}
@@ -4171,7 +4254,8 @@
public IIntentSender getIntentSender(int type,
String packageName, IBinder token, String resultWho,
- int requestCode, Intent[] intents, String[] resolvedTypes, int flags) {
+ int requestCode, Intent[] intents, String[] resolvedTypes,
+ int flags, Bundle options) {
enforceNotIsolatedCaller("getIntentSender");
// Refuse possible leaked file descriptors
if (intents != null) {
@@ -4197,14 +4281,19 @@
"Intent array length does not match resolvedTypes length");
}
}
+ if (options != null) {
+ if (options.hasFileDescriptors()) {
+ throw new IllegalArgumentException("File descriptors passed in options");
+ }
+ }
synchronized(this) {
int callingUid = Binder.getCallingUid();
try {
if (callingUid != 0 && callingUid != Process.SYSTEM_UID) {
int uid = AppGlobals.getPackageManager()
- .getPackageUid(packageName);
- if (UserId.getAppId(callingUid) != uid) {
+ .getPackageUid(packageName, UserId.getUserId(callingUid));
+ if (!UserId.isSameApp(callingUid, uid)) {
String msg = "Permission Denial: getIntentSender() from pid="
+ Binder.getCallingPid()
+ ", uid=" + Binder.getCallingUid()
@@ -4219,7 +4308,7 @@
Slog.i(TAG_MU, "Getting intent sender for origCallingUid="
+ Binder.getOrigCallingUid());
return getIntentSenderLocked(type, packageName, Binder.getOrigCallingUid(),
- token, resultWho, requestCode, intents, resolvedTypes, flags);
+ token, resultWho, requestCode, intents, resolvedTypes, flags, options);
} catch (RemoteException e) {
throw new SecurityException(e);
@@ -4229,7 +4318,8 @@
IIntentSender getIntentSenderLocked(int type,
String packageName, int callingUid, IBinder token, String resultWho,
- int requestCode, Intent[] intents, String[] resolvedTypes, int flags) {
+ int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
+ Bundle options) {
if (DEBUG_MU)
Slog.v(TAG_MU, "getIntentSenderLocked(): uid=" + callingUid);
ActivityRecord activity = null;
@@ -4251,7 +4341,7 @@
PendingIntentRecord.Key key = new PendingIntentRecord.Key(
type, packageName, activity, resultWho,
- requestCode, intents, resolvedTypes, flags);
+ requestCode, intents, resolvedTypes, flags, options);
WeakReference<PendingIntentRecord> ref;
ref = mIntentSenderRecords.get(key);
PendingIntentRecord rec = ref != null ? ref.get() : null;
@@ -4298,7 +4388,7 @@
PendingIntentRecord rec = (PendingIntentRecord)sender;
try {
int uid = AppGlobals.getPackageManager()
- .getPackageUid(rec.key.packageName);
+ .getPackageUid(rec.key.packageName, UserId.getCallingUserId());
if (!UserId.isSameApp(uid, Binder.getCallingUid())) {
String msg = "Permission Denial: cancelIntentSender() from pid="
+ Binder.getCallingPid()
@@ -4708,7 +4798,7 @@
} else {
try {
pi = pm.resolveContentProvider(name,
- PackageManager.GET_URI_PERMISSION_PATTERNS);
+ PackageManager.GET_URI_PERMISSION_PATTERNS, UserId.getUserId(callingUid));
} catch (RemoteException ex) {
}
}
@@ -4720,7 +4810,7 @@
int targetUid = lastTargetUid;
if (targetUid < 0 && targetPkg != null) {
try {
- targetUid = pm.getPackageUid(targetPkg);
+ targetUid = pm.getPackageUid(targetPkg, UserId.getUserId(callingUid));
if (targetUid < 0) {
if (DEBUG_URI_PERMISSION) Slog.v(TAG,
"Can't grant URI permission no uid for: " + targetPkg);
@@ -5012,14 +5102,14 @@
final String authority = uri.getAuthority();
ProviderInfo pi = null;
- ContentProviderRecord cpr = mProviderMap.getProviderByName(authority,
- UserId.getUserId(callingUid));
+ int userId = UserId.getUserId(callingUid);
+ ContentProviderRecord cpr = mProviderMap.getProviderByName(authority, userId);
if (cpr != null) {
pi = cpr.info;
} else {
try {
pi = pm.resolveContentProvider(authority,
- PackageManager.GET_URI_PERMISSION_PATTERNS);
+ PackageManager.GET_URI_PERMISSION_PATTERNS, userId);
} catch (RemoteException ex) {
}
}
@@ -5114,7 +5204,7 @@
} else {
try {
pi = pm.resolveContentProvider(authority,
- PackageManager.GET_URI_PERMISSION_PATTERNS);
+ PackageManager.GET_URI_PERMISSION_PATTERNS, r.userId);
} catch (RemoteException ex) {
}
}
@@ -5392,12 +5482,13 @@
// Check whether this activity is currently available.
try {
if (rti.origActivity != null) {
- if (pm.getActivityInfo(rti.origActivity, 0) == null) {
+ if (pm.getActivityInfo(rti.origActivity, 0, callingUserId)
+ == null) {
continue;
}
} else if (rti.baseIntent != null) {
if (pm.queryIntentActivities(rti.baseIntent,
- null, 0) == null) {
+ null, 0, callingUserId) == null) {
continue;
}
}
@@ -5443,15 +5534,16 @@
"removeSubTask()");
long ident = Binder.clearCallingIdentity();
try {
- return mMainStack.removeTaskActivitiesLocked(taskId, subTaskIndex) != null;
+ return mMainStack.removeTaskActivitiesLocked(taskId, subTaskIndex,
+ true) != null;
} finally {
Binder.restoreCallingIdentity(ident);
}
}
}
- private void cleanUpRemovedTaskLocked(ActivityRecord root, boolean killProcesses) {
- TaskRecord tr = root.task;
+ private void cleanUpRemovedTaskLocked(TaskRecord tr, int flags) {
+ final boolean killProcesses = (flags&ActivityManager.REMOVE_TASK_KILL_PROCESS) != 0;
Intent baseIntent = new Intent(
tr.intent != null ? tr.intent : tr.affinityIntent);
ComponentName component = baseIntent.getComponent();
@@ -5462,7 +5554,7 @@
// Find any running services associated with this app.
ArrayList<ServiceRecord> services = new ArrayList<ServiceRecord>();
- for (ServiceRecord sr : mServiceMap.getAllServices(root.userId)) {
+ for (ServiceRecord sr : mServiceMap.getAllServices(tr.userId)) {
if (sr.packageName.equals(component.getPackageName())) {
services.add(sr);
}
@@ -5517,11 +5609,11 @@
"removeTask()");
long ident = Binder.clearCallingIdentity();
try {
- ActivityRecord r = mMainStack.removeTaskActivitiesLocked(taskId, -1);
+ ActivityRecord r = mMainStack.removeTaskActivitiesLocked(taskId, -1,
+ false);
if (r != null) {
mRecentTasks.remove(r.task);
- cleanUpRemovedTaskLocked(r,
- (flags&ActivityManager.REMOVE_TASK_KILL_PROCESS) != 0);
+ cleanUpRemovedTaskLocked(r.task, flags);
return true;
} else {
TaskRecord tr = null;
@@ -5539,6 +5631,8 @@
// Caller is just removing a recent task that is
// not actively running. That is easy!
mRecentTasks.remove(i);
+ cleanUpRemovedTaskLocked(tr, flags);
+ return true;
} else {
Slog.w(TAG, "removeTask: task " + taskId
+ " does not have activities to remove, "
@@ -5594,13 +5688,14 @@
/**
* TODO: Add mController hook
*/
- public void moveTaskToFront(int task, int flags) {
+ public void moveTaskToFront(int task, int flags, Bundle options) {
enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,
"moveTaskToFront()");
synchronized(this) {
if (!checkAppSwitchAllowedLocked(Binder.getCallingPid(),
Binder.getCallingUid(), "Task to front")) {
+ ActivityOptions.abort(options);
return;
}
final long origId = Binder.clearCallingIdentity();
@@ -5615,7 +5710,7 @@
// we'll just move the home task to the top first.
mMainStack.moveHomeToFrontLocked();
}
- mMainStack.moveTaskToFrontLocked(tr, null);
+ mMainStack.moveTaskToFrontLocked(tr, null, options);
return;
}
for (int i=mMainStack.mHistory.size()-1; i>=0; i--) {
@@ -5629,13 +5724,14 @@
// we'll just move the home task to the top first.
mMainStack.moveHomeToFrontLocked();
}
- mMainStack.moveTaskToFrontLocked(hr.task, null);
+ mMainStack.moveTaskToFrontLocked(hr.task, null, options);
return;
}
}
} finally {
Binder.restoreCallingIdentity(origId);
}
+ ActivityOptions.abort(options);
}
}
@@ -6041,15 +6137,14 @@
try {
cpi = AppGlobals.getPackageManager().
resolveContentProvider(name,
- STOCK_PM_FLAGS | PackageManager.GET_URI_PERMISSION_PATTERNS);
+ STOCK_PM_FLAGS | PackageManager.GET_URI_PERMISSION_PATTERNS, userId);
} catch (RemoteException ex) {
}
if (cpi == null) {
return null;
}
- cpi.applicationInfo = getAppInfoForUser(cpi.applicationInfo,
- Binder.getOrigCallingUser());
+ cpi.applicationInfo = getAppInfoForUser(cpi.applicationInfo, userId);
String msg;
if ((msg=checkContentProviderPermissionLocked(cpi, r)) != null) {
@@ -6066,7 +6161,7 @@
}
ComponentName comp = new ComponentName(cpi.packageName, cpi.name);
- cpr = mProviderMap.getProviderByClass(comp, Binder.getOrigCallingUser());
+ cpr = mProviderMap.getProviderByClass(comp, userId);
final boolean firstClass = cpr == null;
if (firstClass) {
try {
@@ -6074,13 +6169,13 @@
AppGlobals.getPackageManager().
getApplicationInfo(
cpi.applicationInfo.packageName,
- STOCK_PM_FLAGS);
+ STOCK_PM_FLAGS, userId);
if (ai == null) {
Slog.w(TAG, "No package info for content provider "
+ cpi.name);
return null;
}
- ai = getAppInfoForUser(ai, Binder.getOrigCallingUser());
+ ai = getAppInfoForUser(ai, userId);
cpr = new ContentProviderRecord(this, cpi, ai, comp);
} catch (RemoteException ex) {
// pm is in same process, this will never happen.
@@ -6121,7 +6216,7 @@
// Content provider is now in use, its package can't be stopped.
try {
AppGlobals.getPackageManager().setPackageStoppedState(
- cpr.appInfo.packageName, false);
+ cpr.appInfo.packageName, false, userId);
} catch (RemoteException e) {
} catch (IllegalArgumentException e) {
Slog.w(TAG, "Failed trying to unstop package "
@@ -6455,7 +6550,7 @@
// This package really, really can not be stopped.
try {
AppGlobals.getPackageManager().setPackageStoppedState(
- info.packageName, false);
+ info.packageName, false, UserId.getUserId(app.uid));
} catch (RemoteException e) {
} catch (IllegalArgumentException e) {
Slog.w(TAG, "Failed trying to unstop package "
@@ -6687,7 +6782,7 @@
mDebugTransient = !persistent;
if (packageName != null) {
final long origId = Binder.clearCallingIdentity();
- forceStopPackageLocked(packageName, -1, false, false, true, true);
+ forceStopPackageLocked(packageName, -1, false, false, true, true, 0);
Binder.restoreCallingIdentity(origId);
}
}
@@ -6902,7 +6997,43 @@
}
return killed;
}
-
+
+ @Override
+ public boolean killProcessesBelowForeground(String reason) {
+ if (Binder.getCallingUid() != Process.SYSTEM_UID) {
+ throw new SecurityException("killProcessesBelowForeground() only available to system");
+ }
+
+ return killProcessesBelowAdj(ProcessList.FOREGROUND_APP_ADJ, reason);
+ }
+
+ private boolean killProcessesBelowAdj(int belowAdj, String reason) {
+ if (Binder.getCallingUid() != Process.SYSTEM_UID) {
+ throw new SecurityException("killProcessesBelowAdj() only available to system");
+ }
+
+ boolean killed = false;
+ synchronized (mPidsSelfLocked) {
+ final int size = mPidsSelfLocked.size();
+ for (int i = 0; i < size; i++) {
+ final int pid = mPidsSelfLocked.keyAt(i);
+ final ProcessRecord proc = mPidsSelfLocked.valueAt(i);
+ if (proc == null) continue;
+
+ final int adj = proc.setAdj;
+ if (adj > belowAdj && !proc.killedBackground) {
+ Slog.w(TAG, "Killing " + proc + " (adj " + adj + "): " + reason);
+ EventLog.writeEvent(
+ EventLogTags.AM_KILL, proc.pid, proc.processName, adj, reason);
+ killed = true;
+ proc.killedBackground = true;
+ Process.killProcessQuiet(pid);
+ }
+ }
+ }
+ return killed;
+ }
+
public final void startRunning(String pkg, String cls, String action,
String data) {
synchronized(this) {
@@ -7046,7 +7177,7 @@
List<ResolveInfo> ris = null;
try {
ris = AppGlobals.getPackageManager().queryIntentReceivers(
- intent, null, 0);
+ intent, null, 0, 0);
} catch (RemoteException e) {
}
if (ris != null) {
@@ -7303,6 +7434,10 @@
}
private boolean handleAppCrashLocked(ProcessRecord app) {
+ if (mHeadless) {
+ Log.e(TAG, "handleAppCrashLocked: " + app.processName);
+ return false;
+ }
long now = SystemClock.uptimeMillis();
Long crashTime;
@@ -7350,7 +7485,7 @@
mMainStack.resumeTopActivityLocked(null);
} else {
ActivityRecord r = mMainStack.topRunningActivityLocked(null);
- if (r.app == app) {
+ if (r != null && r.app == app) {
// If the top running activity is from this crashing
// process, then terminate it to avoid getting in a loop.
Slog.w(TAG, " Force finishing activity "
@@ -7712,7 +7847,7 @@
for (String pkg : process.pkgList) {
sb.append("Package: ").append(pkg);
try {
- PackageInfo pi = pm.getPackageInfo(pkg, 0);
+ PackageInfo pi = pm.getPackageInfo(pkg, 0, 0);
if (pi != null) {
sb.append(" v").append(pi.versionCode);
if (pi.versionName != null) {
@@ -8110,7 +8245,7 @@
IPackageManager pm = AppGlobals.getPackageManager();
for (String pkg : extList) {
try {
- ApplicationInfo info = pm.getApplicationInfo(pkg, 0);
+ ApplicationInfo info = pm.getApplicationInfo(pkg, 0, UserId.getCallingUserId());
if ((info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0) {
retList.add(info);
}
@@ -9360,7 +9495,7 @@
boolean dumpProvidersLocked(FileDescriptor fd, PrintWriter pw, String[] args,
int opti, boolean dumpAll, String dumpPackage) {
- boolean needSep = false;
+ boolean needSep = true;
ItemMatcher matcher = new ItemMatcher();
matcher.build(args, opti);
@@ -10591,21 +10726,21 @@
};
private ServiceLookupResult findServiceLocked(Intent service,
- String resolvedType) {
+ String resolvedType, int userId) {
ServiceRecord r = null;
if (service.getComponent() != null) {
- r = mServiceMap.getServiceByName(service.getComponent(), Binder.getOrigCallingUser());
+ r = mServiceMap.getServiceByName(service.getComponent(), userId);
}
if (r == null) {
Intent.FilterComparison filter = new Intent.FilterComparison(service);
- r = mServiceMap.getServiceByIntent(filter, Binder.getOrigCallingUser());
+ r = mServiceMap.getServiceByIntent(filter, userId);
}
if (r == null) {
try {
ResolveInfo rInfo =
AppGlobals.getPackageManager().resolveService(
- service, resolvedType, 0);
+ service, resolvedType, 0, userId);
ServiceInfo sInfo =
rInfo != null ? rInfo.serviceInfo : null;
if (sInfo == null) {
@@ -10676,7 +10811,7 @@
try {
ResolveInfo rInfo =
AppGlobals.getPackageManager().resolveService(
- service, resolvedType, STOCK_PM_FLAGS);
+ service, resolvedType, STOCK_PM_FLAGS, userId);
ServiceInfo sInfo =
rInfo != null ? rInfo.serviceInfo : null;
if (sInfo == null) {
@@ -11041,7 +11176,7 @@
// Service is now being launched, its package can't be stopped.
try {
AppGlobals.getPackageManager().setPackageStoppedState(
- r.packageName, false);
+ r.packageName, false, r.userId);
} catch (RemoteException e) {
} catch (IllegalArgumentException e) {
Slog.w(TAG, "Failed trying to unstop package "
@@ -11346,7 +11481,8 @@
}
// If this service is active, make sure it is stopped.
- ServiceLookupResult r = findServiceLocked(service, resolvedType);
+ ServiceLookupResult r = findServiceLocked(service, resolvedType,
+ callerApp == null ? UserId.getCallingUserId() : callerApp.userId);
if (r != null) {
if (r.record != null) {
final long origId = Binder.clearCallingIdentity();
@@ -11374,7 +11510,8 @@
IBinder ret = null;
synchronized(this) {
- ServiceLookupResult r = findServiceLocked(service, resolvedType);
+ ServiceLookupResult r = findServiceLocked(service, resolvedType,
+ UserId.getCallingUserId());
if (r != null) {
// r.record is null if findServiceLocked() failed the caller permission check
@@ -12003,7 +12140,7 @@
// Backup agent is now in use, its package can't be stopped.
try {
AppGlobals.getPackageManager().setPackageStoppedState(
- app.packageName, false);
+ app.packageName, false, UserId.getUserId(app.uid));
} catch (RemoteException e) {
} catch (IllegalArgumentException e) {
Slog.w(TAG, "Failed trying to unstop package "
@@ -12367,7 +12504,7 @@
String list[] = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST);
if (list != null && (list.length > 0)) {
for (String pkg : list) {
- forceStopPackageLocked(pkg, -1, false, true, true, false);
+ forceStopPackageLocked(pkg, -1, false, true, true, false, userId);
}
sendPackageBroadcastLocked(
IApplicationThread.EXTERNAL_STORAGE_UNAVAILABLE, list);
@@ -12378,7 +12515,8 @@
if (data != null && (ssp=data.getSchemeSpecificPart()) != null) {
if (!intent.getBooleanExtra(Intent.EXTRA_DONT_KILL_APP, false)) {
forceStopPackageLocked(ssp,
- intent.getIntExtra(Intent.EXTRA_UID, -1), false, true, true, false);
+ intent.getIntExtra(Intent.EXTRA_UID, -1), false, true, true,
+ false, userId);
}
if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
sendPackageBroadcastLocked(IApplicationThread.PACKAGE_REMOVED,
@@ -12495,7 +12633,7 @@
if (intent.getComponent() != null) {
// Broadcast is going to one specific receiver class...
ActivityInfo ai = AppGlobals.getPackageManager().
- getReceiverInfo(intent.getComponent(), STOCK_PM_FLAGS);
+ getReceiverInfo(intent.getComponent(), STOCK_PM_FLAGS, userId);
if (ai != null) {
receivers = new ArrayList();
ResolveInfo ri = new ResolveInfo();
@@ -12503,15 +12641,15 @@
receivers.add(ri);
}
} else {
- // TODO: Apply userId
// Need to resolve the intent to interested receivers...
if ((intent.getFlags()&Intent.FLAG_RECEIVER_REGISTERED_ONLY)
== 0) {
receivers =
AppGlobals.getPackageManager().queryIntentReceivers(
- intent, resolvedType, STOCK_PM_FLAGS);
+ intent, resolvedType, STOCK_PM_FLAGS, userId);
}
- registeredReceivers = mReceiverResolver.queryIntent(intent, resolvedType, false);
+ registeredReceivers = mReceiverResolver.queryIntent(intent, resolvedType, false,
+ userId);
}
} catch (RemoteException ex) {
// pm is in same process, this will never happen.
@@ -12802,7 +12940,7 @@
ii = mContext.getPackageManager().getInstrumentationInfo(
className, STOCK_PM_FLAGS);
ai = mContext.getPackageManager().getApplicationInfo(
- ii.targetPackage, STOCK_PM_FLAGS);
+ ii.targetPackage, STOCK_PM_FLAGS);
} catch (PackageManager.NameNotFoundException e) {
}
if (ii == null) {
@@ -12830,9 +12968,10 @@
throw new SecurityException(msg);
}
+ int userId = UserId.getCallingUserId();
final long origId = Binder.clearCallingIdentity();
// Instrumentation can kill and relaunch even persistent processes
- forceStopPackageLocked(ii.targetPackage, -1, true, false, true, true);
+ forceStopPackageLocked(ii.targetPackage, -1, true, false, true, true, userId);
ProcessRecord app = addAppLocked(ai, false);
app.instrumentationClass = className;
app.instrumentationInfo = ai;
@@ -12887,11 +13026,12 @@
app.instrumentationProfileFile = null;
app.instrumentationArguments = null;
- forceStopPackageLocked(app.processName, -1, false, false, true, true);
+ forceStopPackageLocked(app.processName, -1, false, false, true, true, app.userId);
}
public void finishInstrumentation(IApplicationThread target,
int resultCode, Bundle results) {
+ int userId = UserId.getCallingUserId();
// Refuse possible leaked file descriptors
if (results != null && results.hasFileDescriptors()) {
throw new IllegalArgumentException("File descriptors passed in Intent");
diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java
index a337b40..d60ff2b 100644
--- a/services/java/com/android/server/am/ActivityRecord.java
+++ b/services/java/com/android/server/am/ActivityRecord.java
@@ -20,12 +20,12 @@
import com.android.server.am.ActivityStack.ActivityState;
import android.app.Activity;
+import android.app.ActivityOptions;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.res.CompatibilityInfo;
-import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.Build;
@@ -85,6 +85,8 @@
long startTime; // last time this activity was started
long lastVisibleTime; // last time this activity became visible
long cpuTimeAtResume; // the cpu time of host process at the time of resuming activity
+ long pauseTime; // last time we started pausing the activity
+ long launchTickTime; // base time for launch tick messages
Configuration configuration; // configuration activity was last running in
CompatibilityInfo compat;// last used compatibility mode
ActivityRecord resultTo; // who started this entry, so will get our reply
@@ -93,6 +95,7 @@
ArrayList results; // pending ActivityResult objs we have received
HashSet<WeakReference<PendingIntentRecord>> pendingResults; // all pending intents for this act
ArrayList newIntents; // any pending new intents for single-top mode
+ ActivityOptions pendingOptions; // most recently given options
HashSet<ConnectionRecord> connections; // All ConnectionRecord we hold
UriPermissionOwner uriPermissions; // current special URI access perms.
ProcessRecord app; // if non-null, hosting application
@@ -536,6 +539,42 @@
}
}
+ void updateOptionsLocked(Bundle options) {
+ if (options != null) {
+ if (pendingOptions != null) {
+ pendingOptions.abort();
+ }
+ pendingOptions = new ActivityOptions(options);
+ }
+ }
+
+ void applyOptionsLocked() {
+ if (pendingOptions != null) {
+ switch (pendingOptions.getAnimationType()) {
+ case ActivityOptions.ANIM_CUSTOM:
+ service.mWindowManager.overridePendingAppTransition(
+ pendingOptions.getPackageName(),
+ pendingOptions.getCustomEnterResId(),
+ pendingOptions.getCustomExitResId());
+ break;
+ case ActivityOptions.ANIM_THUMBNAIL:
+ service.mWindowManager.overridePendingAppTransitionThumb(
+ pendingOptions.getThumbnail(),
+ pendingOptions.getStartX(), pendingOptions.getStartY(),
+ pendingOptions.getOnAnimationStartListener());
+ break;
+ }
+ pendingOptions = null;
+ }
+ }
+
+ void clearOptionsLocked() {
+ if (pendingOptions != null) {
+ pendingOptions.abort();
+ pendingOptions = null;
+ }
+ }
+
void removeUriPermissionsLocked() {
if (uriPermissions != null) {
uriPermissions.removeUriPermissionsLocked();
@@ -576,6 +615,32 @@
}
}
+ void startLaunchTickingLocked() {
+ if (ActivityManagerService.IS_USER_BUILD) {
+ return;
+ }
+ if (launchTickTime == 0) {
+ launchTickTime = SystemClock.uptimeMillis();
+ continueLaunchTickingLocked();
+ }
+ }
+
+ boolean continueLaunchTickingLocked() {
+ if (launchTickTime != 0) {
+ Message msg = stack.mHandler.obtainMessage(ActivityStack.LAUNCH_TICK_MSG);
+ msg.obj = this;
+ stack.mHandler.removeMessages(ActivityStack.LAUNCH_TICK_MSG);
+ stack.mHandler.sendMessageDelayed(msg, ActivityStack.LAUNCH_TICK);
+ return true;
+ }
+ return false;
+ }
+
+ void finishLaunchTickingLocked() {
+ launchTickTime = 0;
+ stack.mHandler.removeMessages(ActivityStack.LAUNCH_TICK_MSG);
+ }
+
// IApplicationToken
public boolean mayFreezeScreenLocked(ProcessRecord app) {
@@ -631,6 +696,7 @@
stack.mInitialStartTime = 0;
}
startTime = 0;
+ finishLaunchTickingLocked();
}
}
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index edebbac..a01ed25 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -22,6 +22,7 @@
import android.app.Activity;
import android.app.ActivityManager;
+import android.app.ActivityOptions;
import android.app.AppGlobals;
import android.app.IActivityManager;
import android.app.IThumbnailRetriever;
@@ -87,7 +88,10 @@
// How long we wait until giving up on the last activity telling us it
// is idle.
static final int IDLE_TIMEOUT = 10*1000;
-
+
+ // Ticks during which we check progress while waiting for an app to launch.
+ static final int LAUNCH_TICK = 500;
+
// How long we wait until giving up on the last activity to pause. This
// is short because it directly impacts the responsiveness of starting the
// next activity.
@@ -275,6 +279,7 @@
static final int LAUNCH_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 4;
static final int DESTROY_TIMEOUT_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 5;
static final int RESUME_TOP_ACTIVITY_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 6;
+ static final int LAUNCH_TICK_MSG = ActivityManagerService.FIRST_ACTIVITY_STACK_MSG + 7;
final Handler mHandler = new Handler() {
//public Handler() {
@@ -297,6 +302,13 @@
// We don't at this point know if the activity is fullscreen,
// so we need to be conservative and assume it isn't.
Slog.w(TAG, "Activity pause timeout for " + r);
+ synchronized (mService) {
+ if (r.app != null) {
+ mService.logAppTooSlow(r.app, r.pauseTime,
+ "pausing " + r);
+ }
+ }
+
activityPaused(r != null ? r.appToken : null, true);
} break;
case IDLE_TIMEOUT_MSG: {
@@ -313,6 +325,15 @@
Slog.w(TAG, "Activity idle timeout for " + r);
activityIdleInternal(r != null ? r.appToken : null, true, null);
} break;
+ case LAUNCH_TICK_MSG: {
+ ActivityRecord r = (ActivityRecord)msg.obj;
+ synchronized (mService) {
+ if (r.continueLaunchTickingLocked()) {
+ mService.logAppTooSlow(r.app, r.launchTickTime,
+ "launching " + r);
+ }
+ }
+ } break;
case DESTROY_TIMEOUT_MSG: {
ActivityRecord r = (ActivityRecord)msg.obj;
// We don't at this point know if the activity is fullscreen,
@@ -554,6 +575,9 @@
r.startFreezingScreenLocked(app, 0);
mService.mWindowManager.setAppVisibility(r.appToken, true);
+ // schedule launch ticks to collect information about slow apps.
+ r.startLaunchTickingLocked();
+
// Have the window manager re-evaluate the orientation of
// the screen based on the new activity order. Note that
// as a result of this, it can call back into the activity
@@ -936,6 +960,7 @@
// responsiveness seen by the user.
Message msg = mHandler.obtainMessage(PAUSE_TIMEOUT_MSG);
msg.obj = prev;
+ prev.pauseTime = SystemClock.uptimeMillis();
mHandler.sendMessageDelayed(msg, PAUSE_TIMEOUT);
if (DEBUG_PAUSE) Slog.v(TAG, "Waiting for pause to complete...");
} else {
@@ -1420,9 +1445,8 @@
// Launching this app's activity, make sure the app is no longer
// considered stopped.
try {
- // TODO: Apply to the correct userId
AppGlobals.getPackageManager().setPackageStoppedState(
- next.packageName, false);
+ next.packageName, false, next.userId); /* TODO: Verify if correct userid */
} catch (RemoteException e1) {
} catch (IllegalArgumentException e) {
Slog.w(TAG, "Failed trying to unstop package "
@@ -1432,6 +1456,7 @@
// We are starting up the next activity, so tell the window manager
// that the previous one will be hidden soon. This way it can know
// to ignore it when computing the desired screen orientation.
+ boolean noAnim = false;
if (prev != null) {
if (prev.finishing) {
if (DEBUG_TRANSITION) Slog.v(TAG,
@@ -1450,6 +1475,7 @@
if (DEBUG_TRANSITION) Slog.v(TAG,
"Prepare open transition: prev=" + prev);
if (mNoAnimActivities.contains(next)) {
+ noAnim = true;
mService.mWindowManager.prepareAppTransition(
WindowManagerPolicy.TRANSIT_NONE, false);
} else {
@@ -1466,6 +1492,7 @@
if (DEBUG_TRANSITION) Slog.v(TAG,
"Prepare open transition: no previous");
if (mNoAnimActivities.contains(next)) {
+ noAnim = true;
mService.mWindowManager.prepareAppTransition(
WindowManagerPolicy.TRANSIT_NONE, false);
} else {
@@ -1473,6 +1500,11 @@
WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN, false);
}
}
+ if (!noAnim) {
+ next.applyOptionsLocked();
+ } else {
+ next.clearOptionsLocked();
+ }
if (next.app != null && next.app.thread != null) {
if (DEBUG_SWITCH) Slog.v(TAG, "Resume running: " + next);
@@ -1480,6 +1512,9 @@
// This activity is now becoming visible.
mService.mWindowManager.setAppVisibility(next.appToken, true);
+ // schedule launch ticks to collect information about slow apps.
+ next.startLaunchTickingLocked();
+
ActivityRecord lastResumedActivity = mResumedActivity;
ActivityState lastState = next.state;
@@ -1628,7 +1663,7 @@
}
private final void startActivityLocked(ActivityRecord r, boolean newTask,
- boolean doResume, boolean keepCurTransition) {
+ boolean doResume, boolean keepCurTransition, Bundle options) {
final int NH = mHistory.size();
int addPos = -1;
@@ -1660,6 +1695,7 @@
if (VALIDATE_TOKENS) {
validateAppTokensLocked();
}
+ ActivityOptions.abort(options);
return;
}
break;
@@ -1721,6 +1757,7 @@
: WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN, keepCurTransition);
mNoAnimActivities.remove(r);
}
+ r.updateOptionsLocked(options);
mService.mWindowManager.addAppToken(
addPos, r.appToken, r.task.taskId, r.info.screenOrientation, r.fullscreen);
boolean doShow = true;
@@ -1761,6 +1798,7 @@
// because there is nothing for it to animate on top of.
mService.mWindowManager.addAppToken(addPos, r.appToken, r.task.taskId,
r.info.screenOrientation, r.fullscreen);
+ ActivityOptions.abort(options);
}
if (VALIDATE_TOKENS) {
validateAppTokensLocked();
@@ -2308,6 +2346,7 @@
// Transfer the result target from the source activity to the new
// one being started, including any failures.
if (requestCode >= 0) {
+ ActivityOptions.abort(options);
return ActivityManager.START_FORWARD_AND_REQUEST_CONFLICT;
}
resultRecord = sourceRecord.resultTo;
@@ -2339,6 +2378,7 @@
Activity.RESULT_CANCELED, null);
}
mDismissKeyguardOnNextActivity = false;
+ ActivityOptions.abort(options);
return err;
}
@@ -2389,6 +2429,7 @@
// We pretend to the caller that it was really started, but
// they will just get a cancel result.
mDismissKeyguardOnNextActivity = false;
+ ActivityOptions.abort(options);
return ActivityManager.START_SUCCESS;
}
}
@@ -2411,6 +2452,7 @@
pal.startFlags = startFlags;
mService.mPendingActivityLaunches.add(pal);
mDismissKeyguardOnNextActivity = false;
+ ActivityOptions.abort(options);
return ActivityManager.START_SWITCHES_CANCELED;
}
}
@@ -2430,7 +2472,7 @@
}
err = startActivityUncheckedLocked(r, sourceRecord,
- startFlags, true);
+ startFlags, true, options);
if (mDismissKeyguardOnNextActivity && mPausingActivity == null) {
// Someone asked to have the keyguard dismissed on the next
// activity start, but we are not actually doing an activity
@@ -2453,7 +2495,8 @@
}
final int startActivityUncheckedLocked(ActivityRecord r,
- ActivityRecord sourceRecord, int startFlags, boolean doResume) {
+ ActivityRecord sourceRecord, int startFlags, boolean doResume,
+ Bundle options) {
final Intent intent = r.intent;
final int callingUid = r.launchedFromUid;
final int userId = r.userId;
@@ -2564,7 +2607,7 @@
// We really do want to push this one into the
// user's face, right now.
moveHomeToFrontFromLaunchLocked(launchFlags);
- moveTaskToFrontLocked(taskTop.task, r);
+ moveTaskToFrontLocked(taskTop.task, r, options);
}
}
// If the caller has requested that the target task be
@@ -2580,6 +2623,7 @@
if (doResume) {
resumeTopActivityLocked(null);
}
+ ActivityOptions.abort(options);
return ActivityManager.START_RETURN_INTENT_TO_CALLER;
}
if ((launchFlags &
@@ -2667,6 +2711,7 @@
if (doResume) {
resumeTopActivityLocked(null);
}
+ ActivityOptions.abort(options);
return ActivityManager.START_TASK_TO_FRONT;
}
}
@@ -2696,6 +2741,7 @@
if (doResume) {
resumeTopActivityLocked(null);
}
+ ActivityOptions.abort(options);
if ((startFlags&ActivityManager.START_FLAG_ONLY_IF_NEEDED) != 0) {
// We don't need to start a new activity, and
// the client said not to do anything if that
@@ -2715,6 +2761,7 @@
r.resultTo, r.resultWho, r.requestCode,
Activity.RESULT_CANCELED, null);
}
+ ActivityOptions.abort(options);
return ActivityManager.START_CLASS_NOT_FOUND;
}
@@ -2756,6 +2803,7 @@
if (doResume) {
resumeTopActivityLocked(null);
}
+ ActivityOptions.abort(options);
return ActivityManager.START_DELIVERED_TO_TOP;
}
} else if (!addingToTask &&
@@ -2767,6 +2815,7 @@
if (where >= 0) {
ActivityRecord top = moveActivityToFrontLocked(where);
logStartActivity(EventLogTags.AM_NEW_INTENT, r, top.task);
+ top.updateOptionsLocked(options);
top.deliverNewIntentLocked(callingUid, r.intent);
if (doResume) {
resumeTopActivityLocked(null);
@@ -2802,12 +2851,12 @@
EventLog.writeEvent(EventLogTags.AM_CREATE_TASK, r.task.taskId);
}
logStartActivity(EventLogTags.AM_CREATE_ACTIVITY, r, r.task);
- startActivityLocked(r, newTask, doResume, keepCurTransition);
+ startActivityLocked(r, newTask, doResume, keepCurTransition, options);
return ActivityManager.START_SUCCESS;
}
ActivityInfo resolveActivity(Intent intent, String resolvedType, int startFlags,
- String profileFile, ParcelFileDescriptor profileFd) {
+ String profileFile, ParcelFileDescriptor profileFd, int userId) {
// Collect information about the target of the Intent.
ActivityInfo aInfo;
try {
@@ -2815,7 +2864,7 @@
AppGlobals.getPackageManager().resolveIntent(
intent, resolvedType,
PackageManager.MATCH_DEFAULT_ONLY
- | ActivityManagerService.STOCK_PM_FLAGS);
+ | ActivityManagerService.STOCK_PM_FLAGS, userId);
aInfo = rInfo != null ? rInfo.activityInfo : null;
} catch (RemoteException e) {
aInfo = null;
@@ -2869,7 +2918,7 @@
// Collect information about the target of the Intent.
ActivityInfo aInfo = resolveActivity(intent, resolvedType, startFlags,
- profileFile, profileFd);
+ profileFile, profileFd, userId);
aInfo = mService.getActivityInfoForUser(aInfo, userId);
synchronized (mService) {
@@ -2909,6 +2958,7 @@
Slog.w(TAG, "Unable to find app for caller " + caller
+ " (pid=" + realCallingPid + ") when starting: "
+ intent.toString());
+ ActivityOptions.abort(options);
return ActivityManager.START_PERMISSION_DENIED;
}
}
@@ -2917,7 +2967,7 @@
ActivityManager.INTENT_SENDER_ACTIVITY, "android",
realCallingUid, null, null, 0, new Intent[] { intent },
new String[] { resolvedType }, PendingIntent.FLAG_CANCEL_CURRENT
- | PendingIntent.FLAG_ONE_SHOT);
+ | PendingIntent.FLAG_ONE_SHOT, null);
Intent newIntent = new Intent();
if (requestCode >= 0) {
@@ -2949,7 +2999,7 @@
AppGlobals.getPackageManager().resolveIntent(
intent, null,
PackageManager.MATCH_DEFAULT_ONLY
- | ActivityManagerService.STOCK_PM_FLAGS);
+ | ActivityManagerService.STOCK_PM_FLAGS, userId);
aInfo = rInfo != null ? rInfo.activityInfo : null;
aInfo = mService.getActivityInfoForUser(aInfo, userId);
} catch (RemoteException e) {
@@ -3058,7 +3108,7 @@
// Collect information about the target of the Intent.
ActivityInfo aInfo = resolveActivity(intent, resolvedTypes[i],
- 0, null, null);
+ 0, null, null, userId);
// TODO: New, check if this is correct
aInfo = mService.getActivityInfoForUser(aInfo, userId);
@@ -3068,9 +3118,15 @@
"FLAG_CANT_SAVE_STATE not supported here");
}
+ Bundle theseOptions;
+ if (options != null && i == intents.length-1) {
+ theseOptions = options;
+ } else {
+ theseOptions = null;
+ }
int res = startActivityLocked(caller, intent, resolvedTypes[i],
aInfo, resultTo, null, -1, callingPid, callingUid,
- 0, options, componentSpecified, outActivity);
+ 0, theseOptions, componentSpecified, outActivity);
if (res < 0) {
return res;
}
@@ -3257,6 +3313,7 @@
ActivityRecord r = ActivityRecord.forToken(token);
if (r != null) {
mHandler.removeMessages(IDLE_TIMEOUT_MSG, r);
+ r.finishLaunchTickingLocked();
}
// Get the activity record.
@@ -3434,6 +3491,15 @@
*/
final boolean finishActivityLocked(ActivityRecord r, int index,
int resultCode, Intent resultData, String reason) {
+ return finishActivityLocked(r, index, resultCode, resultData, reason, false);
+ }
+
+ /**
+ * @return Returns true if this activity has been removed from the history
+ * list, or false if it is still in the list and will be removed later.
+ */
+ final boolean finishActivityLocked(ActivityRecord r, int index,
+ int resultCode, Intent resultData, String reason, boolean immediate) {
if (r.finishing) {
Slog.w(TAG, "Duplicate finish request for " + r);
return false;
@@ -3475,7 +3541,10 @@
mService.mCancelledThumbnails.add(r);
}
- if (mResumedActivity == r) {
+ if (immediate) {
+ return finishCurrentActivityLocked(r, index,
+ FINISH_IMMEDIATELY) == null;
+ } else if (mResumedActivity == r) {
boolean endTask = index <= 0
|| (mHistory.get(index-1)).task != r.task;
if (DEBUG_TRANSITION) Slog.v(TAG,
@@ -3627,6 +3696,7 @@
mHandler.removeMessages(PAUSE_TIMEOUT_MSG, r);
mHandler.removeMessages(IDLE_TIMEOUT_MSG, r);
mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r);
+ r.finishLaunchTickingLocked();
}
final void removeActivityFromHistoryLocked(ActivityRecord r) {
@@ -3840,12 +3910,12 @@
}
}
if (homeTask != null) {
- moveTaskToFrontLocked(homeTask, null);
+ moveTaskToFrontLocked(homeTask, null, null);
}
}
- final void moveTaskToFrontLocked(TaskRecord tr, ActivityRecord reason) {
+ final void moveTaskToFrontLocked(TaskRecord tr, ActivityRecord reason, Bundle options) {
if (DEBUG_SWITCH) Slog.v(TAG, "moveTaskToFront: " + tr);
final int task = tr.taskId;
@@ -3853,6 +3923,7 @@
if (top < 0 || (mHistory.get(top)).task.taskId == task) {
// nothing to do!
+ ActivityOptions.abort(options);
return;
}
@@ -3894,7 +3965,16 @@
if (r != null) {
mNoAnimActivities.add(r);
}
+ ActivityOptions.abort(options);
} else {
+ if (options != null) {
+ ActivityRecord r = topRunningActivityLocked(null);
+ if (r != null && r.state != ActivityState.RESUMED) {
+ r.updateOptionsLocked(options);
+ } else {
+ ActivityOptions.abort(options);
+ }
+ }
mService.mWindowManager.prepareAppTransition(
WindowManagerPolicy.TRANSIT_TASK_TO_FRONT, false);
}
@@ -4011,10 +4091,13 @@
return info;
}
- public ActivityRecord removeTaskActivitiesLocked(int taskId, int subTaskIndex) {
+ public ActivityRecord removeTaskActivitiesLocked(int taskId, int subTaskIndex,
+ boolean taskRequired) {
TaskAccessInfo info = getTaskAccessInfoLocked(taskId, false);
if (info.root == null) {
- Slog.w(TAG, "removeTaskLocked: unknown taskId " + taskId);
+ if (taskRequired) {
+ Slog.w(TAG, "removeTaskLocked: unknown taskId " + taskId);
+ }
return null;
}
@@ -4025,7 +4108,9 @@
}
if (subTaskIndex >= info.subtasks.size()) {
- Slog.w(TAG, "removeTaskLocked: unknown subTaskIndex " + subTaskIndex);
+ if (taskRequired) {
+ Slog.w(TAG, "removeTaskLocked: unknown subTaskIndex " + subTaskIndex);
+ }
return null;
}
diff --git a/services/java/com/android/server/am/BroadcastQueue.java b/services/java/com/android/server/am/BroadcastQueue.java
index 39b63db..1b83e0b 100644
--- a/services/java/com/android/server/am/BroadcastQueue.java
+++ b/services/java/com/android/server/am/BroadcastQueue.java
@@ -732,7 +732,7 @@
// Broadcast is being executed, its package can't be stopped.
try {
AppGlobals.getPackageManager().setPackageStoppedState(
- r.curComponent.getPackageName(), false);
+ r.curComponent.getPackageName(), false, UserId.getUserId(r.callingUid));
} catch (RemoteException e) {
} catch (IllegalArgumentException e) {
Slog.w(TAG, "Failed trying to unstop package "
diff --git a/services/java/com/android/server/am/CompatModePackages.java b/services/java/com/android/server/am/CompatModePackages.java
index cd72202..3ba3fbb 100644
--- a/services/java/com/android/server/am/CompatModePackages.java
+++ b/services/java/com/android/server/am/CompatModePackages.java
@@ -121,7 +121,7 @@
public void handlePackageAddedLocked(String packageName, boolean updated) {
ApplicationInfo ai = null;
try {
- ai = AppGlobals.getPackageManager().getApplicationInfo(packageName, 0);
+ ai = AppGlobals.getPackageManager().getApplicationInfo(packageName, 0, 0);
} catch (RemoteException e) {
}
if (ai == null) {
@@ -220,7 +220,7 @@
public int getPackageScreenCompatModeLocked(String packageName) {
ApplicationInfo ai = null;
try {
- ai = AppGlobals.getPackageManager().getApplicationInfo(packageName, 0);
+ ai = AppGlobals.getPackageManager().getApplicationInfo(packageName, 0, 0);
} catch (RemoteException e) {
}
if (ai == null) {
@@ -232,7 +232,7 @@
public void setPackageScreenCompatModeLocked(String packageName, int mode) {
ApplicationInfo ai = null;
try {
- ai = AppGlobals.getPackageManager().getApplicationInfo(packageName, 0);
+ ai = AppGlobals.getPackageManager().getApplicationInfo(packageName, 0, 0);
} catch (RemoteException e) {
}
if (ai == null) {
@@ -365,7 +365,7 @@
}
ApplicationInfo ai = null;
try {
- ai = pm.getApplicationInfo(pkg, 0);
+ ai = pm.getApplicationInfo(pkg, 0, 0);
} catch (RemoteException e) {
}
if (ai == null) {
diff --git a/services/java/com/android/server/am/ContentProviderRecord.java b/services/java/com/android/server/am/ContentProviderRecord.java
index f338cfc..608b09a 100644
--- a/services/java/com/android/server/am/ContentProviderRecord.java
+++ b/services/java/com/android/server/am/ContentProviderRecord.java
@@ -157,7 +157,7 @@
sb.append("ContentProviderRecord{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
sb.append(' ');
- sb.append(info.name);
+ sb.append(name.flattenToShortString());
sb.append('}');
return stringName = sb.toString();
}
diff --git a/services/java/com/android/server/am/PendingIntentRecord.java b/services/java/com/android/server/am/PendingIntentRecord.java
index 9676084..ad15da1 100644
--- a/services/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/java/com/android/server/am/PendingIntentRecord.java
@@ -49,6 +49,7 @@
final int requestCode;
final Intent requestIntent;
final String requestResolvedType;
+ final Bundle options;
Intent[] allIntents;
String[] allResolvedTypes;
final int flags;
@@ -57,7 +58,7 @@
private static final int ODD_PRIME_NUMBER = 37;
Key(int _t, String _p, ActivityRecord _a, String _w,
- int _r, Intent[] _i, String[] _it, int _f) {
+ int _r, Intent[] _i, String[] _it, int _f, Bundle _o) {
type = _t;
packageName = _p;
activity = _a;
@@ -68,6 +69,7 @@
allIntents = _i;
allResolvedTypes = _it;
flags = _f;
+ options = _o;
int hash = 23;
hash = (ODD_PRIME_NUMBER*hash) + _f;
@@ -215,6 +217,13 @@
boolean sendFinish = finishedReceiver != null;
switch (key.type) {
case ActivityManager.INTENT_SENDER_ACTIVITY:
+ if (options == null) {
+ options = key.options;
+ } else if (key.options != null) {
+ Bundle opts = new Bundle(key.options);
+ opts.putAll(options);
+ options = opts;
+ }
try {
if (key.allIntents != null && key.allIntents.length > 1) {
Intent[] allIntents = new Intent[key.allIntents.length];
diff --git a/services/java/com/android/server/am/ProviderMap.java b/services/java/com/android/server/am/ProviderMap.java
index 2021e0d..ccc928f 100644
--- a/services/java/com/android/server/am/ProviderMap.java
+++ b/services/java/com/android/server/am/ProviderMap.java
@@ -183,16 +183,20 @@
r.dump(pw, " ");
} else {
pw.print(" * ");
- pw.print(r.name.toShortString());
- /*
- if (r.app != null) {
- pw.println(":");
- pw.print(" ");
- pw.println(r.app);
- } else {
- pw.println();
+ pw.println(r);
+ if (r.proc != null) {
+ pw.print(" proc=");
+ pw.println(r.proc);
}
- */
+ if (r.launchingApp != null) {
+ pw.print(" launchingApp=");
+ pw.println(r.launchingApp);
+ }
+ if (r.clients.size() > 0 || r.externalProcessNoHandleCount > 0) {
+ pw.print(" "); pw.print(r.clients.size());
+ pw.print(" clients, "); pw.print(r.externalProcessNoHandleCount);
+ pw.println(" external handles");
+ }
}
}
}
@@ -217,7 +221,7 @@
pw.println(" ");
pw.println(" Published content providers (by class):");
dumpProvidersByClassLocked(pw, dumpAll, mGlobalByClass);
- pw.println(" ");
+ pw.println("");
}
if (mProvidersByClassPerUser.size() > 1) {
diff --git a/services/java/com/android/server/am/TaskRecord.java b/services/java/com/android/server/am/TaskRecord.java
index 67873cc..e3ebcc61 100644
--- a/services/java/com/android/server/am/TaskRecord.java
+++ b/services/java/com/android/server/am/TaskRecord.java
@@ -39,7 +39,7 @@
boolean askedCompatMode;// Have asked the user about compat mode for this task.
String stringName; // caching of toString() result.
- int userId; // user for which this task was created
+ int userId; // user for which this task was created
TaskRecord(int _taskId, ActivityInfo info, Intent _intent) {
taskId = _taskId;
diff --git a/services/java/com/android/server/net/NetworkPolicyManagerService.java b/services/java/com/android/server/net/NetworkPolicyManagerService.java
index 2ad24e2..1f1e720 100644
--- a/services/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -41,7 +41,6 @@
import static android.net.NetworkPolicyManager.computeLastCycleBoundary;
import static android.net.NetworkPolicyManager.dumpPolicy;
import static android.net.NetworkPolicyManager.dumpRules;
-import static android.net.NetworkPolicyManager.isUidValidForPolicy;
import static android.net.NetworkTemplate.MATCH_ETHERNET;
import static android.net.NetworkTemplate.MATCH_MOBILE_3G_LOWER;
import static android.net.NetworkTemplate.MATCH_MOBILE_4G;
@@ -74,6 +73,7 @@
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
+import android.content.pm.UserInfo;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.IConnectivityManager;
@@ -96,6 +96,7 @@
import android.os.MessageQueue.IdleHandler;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
+import android.os.UserId;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.format.Formatter;
@@ -157,6 +158,8 @@
private static final int VERSION_ADDED_METERED = 4;
private static final int VERSION_SPLIT_SNOOZE = 5;
private static final int VERSION_ADDED_TIMEZONE = 6;
+ private static final int VERSION_ADDED_INFERRED = 7;
+ private static final int VERSION_SWITCH_APP_ID = 8;
// @VisibleForTesting
public static final int TYPE_WARNING = 0x1;
@@ -166,6 +169,7 @@
private static final String TAG_POLICY_LIST = "policy-list";
private static final String TAG_NETWORK_POLICY = "network-policy";
private static final String TAG_UID_POLICY = "uid-policy";
+ private static final String TAG_APP_POLICY = "app-policy";
private static final String ATTR_VERSION = "version";
private static final String ATTR_RESTRICT_BACKGROUND = "restrictBackground";
@@ -179,7 +183,9 @@
private static final String ATTR_LAST_WARNING_SNOOZE = "lastWarningSnooze";
private static final String ATTR_LAST_LIMIT_SNOOZE = "lastLimitSnooze";
private static final String ATTR_METERED = "metered";
+ private static final String ATTR_INFERRED = "inferred";
private static final String ATTR_UID = "uid";
+ private static final String ATTR_APP_ID = "appId";
private static final String ATTR_POLICY = "policy";
private static final String TAG_ALLOW_BACKGROUND = TAG + ":allowBackground";
@@ -221,8 +227,8 @@
/** Currently active network rules for ifaces. */
private HashMap<NetworkPolicy, String[]> mNetworkRules = Maps.newHashMap();
- /** Defined UID policies. */
- private SparseIntArray mUidPolicy = new SparseIntArray();
+ /** Defined app policies. */
+ private SparseIntArray mAppPolicy = new SparseIntArray();
/** Currently derived rules for each UID. */
private SparseIntArray mUidRules = new SparseIntArray();
@@ -377,18 +383,26 @@
final String action = intent.getAction();
final int uid = intent.getIntExtra(EXTRA_UID, 0);
+ final int appId = UserId.getAppId(uid);
synchronized (mRulesLock) {
if (ACTION_PACKAGE_ADDED.equals(action)) {
+ // NOTE: PACKAGE_ADDED is currently only sent once, and is
+ // not broadcast when users are added.
+
// update rules for UID, since it might be subject to
// global background data policy.
if (LOGV) Slog.v(TAG, "ACTION_PACKAGE_ADDED for uid=" + uid);
- updateRulesForUidLocked(uid);
+ updateRulesForAppLocked(appId);
} else if (ACTION_UID_REMOVED.equals(action)) {
+ // NOTE: UID_REMOVED is currently only sent once, and is not
+ // broadcast when users are removed.
+
// remove any policy and update rules to clean up.
if (LOGV) Slog.v(TAG, "ACTION_UID_REMOVED for uid=" + uid);
- mUidPolicy.delete(uid);
- updateRulesForUidLocked(uid);
+
+ mAppPolicy.delete(appId);
+ updateRulesForAppLocked(appId);
writePolicyLocked();
}
}
@@ -522,6 +536,11 @@
case MATCH_MOBILE_3G_LOWER:
case MATCH_MOBILE_4G:
case MATCH_MOBILE_ALL:
+ // mobile templates aren't relevant in airplane mode
+ if (isAirplaneModeOn(mContext)) {
+ return false;
+ }
+
// mobile templates are relevant when subscriberid is active
return Objects.equal(getActiveSubscriberId(), template.getSubscriberId());
}
@@ -932,7 +951,7 @@
final NetworkTemplate template = buildTemplateMobileAll(subscriberId);
mNetworkPolicy.put(template, new NetworkPolicy(template, cycleDay, cycleTimezone,
- warningBytes, LIMIT_DISABLED, SNOOZE_NEVER, SNOOZE_NEVER, true));
+ warningBytes, LIMIT_DISABLED, SNOOZE_NEVER, SNOOZE_NEVER, true, true));
writePolicyLocked();
}
}
@@ -942,7 +961,7 @@
// clear any existing policy and read from disk
mNetworkPolicy.clear();
- mUidPolicy.clear();
+ mAppPolicy.clear();
FileInputStream fis = null;
try {
@@ -1004,22 +1023,38 @@
} else {
lastWarningSnooze = SNOOZE_NEVER;
}
+ final boolean inferred;
+ if (version >= VERSION_ADDED_INFERRED) {
+ inferred = readBooleanAttribute(in, ATTR_INFERRED);
+ } else {
+ inferred = false;
+ }
final NetworkTemplate template = new NetworkTemplate(
networkTemplate, subscriberId);
mNetworkPolicy.put(template, new NetworkPolicy(template, cycleDay,
cycleTimezone, warningBytes, limitBytes, lastWarningSnooze,
- lastLimitSnooze, metered));
+ lastLimitSnooze, metered, inferred));
} else if (TAG_UID_POLICY.equals(tag)) {
final int uid = readIntAttribute(in, ATTR_UID);
final int policy = readIntAttribute(in, ATTR_POLICY);
- if (isUidValidForPolicy(mContext, uid)) {
- setUidPolicyUnchecked(uid, policy, false);
+ final int appId = UserId.getAppId(uid);
+ if (UserId.isApp(appId)) {
+ setAppPolicyUnchecked(appId, policy, false);
} else {
Slog.w(TAG, "unable to apply policy to UID " + uid + "; ignoring");
}
+ } else if (TAG_APP_POLICY.equals(tag)) {
+ final int appId = readIntAttribute(in, ATTR_APP_ID);
+ final int policy = readIntAttribute(in, ATTR_POLICY);
+
+ if (UserId.isApp(appId)) {
+ setAppPolicyUnchecked(appId, policy, false);
+ } else {
+ Slog.w(TAG, "unable to apply policy to appId " + appId + "; ignoring");
+ }
}
}
}
@@ -1064,7 +1099,7 @@
out.startDocument(null, true);
out.startTag(null, TAG_POLICY_LIST);
- writeIntAttribute(out, ATTR_VERSION, VERSION_ADDED_TIMEZONE);
+ writeIntAttribute(out, ATTR_VERSION, VERSION_SWITCH_APP_ID);
writeBooleanAttribute(out, ATTR_RESTRICT_BACKGROUND, mRestrictBackground);
// write all known network policies
@@ -1084,21 +1119,22 @@
writeLongAttribute(out, ATTR_LAST_WARNING_SNOOZE, policy.lastWarningSnooze);
writeLongAttribute(out, ATTR_LAST_LIMIT_SNOOZE, policy.lastLimitSnooze);
writeBooleanAttribute(out, ATTR_METERED, policy.metered);
+ writeBooleanAttribute(out, ATTR_INFERRED, policy.inferred);
out.endTag(null, TAG_NETWORK_POLICY);
}
// write all known uid policies
- for (int i = 0; i < mUidPolicy.size(); i++) {
- final int uid = mUidPolicy.keyAt(i);
- final int policy = mUidPolicy.valueAt(i);
+ for (int i = 0; i < mAppPolicy.size(); i++) {
+ final int appId = mAppPolicy.keyAt(i);
+ final int policy = mAppPolicy.valueAt(i);
// skip writing empty policies
if (policy == POLICY_NONE) continue;
- out.startTag(null, TAG_UID_POLICY);
- writeIntAttribute(out, ATTR_UID, uid);
+ out.startTag(null, TAG_APP_POLICY);
+ writeIntAttribute(out, ATTR_APP_ID, appId);
writeIntAttribute(out, ATTR_POLICY, policy);
- out.endTag(null, TAG_UID_POLICY);
+ out.endTag(null, TAG_APP_POLICY);
}
out.endTag(null, TAG_POLICY_LIST);
@@ -1113,24 +1149,24 @@
}
@Override
- public void setUidPolicy(int uid, int policy) {
+ public void setAppPolicy(int appId, int policy) {
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
- if (!isUidValidForPolicy(mContext, uid)) {
- throw new IllegalArgumentException("cannot apply policy to UID " + uid);
+ if (!UserId.isApp(appId)) {
+ throw new IllegalArgumentException("cannot apply policy to appId " + appId);
}
- setUidPolicyUnchecked(uid, policy, true);
+ setAppPolicyUnchecked(appId, policy, true);
}
- private void setUidPolicyUnchecked(int uid, int policy, boolean persist) {
+ private void setAppPolicyUnchecked(int appId, int policy, boolean persist) {
final int oldPolicy;
synchronized (mRulesLock) {
- oldPolicy = getUidPolicy(uid);
- mUidPolicy.put(uid, policy);
+ oldPolicy = getAppPolicy(appId);
+ mAppPolicy.put(appId, policy);
// uid policy changed, recompute rules and persist policy.
- updateRulesForUidLocked(uid);
+ updateRulesForAppLocked(appId);
if (persist) {
writePolicyLocked();
}
@@ -1138,11 +1174,11 @@
}
@Override
- public int getUidPolicy(int uid) {
+ public int getAppPolicy(int appId) {
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
synchronized (mRulesLock) {
- return mUidPolicy.get(uid, POLICY_NONE);
+ return mAppPolicy.get(appId, POLICY_NONE);
}
}
@@ -1333,27 +1369,29 @@
fout.print(" "); fout.println(policy.toString());
}
- fout.println("Policy status for known UIDs:");
+ fout.println("Policy for apps:");
+ int size = mAppPolicy.size();
+ for (int i = 0; i < size; i++) {
+ final int appId = mAppPolicy.keyAt(i);
+ final int policy = mAppPolicy.valueAt(i);
+ fout.print(" appId=");
+ fout.print(appId);
+ fout.print(" policy=");
+ dumpPolicy(fout, policy);
+ fout.println();
+ }
final SparseBooleanArray knownUids = new SparseBooleanArray();
- collectKeys(mUidPolicy, knownUids);
collectKeys(mUidForeground, knownUids);
collectKeys(mUidRules, knownUids);
- final int size = knownUids.size();
+ fout.println("Status for known UIDs:");
+ size = knownUids.size();
for (int i = 0; i < size; i++) {
final int uid = knownUids.keyAt(i);
fout.print(" UID=");
fout.print(uid);
- fout.print(" policy=");
- final int policyIndex = mUidPolicy.indexOfKey(uid);
- if (policyIndex < 0) {
- fout.print("UNKNOWN");
- } else {
- dumpPolicy(fout, mUidPolicy.valueAt(policyIndex));
- }
-
fout.print(" foreground=");
final int foregroundIndex = mUidPidForeground.indexOfKey(uid);
if (foregroundIndex < 0) {
@@ -1443,7 +1481,8 @@
final PackageManager pm = mContext.getPackageManager();
final List<ApplicationInfo> apps = pm.getInstalledApplications(0);
for (ApplicationInfo app : apps) {
- updateRulesForUidLocked(app.uid);
+ final int appId = UserId.getAppId(app.uid);
+ updateRulesForAppLocked(appId);
}
// and catch system UIDs
@@ -1462,13 +1501,21 @@
}
}
+ private void updateRulesForAppLocked(int appId) {
+ for (UserInfo user : mContext.getPackageManager().getUsers()) {
+ final int uid = UserId.getUid(user.id, appId);
+ updateRulesForUidLocked(uid);
+ }
+ }
+
private void updateRulesForUidLocked(int uid) {
- final int uidPolicy = getUidPolicy(uid);
+ final int appId = UserId.getAppId(uid);
+ final int appPolicy = getAppPolicy(appId);
final boolean uidForeground = isUidForeground(uid);
// derive active rules based on policy and active state
int uidRules = RULE_ALLOW_ALL;
- if (!uidForeground && (uidPolicy & POLICY_REJECT_METERED_BACKGROUND) != 0) {
+ if (!uidForeground && (appPolicy & POLICY_REJECT_METERED_BACKGROUND) != 0) {
// uid in background, and policy says to block metered data
uidRules = RULE_REJECT_METERED;
}
@@ -1714,6 +1761,11 @@
mHandler.getLooper().getQueue().addIdleHandler(handler);
}
+ public static boolean isAirplaneModeOn(Context context) {
+ return Settings.System.getInt(
+ context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0;
+ }
+
private static void collectKeys(SparseIntArray source, SparseBooleanArray target) {
final int size = source.size();
for (int i = 0; i < size; i++) {
diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java
index fd8d411..8796afc 100644
--- a/services/java/com/android/server/net/NetworkStatsService.java
+++ b/services/java/com/android/server/net/NetworkStatsService.java
@@ -26,6 +26,7 @@
import static android.content.Intent.EXTRA_UID;
import static android.net.ConnectivityManager.ACTION_TETHER_STATE_CHANGED;
import static android.net.ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE;
+import static android.net.NetworkIdentity.COMBINE_SUBTYPE_ENABLED;
import static android.net.NetworkStats.IFACE_ALL;
import static android.net.NetworkStats.SET_ALL;
import static android.net.NetworkStats.SET_DEFAULT;
@@ -304,7 +305,9 @@
// watch for networkType changes that aren't broadcast through
// CONNECTIVITY_ACTION_IMMEDIATE above.
- mTeleManager.listen(mPhoneListener, LISTEN_DATA_CONNECTION_STATE);
+ if (!COMBINE_SUBTYPE_ENABLED) {
+ mTeleManager.listen(mPhoneListener, LISTEN_DATA_CONNECTION_STATE);
+ }
registerPollAlarmLocked();
registerGlobalAlert();
@@ -325,7 +328,9 @@
mContext.unregisterReceiver(mRemovedReceiver);
mContext.unregisterReceiver(mShutdownReceiver);
- mTeleManager.listen(mPhoneListener, LISTEN_NONE);
+ if (!COMBINE_SUBTYPE_ENABLED) {
+ mTeleManager.listen(mPhoneListener, LISTEN_NONE);
+ }
final long currentTime = mTime.hasCache() ? mTime.currentTimeMillis()
: System.currentTimeMillis();
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 9f45eff..067bf28 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -20,6 +20,10 @@
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+import static android.content.pm.PackageManager.ENFORCEMENT_DEFAULT;
+import static android.content.pm.PackageManager.ENFORCEMENT_YES;
+import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
+import static android.Manifest.permission.GRANT_REVOKE_PERMISSIONS;
import static libcore.io.OsConstants.S_ISLNK;
import com.android.internal.app.IMediaContainerService;
@@ -391,7 +395,7 @@
static final int MCS_GIVE_UP = 11;
static final int UPDATED_MEDIA_STATUS = 12;
static final int WRITE_SETTINGS = 13;
- static final int WRITE_STOPPED_PACKAGES = 14;
+ static final int WRITE_PACKAGE_RESTRICTIONS = 14;
static final int PACKAGE_VERIFIED = 15;
static final int CHECK_PENDING_VERIFICATION = 16;
@@ -402,6 +406,9 @@
final UserManager mUserManager;
+ // Stores a list of users whose package restrictions file needs to be updated
+ private HashSet<Integer> mDirtyUsers = new HashSet<Integer>();
+
final private DefaultContainerConnection mDefContainerConn =
new DefaultContainerConnection();
class DefaultContainerConnection implements ServiceConnection {
@@ -625,7 +632,7 @@
packages[i] = ent.getKey();
components[i] = ent.getValue();
PackageSetting ps = mSettings.mPackages.get(ent.getKey());
- uids[i] = (ps != null) ? ps.userId : -1;
+ uids[i] = (ps != null) ? ps.uid : -1;
i++;
}
size = i;
@@ -731,16 +738,20 @@
Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);
synchronized (mPackages) {
removeMessages(WRITE_SETTINGS);
- removeMessages(WRITE_STOPPED_PACKAGES);
+ removeMessages(WRITE_PACKAGE_RESTRICTIONS);
mSettings.writeLPr();
+ mDirtyUsers.clear();
}
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
} break;
- case WRITE_STOPPED_PACKAGES: {
+ case WRITE_PACKAGE_RESTRICTIONS: {
Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);
synchronized (mPackages) {
- removeMessages(WRITE_STOPPED_PACKAGES);
- mSettings.writeStoppedLPr();
+ removeMessages(WRITE_PACKAGE_RESTRICTIONS);
+ for (int userId : mDirtyUsers) {
+ mSettings.writePackageRestrictionsLPr(userId);
+ }
+ mDirtyUsers.clear();
}
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
} break;
@@ -807,10 +818,11 @@
mHandler.sendEmptyMessageDelayed(WRITE_SETTINGS, WRITE_SETTINGS_DELAY);
}
}
-
- void scheduleWriteStoppedPackagesLocked() {
- if (!mHandler.hasMessages(WRITE_STOPPED_PACKAGES)) {
- mHandler.sendEmptyMessageDelayed(WRITE_STOPPED_PACKAGES, WRITE_SETTINGS_DELAY);
+
+ void scheduleWritePackageRestrictionsLocked(int userId) {
+ mDirtyUsers.add(userId);
+ if (!mHandler.hasMessages(WRITE_PACKAGE_RESTRICTIONS)) {
+ mHandler.sendEmptyMessageDelayed(WRITE_PACKAGE_RESTRICTIONS, WRITE_SETTINGS_DELAY);
}
}
@@ -912,7 +924,7 @@
readPermissions();
- mRestoredSettings = mSettings.readLPw();
+ mRestoredSettings = mSettings.readLPw(getUsers());
long startTime = SystemClock.uptimeMillis();
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_SYSTEM_SCAN_START,
@@ -1176,7 +1188,7 @@
private String getRequiredVerifierLPr() {
final Intent verification = new Intent(Intent.ACTION_PACKAGE_NEEDS_VERIFICATION);
final List<ResolveInfo> receivers = queryIntentReceivers(verification, PACKAGE_MIME_TYPE,
- PackageManager.GET_DISABLED_COMPONENTS);
+ PackageManager.GET_DISABLED_COMPONENTS, 0 /* TODO: Which userId? */);
String requiredVerifier = null;
@@ -1508,7 +1520,8 @@
ps.firstInstallTime, ps.lastUpdateTime, gp.grantedPermissions);
}
- public PackageInfo getPackageInfo(String packageName, int flags) {
+ @Override
+ public PackageInfo getPackageInfo(String packageName, int flags, int userId) {
// reader
synchronized (mPackages) {
PackageParser.Package p = mPackages.get(packageName);
@@ -1518,7 +1531,7 @@
return generatePackageInfo(p, flags);
}
if((flags & PackageManager.GET_UNINSTALLED_PACKAGES) != 0) {
- return generatePackageInfoFromSettingsLPw(packageName, flags);
+ return generatePackageInfoFromSettingsLPw(packageName, flags, userId);
}
}
return null;
@@ -1547,20 +1560,21 @@
}
return out;
}
-
- public int getPackageUid(String packageName) {
+
+ @Override
+ public int getPackageUid(String packageName, int userId) {
// reader
synchronized (mPackages) {
PackageParser.Package p = mPackages.get(packageName);
if(p != null) {
- return p.applicationInfo.uid;
+ return UserId.getUid(userId, p.applicationInfo.uid);
}
PackageSetting ps = mSettings.mPackages.get(packageName);
if((ps == null) || (ps.pkg == null) || (ps.pkg.applicationInfo == null)) {
return -1;
}
p = ps.pkg;
- return p != null ? p.applicationInfo.uid : -1;
+ return p != null ? UserId.getUid(userId, p.applicationInfo.uid) : -1;
}
}
@@ -1573,7 +1587,16 @@
if (p != null) {
final PackageSetting ps = (PackageSetting)p.mExtras;
final SharedUserSetting suid = ps.sharedUser;
- return suid != null ? suid.gids : ps.gids;
+ int[] gids = suid != null ? suid.gids : ps.gids;
+
+ // include GIDs for any unenforced permissions
+ if (!isPermissionEnforcedLocked(READ_EXTERNAL_STORAGE)) {
+ final BasePermission basePerm = mSettings.mPermissions.get(
+ READ_EXTERNAL_STORAGE);
+ gids = appendInts(gids, basePerm.gids);
+ }
+
+ return gids;
}
}
// stupid thing to indicate an error.
@@ -1648,11 +1671,12 @@
}
}
- private ApplicationInfo generateApplicationInfoFromSettingsLPw(String packageName, int flags) {
+ private ApplicationInfo generateApplicationInfoFromSettingsLPw(String packageName, int flags,
+ int userId) {
PackageSetting ps = mSettings.mPackages.get(packageName);
if (ps != null) {
if (ps.pkg == null) {
- PackageInfo pInfo = generatePackageInfoFromSettingsLPw(packageName, flags);
+ PackageInfo pInfo = generatePackageInfoFromSettingsLPw(packageName, flags, userId);
if (pInfo != null) {
return pInfo.applicationInfo;
}
@@ -1663,7 +1687,8 @@
return null;
}
- private PackageInfo generatePackageInfoFromSettingsLPw(String packageName, int flags) {
+ private PackageInfo generatePackageInfoFromSettingsLPw(String packageName, int flags,
+ int userId) {
PackageSetting ps = mSettings.mPackages.get(packageName);
if (ps != null) {
if (ps.pkg == null) {
@@ -1675,15 +1700,16 @@
ps.pkg.applicationInfo.dataDir =
getDataPathForPackage(ps.pkg.packageName, 0).getPath();
ps.pkg.applicationInfo.nativeLibraryDir = ps.nativeLibraryPathString;
- ps.pkg.mSetEnabled = ps.enabled;
- ps.pkg.mSetStopped = ps.stopped;
}
+ ps.pkg.mSetEnabled = ps.getEnabled(userId);
+ ps.pkg.mSetStopped = ps.getStopped(userId);
return generatePackageInfo(ps.pkg, flags);
}
return null;
}
- public ApplicationInfo getApplicationInfo(String packageName, int flags) {
+ @Override
+ public ApplicationInfo getApplicationInfo(String packageName, int flags, int userId) {
// writer
synchronized (mPackages) {
PackageParser.Package p = mPackages.get(packageName);
@@ -1698,7 +1724,7 @@
return mAndroidApplication;
}
if((flags & PackageManager.GET_UNINSTALLED_PACKAGES) != 0) {
- return generateApplicationInfoFromSettingsLPw(packageName, flags);
+ return generateApplicationInfoFromSettingsLPw(packageName, flags, userId);
}
}
return null;
@@ -1754,16 +1780,13 @@
});
}
- public ActivityInfo getActivityInfo(ComponentName component, int flags) {
- return getActivityInfo(component, flags, Binder.getOrigCallingUser());
- }
-
- ActivityInfo getActivityInfo(ComponentName component, int flags, int userId) {
+ @Override
+ public ActivityInfo getActivityInfo(ComponentName component, int flags, int userId) {
synchronized (mPackages) {
PackageParser.Activity a = mActivities.mActivities.get(component);
if (DEBUG_PACKAGE_INFO) Log.v(TAG, "getActivityInfo " + component + ": " + a);
- if (a != null && mSettings.isEnabledLPr(a.info, flags)) {
+ if (a != null && mSettings.isEnabledLPr(a.info, flags, userId)) {
return PackageParser.generateActivityInfo(a, flags, userId);
}
if (mResolveComponentName.equals(component)) {
@@ -1773,48 +1796,39 @@
return null;
}
- public ActivityInfo getReceiverInfo(ComponentName component, int flags) {
- return getReceiverInfo(component, flags, Binder.getOrigCallingUser());
- }
-
- ActivityInfo getReceiverInfo(ComponentName component, int flags, int userId) {
+ @Override
+ public ActivityInfo getReceiverInfo(ComponentName component, int flags, int userId) {
synchronized (mPackages) {
PackageParser.Activity a = mReceivers.mActivities.get(component);
if (DEBUG_PACKAGE_INFO) Log.v(
TAG, "getReceiverInfo " + component + ": " + a);
- if (a != null && mSettings.isEnabledLPr(a.info, flags)) {
+ if (a != null && mSettings.isEnabledLPr(a.info, flags, userId)) {
return PackageParser.generateActivityInfo(a, flags, userId);
}
}
return null;
}
- public ServiceInfo getServiceInfo(ComponentName component, int flags) {
- return getServiceInfo(component, flags, Binder.getOrigCallingUser());
- }
-
- ServiceInfo getServiceInfo(ComponentName component, int flags, int userId) {
+ @Override
+ public ServiceInfo getServiceInfo(ComponentName component, int flags, int userId) {
synchronized (mPackages) {
PackageParser.Service s = mServices.mServices.get(component);
if (DEBUG_PACKAGE_INFO) Log.v(
TAG, "getServiceInfo " + component + ": " + s);
- if (s != null && mSettings.isEnabledLPr(s.info, flags)) {
+ if (s != null && mSettings.isEnabledLPr(s.info, flags, userId)) {
return PackageParser.generateServiceInfo(s, flags, userId);
}
}
return null;
}
- public ProviderInfo getProviderInfo(ComponentName component, int flags) {
- return getProviderInfo(component, flags, UserId.getUserId(Binder.getCallingUid()));
- }
-
- ProviderInfo getProviderInfo(ComponentName component, int flags, int userId) {
+ @Override
+ public ProviderInfo getProviderInfo(ComponentName component, int flags, int userId) {
synchronized (mPackages) {
PackageParser.Provider p = mProvidersByComponent.get(component);
if (DEBUG_PACKAGE_INFO) Log.v(
TAG, "getProviderInfo " + component + ": " + p);
- if (p != null && mSettings.isEnabledLPr(p.info, flags)) {
+ if (p != null && mSettings.isEnabledLPr(p.info, flags, userId)) {
return PackageParser.generateProviderInfo(p, flags, userId);
}
}
@@ -1859,6 +1873,14 @@
}
}
+ private void checkValidCaller(int uid, int userId) {
+ if (UserId.getUserId(uid) == userId || uid == Process.SYSTEM_UID || uid == 0)
+ return;
+
+ throw new SecurityException("Caller uid=" + uid
+ + " is not privileged to communicate with user=" + userId);
+ }
+
public int checkPermission(String permName, String pkgName) {
synchronized (mPackages) {
PackageParser.Package p = mPackages.get(pkgName);
@@ -1872,6 +1894,9 @@
return PackageManager.PERMISSION_GRANTED;
}
}
+ if (!isPermissionEnforcedLocked(permName)) {
+ return PackageManager.PERMISSION_GRANTED;
+ }
}
return PackageManager.PERMISSION_DENIED;
}
@@ -1890,6 +1915,9 @@
return PackageManager.PERMISSION_GRANTED;
}
}
+ if (!isPermissionEnforcedLocked(permName)) {
+ return PackageManager.PERMISSION_GRANTED;
+ }
}
return PackageManager.PERMISSION_DENIED;
}
@@ -1987,7 +2015,7 @@
if (!async) {
mSettings.writeLPr();
} else {
- scheduleWriteSettingsLocked();
+ scheduleWriteSettingsLocked();
}
}
return added;
@@ -2222,14 +2250,15 @@
}
}
+ @Override
public ResolveInfo resolveIntent(Intent intent, String resolvedType,
- int flags) {
- List<ResolveInfo> query = queryIntentActivities(intent, resolvedType, flags);
- return chooseBestActivity(intent, resolvedType, flags, query);
+ int flags, int userId) {
+ List<ResolveInfo> query = queryIntentActivities(intent, resolvedType, flags, userId);
+ return chooseBestActivity(intent, resolvedType, flags, query, userId);
}
private ResolveInfo chooseBestActivity(Intent intent, String resolvedType,
- int flags, List<ResolveInfo> query) {
+ int flags, List<ResolveInfo> query, int userId) {
if (query != null) {
final int N = query.size();
if (N == 1) {
@@ -2253,7 +2282,7 @@
// If we have saved a preference for a preferred activity for
// this Intent, use that.
ResolveInfo ri = findPreferredActivity(intent, resolvedType,
- flags, query, r0.priority);
+ flags, query, r0.priority, userId);
if (ri != null) {
return ri;
}
@@ -2264,7 +2293,7 @@
}
ResolveInfo findPreferredActivity(Intent intent, String resolvedType,
- int flags, List<ResolveInfo> query, int priority) {
+ int flags, List<ResolveInfo> query, int priority, int userId) {
// writer
synchronized (mPackages) {
if (intent.getSelector() != null) {
@@ -2273,7 +2302,7 @@
if (DEBUG_PREFERRED) intent.addFlags(Intent.FLAG_DEBUG_LOG_RESOLUTION);
List<PreferredActivity> prefs =
mSettings.mPreferredActivities.queryIntent(intent, resolvedType,
- (flags&PackageManager.MATCH_DEFAULT_ONLY) != 0);
+ (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0, userId);
if (prefs != null && prefs.size() > 0) {
// First figure out how good the original match set is.
// We will only allow preferred activities that came
@@ -2307,7 +2336,7 @@
if (pa.mPref.mMatch != match) {
continue;
}
- final ActivityInfo ai = getActivityInfo(pa.mPref.mComponent, flags);
+ final ActivityInfo ai = getActivityInfo(pa.mPref.mComponent, flags, userId);
if (DEBUG_PREFERRED) {
Log.v(TAG, "Got preferred activity:");
if (ai != null) {
@@ -2357,8 +2386,9 @@
return null;
}
+ @Override
public List<ResolveInfo> queryIntentActivities(Intent intent,
- String resolvedType, int flags) {
+ String resolvedType, int flags, int userId) {
ComponentName comp = intent.getComponent();
if (comp == null) {
if (intent.getSelector() != null) {
@@ -2369,7 +2399,7 @@
if (comp != null) {
final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
- final ActivityInfo ai = getActivityInfo(comp, flags);
+ final ActivityInfo ai = getActivityInfo(comp, flags, userId);
if (ai != null) {
final ResolveInfo ri = new ResolveInfo();
ri.activityInfo = ai;
@@ -2382,24 +2412,25 @@
synchronized (mPackages) {
final String pkgName = intent.getPackage();
if (pkgName == null) {
- return mActivities.queryIntent(intent, resolvedType, flags);
+ return mActivities.queryIntent(intent, resolvedType, flags, userId);
}
final PackageParser.Package pkg = mPackages.get(pkgName);
if (pkg != null) {
return mActivities.queryIntentForPackage(intent, resolvedType, flags,
- pkg.activities);
+ pkg.activities, userId);
}
return new ArrayList<ResolveInfo>();
}
}
+ @Override
public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
Intent[] specifics, String[] specificTypes, Intent intent,
- String resolvedType, int flags) {
+ String resolvedType, int flags, int userId) {
final String resultsAction = intent.getAction();
List<ResolveInfo> results = queryIntentActivities(intent, resolvedType, flags
- | PackageManager.GET_RESOLVED_FILTER);
+ | PackageManager.GET_RESOLVED_FILTER, userId);
if (DEBUG_INTENT_MATCHING) {
Log.v(TAG, "Query " + intent + ": " + results);
@@ -2442,7 +2473,7 @@
ri = resolveIntent(
sintent,
specificTypes != null ? specificTypes[i] : null,
- flags);
+ flags, userId);
if (ri == null) {
continue;
}
@@ -2453,7 +2484,7 @@
comp = new ComponentName(ai.applicationInfo.packageName,
ai.name);
} else {
- ai = getActivityInfo(comp, flags);
+ ai = getActivityInfo(comp, flags, userId);
if (ai == null) {
continue;
}
@@ -2562,7 +2593,9 @@
return results;
}
- public List<ResolveInfo> queryIntentReceivers(Intent intent, String resolvedType, int flags) {
+ @Override
+ public List<ResolveInfo> queryIntentReceivers(Intent intent, String resolvedType, int flags,
+ int userId) {
ComponentName comp = intent.getComponent();
if (comp == null) {
if (intent.getSelector() != null) {
@@ -2572,7 +2605,7 @@
}
if (comp != null) {
List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
- ActivityInfo ai = getReceiverInfo(comp, flags);
+ ActivityInfo ai = getReceiverInfo(comp, flags, userId);
if (ai != null) {
ResolveInfo ri = new ResolveInfo();
ri.activityInfo = ai;
@@ -2585,18 +2618,20 @@
synchronized (mPackages) {
String pkgName = intent.getPackage();
if (pkgName == null) {
- return mReceivers.queryIntent(intent, resolvedType, flags);
+ return mReceivers.queryIntent(intent, resolvedType, flags, userId);
}
final PackageParser.Package pkg = mPackages.get(pkgName);
if (pkg != null) {
- return mReceivers.queryIntentForPackage(intent, resolvedType, flags, pkg.receivers);
+ return mReceivers.queryIntentForPackage(intent, resolvedType, flags, pkg.receivers,
+ userId);
}
return null;
}
}
- public ResolveInfo resolveService(Intent intent, String resolvedType, int flags) {
- List<ResolveInfo> query = queryIntentServices(intent, resolvedType, flags);
+ @Override
+ public ResolveInfo resolveService(Intent intent, String resolvedType, int flags, int userId) {
+ List<ResolveInfo> query = queryIntentServices(intent, resolvedType, flags, userId);
if (query != null) {
if (query.size() >= 1) {
// If there is more than one service with the same priority,
@@ -2607,7 +2642,9 @@
return null;
}
- public List<ResolveInfo> queryIntentServices(Intent intent, String resolvedType, int flags) {
+ @Override
+ public List<ResolveInfo> queryIntentServices(Intent intent, String resolvedType, int flags,
+ int userId) {
ComponentName comp = intent.getComponent();
if (comp == null) {
if (intent.getSelector() != null) {
@@ -2617,7 +2654,7 @@
}
if (comp != null) {
final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
- final ServiceInfo si = getServiceInfo(comp, flags);
+ final ServiceInfo si = getServiceInfo(comp, flags, userId);
if (si != null) {
final ResolveInfo ri = new ResolveInfo();
ri.serviceInfo = si;
@@ -2630,11 +2667,12 @@
synchronized (mPackages) {
String pkgName = intent.getPackage();
if (pkgName == null) {
- return mServices.queryIntent(intent, resolvedType, flags);
+ return mServices.queryIntent(intent, resolvedType, flags, userId);
}
final PackageParser.Package pkg = mPackages.get(pkgName);
if (pkg != null) {
- return mServices.queryIntentForPackage(intent, resolvedType, flags, pkg.services);
+ return mServices.queryIntentForPackage(intent, resolvedType, flags, pkg.services,
+ userId);
}
return null;
}
@@ -2659,6 +2697,7 @@
final ParceledListSlice<PackageInfo> list = new ParceledListSlice<PackageInfo>();
final boolean listUninstalled = (flags & PackageManager.GET_UNINSTALLED_PACKAGES) != 0;
final String[] keys;
+ int userId = UserId.getCallingUserId();
// writer
synchronized (mPackages) {
@@ -2679,7 +2718,7 @@
if (listUninstalled) {
final PackageSetting ps = mSettings.mPackages.get(packageName);
if (ps != null) {
- pi = generatePackageInfoFromSettingsLPw(ps.name, flags);
+ pi = generatePackageInfoFromSettingsLPw(ps.name, flags, userId);
}
} else {
final PackageParser.Package p = mPackages.get(packageName);
@@ -2701,8 +2740,9 @@
return list;
}
+ @Override
public ParceledListSlice<ApplicationInfo> getInstalledApplications(int flags,
- String lastRead) {
+ String lastRead, int userId) {
final ParceledListSlice<ApplicationInfo> list = new ParceledListSlice<ApplicationInfo>();
final boolean listUninstalled = (flags & PackageManager.GET_UNINSTALLED_PACKAGES) != 0;
final String[] keys;
@@ -2718,7 +2758,6 @@
Arrays.sort(keys);
int i = getContinuationPoint(keys, lastRead);
final int N = keys.length;
- final int userId = UserId.getUserId(Binder.getCallingUid());
while (i < N) {
final String packageName = keys[i++];
@@ -2727,7 +2766,7 @@
if (listUninstalled) {
final PackageSetting ps = mSettings.mPackages.get(packageName);
if (ps != null) {
- ai = generateApplicationInfoFromSettingsLPw(ps.name, flags);
+ ai = generateApplicationInfoFromSettingsLPw(ps.name, flags, userId);
}
} else {
final PackageParser.Package p = mPackages.get(packageName);
@@ -2769,16 +2808,16 @@
return finalList;
}
- public ProviderInfo resolveContentProvider(String name, int flags) {
+ @Override
+ public ProviderInfo resolveContentProvider(String name, int flags, int userId) {
// reader
synchronized (mPackages) {
final PackageParser.Provider provider = mProviders.get(name);
return provider != null
- && mSettings.isEnabledLPr(provider.info, flags)
+ && mSettings.isEnabledLPr(provider.info, flags, userId)
&& (!mSafeMode || (provider.info.applicationInfo.flags
&ApplicationInfo.FLAG_SYSTEM) != 0)
- ? PackageParser.generateProviderInfo(provider, flags,
- UserId.getUserId(Binder.getCallingUid()))
+ ? PackageParser.generateProviderInfo(provider, flags, userId)
: null;
}
}
@@ -2814,15 +2853,15 @@
// reader
synchronized (mPackages) {
final Iterator<PackageParser.Provider> i = mProvidersByComponent.values().iterator();
- final int userId = UserId.getUserId(Binder.getCallingUid());
+ final int userId = processName != null ?
+ UserId.getUserId(uid) : UserId.getCallingUserId();
while (i.hasNext()) {
final PackageParser.Provider p = i.next();
if (p.info.authority != null
&& (processName == null
|| (p.info.processName.equals(processName)
- && UserId.getAppId(p.info.applicationInfo.uid)
- == UserId.getAppId(uid)))
- && mSettings.isEnabledLPr(p.info, flags)
+ && UserId.isSameApp(p.info.applicationInfo.uid, uid)))
+ && mSettings.isEnabledLPr(p.info, flags, userId)
&& (!mSafeMode
|| (p.info.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0)) {
if (finalList == null) {
@@ -3472,7 +3511,7 @@
pkg.applicationInfo.flags |= ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
}
- pkg.applicationInfo.uid = pkgSetting.userId;
+ pkg.applicationInfo.uid = pkgSetting.uid;
pkg.mExtras = pkgSetting;
if (!verifySignaturesLP(pkgSetting, pkg)) {
@@ -4470,19 +4509,20 @@
private final class ActivityIntentResolver
extends IntentResolver<PackageParser.ActivityIntentInfo, ResolveInfo> {
public List<ResolveInfo> queryIntent(Intent intent, String resolvedType,
- boolean defaultOnly) {
+ boolean defaultOnly, int userId) {
mFlags = defaultOnly ? PackageManager.MATCH_DEFAULT_ONLY : 0;
- return super.queryIntent(intent, resolvedType, defaultOnly);
+ return super.queryIntent(intent, resolvedType, defaultOnly, userId);
}
- public List<ResolveInfo> queryIntent(Intent intent, String resolvedType, int flags) {
+ public List<ResolveInfo> queryIntent(Intent intent, String resolvedType, int flags,
+ int userId) {
mFlags = flags;
return super.queryIntent(intent, resolvedType,
- (flags&PackageManager.MATCH_DEFAULT_ONLY) != 0);
+ (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0, userId);
}
public List<ResolveInfo> queryIntentForPackage(Intent intent, String resolvedType,
- int flags, ArrayList<PackageParser.Activity> packageActivities) {
+ int flags, ArrayList<PackageParser.Activity> packageActivities, int userId) {
if (packageActivities == null) {
return null;
}
@@ -4499,7 +4539,7 @@
listCut.add(intentFilters);
}
}
- return super.queryIntentFromList(intent, resolvedType, defaultOnly, listCut);
+ return super.queryIntentFromList(intent, resolvedType, defaultOnly, listCut, userId);
}
public final void addActivity(PackageParser.Activity a, String type) {
@@ -4564,7 +4604,7 @@
}
@Override
- protected boolean isFilterStopped(PackageParser.ActivityIntentInfo filter) {
+ protected boolean isFilterStopped(PackageParser.ActivityIntentInfo filter, int userId) {
PackageParser.Package p = filter.activity.owner;
if (p != null) {
PackageSetting ps = (PackageSetting)p.mExtras;
@@ -4572,7 +4612,7 @@
// System apps are never considered stopped for purposes of
// filtering, because there may be no way for the user to
// actually re-launch them.
- return ps.stopped && (ps.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0;
+ return ps.getStopped(userId) && (ps.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0;
}
}
return false;
@@ -4585,8 +4625,8 @@
@Override
protected ResolveInfo newResult(PackageParser.ActivityIntentInfo info,
- int match) {
- if (!mSettings.isEnabledLPr(info.activity.info, mFlags)) {
+ int match, int userId) {
+ if (!mSettings.isEnabledLPr(info.activity.info, mFlags, userId)) {
return null;
}
final PackageParser.Activity activity = info.activity;
@@ -4595,8 +4635,7 @@
return null;
}
final ResolveInfo res = new ResolveInfo();
- res.activityInfo = PackageParser.generateActivityInfo(activity, mFlags,
- Binder.getOrigCallingUser());
+ res.activityInfo = PackageParser.generateActivityInfo(activity, mFlags, userId);
if ((mFlags&PackageManager.GET_RESOLVED_FILTER) != 0) {
res.filter = info;
}
@@ -4650,19 +4689,20 @@
private final class ServiceIntentResolver
extends IntentResolver<PackageParser.ServiceIntentInfo, ResolveInfo> {
public List<ResolveInfo> queryIntent(Intent intent, String resolvedType,
- boolean defaultOnly) {
+ boolean defaultOnly, int userId) {
mFlags = defaultOnly ? PackageManager.MATCH_DEFAULT_ONLY : 0;
- return super.queryIntent(intent, resolvedType, defaultOnly);
+ return super.queryIntent(intent, resolvedType, defaultOnly, userId);
}
- public List<ResolveInfo> queryIntent(Intent intent, String resolvedType, int flags) {
+ public List<ResolveInfo> queryIntent(Intent intent, String resolvedType, int flags,
+ int userId) {
mFlags = flags;
return super.queryIntent(intent, resolvedType,
- (flags&PackageManager.MATCH_DEFAULT_ONLY) != 0);
+ (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0, userId);
}
public List<ResolveInfo> queryIntentForPackage(Intent intent, String resolvedType,
- int flags, ArrayList<PackageParser.Service> packageServices) {
+ int flags, ArrayList<PackageParser.Service> packageServices, int userId) {
if (packageServices == null) {
return null;
}
@@ -4679,7 +4719,7 @@
listCut.add(intentFilters);
}
}
- return super.queryIntentFromList(intent, resolvedType, defaultOnly, listCut);
+ return super.queryIntentFromList(intent, resolvedType, defaultOnly, listCut, userId);
}
public final void addService(PackageParser.Service s) {
@@ -4739,7 +4779,7 @@
}
@Override
- protected boolean isFilterStopped(PackageParser.ServiceIntentInfo filter) {
+ protected boolean isFilterStopped(PackageParser.ServiceIntentInfo filter, int userId) {
PackageParser.Package p = filter.service.owner;
if (p != null) {
PackageSetting ps = (PackageSetting)p.mExtras;
@@ -4747,7 +4787,8 @@
// System apps are never considered stopped for purposes of
// filtering, because there may be no way for the user to
// actually re-launch them.
- return ps.stopped && (ps.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0;
+ return ps.getStopped(userId)
+ && (ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) == 0;
}
}
return false;
@@ -4760,9 +4801,9 @@
@Override
protected ResolveInfo newResult(PackageParser.ServiceIntentInfo filter,
- int match) {
+ int match, int userId) {
final PackageParser.ServiceIntentInfo info = (PackageParser.ServiceIntentInfo)filter;
- if (!mSettings.isEnabledLPr(info.service.info, mFlags)) {
+ if (!mSettings.isEnabledLPr(info.service.info, mFlags, userId)) {
return null;
}
final PackageParser.Service service = info.service;
@@ -4771,8 +4812,7 @@
return null;
}
final ResolveInfo res = new ResolveInfo();
- res.serviceInfo = PackageParser.generateServiceInfo(service, mFlags,
- Binder.getOrigCallingUser());
+ res.serviceInfo = PackageParser.generateServiceInfo(service, mFlags, userId);
if ((mFlags&PackageManager.GET_RESOLVED_FILTER) != 0) {
res.filter = filter;
}
@@ -5625,14 +5665,14 @@
* do, then we'll defer to them to verify the packages.
*/
final int requiredUid = mRequiredVerifierPackage == null ? -1
- : getPackageUid(mRequiredVerifierPackage);
+ : getPackageUid(mRequiredVerifierPackage, 0);
if (requiredUid != -1 && isVerificationEnabled()) {
final Intent verification = new Intent(Intent.ACTION_PACKAGE_NEEDS_VERIFICATION);
verification.setDataAndType(packageURI, PACKAGE_MIME_TYPE);
verification.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
final List<ResolveInfo> receivers = queryIntentReceivers(verification, null,
- PackageManager.GET_DISABLED_COMPONENTS);
+ PackageManager.GET_DISABLED_COMPONENTS, 0 /* TODO: Which userId? */);
if (DEBUG_VERIFY) {
Slog.d(TAG, "Found " + receivers.size() + " verifiers for intent "
@@ -7306,17 +7346,19 @@
return ret;
}
+ @Override
public void clearApplicationUserData(final String packageName,
- final IPackageDataObserver observer) {
+ final IPackageDataObserver observer, final int userId) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.CLEAR_APP_USER_DATA, null);
+ checkValidCaller(Binder.getCallingUid(), userId);
// Queue up an async operation since the package deletion may take a little while.
mHandler.post(new Runnable() {
public void run() {
mHandler.removeCallbacks(this);
final boolean succeeded;
synchronized (mInstallLock) {
- succeeded = clearApplicationUserDataLI(packageName);
+ succeeded = clearApplicationUserDataLI(packageName, userId);
}
if (succeeded) {
// invoke DeviceStorageMonitor's update method to clear any notifications
@@ -7337,7 +7379,7 @@
});
}
- private boolean clearApplicationUserDataLI(String packageName) {
+ private boolean clearApplicationUserDataLI(String packageName, int userId) {
if (packageName == null) {
Slog.w(TAG, "Attempt to delete null packageName.");
return false;
@@ -7369,7 +7411,7 @@
return false;
}
}
- int retCode = mInstaller.clearUserData(packageName, 0); // TODO - correct userId
+ int retCode = mInstaller.clearUserData(packageName, userId);
if (retCode < 0) {
Slog.w(TAG, "Couldn't remove cache files for package: "
+ packageName);
@@ -7383,12 +7425,13 @@
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.DELETE_CACHE_FILES, null);
// Queue up an async operation since the package deletion may take a little while.
+ final int userId = UserId.getCallingUserId();
mHandler.post(new Runnable() {
public void run() {
mHandler.removeCallbacks(this);
final boolean succeded;
synchronized (mInstallLock) {
- succeded = deleteApplicationCacheFilesLI(packageName);
+ succeded = deleteApplicationCacheFilesLI(packageName, userId);
}
if(observer != null) {
try {
@@ -7401,7 +7444,7 @@
});
}
- private boolean deleteApplicationCacheFilesLI(String packageName) {
+ private boolean deleteApplicationCacheFilesLI(String packageName, int userId) {
if (packageName == null) {
Slog.w(TAG, "Attempt to delete null packageName.");
return false;
@@ -7419,6 +7462,7 @@
Slog.w(TAG, "Package " + packageName + " has no applicationInfo.");
return false;
}
+ // TODO: Pass userId to deleteCacheFiles
int retCode = mInstaller.deleteCacheFiles(packageName);
if (retCode < 0) {
Slog.w(TAG, "Couldn't remove cache files for package: "
@@ -7685,19 +7729,21 @@
return num;
}
+ @Override
public void setApplicationEnabledSetting(String appPackageName,
- int newState, int flags) {
- setEnabledSetting(appPackageName, null, newState, flags);
+ int newState, int flags, int userId) {
+ setEnabledSetting(appPackageName, null, newState, flags, userId);
}
+ @Override
public void setComponentEnabledSetting(ComponentName componentName,
- int newState, int flags) {
+ int newState, int flags, int userId) {
setEnabledSetting(componentName.getPackageName(),
- componentName.getClassName(), newState, flags);
+ componentName.getClassName(), newState, flags, userId);
}
private void setEnabledSetting(
- final String packageName, String className, int newState, final int flags) {
+ final String packageName, String className, int newState, final int flags, int userId) {
if (!(newState == COMPONENT_ENABLED_STATE_DEFAULT
|| newState == COMPONENT_ENABLED_STATE_ENABLED
|| newState == COMPONENT_ENABLED_STATE_DISABLED
@@ -7709,6 +7755,7 @@
final int uid = Binder.getCallingUid();
final int permission = mContext.checkCallingPermission(
android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE);
+ checkValidCaller(uid, userId);
final boolean allowedByPermission = (permission == PackageManager.PERMISSION_GRANTED);
boolean sendNow = false;
boolean isApp = (className == null);
@@ -7728,19 +7775,20 @@
"Unknown component: " + packageName
+ "/" + className);
}
- if (!allowedByPermission && (!UserId.isSameApp(uid, pkgSetting.userId))) {
+ // Allow root and verify that userId is not being specified by a different user
+ if (!allowedByPermission && !UserId.isSameApp(uid, pkgSetting.uid)) {
throw new SecurityException(
"Permission Denial: attempt to change component state from pid="
+ Binder.getCallingPid()
- + ", uid=" + uid + ", package uid=" + pkgSetting.userId);
+ + ", uid=" + uid + ", package uid=" + pkgSetting.uid);
}
if (className == null) {
// We're dealing with an application/package level state change
- if (pkgSetting.enabled == newState) {
+ if (pkgSetting.getEnabled(userId) == newState) {
// Nothing to do
return;
}
- pkgSetting.enabled = newState;
+ pkgSetting.setEnabled(newState, userId);
pkgSetting.pkg.mSetEnabled = newState;
} else {
// We're dealing with a component level state change
@@ -7757,17 +7805,17 @@
}
switch (newState) {
case COMPONENT_ENABLED_STATE_ENABLED:
- if (!pkgSetting.enableComponentLPw(className)) {
+ if (!pkgSetting.enableComponentLPw(className, userId)) {
return;
}
break;
case COMPONENT_ENABLED_STATE_DISABLED:
- if (!pkgSetting.disableComponentLPw(className)) {
+ if (!pkgSetting.disableComponentLPw(className, userId)) {
return;
}
break;
case COMPONENT_ENABLED_STATE_DEFAULT:
- if (!pkgSetting.restoreComponentLPw(className)) {
+ if (!pkgSetting.restoreComponentLPw(className, userId)) {
return;
}
break;
@@ -7776,8 +7824,8 @@
return;
}
}
- mSettings.writeLPr();
- packageUid = pkgSetting.userId;
+ mSettings.writePackageRestrictionsLPr(userId);
+ packageUid = pkgSetting.uid;
components = mPendingBroadcasts.get(packageName);
final boolean newPackage = components == null;
if (newPackage) {
@@ -7828,16 +7876,17 @@
sendPackageBroadcast(Intent.ACTION_PACKAGE_CHANGED, packageName, extras, null, null);
}
- public void setPackageStoppedState(String packageName, boolean stopped) {
+ public void setPackageStoppedState(String packageName, boolean stopped, int userId) {
final int uid = Binder.getCallingUid();
final int permission = mContext.checkCallingOrSelfPermission(
android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE);
final boolean allowedByPermission = (permission == PackageManager.PERMISSION_GRANTED);
+ checkValidCaller(uid, userId);
// writer
synchronized (mPackages) {
if (mSettings.setPackageStoppedStateLPw(packageName, stopped, allowedByPermission,
- uid)) {
- scheduleWriteStoppedPackagesLocked();
+ uid, userId)) {
+ scheduleWritePackageRestrictionsLocked(userId);
}
}
}
@@ -7849,17 +7898,23 @@
}
}
- public int getApplicationEnabledSetting(String packageName) {
+ @Override
+ public int getApplicationEnabledSetting(String packageName, int userId) {
+ int uid = Binder.getCallingUid();
+ checkValidCaller(uid, userId);
// reader
synchronized (mPackages) {
- return mSettings.getApplicationEnabledSettingLPr(packageName);
+ return mSettings.getApplicationEnabledSettingLPr(packageName, userId);
}
}
- public int getComponentEnabledSetting(ComponentName componentName) {
+ @Override
+ public int getComponentEnabledSetting(ComponentName componentName, int userId) {
+ int uid = Binder.getCallingUid();
+ checkValidCaller(uid, userId);
// reader
synchronized (mPackages) {
- return mSettings.getComponentEnabledSettingLPr(componentName);
+ return mSettings.getComponentEnabledSettingLPr(componentName, userId);
}
}
@@ -8063,7 +8118,7 @@
pw.print(" Required: ");
pw.print(mRequiredVerifierPackage);
pw.print(" (uid=");
- pw.print(getPackageUid(mRequiredVerifierPackage));
+ pw.print(getPackageUid(mRequiredVerifierPackage, 0));
pw.println(")");
}
@@ -8328,7 +8383,7 @@
+ " at code path: " + ps.codePathString);
// We do have a valid package installed on sdcard
processCids.put(args, ps.codePathString);
- int uid = ps.userId;
+ int uid = ps.uid;
if (uid != -1) {
uidList[num++] = uid;
}
@@ -8835,4 +8890,57 @@
public List<UserInfo> getUsers() {
return mUserManager.getUsers();
}
+
+ @Override
+ public void setPermissionEnforcement(String permission, int enforcement) {
+ mContext.enforceCallingOrSelfPermission(GRANT_REVOKE_PERMISSIONS, null);
+ if (READ_EXTERNAL_STORAGE.equals(permission)) {
+ synchronized (mPackages) {
+ if (mSettings.mReadExternalStorageEnforcement != enforcement) {
+ mSettings.mReadExternalStorageEnforcement = enforcement;
+ mSettings.writeLPr();
+
+ // kill any non-foreground processes so we restart them and
+ // grant/revoke the GID.
+ final IActivityManager am = ActivityManagerNative.getDefault();
+ if (am != null) {
+ final long token = Binder.clearCallingIdentity();
+ try {
+ am.killProcessesBelowForeground("setPermissionEnforcement");
+ } catch (RemoteException e) {
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+ }
+ }
+ } else {
+ throw new IllegalArgumentException("No selective enforcement for " + permission);
+ }
+ }
+
+ @Override
+ public int getPermissionEnforcement(String permission) {
+ mContext.enforceCallingOrSelfPermission(GRANT_REVOKE_PERMISSIONS, null);
+ if (READ_EXTERNAL_STORAGE.equals(permission)) {
+ synchronized (mPackages) {
+ return mSettings.mReadExternalStorageEnforcement;
+ }
+ } else {
+ throw new IllegalArgumentException("No selective enforcement for " + permission);
+ }
+ }
+
+ private boolean isPermissionEnforcedLocked(String permission) {
+ if (READ_EXTERNAL_STORAGE.equals(permission)) {
+ switch (mSettings.mReadExternalStorageEnforcement) {
+ case ENFORCEMENT_DEFAULT:
+ return false;
+ case ENFORCEMENT_YES:
+ return true;
+ }
+ }
+
+ return true;
+ }
}
diff --git a/services/java/com/android/server/pm/PackageSetting.java b/services/java/com/android/server/pm/PackageSetting.java
index efdc2b3..48ed9bf 100644
--- a/services/java/com/android/server/pm/PackageSetting.java
+++ b/services/java/com/android/server/pm/PackageSetting.java
@@ -24,7 +24,7 @@
* Settings data for a particular package we know about.
*/
final class PackageSetting extends PackageSettingBase {
- int userId;
+ int uid;
PackageParser.Package pkg;
SharedUserSetting sharedUser;
@@ -41,7 +41,7 @@
PackageSetting(PackageSetting orig) {
super(orig);
- userId = orig.userId;
+ uid = orig.uid;
pkg = orig.pkg;
sharedUser = orig.sharedUser;
}
@@ -50,6 +50,6 @@
public String toString() {
return "PackageSetting{"
+ Integer.toHexString(System.identityHashCode(this))
- + " " + name + "/" + userId + "}";
+ + " " + name + "/" + uid + "}";
}
}
\ No newline at end of file
diff --git a/services/java/com/android/server/pm/PackageSettingBase.java b/services/java/com/android/server/pm/PackageSettingBase.java
index e2f83ad..b7cf8d6 100644
--- a/services/java/com/android/server/pm/PackageSettingBase.java
+++ b/services/java/com/android/server/pm/PackageSettingBase.java
@@ -20,6 +20,8 @@
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+import android.util.SparseArray;
+import android.util.SparseIntArray;
import java.io.File;
import java.util.HashSet;
@@ -62,20 +64,22 @@
// Whether this package is currently stopped, thus can not be
// started until explicitly launched by the user.
- public boolean stopped;
+ private SparseArray<Boolean> stopped = new SparseArray<Boolean>();
// Set to true if we have never launched this app.
- public boolean notLaunched;
+ private SparseArray<Boolean> notLaunched = new SparseArray<Boolean>();
/* Explicitly disabled components */
- HashSet<String> disabledComponents = new HashSet<String>(0);
+ private SparseArray<HashSet<String>> disabledComponents = new SparseArray<HashSet<String>>();
/* Explicitly enabled components */
- HashSet<String> enabledComponents = new HashSet<String>(0);
- int enabled = COMPONENT_ENABLED_STATE_DEFAULT;
+ private SparseArray<HashSet<String>> enabledComponents = new SparseArray<HashSet<String>>();
+ /* Enabled state */
+ private SparseIntArray enabled = new SparseIntArray();
+
int installStatus = PKG_INSTALL_COMPLETE;
PackageSettingBase origPackage;
-
+
/* package name of the app that installed this package */
String installerPackageName;
PackageSettingBase(String name, String realName, File codePath, File resourcePath,
@@ -111,14 +115,12 @@
permissionsFixed = base.permissionsFixed;
haveGids = base.haveGids;
- stopped = base.stopped;
notLaunched = base.notLaunched;
- disabledComponents = (HashSet<String>) base.disabledComponents.clone();
-
- enabledComponents = (HashSet<String>) base.enabledComponents.clone();
-
- enabled = base.enabled;
+ disabledComponents = (SparseArray<HashSet<String>>) base.disabledComponents.clone();
+ enabledComponents = (SparseArray<HashSet<String>>) base.enabledComponents.clone();
+ enabled = (SparseIntArray) base.enabled.clone();
+ stopped = (SparseArray<Boolean>) base.stopped.clone();
installStatus = base.installStatus;
origPackage = base.origPackage;
@@ -177,31 +179,98 @@
installStatus = base.installStatus;
}
- boolean enableComponentLPw(String componentClassName) {
- boolean changed = disabledComponents.remove(componentClassName);
- changed |= enabledComponents.add(componentClassName);
+ void setEnabled(int state, int userId) {
+ enabled.put(userId, state);
+ }
+
+ int getEnabled(int userId) {
+ return enabled.get(userId, COMPONENT_ENABLED_STATE_DEFAULT);
+ }
+
+ boolean getStopped(int userId) {
+ return stopped.get(userId, false);
+ }
+
+ void setStopped(boolean stop, int userId) {
+ stopped.put(userId, stop);
+ }
+
+ boolean getNotLaunched(int userId) {
+ return notLaunched.get(userId, false);
+ }
+
+ void setNotLaunched(boolean stop, int userId) {
+ notLaunched.put(userId, stop);
+ }
+
+ HashSet<String> getEnabledComponents(int userId) {
+ return getComponentHashSet(enabledComponents, userId);
+ }
+
+ HashSet<String> getDisabledComponents(int userId) {
+ return getComponentHashSet(disabledComponents, userId);
+ }
+
+ void setEnabledComponents(HashSet<String> components, int userId) {
+ enabledComponents.put(userId, components);
+ }
+
+ void setDisabledComponents(HashSet<String> components, int userId) {
+ disabledComponents.put(userId, components);
+ }
+
+ private HashSet<String> getComponentHashSet(SparseArray<HashSet<String>> setArray, int userId) {
+ HashSet<String> set = setArray.get(userId);
+ if (set == null) {
+ set = new HashSet<String>(1);
+ setArray.put(userId, set);
+ }
+ return set;
+ }
+
+ void addDisabledComponent(String componentClassName, int userId) {
+ HashSet<String> disabled = getComponentHashSet(disabledComponents, userId);
+ disabled.add(componentClassName);
+ }
+
+ void addEnabledComponent(String componentClassName, int userId) {
+ HashSet<String> enabled = getComponentHashSet(enabledComponents, userId);
+ enabled.add(componentClassName);
+ }
+
+ boolean enableComponentLPw(String componentClassName, int userId) {
+ HashSet<String> disabled = getComponentHashSet(disabledComponents, userId);
+ HashSet<String> enabled = getComponentHashSet(enabledComponents, userId);
+ boolean changed = disabled.remove(componentClassName);
+ changed |= enabled.add(componentClassName);
return changed;
}
- boolean disableComponentLPw(String componentClassName) {
- boolean changed = enabledComponents.remove(componentClassName);
- changed |= disabledComponents.add(componentClassName);
+ boolean disableComponentLPw(String componentClassName, int userId) {
+ HashSet<String> disabled = getComponentHashSet(disabledComponents, userId);
+ HashSet<String> enabled = getComponentHashSet(enabledComponents, userId);
+ boolean changed = enabled.remove(componentClassName);
+ changed |= disabled.add(componentClassName);
return changed;
}
- boolean restoreComponentLPw(String componentClassName) {
- boolean changed = enabledComponents.remove(componentClassName);
- changed |= disabledComponents.remove(componentClassName);
+ boolean restoreComponentLPw(String componentClassName, int userId) {
+ HashSet<String> disabled = getComponentHashSet(disabledComponents, userId);
+ HashSet<String> enabled = getComponentHashSet(enabledComponents, userId);
+ boolean changed = enabled.remove(componentClassName);
+ changed |= disabled.remove(componentClassName);
return changed;
}
- int getCurrentEnabledStateLPr(String componentName) {
- if (enabledComponents.contains(componentName)) {
+ int getCurrentEnabledStateLPr(String componentName, int userId) {
+ HashSet<String> disabled = getComponentHashSet(disabledComponents, userId);
+ HashSet<String> enabled = getComponentHashSet(enabledComponents, userId);
+ if (enabled.contains(componentName)) {
return COMPONENT_ENABLED_STATE_ENABLED;
- } else if (disabledComponents.contains(componentName)) {
+ } else if (disabled.contains(componentName)) {
return COMPONENT_ENABLED_STATE_DISABLED;
} else {
return COMPONENT_ENABLED_STATE_DEFAULT;
}
}
-}
\ No newline at end of file
+}
diff --git a/services/java/com/android/server/pm/Settings.java b/services/java/com/android/server/pm/Settings.java
index 5da6ac9..b541c8c 100644
--- a/services/java/com/android/server/pm/Settings.java
+++ b/services/java/com/android/server/pm/Settings.java
@@ -20,6 +20,7 @@
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+import static android.content.pm.PackageManager.ENFORCEMENT_DEFAULT;
import com.android.internal.util.FastXmlSerializer;
import com.android.internal.util.JournaledFile;
@@ -31,6 +32,7 @@
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
+import android.app.AppGlobals;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
@@ -39,11 +41,14 @@
import android.content.pm.PackageParser;
import android.content.pm.PermissionInfo;
import android.content.pm.Signature;
+import android.content.pm.UserInfo;
import android.content.pm.VerifierDeviceIdentity;
import android.os.Binder;
import android.os.Environment;
import android.os.FileUtils;
import android.os.Process;
+import android.os.RemoteException;
+import android.os.UserId;
import android.util.Log;
import android.util.Slog;
import android.util.SparseArray;
@@ -62,6 +67,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import libcore.io.IoUtils;
@@ -74,6 +80,20 @@
private static final boolean DEBUG_STOPPED = false;
+ private static final String TAG_READ_EXTERNAL_STORAGE = "read-external-storage";
+ private static final String ATTR_ENFORCEMENT = "enforcement";
+
+ private static final String TAG_ITEM = "item";
+ private static final String TAG_DISABLED_COMPONENTS = "disabled-components";
+ private static final String TAG_ENABLED_COMPONENTS = "enabled-components";
+ private static final String TAG_PACKAGE_RESTRICTIONS = "package-restrictions";
+ private static final String TAG_PACKAGE = "pkg";
+
+ private static final String ATTR_NAME = "name";
+ private static final String ATTR_NOT_LAUNCHED = "nl";
+ private static final String ATTR_ENABLED = "enabled";
+ private static final String ATTR_STOPPED = "stopped";
+
private final File mSettingsFilename;
private final File mBackupSettingsFilename;
private final File mPackageListFilename;
@@ -91,6 +111,8 @@
int mInternalSdkPlatform;
int mExternalSdkPlatform;
+ int mReadExternalStorageEnforcement = ENFORCEMENT_DEFAULT;
+
/** Device identity for the purpose of package verification. */
private VerifierDeviceIdentity mVerifierDeviceIdentity;
@@ -147,19 +169,24 @@
*/
private final ArrayList<PendingPackage> mPendingPackages = new ArrayList<PendingPackage>();
+ private final File mSystemDir;
Settings() {
- File dataDir = Environment.getDataDirectory();
- File systemDir = new File(dataDir, "system");
- systemDir.mkdirs();
- FileUtils.setPermissions(systemDir.toString(),
+ this(Environment.getDataDirectory());
+ }
+
+ Settings(File dataDir) {
+ mSystemDir = new File(dataDir, "system");
+ mSystemDir.mkdirs();
+ FileUtils.setPermissions(mSystemDir.toString(),
FileUtils.S_IRWXU|FileUtils.S_IRWXG
|FileUtils.S_IROTH|FileUtils.S_IXOTH,
-1, -1);
- mSettingsFilename = new File(systemDir, "packages.xml");
- mBackupSettingsFilename = new File(systemDir, "packages-backup.xml");
- mPackageListFilename = new File(systemDir, "packages.list");
- mStoppedPackagesFilename = new File(systemDir, "packages-stopped.xml");
- mBackupStoppedPackagesFilename = new File(systemDir, "packages-stopped-backup.xml");
+ mSettingsFilename = new File(mSystemDir, "packages.xml");
+ mBackupSettingsFilename = new File(mSystemDir, "packages-backup.xml");
+ mPackageListFilename = new File(mSystemDir, "packages.list");
+ // Deprecated: Needed for migration
+ mStoppedPackagesFilename = new File(mSystemDir, "packages-stopped.xml");
+ mBackupStoppedPackagesFilename = new File(mSystemDir, "packages-stopped-backup.xml");
}
PackageSetting getPackageLPw(PackageParser.Package pkg, PackageSetting origPackage,
@@ -248,7 +275,7 @@
p.pkg.applicationInfo.flags &= ~ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
}
PackageSetting ret = addPackageLPw(name, p.realName, p.codePath, p.resourcePath,
- p.nativeLibraryPathString, p.userId, p.versionCode, p.pkgFlags);
+ p.nativeLibraryPathString, p.uid, p.versionCode, p.pkgFlags);
mDisabledSysPackages.remove(name);
return ret;
}
@@ -257,7 +284,7 @@
String nativeLibraryPathString, int uid, int vc, int pkgFlags) {
PackageSetting p = mPackages.get(name);
if (p != null) {
- if (p.userId == uid) {
+ if (p.uid == uid) {
return p;
}
PackageManagerService.reportSettingsProblem(Log.ERROR,
@@ -266,7 +293,7 @@
}
p = new PackageSetting(name, realName, codePath, resourcePath, nativeLibraryPathString,
vc, pkgFlags);
- p.userId = uid;
+ p.uid = uid;
if (addUserIdLPw(uid, p, name)) {
mPackages.put(name, p);
return p;
@@ -317,7 +344,7 @@
}
}
}
-
+
private PackageSetting getPackageLPw(String name, PackageSetting origPackage,
String realName, SharedUserSetting sharedUser, File codePath, File resourcePath,
String nativeLibraryPathString, int vc, int pkgFlags, boolean create, boolean add) {
@@ -329,13 +356,13 @@
// This is an updated system app with versions in both system
// and data partition. Just let the most recent version
// take precedence.
- Slog.w(PackageManagerService.TAG, "Trying to update system app code path from " +
- p.codePathString + " to " + codePath.toString());
+ Slog.w(PackageManagerService.TAG, "Trying to update system app code path from "
+ + p.codePathString + " to " + codePath.toString());
} else {
// Just a change in the code path is not an issue, but
// let's log a message about it.
- Slog.i(PackageManagerService.TAG, "Package " + name + " codePath changed from " + p.codePath
- + " to " + codePath + "; Retaining data and using new");
+ Slog.i(PackageManagerService.TAG, "Package " + name + " codePath changed from "
+ + p.codePath + " to " + codePath + "; Retaining data and using new");
/*
* Since we've changed paths, we need to prefer the new
* native library path over the one stored in the
@@ -372,15 +399,15 @@
// We are consuming the data from an existing package.
p = new PackageSetting(origPackage.name, name, codePath, resourcePath,
nativeLibraryPathString, vc, pkgFlags);
- if (PackageManagerService.DEBUG_UPGRADE) Log.v(PackageManagerService.TAG, "Package " + name
- + " is adopting original package " + origPackage.name);
+ if (PackageManagerService.DEBUG_UPGRADE) Log.v(PackageManagerService.TAG, "Package "
+ + name + " is adopting original package " + origPackage.name);
// Note that we will retain the new package's signature so
// that we can keep its data.
PackageSignatures s = p.signatures;
p.copyFrom(origPackage);
p.signatures = s;
p.sharedUser = origPackage.sharedUser;
- p.userId = origPackage.userId;
+ p.uid = origPackage.uid;
p.origPackage = origPackage;
mRenamedPackages.put(name, origPackage.name);
name = origPackage.name;
@@ -398,11 +425,17 @@
e.fillInStackTrace();
Slog.i(PackageManagerService.TAG, "Stopping package " + name, e);
}
- p.stopped = true;
- p.notLaunched = true;
+ List<UserInfo> users = getAllUsers();
+ if (users != null) {
+ for (UserInfo user : users) {
+ p.setStopped(true, user.id);
+ p.setNotLaunched(true, user.id);
+ writePackageRestrictionsLPr(user.id);
+ }
+ }
}
if (sharedUser != null) {
- p.userId = sharedUser.userId;
+ p.uid = sharedUser.userId;
} else {
// Clone the setting here for disabled system packages
PackageSetting dis = mDisabledSysPackages.get(name);
@@ -414,21 +447,31 @@
if (dis.signatures.mSignatures != null) {
p.signatures.mSignatures = dis.signatures.mSignatures.clone();
}
- p.userId = dis.userId;
+ p.uid = dis.uid;
// Clone permissions
p.grantedPermissions = new HashSet<String>(dis.grantedPermissions);
// Clone component info
- p.disabledComponents = new HashSet<String>(dis.disabledComponents);
- p.enabledComponents = new HashSet<String>(dis.enabledComponents);
+ List<UserInfo> users = getAllUsers();
+ if (users != null) {
+ for (UserInfo user : users) {
+ int userId = user.id;
+ p.setDisabledComponents(
+ new HashSet<String>(dis.getDisabledComponents(userId)),
+ userId);
+ p.setEnabledComponents(
+ new HashSet<String>(dis.getEnabledComponents(userId)),
+ userId);
+ }
+ }
// Add new setting to list of user ids
- addUserIdLPw(p.userId, p, name);
+ addUserIdLPw(p.uid, p, name);
} else {
// Assign new user id
- p.userId = newUserIdLPw(p);
+ p.uid = newUserIdLPw(p);
}
}
}
- if (p.userId < 0) {
+ if (p.uid < 0) {
PackageManagerService.reportSettingsProblem(Log.WARN,
"Package " + name + " could not be assigned a valid uid");
return null;
@@ -444,8 +487,8 @@
void insertPackageSettingLPw(PackageSetting p, PackageParser.Package pkg) {
p.pkg = pkg;
- pkg.mSetEnabled = p.enabled;
- pkg.mSetStopped = p.stopped;
+ // pkg.mSetEnabled = p.getEnabled(userId);
+ // pkg.mSetStopped = p.getStopped(userId);
final String codePath = pkg.applicationInfo.sourceDir;
final String resourcePath = pkg.applicationInfo.publicSourceDir;
// Update code path if needed
@@ -469,18 +512,18 @@
p.nativeLibraryPathString = nativeLibraryPath;
}
// Update version code if needed
- if (pkg.mVersionCode != p.versionCode) {
+ if (pkg.mVersionCode != p.versionCode) {
p.versionCode = pkg.mVersionCode;
}
- // Update signatures if needed.
- if (p.signatures.mSignatures == null) {
- p.signatures.assignSignatures(pkg.mSignatures);
- }
- // If this app defines a shared user id initialize
- // the shared user signatures as well.
- if (p.sharedUser != null && p.sharedUser.signatures.mSignatures == null) {
- p.sharedUser.signatures.assignSignatures(pkg.mSignatures);
- }
+ // Update signatures if needed.
+ if (p.signatures.mSignatures == null) {
+ p.signatures.assignSignatures(pkg.mSignatures);
+ }
+ // If this app defines a shared user id initialize
+ // the shared user signatures as well.
+ if (p.sharedUser != null && p.sharedUser.signatures.mSignatures == null) {
+ p.sharedUser.signatures.assignSignatures(pkg.mSignatures);
+ }
addPackageSettingLPw(p, pkg.packageName, p.sharedUser);
}
@@ -496,9 +539,9 @@
+ p.sharedUser + " but is now " + sharedUser
+ "; I am not changing its files so it will probably fail!");
p.sharedUser.packages.remove(p);
- } else if (p.userId != sharedUser.userId) {
+ } else if (p.uid != sharedUser.userId) {
PackageManagerService.reportSettingsProblem(Log.ERROR,
- "Package " + p.name + " was user id " + p.userId
+ "Package " + p.name + " was user id " + p.uid
+ " but is now user " + sharedUser
+ " with id " + sharedUser.userId
+ "; I am not changing its files so it will probably fail!");
@@ -506,7 +549,7 @@
sharedUser.packages.add(p);
p.sharedUser = sharedUser;
- p.userId = sharedUser.userId;
+ p.uid = sharedUser.userId;
}
}
@@ -571,8 +614,8 @@
return p.sharedUser.userId;
}
} else {
- removeUserIdLPw(p.userId);
- return p.userId;
+ removeUserIdLPw(p.uid);
+ return p.uid;
}
}
return -1;
@@ -585,7 +628,7 @@
p.sharedUser.packages.remove(p);
p.sharedUser.packages.add(newp);
} else {
- replaceUserIdLPw(p.userId, newp);
+ replaceUserIdLPw(p.uid, newp);
}
}
mPackages.put(name, newp);
@@ -652,50 +695,269 @@
}
}
- void writeStoppedLPr() {
+ private File getUserPackagesStateFile(int userId) {
+ return new File(mSystemDir,
+ "users/" + userId + "/package-restrictions.xml");
+ }
+
+ private File getUserPackagesStateBackupFile(int userId) {
+ return new File(mSystemDir,
+ "users/" + userId + "/package-restrictions-backup.xml");
+ }
+
+ void writeAllUsersPackageRestrictionsLPr() {
+ List<UserInfo> users = getAllUsers();
+ if (users == null) return;
+
+ for (UserInfo user : users) {
+ writePackageRestrictionsLPr(user.id);
+ }
+ }
+
+ void readAllUsersPackageRestrictionsLPr() {
+ List<UserInfo> users = getAllUsers();
+ if (users == null) {
+ readPackageRestrictionsLPr(0);
+ return;
+ }
+
+ for (UserInfo user : users) {
+ readPackageRestrictionsLPr(user.id);
+ }
+ }
+
+ void readPackageRestrictionsLPr(int userId) {
+ FileInputStream str = null;
+ File userPackagesStateFile = getUserPackagesStateFile(userId);
+ File backupFile = getUserPackagesStateBackupFile(userId);
+ if (backupFile.exists()) {
+ try {
+ str = new FileInputStream(backupFile);
+ mReadMessages.append("Reading from backup stopped packages file\n");
+ PackageManagerService.reportSettingsProblem(Log.INFO,
+ "Need to read from backup stopped packages file");
+ if (userPackagesStateFile.exists()) {
+ // If both the backup and normal file exist, we
+ // ignore the normal one since it might have been
+ // corrupted.
+ Slog.w(PackageManagerService.TAG, "Cleaning up stopped packages file "
+ + userPackagesStateFile);
+ userPackagesStateFile.delete();
+ }
+ } catch (java.io.IOException e) {
+ // We'll try for the normal settings file.
+ }
+ }
+
+ try {
+ if (str == null) {
+ if (!userPackagesStateFile.exists()) {
+ mReadMessages.append("No stopped packages file found\n");
+ PackageManagerService.reportSettingsProblem(Log.INFO,
+ "No stopped packages file; "
+ + "assuming all started");
+ // At first boot, make sure no packages are stopped.
+ // We usually want to have third party apps initialize
+ // in the stopped state, but not at first boot.
+ for (PackageSetting pkg : mPackages.values()) {
+ pkg.setStopped(false, userId);
+ pkg.setNotLaunched(false, userId);
+ }
+ return;
+ }
+ str = new FileInputStream(userPackagesStateFile);
+ }
+ final XmlPullParser parser = Xml.newPullParser();
+ parser.setInput(str, null);
+
+ int type;
+ while ((type=parser.next()) != XmlPullParser.START_TAG
+ && type != XmlPullParser.END_DOCUMENT) {
+ ;
+ }
+
+ if (type != XmlPullParser.START_TAG) {
+ mReadMessages.append("No start tag found in package restrictions file\n");
+ PackageManagerService.reportSettingsProblem(Log.WARN,
+ "No start tag found in package manager stopped packages");
+ return;
+ }
+
+ int outerDepth = parser.getDepth();
+ PackageSetting ps = null;
+ while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG
+ || parser.getDepth() > outerDepth)) {
+ if (type == XmlPullParser.END_TAG
+ || type == XmlPullParser.TEXT) {
+ continue;
+ }
+
+ String tagName = parser.getName();
+ if (tagName.equals(TAG_PACKAGE)) {
+ String name = parser.getAttributeValue(null, ATTR_NAME);
+ ps = mPackages.get(name);
+ if (ps == null) {
+ Slog.w(PackageManagerService.TAG, "No package known for stopped package: "
+ + name);
+ XmlUtils.skipCurrentTag(parser);
+ continue;
+ }
+ String enabledStr = parser.getAttributeValue(null, ATTR_ENABLED);
+ int enabled = enabledStr == null ? COMPONENT_ENABLED_STATE_DEFAULT
+ : Integer.parseInt(enabledStr);
+ ps.setEnabled(enabled, userId);
+ String stoppedStr = parser.getAttributeValue(null, ATTR_STOPPED);
+ boolean stopped = stoppedStr == null ? false : Boolean.parseBoolean(stoppedStr);
+ ps.setStopped(stopped, userId);
+ String notLaunchedStr = parser.getAttributeValue(null, ATTR_NOT_LAUNCHED);
+ boolean notLaunched = stoppedStr == null ? false
+ : Boolean.parseBoolean(notLaunchedStr);
+ ps.setNotLaunched(notLaunched, userId);
+
+ int packageDepth = parser.getDepth();
+ while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG
+ || parser.getDepth() > packageDepth)) {
+ if (type == XmlPullParser.END_TAG
+ || type == XmlPullParser.TEXT) {
+ continue;
+ }
+ tagName = parser.getName();
+ if (tagName.equals(TAG_ENABLED_COMPONENTS)) {
+ HashSet<String> components = readComponentsLPr(parser);
+ ps.setEnabledComponents(components, userId);
+ } else if (tagName.equals(TAG_DISABLED_COMPONENTS)) {
+ HashSet<String> components = readComponentsLPr(parser);
+ ps.setDisabledComponents(components, userId);
+ }
+ }
+ } else {
+ Slog.w(PackageManagerService.TAG, "Unknown element under <stopped-packages>: "
+ + parser.getName());
+ XmlUtils.skipCurrentTag(parser);
+ }
+ }
+
+ str.close();
+
+ } catch (XmlPullParserException e) {
+ mReadMessages.append("Error reading: " + e.toString());
+ PackageManagerService.reportSettingsProblem(Log.ERROR,
+ "Error reading stopped packages: " + e);
+ Log.wtf(PackageManagerService.TAG, "Error reading package manager stopped packages", e);
+
+ } catch (java.io.IOException e) {
+ mReadMessages.append("Error reading: " + e.toString());
+ PackageManagerService.reportSettingsProblem(Log.ERROR, "Error reading settings: " + e);
+ Log.wtf(PackageManagerService.TAG, "Error reading package manager stopped packages", e);
+ }
+ }
+
+ private HashSet<String> readComponentsLPr(XmlPullParser parser)
+ throws IOException, XmlPullParserException {
+ HashSet<String> components = new HashSet<String>();
+ int type;
+ int outerDepth = parser.getDepth();
+ String tagName;
+ while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
+ && (type != XmlPullParser.END_TAG
+ || parser.getDepth() > outerDepth)) {
+ if (type == XmlPullParser.END_TAG
+ || type == XmlPullParser.TEXT) {
+ continue;
+ }
+ tagName = parser.getName();
+ if (tagName.equals(TAG_ITEM)) {
+ String componentName = parser.getAttributeValue(null, ATTR_NAME);
+ if (componentName != null) {
+ components.add(componentName);
+ }
+ }
+ }
+ return components;
+ }
+
+ void writePackageRestrictionsLPr(int userId) {
// Keep the old stopped packages around until we know the new ones have
// been successfully written.
- if (mStoppedPackagesFilename.exists()) {
+ File userPackagesStateFile = getUserPackagesStateFile(userId);
+ File backupFile = getUserPackagesStateBackupFile(userId);
+ new File(userPackagesStateFile.getParent()).mkdirs();
+ if (userPackagesStateFile.exists()) {
// Presence of backup settings file indicates that we failed
// to persist packages earlier. So preserve the older
// backup for future reference since the current packages
// might have been corrupted.
- if (!mBackupStoppedPackagesFilename.exists()) {
- if (!mStoppedPackagesFilename.renameTo(mBackupStoppedPackagesFilename)) {
- Log.wtf(PackageManagerService.TAG, "Unable to backup package manager stopped packages, "
+ if (!backupFile.exists()) {
+ if (!userPackagesStateFile.renameTo(backupFile)) {
+ Log.wtf(PackageManagerService.TAG, "Unable to backup user packages state file, "
+ "current changes will be lost at reboot");
return;
}
} else {
- mStoppedPackagesFilename.delete();
+ userPackagesStateFile.delete();
Slog.w(PackageManagerService.TAG, "Preserving older stopped packages backup");
}
}
try {
- final FileOutputStream fstr = new FileOutputStream(mStoppedPackagesFilename);
+ final FileOutputStream fstr = new FileOutputStream(userPackagesStateFile);
final BufferedOutputStream str = new BufferedOutputStream(fstr);
- //XmlSerializer serializer = XmlUtils.serializerInstance();
final XmlSerializer serializer = new FastXmlSerializer();
serializer.setOutput(str, "utf-8");
serializer.startDocument(null, true);
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
- serializer.startTag(null, "stopped-packages");
+ serializer.startTag(null, TAG_PACKAGE_RESTRICTIONS);
for (final PackageSetting pkg : mPackages.values()) {
- if (pkg.stopped) {
- serializer.startTag(null, "pkg");
- serializer.attribute(null, "name", pkg.name);
- if (pkg.notLaunched) {
- serializer.attribute(null, "nl", "1");
+ if (pkg.getStopped(userId)
+ || pkg.getNotLaunched(userId)
+ || pkg.getEnabled(userId) != COMPONENT_ENABLED_STATE_DEFAULT
+ || pkg.getEnabledComponents(userId).size() > 0
+ || pkg.getDisabledComponents(userId).size() > 0) {
+ serializer.startTag(null, TAG_PACKAGE);
+ serializer.attribute(null, ATTR_NAME, pkg.name);
+ boolean stopped = pkg.getStopped(userId);
+ boolean notLaunched = pkg.getNotLaunched(userId);
+ int enabled = pkg.getEnabled(userId);
+ HashSet<String> enabledComponents = pkg.getEnabledComponents(userId);
+ HashSet<String> disabledComponents = pkg.getDisabledComponents(userId);
+
+ if (stopped) {
+ serializer.attribute(null, ATTR_STOPPED, "true");
}
- serializer.endTag(null, "pkg");
+ if (notLaunched) {
+ serializer.attribute(null, ATTR_NOT_LAUNCHED, "true");
+ }
+ if (enabled != COMPONENT_ENABLED_STATE_DEFAULT) {
+ serializer.attribute(null, ATTR_ENABLED, Integer.toString(enabled));
+ }
+ if (enabledComponents.size() > 0) {
+ serializer.startTag(null, TAG_ENABLED_COMPONENTS);
+ for (final String name : enabledComponents) {
+ serializer.startTag(null, TAG_ITEM);
+ serializer.attribute(null, ATTR_NAME, name);
+ serializer.endTag(null, TAG_ITEM);
+ }
+ serializer.endTag(null, TAG_ENABLED_COMPONENTS);
+ }
+ if (disabledComponents.size() > 0) {
+ serializer.startTag(null, TAG_DISABLED_COMPONENTS);
+ for (final String name : disabledComponents) {
+ serializer.startTag(null, TAG_ITEM);
+ serializer.attribute(null, ATTR_NAME, name);
+ serializer.endTag(null, TAG_ITEM);
+ }
+ serializer.endTag(null, TAG_DISABLED_COMPONENTS);
+ }
+ serializer.endTag(null, TAG_PACKAGE);
}
}
- serializer.endTag(null, "stopped-packages");
+ serializer.endTag(null, TAG_PACKAGE_RESTRICTIONS);
serializer.endDocument();
@@ -705,8 +967,8 @@
// New settings successfully written, old ones are no longer
// needed.
- mBackupStoppedPackagesFilename.delete();
- FileUtils.setPermissions(mStoppedPackagesFilename.toString(),
+ backupFile.delete();
+ FileUtils.setPermissions(userPackagesStateFile.toString(),
FileUtils.S_IRUSR|FileUtils.S_IWUSR
|FileUtils.S_IRGRP|FileUtils.S_IWGRP,
-1, -1);
@@ -714,26 +976,30 @@
// Done, all is good!
return;
} catch(java.io.IOException e) {
- Log.wtf(PackageManagerService.TAG, "Unable to write package manager stopped packages, "
+ Log.wtf(PackageManagerService.TAG,
+ "Unable to write package manager user packages state, "
+ " current changes will be lost at reboot", e);
}
// Clean up partially written files
- if (mStoppedPackagesFilename.exists()) {
- if (!mStoppedPackagesFilename.delete()) {
- Log.i(PackageManagerService.TAG, "Failed to clean up mangled file: " + mStoppedPackagesFilename);
+ if (userPackagesStateFile.exists()) {
+ if (!userPackagesStateFile.delete()) {
+ Log.i(PackageManagerService.TAG, "Failed to clean up mangled file: "
+ + mStoppedPackagesFilename);
}
}
}
// Note: assumed "stopped" field is already cleared in all packages.
+ // Legacy reader, used to read in the old file format after an upgrade. Not used after that.
void readStoppedLPw() {
FileInputStream str = null;
if (mBackupStoppedPackagesFilename.exists()) {
try {
str = new FileInputStream(mBackupStoppedPackagesFilename);
mReadMessages.append("Reading from backup stopped packages file\n");
- PackageManagerService.reportSettingsProblem(Log.INFO, "Need to read from backup stopped packages file");
+ PackageManagerService.reportSettingsProblem(Log.INFO,
+ "Need to read from backup stopped packages file");
if (mSettingsFilename.exists()) {
// If both the backup and normal file exist, we
// ignore the normal one since it might have been
@@ -751,14 +1017,14 @@
if (str == null) {
if (!mStoppedPackagesFilename.exists()) {
mReadMessages.append("No stopped packages file found\n");
- PackageManagerService.reportSettingsProblem(Log.INFO, "No stopped packages file file; "
- + "assuming all started");
+ PackageManagerService.reportSettingsProblem(Log.INFO,
+ "No stopped packages file file; assuming all started");
// At first boot, make sure no packages are stopped.
// We usually want to have third party apps initialize
// in the stopped state, but not at first boot.
for (PackageSetting pkg : mPackages.values()) {
- pkg.stopped = false;
- pkg.notLaunched = false;
+ pkg.setStopped(false, 0);
+ pkg.setNotLaunched(false, 0);
}
return;
}
@@ -790,16 +1056,17 @@
}
String tagName = parser.getName();
- if (tagName.equals("pkg")) {
- String name = parser.getAttributeValue(null, "name");
+ if (tagName.equals(TAG_PACKAGE)) {
+ String name = parser.getAttributeValue(null, ATTR_NAME);
PackageSetting ps = mPackages.get(name);
if (ps != null) {
- ps.stopped = true;
- if ("1".equals(parser.getAttributeValue(null, "nl"))) {
- ps.notLaunched = true;
+ ps.setStopped(true, 0);
+ if ("1".equals(parser.getAttributeValue(null, ATTR_NOT_LAUNCHED))) {
+ ps.setNotLaunched(true, 0);
}
} else {
- Slog.w(PackageManagerService.TAG, "No package known for stopped package: " + name);
+ Slog.w(PackageManagerService.TAG,
+ "No package known for stopped package: " + name);
}
XmlUtils.skipCurrentTag(parser);
} else {
@@ -811,12 +1078,13 @@
str.close();
- } catch(XmlPullParserException e) {
+ } catch (XmlPullParserException e) {
mReadMessages.append("Error reading: " + e.toString());
- PackageManagerService.reportSettingsProblem(Log.ERROR, "Error reading stopped packages: " + e);
+ PackageManagerService.reportSettingsProblem(Log.ERROR,
+ "Error reading stopped packages: " + e);
Log.wtf(PackageManagerService.TAG, "Error reading package manager stopped packages", e);
- } catch(java.io.IOException e) {
+ } catch (java.io.IOException e) {
mReadMessages.append("Error reading: " + e.toString());
PackageManagerService.reportSettingsProblem(Log.ERROR, "Error reading settings: " + e);
Log.wtf(PackageManagerService.TAG, "Error reading package manager stopped packages", e);
@@ -864,13 +1132,20 @@
serializer.attribute(null, "internal", Integer.toString(mInternalSdkPlatform));
serializer.attribute(null, "external", Integer.toString(mExternalSdkPlatform));
serializer.endTag(null, "last-platform-version");
-
+
if (mVerifierDeviceIdentity != null) {
serializer.startTag(null, "verifier");
serializer.attribute(null, "device", mVerifierDeviceIdentity.toString());
serializer.endTag(null, "verifier");
}
+ if (mReadExternalStorageEnforcement != ENFORCEMENT_DEFAULT) {
+ serializer.startTag(null, TAG_READ_EXTERNAL_STORAGE);
+ serializer.attribute(
+ null, ATTR_ENFORCEMENT, Integer.toString(mReadExternalStorageEnforcement));
+ serializer.endTag(null, TAG_READ_EXTERNAL_STORAGE);
+ }
+
serializer.startTag(null, "permission-trees");
for (BasePermission bp : mPermissionTrees.values()) {
writePermissionLPr(serializer, bp);
@@ -893,23 +1168,23 @@
serializer.startTag(null, "preferred-activities");
for (final PreferredActivity pa : mPreferredActivities.filterSet()) {
- serializer.startTag(null, "item");
+ serializer.startTag(null, TAG_ITEM);
pa.writeToXml(serializer);
- serializer.endTag(null, "item");
+ serializer.endTag(null, TAG_ITEM);
}
serializer.endTag(null, "preferred-activities");
for (final SharedUserSetting usr : mSharedUsers.values()) {
serializer.startTag(null, "shared-user");
- serializer.attribute(null, "name", usr.name);
+ serializer.attribute(null, ATTR_NAME, usr.name);
serializer.attribute(null, "userId",
Integer.toString(usr.userId));
usr.signatures.writeXml(serializer, "sigs", mPastSignatures);
serializer.startTag(null, "perms");
for (String name : usr.grantedPermissions) {
- serializer.startTag(null, "item");
- serializer.attribute(null, "name", name);
- serializer.endTag(null, "item");
+ serializer.startTag(null, TAG_ITEM);
+ serializer.attribute(null, ATTR_NAME, name);
+ serializer.endTag(null, TAG_ITEM);
}
serializer.endTag(null, "perms");
serializer.endTag(null, "shared-user");
@@ -918,7 +1193,7 @@
if (mPackagesToBeCleaned.size() > 0) {
for (int i=0; i<mPackagesToBeCleaned.size(); i++) {
serializer.startTag(null, "cleaning-package");
- serializer.attribute(null, "name", mPackagesToBeCleaned.get(i));
+ serializer.attribute(null, ATTR_NAME, mPackagesToBeCleaned.get(i));
serializer.endTag(null, "cleaning-package");
}
}
@@ -1003,8 +1278,7 @@
|FileUtils.S_IRGRP|FileUtils.S_IWGRP,
-1, -1);
- writeStoppedLPr();
-
+ writeAllUsersPackageRestrictionsLPr();
return;
} catch(XmlPullParserException e) {
@@ -1017,7 +1291,8 @@
// Clean up partially written files
if (mSettingsFilename.exists()) {
if (!mSettingsFilename.delete()) {
- Log.wtf(PackageManagerService.TAG, "Failed to clean up mangled file: " + mSettingsFilename);
+ Log.wtf(PackageManagerService.TAG, "Failed to clean up mangled file: "
+ + mSettingsFilename);
}
}
//Debug.stopMethodTracing();
@@ -1026,7 +1301,7 @@
void writeDisabledSysPackageLPr(XmlSerializer serializer, final PackageSetting pkg)
throws java.io.IOException {
serializer.startTag(null, "updated-package");
- serializer.attribute(null, "name", pkg.name);
+ serializer.attribute(null, ATTR_NAME, pkg.name);
if (pkg.realName != null) {
serializer.attribute(null, "realName", pkg.realName);
}
@@ -1042,9 +1317,9 @@
serializer.attribute(null, "nativeLibraryPath", pkg.nativeLibraryPathString);
}
if (pkg.sharedUser == null) {
- serializer.attribute(null, "userId", Integer.toString(pkg.userId));
+ serializer.attribute(null, "userId", Integer.toString(pkg.uid));
} else {
- serializer.attribute(null, "sharedUserId", Integer.toString(pkg.userId));
+ serializer.attribute(null, "sharedUserId", Integer.toString(pkg.uid));
}
serializer.startTag(null, "perms");
if (pkg.sharedUser == null) {
@@ -1059,9 +1334,9 @@
// this wont
// match the semantics of grantedPermissions. So write all
// permissions.
- serializer.startTag(null, "item");
- serializer.attribute(null, "name", name);
- serializer.endTag(null, "item");
+ serializer.startTag(null, TAG_ITEM);
+ serializer.attribute(null, ATTR_NAME, name);
+ serializer.endTag(null, TAG_ITEM);
}
}
}
@@ -1072,7 +1347,7 @@
void writePackageLPr(XmlSerializer serializer, final PackageSetting pkg)
throws java.io.IOException {
serializer.startTag(null, "package");
- serializer.attribute(null, "name", pkg.name);
+ serializer.attribute(null, ATTR_NAME, pkg.name);
if (pkg.realName != null) {
serializer.attribute(null, "realName", pkg.realName);
}
@@ -1089,16 +1364,13 @@
serializer.attribute(null, "ut", Long.toHexString(pkg.lastUpdateTime));
serializer.attribute(null, "version", String.valueOf(pkg.versionCode));
if (pkg.sharedUser == null) {
- serializer.attribute(null, "userId", Integer.toString(pkg.userId));
+ serializer.attribute(null, "userId", Integer.toString(pkg.uid));
} else {
- serializer.attribute(null, "sharedUserId", Integer.toString(pkg.userId));
+ serializer.attribute(null, "sharedUserId", Integer.toString(pkg.uid));
}
if (pkg.uidError) {
serializer.attribute(null, "uidError", "true");
}
- if (pkg.enabled != COMPONENT_ENABLED_STATE_DEFAULT) {
- serializer.attribute(null, "enabled", Integer.toString(pkg.enabled));
- }
if (pkg.installStatus == PackageSettingBase.PKG_INSTALL_INCOMPLETE) {
serializer.attribute(null, "installStatus", "false");
}
@@ -1114,31 +1386,13 @@
// empty permissions list so permissionsFixed will
// be set.
for (final String name : pkg.grantedPermissions) {
- serializer.startTag(null, "item");
- serializer.attribute(null, "name", name);
- serializer.endTag(null, "item");
+ serializer.startTag(null, TAG_ITEM);
+ serializer.attribute(null, ATTR_NAME, name);
+ serializer.endTag(null, TAG_ITEM);
}
}
serializer.endTag(null, "perms");
}
- if (pkg.disabledComponents.size() > 0) {
- serializer.startTag(null, "disabled-components");
- for (final String name : pkg.disabledComponents) {
- serializer.startTag(null, "item");
- serializer.attribute(null, "name", name);
- serializer.endTag(null, "item");
- }
- serializer.endTag(null, "disabled-components");
- }
- if (pkg.enabledComponents.size() > 0) {
- serializer.startTag(null, "enabled-components");
- for (final String name : pkg.enabledComponents) {
- serializer.startTag(null, "item");
- serializer.attribute(null, "name", name);
- serializer.endTag(null, "item");
- }
- serializer.endTag(null, "enabled-components");
- }
serializer.endTag(null, "package");
}
@@ -1146,8 +1400,8 @@
void writePermissionLPr(XmlSerializer serializer, BasePermission bp)
throws XmlPullParserException, java.io.IOException {
if (bp.type != BasePermission.TYPE_BUILTIN && bp.sourcePackage != null) {
- serializer.startTag(null, "item");
- serializer.attribute(null, "name", bp.name);
+ serializer.startTag(null, TAG_ITEM);
+ serializer.attribute(null, ATTR_NAME, bp.name);
serializer.attribute(null, "package", bp.sourcePackage);
if (bp.protectionLevel != PermissionInfo.PROTECTION_NORMAL) {
serializer.attribute(null, "protection", Integer.toString(bp.protectionLevel));
@@ -1167,7 +1421,7 @@
}
}
}
- serializer.endTag(null, "item");
+ serializer.endTag(null, TAG_ITEM);
}
}
@@ -1185,7 +1439,7 @@
return ret;
}
- boolean readLPw() {
+ boolean readLPw(List<UserInfo> users) {
FileInputStream str = null;
if (mBackupSettingsFilename.exists()) {
try {
@@ -1260,7 +1514,7 @@
} else if (tagName.equals("updated-package")) {
readDisabledSysPackageLPw(parser);
} else if (tagName.equals("cleaning-package")) {
- String name = parser.getAttributeValue(null, "name");
+ String name = parser.getAttributeValue(null, ATTR_NAME);
if (name != null) {
mPackagesToBeCleaned.add(name);
}
@@ -1291,6 +1545,12 @@
Slog.w(PackageManagerService.TAG, "Discard invalid verifier device id: "
+ e.getMessage());
}
+ } else if (TAG_READ_EXTERNAL_STORAGE.equals(tagName)) {
+ final String enforcement = parser.getAttributeValue(null, ATTR_ENFORCEMENT);
+ try {
+ mReadExternalStorageEnforcement = Integer.parseInt(enforcement);
+ } catch (NumberFormatException e) {
+ }
} else {
Slog.w(PackageManagerService.TAG, "Unknown element under <packages>: "
+ parser.getName());
@@ -1347,14 +1607,29 @@
final Iterator<PackageSetting> disabledIt = mDisabledSysPackages.values().iterator();
while (disabledIt.hasNext()) {
final PackageSetting disabledPs = disabledIt.next();
- final Object id = getUserIdLPr(disabledPs.userId);
+ final Object id = getUserIdLPr(disabledPs.uid);
if (id != null && id instanceof SharedUserSetting) {
disabledPs.sharedUser = (SharedUserSetting) id;
}
}
- readStoppedLPw();
-
+ if (mBackupStoppedPackagesFilename.exists()
+ || mStoppedPackagesFilename.exists()) {
+ // Read old file
+ readStoppedLPw();
+ mBackupStoppedPackagesFilename.delete();
+ mStoppedPackagesFilename.delete();
+ // Migrate to new file format
+ writePackageRestrictionsLPr(0);
+ } else {
+ if (users == null) {
+ readPackageRestrictionsLPr(0);
+ } else {
+ for (UserInfo user : users) {
+ readPackageRestrictionsLPr(user.id);
+ }
+ }
+ }
mReadMessages.append("Read completed successfully: " + mPackages.size() + " packages, "
+ mSharedUsers.size() + " shared uids\n");
@@ -1388,8 +1663,8 @@
}
final String tagName = parser.getName();
- if (tagName.equals("item")) {
- final String name = parser.getAttributeValue(null, "name");
+ if (tagName.equals(TAG_ITEM)) {
+ final String name = parser.getAttributeValue(null, ATTR_NAME);
final String sourcePackage = parser.getAttributeValue(null, "package");
final String ptype = parser.getAttributeValue(null, "type");
if (name != null && sourcePackage != null) {
@@ -1425,7 +1700,7 @@
private void readDisabledSysPackageLPw(XmlPullParser parser) throws XmlPullParserException,
IOException {
- String name = parser.getAttributeValue(null, "name");
+ String name = parser.getAttributeValue(null, ATTR_NAME);
String realName = parser.getAttributeValue(null, "realName");
String codePathStr = parser.getAttributeValue(null, "codePath");
String resourcePathStr = parser.getAttributeValue(null, "resourcePath");
@@ -1478,10 +1753,10 @@
}
}
String idStr = parser.getAttributeValue(null, "userId");
- ps.userId = idStr != null ? Integer.parseInt(idStr) : 0;
- if (ps.userId <= 0) {
+ ps.uid = idStr != null ? Integer.parseInt(idStr) : 0;
+ if (ps.uid <= 0) {
String sharedIdStr = parser.getAttributeValue(null, "sharedUserId");
- ps.userId = sharedIdStr != null ? Integer.parseInt(sharedIdStr) : 0;
+ ps.uid = sharedIdStr != null ? Integer.parseInt(sharedIdStr) : 0;
}
int outerDepth = parser.getDepth();
int type;
@@ -1522,7 +1797,7 @@
String version = null;
int versionCode = 0;
try {
- name = parser.getAttributeValue(null, "name");
+ name = parser.getAttributeValue(null, ATTR_NAME);
realName = parser.getAttributeValue(null, "realName");
idStr = parser.getAttributeValue(null, "userId");
uidError = parser.getAttributeValue(null, "uidError");
@@ -1653,17 +1928,18 @@
packageSetting.uidError = "true".equals(uidError);
packageSetting.installerPackageName = installerPackageName;
packageSetting.nativeLibraryPathString = nativeLibraryPathStr;
- final String enabledStr = parser.getAttributeValue(null, "enabled");
+ // Handle legacy string here for single-user mode
+ final String enabledStr = parser.getAttributeValue(null, ATTR_ENABLED);
if (enabledStr != null) {
try {
- packageSetting.enabled = Integer.parseInt(enabledStr);
+ packageSetting.setEnabled(Integer.parseInt(enabledStr), 0 /* userId */);
} catch (NumberFormatException e) {
if (enabledStr.equalsIgnoreCase("true")) {
- packageSetting.enabled = COMPONENT_ENABLED_STATE_ENABLED;
+ packageSetting.setEnabled(COMPONENT_ENABLED_STATE_ENABLED, 0);
} else if (enabledStr.equalsIgnoreCase("false")) {
- packageSetting.enabled = COMPONENT_ENABLED_STATE_DISABLED;
+ packageSetting.setEnabled(COMPONENT_ENABLED_STATE_DISABLED, 0);
} else if (enabledStr.equalsIgnoreCase("default")) {
- packageSetting.enabled = COMPONENT_ENABLED_STATE_DEFAULT;
+ packageSetting.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT, 0);
} else {
PackageManagerService.reportSettingsProblem(Log.WARN,
"Error in package manager settings: package " + name
@@ -1672,8 +1948,9 @@
}
}
} else {
- packageSetting.enabled = COMPONENT_ENABLED_STATE_DEFAULT;
+ packageSetting.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT, 0);
}
+
final String installStatusStr = parser.getAttributeValue(null, "installStatus");
if (installStatusStr != null) {
if (installStatusStr.equalsIgnoreCase("false")) {
@@ -1692,10 +1969,11 @@
}
String tagName = parser.getName();
- if (tagName.equals("disabled-components")) {
- readDisabledComponentsLPw(packageSetting, parser);
- } else if (tagName.equals("enabled-components")) {
- readEnabledComponentsLPw(packageSetting, parser);
+ // Legacy
+ if (tagName.equals(TAG_DISABLED_COMPONENTS)) {
+ readDisabledComponentsLPw(packageSetting, parser, 0);
+ } else if (tagName.equals(TAG_ENABLED_COMPONENTS)) {
+ readEnabledComponentsLPw(packageSetting, parser, 0);
} else if (tagName.equals("sigs")) {
packageSetting.signatures.readXml(parser, mPastSignatures);
} else if (tagName.equals("perms")) {
@@ -1712,8 +1990,8 @@
}
}
- private void readDisabledComponentsLPw(PackageSettingBase packageSetting, XmlPullParser parser)
- throws IOException, XmlPullParserException {
+ private void readDisabledComponentsLPw(PackageSettingBase packageSetting, XmlPullParser parser,
+ int userId) throws IOException, XmlPullParserException {
int outerDepth = parser.getDepth();
int type;
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
@@ -1723,10 +2001,10 @@
}
String tagName = parser.getName();
- if (tagName.equals("item")) {
- String name = parser.getAttributeValue(null, "name");
+ if (tagName.equals(TAG_ITEM)) {
+ String name = parser.getAttributeValue(null, ATTR_NAME);
if (name != null) {
- packageSetting.disabledComponents.add(name.intern());
+ packageSetting.addDisabledComponent(name.intern(), userId);
} else {
PackageManagerService.reportSettingsProblem(Log.WARN,
"Error in package manager settings: <disabled-components> has"
@@ -1740,8 +2018,8 @@
}
}
- private void readEnabledComponentsLPw(PackageSettingBase packageSetting, XmlPullParser parser)
- throws IOException, XmlPullParserException {
+ private void readEnabledComponentsLPw(PackageSettingBase packageSetting, XmlPullParser parser,
+ int userId) throws IOException, XmlPullParserException {
int outerDepth = parser.getDepth();
int type;
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
@@ -1751,10 +2029,10 @@
}
String tagName = parser.getName();
- if (tagName.equals("item")) {
- String name = parser.getAttributeValue(null, "name");
+ if (tagName.equals(TAG_ITEM)) {
+ String name = parser.getAttributeValue(null, ATTR_NAME);
if (name != null) {
- packageSetting.enabledComponents.add(name.intern());
+ packageSetting.addEnabledComponent(name.intern(), userId);
} else {
PackageManagerService.reportSettingsProblem(Log.WARN,
"Error in package manager settings: <enabled-components> has"
@@ -1768,13 +2046,13 @@
}
}
- private void readSharedUserLPw(XmlPullParser parser) throws XmlPullParserException, IOException {
+ private void readSharedUserLPw(XmlPullParser parser) throws XmlPullParserException,IOException {
String name = null;
String idStr = null;
int pkgFlags = 0;
SharedUserSetting su = null;
try {
- name = parser.getAttributeValue(null, "name");
+ name = parser.getAttributeValue(null, ATTR_NAME);
idStr = parser.getAttributeValue(null, "userId");
int userId = idStr != null ? Integer.parseInt(idStr) : 0;
if ("true".equals(parser.getAttributeValue(null, "system"))) {
@@ -1840,8 +2118,8 @@
}
String tagName = parser.getName();
- if (tagName.equals("item")) {
- String name = parser.getAttributeValue(null, "name");
+ if (tagName.equals(TAG_ITEM)) {
+ String name = parser.getAttributeValue(null, ATTR_NAME);
if (name != null) {
outPerms.add(name.intern());
} else {
@@ -1868,7 +2146,7 @@
}
String tagName = parser.getName();
- if (tagName.equals("item")) {
+ if (tagName.equals(TAG_ITEM)) {
PreferredActivity pa = new PreferredActivity(parser);
if (pa.mPref.getParseError() == null) {
mPreferredActivities.addFilter(pa);
@@ -1921,32 +2199,34 @@
return ps;
}
- boolean isEnabledLPr(ComponentInfo componentInfo, int flags) {
+ boolean isEnabledLPr(ComponentInfo componentInfo, int flags, int userId) {
if ((flags&PackageManager.GET_DISABLED_COMPONENTS) != 0) {
return true;
}
- final PackageSetting packageSettings = mPackages.get(componentInfo.packageName);
+ final String pkgName = componentInfo.packageName;
+ final PackageSetting packageSettings = mPackages.get(pkgName);
if (PackageManagerService.DEBUG_SETTINGS) {
- Log.v(PackageManagerService.TAG, "isEnabledLock - packageName = " + componentInfo.packageName
- + " componentName = " + componentInfo.name);
+ Log.v(PackageManagerService.TAG, "isEnabledLock - packageName = "
+ + componentInfo.packageName + " componentName = " + componentInfo.name);
Log.v(PackageManagerService.TAG, "enabledComponents: "
- + Arrays.toString(packageSettings.enabledComponents.toArray()));
+ + Arrays.toString(packageSettings.getEnabledComponents(userId).toArray()));
Log.v(PackageManagerService.TAG, "disabledComponents: "
- + Arrays.toString(packageSettings.disabledComponents.toArray()));
+ + Arrays.toString(packageSettings.getDisabledComponents(userId).toArray()));
}
if (packageSettings == null) {
return false;
}
- if (packageSettings.enabled == COMPONENT_ENABLED_STATE_DISABLED
- || packageSettings.enabled == COMPONENT_ENABLED_STATE_DISABLED_USER
+ final int enabled = packageSettings.getEnabled(userId);
+ if (enabled == COMPONENT_ENABLED_STATE_DISABLED
+ || enabled == COMPONENT_ENABLED_STATE_DISABLED_USER
|| (packageSettings.pkg != null && !packageSettings.pkg.applicationInfo.enabled
- && packageSettings.enabled == COMPONENT_ENABLED_STATE_DEFAULT)) {
+ && enabled == COMPONENT_ENABLED_STATE_DEFAULT)) {
return false;
}
- if (packageSettings.enabledComponents.contains(componentInfo.name)) {
+ if (packageSettings.getEnabledComponents(userId).contains(componentInfo.name)) {
return true;
}
- if (packageSettings.disabledComponents.contains(componentInfo.name)) {
+ if (packageSettings.getDisabledComponents(userId).contains(componentInfo.name)) {
return false;
}
return componentInfo.enabled;
@@ -1960,35 +2240,36 @@
return pkg.installerPackageName;
}
- int getApplicationEnabledSettingLPr(String packageName) {
+ int getApplicationEnabledSettingLPr(String packageName, int userId) {
final PackageSetting pkg = mPackages.get(packageName);
if (pkg == null) {
throw new IllegalArgumentException("Unknown package: " + packageName);
}
- return pkg.enabled;
+ return pkg.getEnabled(userId);
}
- int getComponentEnabledSettingLPr(ComponentName componentName) {
+ int getComponentEnabledSettingLPr(ComponentName componentName, int userId) {
final String packageName = componentName.getPackageName();
final PackageSetting pkg = mPackages.get(packageName);
if (pkg == null) {
throw new IllegalArgumentException("Unknown component: " + componentName);
}
final String classNameStr = componentName.getClassName();
- return pkg.getCurrentEnabledStateLPr(classNameStr);
+ return pkg.getCurrentEnabledStateLPr(classNameStr, userId);
}
-
+
boolean setPackageStoppedStateLPw(String packageName, boolean stopped,
- boolean allowedByPermission, int uid) {
+ boolean allowedByPermission, int uid, int userId) {
+ int appId = UserId.getAppId(uid);
final PackageSetting pkgSetting = mPackages.get(packageName);
if (pkgSetting == null) {
throw new IllegalArgumentException("Unknown package: " + packageName);
}
- if (!allowedByPermission && (uid != pkgSetting.userId)) {
+ if (!allowedByPermission && (appId != pkgSetting.uid)) {
throw new SecurityException(
"Permission Denial: attempt to change stopped state from pid="
+ Binder.getCallingPid()
- + ", uid=" + uid + ", package uid=" + pkgSetting.userId);
+ + ", uid=" + uid + ", package uid=" + pkgSetting.uid);
}
if (DEBUG_STOPPED) {
if (stopped) {
@@ -1997,22 +2278,33 @@
Slog.i(TAG, "Stopping package " + packageName, e);
}
}
- if (pkgSetting.stopped != stopped) {
- pkgSetting.stopped = stopped;
- pkgSetting.pkg.mSetStopped = stopped;
- if (pkgSetting.notLaunched) {
+ if (pkgSetting.getStopped(userId) != stopped) {
+ pkgSetting.setStopped(stopped, userId);
+ // pkgSetting.pkg.mSetStopped = stopped;
+ if (pkgSetting.getNotLaunched(userId)) {
if (pkgSetting.installerPackageName != null) {
PackageManagerService.sendPackageBroadcast(Intent.ACTION_PACKAGE_FIRST_LAUNCH,
pkgSetting.name, null,
pkgSetting.installerPackageName, null);
}
- pkgSetting.notLaunched = false;
+ pkgSetting.setNotLaunched(false, userId);
}
return true;
}
return false;
}
+ private List<UserInfo> getAllUsers() {
+ try {
+ return AppGlobals.getPackageManager().getUsers();
+ } catch (RemoteException re) {
+ // Local to system process, shouldn't happen
+ } catch (NullPointerException npe) {
+ // packagemanager not yet initialized
+ }
+ return null;
+ }
+
static final void printFlags(PrintWriter pw, int val, Object[] spec) {
pw.print("[ ");
for (int i=0; i<spec.length; i+=2) {
@@ -2077,7 +2369,7 @@
pw.println(ps.name);
}
- pw.print(" userId="); pw.print(ps.userId);
+ pw.print(" userId="); pw.print(ps.uid);
pw.print(" gids="); pw.println(PackageManagerService.arrayToString(ps.gids));
pw.print(" sharedUser="); pw.println(ps.sharedUser);
pw.print(" pkg="); pw.println(ps.pkg);
@@ -2150,18 +2442,24 @@
pw.print(" haveGids="); pw.println(ps.haveGids);
pw.print(" pkgFlags=0x"); pw.print(Integer.toHexString(ps.pkgFlags));
pw.print(" installStatus="); pw.print(ps.installStatus);
- pw.print(" stopped="); pw.print(ps.stopped);
- pw.print(" enabled="); pw.println(ps.enabled);
- if (ps.disabledComponents.size() > 0) {
- pw.println(" disabledComponents:");
- for (String s : ps.disabledComponents) {
- pw.print(" "); pw.println(s);
+ List<UserInfo> users = getAllUsers();
+ for (UserInfo user : users) {
+ pw.print(" User "); pw.print(user.id); pw.print(": ");
+ pw.print(" stopped=");
+ pw.print(ps.getStopped(user.id));
+ pw.print(" enabled=");
+ pw.println(ps.getEnabled(user.id));
+ if (ps.getDisabledComponents(user.id).size() > 0) {
+ pw.println(" disabledComponents:");
+ for (String s : ps.getDisabledComponents(user.id)) {
+ pw.print(" "); pw.println(s);
+ }
}
- }
- if (ps.enabledComponents.size() > 0) {
- pw.println(" enabledComponents:");
- for (String s : ps.enabledComponents) {
- pw.print(" "); pw.println(s);
+ if (ps.getEnabledComponents(user.id).size() > 0) {
+ pw.println(" enabledComponents:");
+ for (String s : ps.getEnabledComponents(user.id)) {
+ pw.print(" "); pw.println(s);
+ }
}
}
if (ps.grantedPermissions.size() > 0) {
@@ -2215,7 +2513,7 @@
pw.println(ps.name);
}
pw.print(" userId=");
- pw.println(ps.userId);
+ pw.println(ps.uid);
pw.print(" sharedUser=");
pw.println(ps.sharedUser);
pw.print(" codePath=");
@@ -2225,7 +2523,7 @@
}
}
}
-
+
void dumpPermissionsLPr(PrintWriter pw, String packageName, DumpState dumpState) {
boolean printedSomething = false;
for (BasePermission p : mPermissions.values()) {
diff --git a/services/java/com/android/server/pm/UserManager.java b/services/java/com/android/server/pm/UserManager.java
index 5eacf4a..959e570 100644
--- a/services/java/com/android/server/pm/UserManager.java
+++ b/services/java/com/android/server/pm/UserManager.java
@@ -73,6 +73,9 @@
UserManager(File dataDir, File baseUserPath) {
mUsersDir = new File(dataDir, USER_INFO_DIR);
mUsersDir.mkdirs();
+ // Make zeroth user directory, for services to migrate their files to that location
+ File userZeroDir = new File(mUsersDir, "0");
+ userZeroDir.mkdirs();
mBaseUserPath = baseUserPath;
FileUtils.setPermissions(mUsersDir.toString(),
FileUtils.S_IRWXU|FileUtils.S_IRWXG
diff --git a/services/java/com/android/server/usb/UsbDeviceManager.java b/services/java/com/android/server/usb/UsbDeviceManager.java
index ed83fbe..c2ded8a 100644
--- a/services/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/java/com/android/server/usb/UsbDeviceManager.java
@@ -43,6 +43,7 @@
import android.os.Process;
import android.os.storage.StorageManager;
import android.os.storage.StorageVolume;
+import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UEventObserver;
import android.provider.Settings;
@@ -206,6 +207,9 @@
}
private static String addFunction(String functions, String function) {
+ if ("none".equals(functions)) {
+ return function;
+ }
if (!containsFunction(functions, function)) {
if (functions.length() > 0) {
functions += ",";
@@ -222,6 +226,9 @@
split[i] = null;
}
}
+ if (split.length == 1 && split[0] == null) {
+ return "none";
+ }
StringBuilder builder = new StringBuilder();
for (int i = 0; i < split.length; i++) {
String s = split[i];
@@ -365,11 +372,7 @@
for (int i = 0; i < 20; i++) {
// State transition is done when sys.usb.state is set to the new configuration
if (state.equals(SystemProperties.get("sys.usb.state"))) return true;
- try {
- // try again in 50ms
- Thread.sleep(50);
- } catch (InterruptedException e) {
- }
+ SystemClock.sleep(50);
}
Slog.e(TAG, "waitForState(" + state + ") FAILED");
return false;
diff --git a/services/java/com/android/server/wm/AppWindowToken.java b/services/java/com/android/server/wm/AppWindowToken.java
index b84fbdb..1442883 100644
--- a/services/java/com/android/server/wm/AppWindowToken.java
+++ b/services/java/com/android/server/wm/AppWindowToken.java
@@ -21,12 +21,15 @@
import com.android.server.wm.WindowManagerService.H;
import android.content.pm.ActivityInfo;
+import android.graphics.Matrix;
import android.os.Message;
import android.os.RemoteException;
import android.util.Slog;
import android.view.IApplicationToken;
+import android.view.Surface;
import android.view.View;
import android.view.WindowManager;
+import android.view.WindowManagerPolicy;
import android.view.animation.Animation;
import android.view.animation.Transformation;
@@ -37,7 +40,7 @@
* Version of WindowToken that is specifically for a particular application (or
* really activity) that is displaying windows.
*/
-class AppWindowToken extends WindowToken implements WindowManagerService.StepAnimator {
+class AppWindowToken extends WindowToken {
// Non-null only for application tokens.
final IApplicationToken appToken;
@@ -55,7 +58,8 @@
// These are used for determining when all windows associated with
// an activity have been drawn, so they can be made visible together
// at the same time.
- int lastTransactionSequence;
+ // initialize so that it doesn't match mTransactionSequence which is an int.
+ long lastTransactionSequence = Long.MIN_VALUE;
int numInterestingWindows;
int numDrawnWindows;
boolean inPendingTransaction;
@@ -88,6 +92,7 @@
boolean animating;
Animation animation;
+ boolean animInitialized;
boolean hasTransformation;
final Transformation transformation = new Transformation();
@@ -103,6 +108,15 @@
boolean startingMoved;
boolean firstWindowDrawn;
+ // Special surface for thumbnail animation.
+ Surface thumbnail;
+ int thumbnailTransactionSeq;
+ int thumbnailX;
+ int thumbnailY;
+ int thumbnailLayer;
+ Animation thumbnailAnimation;
+ final Transformation thumbnailTransformation = new Transformation();
+
// Input application handle used by the input dispatcher.
final InputApplicationHandle mInputApplicationHandle;
@@ -112,14 +126,14 @@
appWindowToken = this;
appToken = _token;
mInputApplicationHandle = new InputApplicationHandle(this);
- lastTransactionSequence = service.mTransactionSequence-1;
}
- public void setAnimation(Animation anim) {
+ public void setAnimation(Animation anim, boolean initialized) {
if (WindowManagerService.localLOGV) Slog.v(
WindowManagerService.TAG, "Setting animation in " + this + ": " + anim);
animation = anim;
animating = false;
+ animInitialized = initialized;
anim.restrictDuration(WindowManagerService.MAX_ANIMATION_DURATION);
anim.scaleCurrentDuration(service.mTransitionAnimationScale);
int zorder = anim.getZAdjustment();
@@ -134,6 +148,10 @@
animLayerAdjustment = adj;
updateLayers();
}
+ // Start out animation gone if window is gone, or visible if window is visible.
+ transformation.clear();
+ transformation.setAlpha(reportedVisible ? 1 : 0);
+ hasTransformation = true;
}
public void setDummyAnimation() {
@@ -141,6 +159,7 @@
if (WindowManagerService.localLOGV) Slog.v(
WindowManagerService.TAG, "Setting dummy animation in " + this);
animation = WindowManagerService.sDummyAnimation;
+ animInitialized = false;
}
}
@@ -148,15 +167,28 @@
if (animation != null) {
animation = null;
animating = true;
+ animInitialized = false;
+ }
+ clearThumbnail();
+ }
+
+ public void clearThumbnail() {
+ if (thumbnail != null) {
+ thumbnail.destroy();
+ thumbnail = null;
}
}
void updateLayers() {
final int N = allAppWindows.size();
final int adj = animLayerAdjustment;
+ thumbnailLayer = -1;
for (int i=0; i<N; i++) {
WindowState w = allAppWindows.get(i);
w.mAnimLayer = w.mLayer + adj;
+ if (w.mAnimLayer > thumbnailLayer) {
+ thumbnailLayer = w.mAnimLayer;
+ }
if (WindowManagerService.DEBUG_LAYERS) Slog.v(WindowManagerService.TAG, "Updating layer " + w + ": "
+ w.mAnimLayer);
if (w == service.mInputMethodTarget && !service.mInputMethodTargetWaitingAnim) {
@@ -185,18 +217,53 @@
}
}
- void showAllWindowsLocked() {
+ boolean showAllWindowsLocked() {
+ boolean isAnimating = false;
final int NW = allAppWindows.size();
for (int i=0; i<NW; i++) {
WindowState w = allAppWindows.get(i);
if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG,
"performing show on: " + w);
w.performShowLocked();
+ isAnimating |= w.isAnimating();
}
+ return isAnimating;
}
- @Override
- public boolean stepAnimation(long currentTime) {
+ private void stepThumbnailAnimation(long currentTime) {
+ thumbnailTransformation.clear();
+ thumbnailAnimation.getTransformation(currentTime, thumbnailTransformation);
+ thumbnailTransformation.getMatrix().preTranslate(thumbnailX, thumbnailY);
+ final boolean screenAnimation = service.mAnimator.mScreenRotationAnimation != null
+ && service.mAnimator.mScreenRotationAnimation.isAnimating();
+ if (screenAnimation) {
+ thumbnailTransformation.postCompose(
+ service.mAnimator.mScreenRotationAnimation.getEnterTransformation());
+ }
+ // cache often used attributes locally
+ final float tmpFloats[] = service.mTmpFloats;
+ thumbnailTransformation.getMatrix().getValues(tmpFloats);
+ if (WindowManagerService.SHOW_TRANSACTIONS) service.logSurface(thumbnail,
+ "thumbnail", "POS " + tmpFloats[Matrix.MTRANS_X]
+ + ", " + tmpFloats[Matrix.MTRANS_Y], null);
+ thumbnail.setPosition(tmpFloats[Matrix.MTRANS_X], tmpFloats[Matrix.MTRANS_Y]);
+ if (WindowManagerService.SHOW_TRANSACTIONS) service.logSurface(thumbnail,
+ "thumbnail", "alpha=" + thumbnailTransformation.getAlpha()
+ + " layer=" + thumbnailLayer
+ + " matrix=[" + tmpFloats[Matrix.MSCALE_X]
+ + "," + tmpFloats[Matrix.MSKEW_Y]
+ + "][" + tmpFloats[Matrix.MSKEW_X]
+ + "," + tmpFloats[Matrix.MSCALE_Y] + "]", null);
+ thumbnail.setAlpha(thumbnailTransformation.getAlpha());
+ // The thumbnail is layered below the window immediately above this
+ // token's anim layer.
+ thumbnail.setLayer(thumbnailLayer + WindowManagerService.WINDOW_LAYER_MULTIPLIER
+ - WindowManagerService.LAYER_OFFSET_THUMBNAIL);
+ thumbnail.setMatrix(tmpFloats[Matrix.MSCALE_X], tmpFloats[Matrix.MSKEW_Y],
+ tmpFloats[Matrix.MSKEW_X], tmpFloats[Matrix.MSCALE_Y]);
+ }
+
+ private boolean stepAnimation(long currentTime) {
if (animation == null) {
return false;
}
@@ -207,6 +274,7 @@
": more=" + more + ", xform=" + transformation);
if (!more) {
animation = null;
+ clearThumbnail();
if (WindowManagerService.DEBUG_ANIM) Slog.v(
WindowManagerService.TAG, "Finished animation in " + this +
" @ " + currentTime);
@@ -216,8 +284,8 @@
}
// This must be called while inside a transaction.
- boolean startAndFinishAnimationLocked(long currentTime, int dw, int dh) {
- if (!service.mDisplayFrozen && service.mPolicy.isScreenOnFully()) {
+ boolean stepAnimationLocked(long currentTime, int dw, int dh) {
+ if (service.okToDisplay()) {
// We will run animations as long as the display isn't frozen.
if (animation == WindowManagerService.sDummyAnimation) {
@@ -235,12 +303,24 @@
" @ " + currentTime + ": dw=" + dw + " dh=" + dh
+ " scale=" + service.mTransitionAnimationScale
+ " allDrawn=" + allDrawn + " animating=" + animating);
- animation.initialize(dw, dh, dw, dh);
+ if (!animInitialized) {
+ animation.initialize(dw, dh, dw, dh);
+ }
animation.setStartTime(currentTime);
animating = true;
+ if (thumbnail != null) {
+ thumbnail.show();
+ thumbnailAnimation.setStartTime(currentTime);
+ }
}
- // we're done!
- return true;
+ if (stepAnimation(currentTime)) {
+ // animation isn't over, step any thumbnail and that's
+ // it for now.
+ if (thumbnail != null) {
+ stepThumbnailAnimation(currentTime);
+ }
+ return true;
+ }
}
} else if (animation != null) {
// If the display is frozen, and there is a pending animation,
@@ -255,6 +335,11 @@
return false;
}
+ service.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ service.debugLayoutRepeats("AppWindowToken");
+ }
+
clearAnimation();
animating = false;
if (animLayerAdjustment != 0) {
@@ -429,6 +514,15 @@
pw.print(" startingDisplayed="); pw.print(startingDisplayed);
pw.print(" startingMoved"); pw.println(startingMoved);
}
+ if (thumbnail != null) {
+ pw.print(prefix); pw.print("thumbnail="); pw.print(thumbnail);
+ pw.print(" x="); pw.print(thumbnailX);
+ pw.print(" y="); pw.print(thumbnailY);
+ pw.print(" layer="); pw.println(thumbnailLayer);
+ pw.print(prefix); pw.print("thumbnailAnimation="); pw.println(thumbnailAnimation);
+ pw.print(prefix); pw.print("thumbnailTransformation=");
+ pw.println(thumbnailTransformation.toShortString());
+ }
}
@Override
diff --git a/services/java/com/android/server/wm/BlackFrame.java b/services/java/com/android/server/wm/BlackFrame.java
index 26289c9..c915932 100644
--- a/services/java/com/android/server/wm/BlackFrame.java
+++ b/services/java/com/android/server/wm/BlackFrame.java
@@ -32,12 +32,14 @@
class BlackSurface {
final int left;
final int top;
+ final int layer;
final Surface surface;
BlackSurface(SurfaceSession session, int layer, int l, int t, int r, int b)
throws Surface.OutOfResourcesException {
left = l;
top = t;
+ this.layer = layer;
int w = r-l;
int h = b-t;
surface = new Surface(session, 0, "BlackSurface",
@@ -45,8 +47,6 @@
if (WindowManagerService.SHOW_TRANSACTIONS ||
WindowManagerService.SHOW_SURFACE_ALLOC) Slog.i(WindowManagerService.TAG,
" BLACK " + surface + ": CREATE layer=" + layer);
- surface.setAlpha(1.0f);
- surface.setLayer(layer);
}
void setMatrix(Matrix matrix) {
@@ -58,6 +58,8 @@
surface.setMatrix(
mTmpFloats[Matrix.MSCALE_X], mTmpFloats[Matrix.MSKEW_Y],
mTmpFloats[Matrix.MSKEW_X], mTmpFloats[Matrix.MSCALE_Y]);
+ surface.setAlpha(1.0f);
+ surface.setLayer(layer);
if (false) {
Slog.i(WindowManagerService.TAG, "Black Surface @ (" + left + "," + top + "): ("
+ mTmpFloats[Matrix.MTRANS_X] + ","
@@ -157,6 +159,14 @@
}
}
+ public void setAlpha(float alpha) {
+ for (int i=0; i<mBlackSurfaces.length; i++) {
+ if (mBlackSurfaces[i] != null) {
+ mBlackSurfaces[i].surface.setAlpha(alpha);
+ }
+ }
+ }
+
public void clearMatrix() {
for (int i=0; i<mBlackSurfaces.length; i++) {
if (mBlackSurfaces[i] != null) {
diff --git a/services/java/com/android/server/wm/DimAnimator.java b/services/java/com/android/server/wm/DimAnimator.java
index a9d4e01..85495ea 100644
--- a/services/java/com/android/server/wm/DimAnimator.java
+++ b/services/java/com/android/server/wm/DimAnimator.java
@@ -130,33 +130,31 @@
}
}
- boolean animating = false;
- if (mLastDimAnimTime != 0) {
+ boolean animating = mLastDimAnimTime != 0;
+ if (animating) {
mDimCurrentAlpha += mDimDeltaPerMs
* (currentTime-mLastDimAnimTime);
- boolean more = true;
if (displayFrozen) {
// If the display is frozen, there is no reason to animate.
- more = false;
+ animating = false;
} else if (mDimDeltaPerMs > 0) {
if (mDimCurrentAlpha > mDimTargetAlpha) {
- more = false;
+ animating = false;
}
} else if (mDimDeltaPerMs < 0) {
if (mDimCurrentAlpha < mDimTargetAlpha) {
- more = false;
+ animating = false;
}
} else {
- more = false;
+ animating = false;
}
// Do we need to continue animating?
- if (more) {
+ if (animating) {
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, " DIM "
+ mDimSurface + ": alpha=" + mDimCurrentAlpha);
mLastDimAnimTime = currentTime;
mDimSurface.setAlpha(mDimCurrentAlpha);
- animating = true;
} else {
mDimCurrentAlpha = mDimTargetAlpha;
mLastDimAnimTime = 0;
diff --git a/services/java/com/android/server/wm/ScreenRotationAnimation.java b/services/java/com/android/server/wm/ScreenRotationAnimation.java
index 7b5bf08..e460f7fd 100644
--- a/services/java/com/android/server/wm/ScreenRotationAnimation.java
+++ b/services/java/com/android/server/wm/ScreenRotationAnimation.java
@@ -29,19 +29,21 @@
import android.view.animation.AnimationUtils;
import android.view.animation.Transformation;
-class ScreenRotationAnimation implements WindowManagerService.StepAnimator {
+class ScreenRotationAnimation {
static final String TAG = "ScreenRotationAnimation";
static final boolean DEBUG_STATE = false;
static final boolean DEBUG_TRANSFORMS = false;
+ static final boolean USE_CUSTOM_BLACK_FRAME = false;
static final int FREEZE_LAYER = WindowManagerService.TYPE_LAYER_MULTIPLIER * 200;
final Context mContext;
Surface mSurface;
- BlackFrame mBlackFrame;
+ BlackFrame mCustomBlackFrame;
+ BlackFrame mExitingBlackFrame;
+ BlackFrame mEnteringBlackFrame;
int mWidth, mHeight;
- int mSnapshotRotation;
int mSnapshotDeltaRotation;
int mOriginalRotation;
int mOriginalWidth, mOriginalHeight;
@@ -105,6 +107,7 @@
final Matrix mFrameInitialMatrix = new Matrix();
final Matrix mSnapshotInitialMatrix = new Matrix();
final Matrix mSnapshotFinalMatrix = new Matrix();
+ final Matrix mExitFrameFinalMatrix = new Matrix();
final Matrix mTmpMatrix = new Matrix();
final float[] mTmpFloats = new float[9];
private boolean mMoreRotateEnter;
@@ -121,12 +124,21 @@
pw.print(prefix); pw.print("mSurface="); pw.print(mSurface);
pw.print(" mWidth="); pw.print(mWidth);
pw.print(" mHeight="); pw.println(mHeight);
- pw.print(prefix); pw.print("mBlackFrame="); pw.println(mBlackFrame);
- if (mBlackFrame != null) {
- mBlackFrame.printTo(prefix + " ", pw);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ pw.print(prefix); pw.print("mCustomBlackFrame="); pw.println(mCustomBlackFrame);
+ if (mCustomBlackFrame != null) {
+ mCustomBlackFrame.printTo(prefix + " ", pw);
+ }
}
- pw.print(prefix); pw.print("mSnapshotRotation="); pw.print(mSnapshotRotation);
- pw.print(" mSnapshotDeltaRotation="); pw.print(mSnapshotDeltaRotation);
+ pw.print(prefix); pw.print("mExitingBlackFrame="); pw.println(mExitingBlackFrame);
+ if (mExitingBlackFrame != null) {
+ mExitingBlackFrame.printTo(prefix + " ", pw);
+ }
+ pw.print(prefix); pw.print("mEnteringBlackFrame="); pw.println(mEnteringBlackFrame);
+ if (mEnteringBlackFrame != null) {
+ mEnteringBlackFrame.printTo(prefix + " ", pw);
+ }
+ pw.print(prefix); pw.print(" mSnapshotDeltaRotation="); pw.print(mSnapshotDeltaRotation);
pw.print(" mCurRotation="); pw.println(mCurRotation);
pw.print(prefix); pw.print("mOriginalRotation="); pw.print(mOriginalRotation);
pw.print(" mOriginalWidth="); pw.print(mOriginalWidth);
@@ -166,6 +178,9 @@
mSnapshotInitialMatrix.printShortString(pw);
pw.print(" mSnapshotFinalMatrix="); mSnapshotFinalMatrix.printShortString(pw);
pw.println();
+ pw.print(prefix); pw.print("mExitFrameFinalMatrix=");
+ mExitFrameFinalMatrix.printShortString(pw);
+ pw.println();
}
public ScreenRotationAnimation(Context context, SurfaceSession session,
@@ -173,7 +188,6 @@
mContext = context;
// Screenshot does NOT include rotation!
- mSnapshotRotation = 0;
if (originalRotation == Surface.ROTATION_90
|| originalRotation == Surface.ROTATION_270) {
mWidth = originalHeight;
@@ -197,12 +211,12 @@
try {
mSurface = new Surface(session, 0, "FreezeSurface",
-1, mWidth, mHeight, PixelFormat.OPAQUE, Surface.FX_SURFACE_SCREENSHOT | Surface.HIDDEN);
- if (mSurface == null || !mSurface.isValid()) {
+ if (!mSurface.isValid()) {
// Screenshot failed, punt.
mSurface = null;
return;
}
- mSurface.setLayer(FREEZE_LAYER);
+ mSurface.setLayer(FREEZE_LAYER + 1);
mSurface.show();
} catch (Surface.OutOfResourcesException e) {
Slog.w(TAG, "Unable to allocate freeze surface", e);
@@ -281,7 +295,7 @@
// Compute the transformation matrix that must be applied
// to the snapshot to make it stay in the same original position
// with the current screen rotation.
- int delta = deltaRotation(rotation, mSnapshotRotation);
+ int delta = deltaRotation(rotation, Surface.ROTATION_0);
createRotationMatrix(delta, mWidth, mHeight, mSnapshotInitialMatrix);
if (DEBUG_STATE) Slog.v(TAG, "**** ROTATION: " + delta);
@@ -323,14 +337,18 @@
com.android.internal.R.anim.screen_rotate_start_exit);
mStartEnterAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_start_enter);
- mStartFrameAnimation = AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.screen_rotate_start_frame);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mStartFrameAnimation = AnimationUtils.loadAnimation(mContext,
+ com.android.internal.R.anim.screen_rotate_start_frame);
+ }
mFinishExitAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_finish_exit);
mFinishEnterAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_finish_enter);
- mFinishFrameAnimation = AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.screen_rotate_finish_frame);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mFinishFrameAnimation = AnimationUtils.loadAnimation(mContext,
+ com.android.internal.R.anim.screen_rotate_finish_frame);
+ }
}
if (DEBUG_STATE) Slog.v(TAG, "Rotation delta: " + delta + " finalWidth="
@@ -343,16 +361,20 @@
com.android.internal.R.anim.screen_rotate_0_exit);
mRotateEnterAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_0_enter);
- mRotateFrameAnimation = AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.screen_rotate_0_frame);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mRotateFrameAnimation = AnimationUtils.loadAnimation(mContext,
+ com.android.internal.R.anim.screen_rotate_0_frame);
+ }
break;
case Surface.ROTATION_90:
mRotateExitAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_plus_90_exit);
mRotateEnterAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_plus_90_enter);
- mRotateFrameAnimation = AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.screen_rotate_plus_90_frame);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mRotateFrameAnimation = AnimationUtils.loadAnimation(mContext,
+ com.android.internal.R.anim.screen_rotate_plus_90_frame);
+ }
break;
case Surface.ROTATION_180:
mRotateExitAnimation = AnimationUtils.loadAnimation(mContext,
@@ -367,8 +389,10 @@
com.android.internal.R.anim.screen_rotate_minus_90_exit);
mRotateEnterAnimation = AnimationUtils.loadAnimation(mContext,
com.android.internal.R.anim.screen_rotate_minus_90_enter);
- mRotateFrameAnimation = AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.screen_rotate_minus_90_frame);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mRotateFrameAnimation = AnimationUtils.loadAnimation(mContext,
+ com.android.internal.R.anim.screen_rotate_minus_90_frame);
+ }
break;
}
@@ -388,18 +412,23 @@
halfWidth, halfHeight);
mStartExitAnimation.initialize(halfWidth, halfHeight,
mOriginalWidth, mOriginalHeight);
- mStartFrameAnimation.initialize(finalWidth, finalHeight,
- mOriginalWidth, mOriginalHeight);
mFinishEnterAnimation.initialize(finalWidth, finalHeight,
halfWidth, halfHeight);
mFinishExitAnimation.initialize(halfWidth, halfHeight,
mOriginalWidth, mOriginalHeight);
- mFinishFrameAnimation.initialize(finalWidth, finalHeight,
- mOriginalWidth, mOriginalHeight);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mStartFrameAnimation.initialize(finalWidth, finalHeight,
+ mOriginalWidth, mOriginalHeight);
+ mFinishFrameAnimation.initialize(finalWidth, finalHeight,
+ mOriginalWidth, mOriginalHeight);
+ }
}
mRotateEnterAnimation.initialize(finalWidth, finalHeight, mOriginalWidth, mOriginalHeight);
mRotateExitAnimation.initialize(finalWidth, finalHeight, mOriginalWidth, mOriginalHeight);
- mRotateFrameAnimation.initialize(finalWidth, finalHeight, mOriginalWidth, mOriginalHeight);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mRotateFrameAnimation.initialize(finalWidth, finalHeight, mOriginalWidth,
+ mOriginalHeight);
+ }
mAnimRunning = false;
mFinishAnimReady = false;
mFinishAnimStartTime = -1;
@@ -409,23 +438,27 @@
mStartExitAnimation.scaleCurrentDuration(animationScale);
mStartEnterAnimation.restrictDuration(maxAnimationDuration);
mStartEnterAnimation.scaleCurrentDuration(animationScale);
- mStartFrameAnimation.restrictDuration(maxAnimationDuration);
- mStartFrameAnimation.scaleCurrentDuration(animationScale);
mFinishExitAnimation.restrictDuration(maxAnimationDuration);
mFinishExitAnimation.scaleCurrentDuration(animationScale);
mFinishEnterAnimation.restrictDuration(maxAnimationDuration);
mFinishEnterAnimation.scaleCurrentDuration(animationScale);
- mFinishFrameAnimation.restrictDuration(maxAnimationDuration);
- mFinishFrameAnimation.scaleCurrentDuration(animationScale);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mStartFrameAnimation.restrictDuration(maxAnimationDuration);
+ mStartFrameAnimation.scaleCurrentDuration(animationScale);
+ mFinishFrameAnimation.restrictDuration(maxAnimationDuration);
+ mFinishFrameAnimation.scaleCurrentDuration(animationScale);
+ }
}
mRotateExitAnimation.restrictDuration(maxAnimationDuration);
mRotateExitAnimation.scaleCurrentDuration(animationScale);
mRotateEnterAnimation.restrictDuration(maxAnimationDuration);
mRotateEnterAnimation.scaleCurrentDuration(animationScale);
- mRotateFrameAnimation.restrictDuration(maxAnimationDuration);
- mRotateFrameAnimation.scaleCurrentDuration(animationScale);
+ if (USE_CUSTOM_BLACK_FRAME) {
+ mRotateFrameAnimation.restrictDuration(maxAnimationDuration);
+ mRotateFrameAnimation.scaleCurrentDuration(animationScale);
+ }
- if (mBlackFrame == null) {
+ if (USE_CUSTOM_BLACK_FRAME && mCustomBlackFrame == null) {
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS || DEBUG_STATE) Slog.i(
WindowManagerService.TAG,
">>> OPEN TRANSACTION ScreenRotationAnimation.startAnimation");
@@ -443,8 +476,59 @@
Rect outer = new Rect(-mOriginalWidth*1, -mOriginalHeight*1,
mOriginalWidth*2, mOriginalHeight*2);
Rect inner = new Rect(0, 0, mOriginalWidth, mOriginalHeight);
- mBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 1);
- mBlackFrame.setMatrix(mFrameInitialMatrix);
+ mCustomBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 3);
+ mCustomBlackFrame.setMatrix(mFrameInitialMatrix);
+ } catch (Surface.OutOfResourcesException e) {
+ Slog.w(TAG, "Unable to allocate black surface", e);
+ } finally {
+ Surface.closeTransaction();
+ if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS || DEBUG_STATE) Slog.i(
+ WindowManagerService.TAG,
+ "<<< CLOSE TRANSACTION ScreenRotationAnimation.startAnimation");
+ }
+ }
+
+ if (mExitingBlackFrame == null) {
+ if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS || DEBUG_STATE) Slog.i(
+ WindowManagerService.TAG,
+ ">>> OPEN TRANSACTION ScreenRotationAnimation.startAnimation");
+ Surface.openTransaction();
+
+ // Compute the transformation matrix that must be applied
+ // the the black frame to make it stay in the initial position
+ // before the new screen rotation. This is different than the
+ // snapshot transformation because the snapshot is always based
+ // of the native orientation of the screen, not the orientation
+ // we were last in.
+ createRotationMatrix(delta, mOriginalWidth, mOriginalHeight, mFrameInitialMatrix);
+
+ try {
+ Rect outer = new Rect(-mOriginalWidth*1, -mOriginalHeight*1,
+ mOriginalWidth*2, mOriginalHeight*2);
+ Rect inner = new Rect(0, 0, mOriginalWidth, mOriginalHeight);
+ mExitingBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 2);
+ mExitingBlackFrame.setMatrix(mFrameInitialMatrix);
+ } catch (Surface.OutOfResourcesException e) {
+ Slog.w(TAG, "Unable to allocate black surface", e);
+ } finally {
+ Surface.closeTransaction();
+ if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS || DEBUG_STATE) Slog.i(
+ WindowManagerService.TAG,
+ "<<< CLOSE TRANSACTION ScreenRotationAnimation.startAnimation");
+ }
+ }
+
+ if (false && mEnteringBlackFrame == null) {
+ if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS || DEBUG_STATE) Slog.i(
+ WindowManagerService.TAG,
+ ">>> OPEN TRANSACTION ScreenRotationAnimation.startAnimation");
+ Surface.openTransaction();
+
+ try {
+ Rect outer = new Rect(-finalWidth*1, -finalHeight*1,
+ finalWidth*2, finalHeight*2);
+ Rect inner = new Rect(0, 0, finalWidth, finalHeight);
+ mEnteringBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER);
} catch (Surface.OutOfResourcesException e) {
Slog.w(TAG, "Unable to allocate black surface", e);
} finally {
@@ -489,9 +573,17 @@
mSurface.destroy();
mSurface = null;
}
- if (mBlackFrame != null) {
- mBlackFrame.kill();
- mBlackFrame = null;
+ if (mCustomBlackFrame != null) {
+ mCustomBlackFrame.kill();
+ mCustomBlackFrame = null;
+ }
+ if (mExitingBlackFrame != null) {
+ mExitingBlackFrame.kill();
+ mExitingBlackFrame = null;
+ }
+ if (mEnteringBlackFrame != null) {
+ mEnteringBlackFrame.kill();
+ mEnteringBlackFrame = null;
}
if (mStartExitAnimation != null) {
mStartExitAnimation.cancel();
@@ -540,131 +632,127 @@
|| mRotateFrameAnimation != null;
}
- @Override
- public boolean stepAnimation(long now) {
+ private boolean stepAnimation(long now) {
if (mFinishAnimReady && mFinishAnimStartTime < 0) {
if (DEBUG_STATE) Slog.v(TAG, "Step: finish anim now ready");
mFinishAnimStartTime = now;
}
- // If the start animation is no longer running, we want to keep its
- // transformation intact until the finish animation also completes.
-
mMoreStartExit = false;
if (mStartExitAnimation != null) {
- mStartExitTransformation.clear();
mMoreStartExit = mStartExitAnimation.getTransformation(now, mStartExitTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped start exit: " + mStartExitTransformation);
- if (!mMoreStartExit) {
- if (DEBUG_STATE) Slog.v(TAG, "Start exit animation done!");
- mStartExitAnimation.cancel();
- mStartExitAnimation = null;
- }
}
mMoreStartEnter = false;
if (mStartEnterAnimation != null) {
- mStartEnterTransformation.clear();
mMoreStartEnter = mStartEnterAnimation.getTransformation(now, mStartEnterTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped start enter: " + mStartEnterTransformation);
- if (!mMoreStartEnter) {
- if (DEBUG_STATE) Slog.v(TAG, "Start enter animation done!");
- mStartEnterAnimation.cancel();
- mStartEnterAnimation = null;
- }
}
mMoreStartFrame = false;
if (mStartFrameAnimation != null) {
- mStartFrameTransformation.clear();
mMoreStartFrame = mStartFrameAnimation.getTransformation(now, mStartFrameTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped start frame: " + mStartFrameTransformation);
- if (!mMoreStartFrame) {
- if (DEBUG_STATE) Slog.v(TAG, "Start frame animation done!");
- mStartFrameAnimation.cancel();
- mStartFrameAnimation = null;
- }
}
long finishNow = mFinishAnimReady ? (now - mFinishAnimStartTime) : 0;
if (DEBUG_STATE) Slog.v(TAG, "Step: finishNow=" + finishNow);
- mFinishExitTransformation.clear();
mMoreFinishExit = false;
if (mFinishExitAnimation != null) {
mMoreFinishExit = mFinishExitAnimation.getTransformation(finishNow, mFinishExitTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped finish exit: " + mFinishExitTransformation);
- if (!mMoreStartExit && !mMoreFinishExit) {
- if (DEBUG_STATE) Slog.v(TAG, "Finish exit animation done, clearing start/finish anims!");
- mStartExitTransformation.clear();
- mFinishExitAnimation.cancel();
- mFinishExitAnimation = null;
- mFinishExitTransformation.clear();
- }
}
- mFinishEnterTransformation.clear();
mMoreFinishEnter = false;
if (mFinishEnterAnimation != null) {
mMoreFinishEnter = mFinishEnterAnimation.getTransformation(finishNow, mFinishEnterTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped finish enter: " + mFinishEnterTransformation);
- if (!mMoreStartEnter && !mMoreFinishEnter) {
- if (DEBUG_STATE) Slog.v(TAG, "Finish enter animation done, clearing start/finish anims!");
- mStartEnterTransformation.clear();
- mFinishEnterAnimation.cancel();
- mFinishEnterAnimation = null;
- mFinishEnterTransformation.clear();
- }
}
- mFinishFrameTransformation.clear();
mMoreFinishFrame = false;
if (mFinishFrameAnimation != null) {
mMoreFinishFrame = mFinishFrameAnimation.getTransformation(finishNow, mFinishFrameTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped finish frame: " + mFinishFrameTransformation);
- if (!mMoreStartFrame && !mMoreFinishFrame) {
- if (DEBUG_STATE) Slog.v(TAG, "Finish frame animation done, clearing start/finish anims!");
- mStartFrameTransformation.clear();
- mFinishFrameAnimation.cancel();
- mFinishFrameAnimation = null;
- mFinishFrameTransformation.clear();
- }
}
- mRotateExitTransformation.clear();
mMoreRotateExit = false;
if (mRotateExitAnimation != null) {
mMoreRotateExit = mRotateExitAnimation.getTransformation(now, mRotateExitTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped rotate exit: " + mRotateExitTransformation);
- if (!mMoreFinishExit && !mMoreRotateExit) {
- if (DEBUG_STATE) Slog.v(TAG, "Rotate exit animation done!");
+ }
+
+ mMoreRotateEnter = false;
+ if (mRotateEnterAnimation != null) {
+ mMoreRotateEnter = mRotateEnterAnimation.getTransformation(now, mRotateEnterTransformation);
+ if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped rotate enter: " + mRotateEnterTransformation);
+ }
+
+ mMoreRotateFrame = false;
+ if (mRotateFrameAnimation != null) {
+ mMoreRotateFrame = mRotateFrameAnimation.getTransformation(now, mRotateFrameTransformation);
+ if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped rotate frame: " + mRotateFrameTransformation);
+ }
+
+ if (!mMoreStartExit && !mMoreRotateExit && !mMoreFinishExit) {
+ if (mStartExitAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Exit animations done, clearing start exit anim!");
+ mStartExitAnimation.cancel();
+ mStartExitAnimation = null;
+ mStartExitTransformation.clear();
+ }
+ if (mFinishExitAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Exit animations done, clearing finish exit anim!");
+ mFinishExitAnimation.cancel();
+ mFinishExitAnimation = null;
+ mFinishExitTransformation.clear();
+ }
+ if (mRotateExitAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Exit animations done, clearing rotate exit anim!");
mRotateExitAnimation.cancel();
mRotateExitAnimation = null;
mRotateExitTransformation.clear();
}
}
- mRotateEnterTransformation.clear();
- mMoreRotateEnter = false;
- if (mRotateEnterAnimation != null) {
- mMoreRotateEnter = mRotateEnterAnimation.getTransformation(now, mRotateEnterTransformation);
- if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped rotate enter: " + mRotateEnterTransformation);
- if (!mMoreFinishEnter && !mMoreRotateEnter) {
- if (DEBUG_STATE) Slog.v(TAG, "Rotate enter animation done!");
+ if (!mMoreStartEnter && !mMoreRotateEnter && !mMoreFinishEnter) {
+ if (mStartEnterAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Enter animations done, clearing start enter anim!");
+ mStartEnterAnimation.cancel();
+ mStartEnterAnimation = null;
+ mStartEnterTransformation.clear();
+ }
+ if (mFinishEnterAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Enter animations done, clearing finish enter anim!");
+ mFinishEnterAnimation.cancel();
+ mFinishEnterAnimation = null;
+ mFinishEnterTransformation.clear();
+ }
+ if (mRotateEnterAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Enter animations done, clearing rotate enter anim!");
mRotateEnterAnimation.cancel();
mRotateEnterAnimation = null;
mRotateEnterTransformation.clear();
}
}
- mRotateFrameTransformation.clear();
- mMoreRotateFrame = false;
- if (mRotateFrameAnimation != null) {
- mMoreRotateFrame = mRotateFrameAnimation.getTransformation(now, mRotateFrameTransformation);
- if (DEBUG_TRANSFORMS) Slog.v(TAG, "Stepped rotate frame: " + mRotateFrameTransformation);
- if (!mMoreFinishFrame && !mMoreRotateFrame) {
- if (DEBUG_STATE) Slog.v(TAG, "Rotate frame animation done!");
+ if (USE_CUSTOM_BLACK_FRAME && !mMoreStartFrame && !mMoreRotateFrame && !mMoreFinishFrame) {
+ if (mStartFrameAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Frame animations done, clearing start frame anim!");
+ mStartFrameAnimation.cancel();
+ mStartFrameAnimation = null;
+ mStartFrameTransformation.clear();
+ }
+ if (mFinishFrameAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Frame animations done, clearing finish frame anim!");
+ mFinishFrameAnimation.cancel();
+ mFinishFrameAnimation = null;
+ mFinishFrameTransformation.clear();
+ }
+ if (mRotateFrameAnimation != null) {
+ if (DEBUG_STATE) Slog.v(TAG, "Frame animations done, clearing rotate frame anim!");
mRotateFrameAnimation.cancel();
mRotateFrameAnimation = null;
mRotateFrameTransformation.clear();
@@ -679,17 +767,19 @@
mEnterTransformation.compose(mStartEnterTransformation);
mEnterTransformation.compose(mFinishEnterTransformation);
- //mFrameTransformation.set(mRotateExitTransformation);
- //mFrameTransformation.compose(mStartExitTransformation);
- //mFrameTransformation.compose(mFinishExitTransformation);
- mFrameTransformation.set(mRotateFrameTransformation);
- mFrameTransformation.compose(mStartFrameTransformation);
- mFrameTransformation.compose(mFinishFrameTransformation);
- mFrameTransformation.getMatrix().preConcat(mFrameInitialMatrix);
-
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Final exit: " + mExitTransformation);
if (DEBUG_TRANSFORMS) Slog.v(TAG, "Final enter: " + mEnterTransformation);
- if (DEBUG_TRANSFORMS) Slog.v(TAG, "Final frame: " + mFrameTransformation);
+
+ if (USE_CUSTOM_BLACK_FRAME) {
+ //mFrameTransformation.set(mRotateExitTransformation);
+ //mFrameTransformation.compose(mStartExitTransformation);
+ //mFrameTransformation.compose(mFinishExitTransformation);
+ mFrameTransformation.set(mRotateFrameTransformation);
+ mFrameTransformation.compose(mStartFrameTransformation);
+ mFrameTransformation.compose(mFinishFrameTransformation);
+ mFrameTransformation.getMatrix().preConcat(mFrameInitialMatrix);
+ if (DEBUG_TRANSFORMS) Slog.v(TAG, "Final frame: " + mFrameTransformation);
+ }
final boolean more = mMoreStartEnter || mMoreStartExit || mMoreStartFrame
|| mMoreFinishEnter || mMoreFinishExit || mMoreFinishFrame
@@ -704,28 +794,46 @@
}
void updateSurfaces() {
- if (!mMoreStartExit && !mMoreFinishExit && !mMoreRotateExit) {
- if (mSurface != null) {
+ if (mSurface != null) {
+ if (!mMoreStartExit && !mMoreFinishExit && !mMoreRotateExit) {
if (DEBUG_STATE) Slog.v(TAG, "Exit animations done, hiding screenshot surface");
mSurface.hide();
}
}
- if (!mMoreStartFrame && !mMoreFinishFrame && !mMoreRotateFrame) {
- if (mBlackFrame != null) {
+ if (mCustomBlackFrame != null) {
+ if (!mMoreStartFrame && !mMoreFinishFrame && !mMoreRotateFrame) {
if (DEBUG_STATE) Slog.v(TAG, "Frame animations done, hiding black frame");
- mBlackFrame.hide();
+ mCustomBlackFrame.hide();
+ } else {
+ mCustomBlackFrame.setMatrix(mFrameTransformation.getMatrix());
}
- } else {
- if (mBlackFrame != null) {
- mBlackFrame.setMatrix(mFrameTransformation.getMatrix());
+ }
+
+ if (mExitingBlackFrame != null) {
+ if (!mMoreStartExit && !mMoreFinishExit && !mMoreRotateExit) {
+ if (DEBUG_STATE) Slog.v(TAG, "Frame animations done, hiding exiting frame");
+ mExitingBlackFrame.hide();
+ } else {
+ mExitFrameFinalMatrix.setConcat(mExitTransformation.getMatrix(), mFrameInitialMatrix);
+ mExitingBlackFrame.setMatrix(mExitFrameFinalMatrix);
+ mExitingBlackFrame.setAlpha(mExitTransformation.getAlpha());
+ }
+ }
+
+ if (mEnteringBlackFrame != null) {
+ if (!mMoreStartEnter && !mMoreFinishEnter && !mMoreRotateEnter) {
+ if (DEBUG_STATE) Slog.v(TAG, "Frame animations done, hiding entering frame");
+ mEnteringBlackFrame.hide();
+ } else {
+ mEnteringBlackFrame.setMatrix(mEnterTransformation.getMatrix());
}
}
setSnapshotTransform(mSnapshotFinalMatrix, mExitTransformation.getAlpha());
}
- public boolean startAndFinishAnimationLocked(long now) {
+ public boolean stepAnimationLocked(long now) {
if (!isAnimating()) {
if (DEBUG_STATE) Slog.v(TAG, "Step: no animations running");
mFinishAnimReady = false;
@@ -763,8 +871,8 @@
}
mAnimRunning = true;
}
-
- return true;
+
+ return stepAnimation(now);
}
public Transformation getEnterTransformation() {
diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java
new file mode 100644
index 0000000..fbfd9ec
--- /dev/null
+++ b/services/java/com/android/server/wm/WindowAnimator.java
@@ -0,0 +1,628 @@
+// Copyright 2012 Google Inc. All Rights Reserved.
+
+package com.android.server.wm;
+
+import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
+
+import android.content.Context;
+import android.os.SystemClock;
+import android.util.Log;
+import android.util.Slog;
+import android.view.Surface;
+import android.view.WindowManager;
+import android.view.WindowManager.LayoutParams;
+import android.view.WindowManagerPolicy;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+
+import com.android.internal.policy.impl.PhoneWindowManager;
+
+/**
+ * @author cmautner@google.com (Craig Mautner)
+ * Singleton class that carries out the animations and Surface operations in a separate task
+ * on behalf of WindowManagerService.
+ */
+public class WindowAnimator {
+ private static final String TAG = "WindowAnimator";
+
+ final WindowManagerService mService;
+ final Context mContext;
+ final WindowManagerPolicy mPolicy;
+
+ boolean mAnimating;
+ boolean mUpdateRotation;
+ boolean mTokenMayBeDrawn;
+ boolean mForceHiding;
+ WindowState mWindowAnimationBackground;
+ int mWindowAnimationBackgroundColor;
+ int mAdjResult;
+
+ int mPendingLayoutChanges;
+
+ /** Overall window dimensions */
+ int mDw, mDh;
+
+ /** Interior window dimensions */
+ int mInnerDw, mInnerDh;
+
+ /** Time of current animation step. Reset on each iteration */
+ long mCurrentTime;
+
+ /** Skip repeated AppWindowTokens initialization. Note that AppWindowsToken's version of this
+ * is a long initialized to Long.MIN_VALUE so that it doesn't match this value on startup. */
+ private int mTransactionSequence;
+
+ /** The one and only screen rotation if one is happening */
+ ScreenRotationAnimation mScreenRotationAnimation = null;
+
+ WindowAnimator(final WindowManagerService service, final Context context,
+ final WindowManagerPolicy policy) {
+ mService = service;
+ mContext = context;
+ mPolicy = policy;
+ }
+
+ private void updateWindowsAppsAndRotationAnimationsLocked() {
+ int i;
+ final int NAT = mService.mAppTokens.size();
+ for (i=0; i<NAT; i++) {
+ final AppWindowToken appToken = mService.mAppTokens.get(i);
+ final boolean wasAnimating = appToken.animation != null
+ && appToken.animation != WindowManagerService.sDummyAnimation;
+ if (appToken.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
+ mAnimating = true;
+ } else if (wasAnimating) {
+ // stopped animating, do one more pass through the layout
+ mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("appToken " + appToken + " done");
+ }
+ }
+ }
+
+ final int NEAT = mService.mExitingAppTokens.size();
+ for (i=0; i<NEAT; i++) {
+ final AppWindowToken appToken = mService.mExitingAppTokens.get(i);
+ final boolean wasAnimating = appToken.animation != null
+ && appToken.animation != WindowManagerService.sDummyAnimation;
+ if (appToken.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
+ mAnimating = true;
+ } else if (wasAnimating) {
+ // stopped animating, do one more pass through the layout
+ mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("exiting appToken " + appToken + " done");
+ }
+ }
+ }
+
+ if (mScreenRotationAnimation != null &&
+ (mScreenRotationAnimation.isAnimating() ||
+ mScreenRotationAnimation.mFinishAnimReady)) {
+ if (mScreenRotationAnimation.stepAnimationLocked(mCurrentTime)) {
+ mUpdateRotation = false;
+ mAnimating = true;
+ } else {
+ mUpdateRotation = true;
+ mScreenRotationAnimation.kill();
+ mScreenRotationAnimation = null;
+ }
+ }
+ }
+
+ private void updateWindowsAndWallpaperLocked() {
+ ++mTransactionSequence;
+
+ for (int i = mService.mWindows.size() - 1; i >= 0; i--) {
+ WindowState w = mService.mWindows.get(i);
+
+ final WindowManager.LayoutParams attrs = w.mAttrs;
+
+ if (w.mSurface != null) {
+ // Take care of the window being ready to display.
+ if (w.commitFinishDrawingLocked(mCurrentTime)) {
+ if ((w.mAttrs.flags
+ & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) {
+ if (WindowManagerService.DEBUG_WALLPAPER) Slog.v(TAG,
+ "First draw done in potential wallpaper target " + w);
+ mService.mInnerFields.mWallpaperMayChange = true;
+ mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 1");
+ }
+ }
+ }
+
+ // If the window has moved due to its containing
+ // content frame changing, then we'd like to animate
+ // it. The checks here are ordered by what is least
+ // likely to be true first.
+ if (w.shouldAnimateMove()) {
+ // Frame has moved, containing content frame
+ // has also moved, and we're not currently animating...
+ // let's do something.
+ Animation a = AnimationUtils.loadAnimation(mContext,
+ com.android.internal.R.anim.window_move_from_decor);
+ w.setAnimation(a);
+ w.mAnimDw = w.mLastFrame.left - w.mFrame.left;
+ w.mAnimDh = w.mLastFrame.top - w.mFrame.top;
+ } else {
+ w.mAnimDw = mInnerDw;
+ w.mAnimDh = mInnerDh;
+ }
+
+ final boolean wasAnimating = w.mWasAnimating;
+ final boolean nowAnimating = w.stepAnimationLocked(mCurrentTime);
+
+ if (WindowManagerService.DEBUG_WALLPAPER) {
+ Slog.v(TAG, w + ": wasAnimating=" + wasAnimating +
+ ", nowAnimating=" + nowAnimating);
+ }
+
+ // If this window is animating, make a note that we have
+ // an animating window and take care of a request to run
+ // a detached wallpaper animation.
+ if (nowAnimating) {
+ if (w.mAnimation != null) {
+ if ((w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0
+ && w.mAnimation.getDetachWallpaper()) {
+ mService.mInnerFields.mDetachedWallpaper = w;
+ }
+ if (w.mAnimation.getBackgroundColor() != 0) {
+ if (mWindowAnimationBackground == null
+ || (w.mAnimLayer < mWindowAnimationBackground.mAnimLayer)) {
+ mWindowAnimationBackground = w;
+ mWindowAnimationBackgroundColor =
+ w.mAnimation.getBackgroundColor();
+ }
+ }
+ }
+ mAnimating = true;
+ }
+
+ // If this window's app token is running a detached wallpaper
+ // animation, make a note so we can ensure the wallpaper is
+ // displayed behind it.
+ if (w.mAppToken != null && w.mAppToken.animation != null
+ && w.mAppToken.animating) {
+ if ((w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0
+ && w.mAppToken.animation.getDetachWallpaper()) {
+ mService.mInnerFields.mDetachedWallpaper = w;
+ }
+ if (w.mAppToken.animation.getBackgroundColor() != 0) {
+ if (mWindowAnimationBackground == null
+ || (w.mAnimLayer <
+ mWindowAnimationBackground.mAnimLayer)) {
+ mWindowAnimationBackground = w;
+ mWindowAnimationBackgroundColor =
+ w.mAppToken.animation.getBackgroundColor();
+ }
+ }
+ }
+
+ if (wasAnimating && !w.mAnimating && mService.mWallpaperTarget == w) {
+ mService.mInnerFields.mWallpaperMayChange = true;
+ mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 2");
+ }
+ }
+
+ if (mPolicy.doesForceHide(w, attrs)) {
+ if (!wasAnimating && nowAnimating) {
+ if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
+ "Animation started that could impact force hide: "
+ + w);
+ mService.mInnerFields.mWallpaperForceHidingChanged = true;
+ mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 3");
+ }
+ mService.mFocusMayChange = true;
+ } else if (w.isReadyForDisplay() && w.mAnimation == null) {
+ mForceHiding = true;
+ }
+ } else if (mPolicy.canBeForceHidden(w, attrs)) {
+ boolean changed;
+ if (mForceHiding) {
+ changed = w.hideLw(false, false);
+ if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG,
+ "Now policy hidden: " + w);
+ } else {
+ changed = w.showLw(false, false);
+ if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG,
+ "Now policy shown: " + w);
+ if (changed) {
+ if (mService.mInnerFields.mWallpaperForceHidingChanged
+ && w.isVisibleNow() /*w.isReadyForDisplay()*/) {
+ // Assume we will need to animate. If
+ // we don't (because the wallpaper will
+ // stay with the lock screen), then we will
+ // clean up later.
+ Animation a = mPolicy.createForceHideEnterAnimation();
+ if (a != null) {
+ w.setAnimation(a);
+ }
+ }
+ if (mCurrentFocus == null || mCurrentFocus.mLayer < w.mLayer) {
+ // We are showing on to of the current
+ // focus, so re-evaluate focus to make
+ // sure it is correct.
+ mService.mFocusMayChange = true;
+ }
+ }
+ }
+ if (changed && (attrs.flags
+ & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) {
+ mService.mInnerFields.mWallpaperMayChange = true;
+ mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 4");
+ }
+ }
+ }
+ }
+
+ final AppWindowToken atoken = w.mAppToken;
+ if (atoken != null && (!atoken.allDrawn || atoken.freezingScreen)) {
+ if (atoken.lastTransactionSequence != mTransactionSequence) {
+ atoken.lastTransactionSequence = mTransactionSequence;
+ atoken.numInterestingWindows = atoken.numDrawnWindows = 0;
+ atoken.startingDisplayed = false;
+ }
+ if ((w.isOnScreen() || w.mAttrs.type
+ == WindowManager.LayoutParams.TYPE_BASE_APPLICATION)
+ && !w.mExiting && !w.mDestroying) {
+ if (WindowManagerService.DEBUG_VISIBILITY ||
+ WindowManagerService.DEBUG_ORIENTATION) {
+ Slog.v(TAG, "Eval win " + w + ": isDrawn="
+ + w.isDrawnLw()
+ + ", isAnimating=" + w.isAnimating());
+ if (!w.isDrawnLw()) {
+ Slog.v(TAG, "Not displayed: s=" + w.mSurface
+ + " pv=" + w.mPolicyVisibility
+ + " dp=" + w.mDrawPending
+ + " cdp=" + w.mCommitDrawPending
+ + " ah=" + w.mAttachedHidden
+ + " th=" + atoken.hiddenRequested
+ + " a=" + w.mAnimating);
+ }
+ }
+ if (w != atoken.startingWindow) {
+ if (!atoken.freezingScreen || !w.mAppFreezing) {
+ atoken.numInterestingWindows++;
+ if (w.isDrawnLw()) {
+ atoken.numDrawnWindows++;
+ if (WindowManagerService.DEBUG_VISIBILITY ||
+ WindowManagerService.DEBUG_ORIENTATION) Slog.v(TAG,
+ "tokenMayBeDrawn: " + atoken
+ + " freezingScreen=" + atoken.freezingScreen
+ + " mAppFreezing=" + w.mAppFreezing);
+ mTokenMayBeDrawn = true;
+ }
+ }
+ } else if (w.isDrawnLw()) {
+ atoken.startingDisplayed = true;
+ }
+ }
+ } else if (w.mReadyToShow) {
+ if (w.performShowLocked()) {
+ mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 5");
+ }
+ }
+ }
+ if (atoken != null && atoken.thumbnail != null) {
+ if (atoken.thumbnailTransactionSeq != mTransactionSequence) {
+ atoken.thumbnailTransactionSeq = mTransactionSequence;
+ atoken.thumbnailLayer = 0;
+ }
+ if (atoken.thumbnailLayer < w.mAnimLayer) {
+ atoken.thumbnailLayer = w.mAnimLayer;
+ }
+ }
+ } // end forall windows
+ }
+
+ private void testTokenMayBeDrawnLocked() {
+ // See if any windows have been drawn, so they (and others
+ // associated with them) can now be shown.
+ final int NT = mService.mAppTokens.size();
+ for (int i=0; i<NT; i++) {
+ AppWindowToken wtoken = mService.mAppTokens.get(i);
+ if (wtoken.freezingScreen) {
+ int numInteresting = wtoken.numInterestingWindows;
+ if (numInteresting > 0 && wtoken.numDrawnWindows >= numInteresting) {
+ if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
+ "allDrawn: " + wtoken
+ + " interesting=" + numInteresting
+ + " drawn=" + wtoken.numDrawnWindows);
+ wtoken.showAllWindowsLocked();
+ mService.unsetAppFreezingScreenLocked(wtoken, false, true);
+ if (WindowManagerService.DEBUG_ORIENTATION) Slog.i(TAG,
+ "Setting mOrientationChangeComplete=true because wtoken "
+ + wtoken + " numInteresting=" + numInteresting
+ + " numDrawn=" + wtoken.numDrawnWindows);
+ mService.mInnerFields.mOrientationChangeComplete = true;
+ }
+ } else if (!wtoken.allDrawn) {
+ int numInteresting = wtoken.numInterestingWindows;
+ if (numInteresting > 0 && wtoken.numDrawnWindows >= numInteresting) {
+ if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
+ "allDrawn: " + wtoken
+ + " interesting=" + numInteresting
+ + " drawn=" + wtoken.numDrawnWindows);
+ wtoken.allDrawn = true;
+ mPendingLayoutChanges |= PhoneWindowManager.FINISH_LAYOUT_REDO_ANIM;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
+ mService.debugLayoutRepeats("testTokenMayBeDrawnLocked");
+ }
+
+ // We can now show all of the drawn windows!
+ if (!mService.mOpeningApps.contains(wtoken)) {
+ mAnimating |= wtoken.showAllWindowsLocked();
+ }
+ }
+ }
+ }
+ }
+
+ private void performAnimationsLocked() {
+ if (WindowManagerService.DEBUG_APP_TRANSITIONS) Slog.v(TAG, "*** ANIM STEP: seq="
+ + mTransactionSequence + " mAnimating="
+ + mAnimating);
+
+ mTokenMayBeDrawn = false;
+ mService.mInnerFields.mWallpaperMayChange = false;
+ mForceHiding = false;
+ mService.mInnerFields.mDetachedWallpaper = null;
+ mWindowAnimationBackground = null;
+ mWindowAnimationBackgroundColor = 0;
+
+ updateWindowsAndWallpaperLocked();
+
+ if (mTokenMayBeDrawn) {
+ testTokenMayBeDrawnLocked();
+ }
+
+ if (WindowManagerService.DEBUG_APP_TRANSITIONS) Slog.v(TAG, "*** ANIM STEP: changes=0x"
+ + Integer.toHexString(mPendingLayoutChanges));
+ }
+
+ public void prepareSurfaceLocked(final WindowState w, final boolean recoveringMemory) {
+ if (w.mSurface == null) {
+ if (w.mOrientationChanging) {
+ if (WindowManagerService.DEBUG_ORIENTATION) {
+ Slog.v(TAG, "Orientation change skips hidden " + w);
+ }
+ w.mOrientationChanging = false;
+ }
+ return;
+ }
+
+ boolean displayed = false;
+
+ w.computeShownFrameLocked();
+
+ int width, height;
+ if ((w.mAttrs.flags & LayoutParams.FLAG_SCALED) != 0) {
+ // for a scaled surface, we just want to use
+ // the requested size.
+ width = w.mRequestedWidth;
+ height = w.mRequestedHeight;
+ } else {
+ width = w.mCompatFrame.width();
+ height = w.mCompatFrame.height();
+ }
+
+ if (width < 1) {
+ width = 1;
+ }
+ if (height < 1) {
+ height = 1;
+ }
+ final boolean surfaceResized = w.mSurfaceW != width || w.mSurfaceH != height;
+ if (surfaceResized) {
+ w.mSurfaceW = width;
+ w.mSurfaceH = height;
+ }
+
+ if (w.mSurfaceX != w.mShownFrame.left
+ || w.mSurfaceY != w.mShownFrame.top) {
+ try {
+ if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
+ "POS " + w.mShownFrame.left
+ + ", " + w.mShownFrame.top, null);
+ w.mSurfaceX = w.mShownFrame.left;
+ w.mSurfaceY = w.mShownFrame.top;
+ w.mSurface.setPosition(w.mShownFrame.left, w.mShownFrame.top);
+ } catch (RuntimeException e) {
+ Slog.w(TAG, "Error positioning surface of " + w
+ + " pos=(" + w.mShownFrame.left
+ + "," + w.mShownFrame.top + ")", e);
+ if (!recoveringMemory) {
+ mService.reclaimSomeSurfaceMemoryLocked(w, "position", true);
+ }
+ }
+ }
+
+ if (surfaceResized) {
+ try {
+ if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
+ "SIZE " + width + "x" + height, null);
+ w.mSurfaceResized = true;
+ w.mSurface.setSize(width, height);
+ } catch (RuntimeException e) {
+ // If something goes wrong with the surface (such
+ // as running out of memory), don't take down the
+ // entire system.
+ Slog.e(TAG, "Error resizing surface of " + w
+ + " size=(" + width + "x" + height + ")", e);
+ if (!recoveringMemory) {
+ mService.reclaimSomeSurfaceMemoryLocked(w, "size", true);
+ }
+ }
+ }
+
+ if (w.mAttachedHidden || !w.isReadyForDisplay()) {
+ if (!w.mLastHidden) {
+ //dump();
+ w.mLastHidden = true;
+ if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
+ "HIDE (performLayout)", null);
+ if (w.mSurface != null) {
+ w.mSurfaceShown = false;
+ try {
+ w.mSurface.hide();
+ } catch (RuntimeException e) {
+ Slog.w(TAG, "Exception hiding surface in " + w);
+ }
+ }
+ }
+ // If we are waiting for this window to handle an
+ // orientation change, well, it is hidden, so
+ // doesn't really matter. Note that this does
+ // introduce a potential glitch if the window
+ // becomes unhidden before it has drawn for the
+ // new orientation.
+ if (w.mOrientationChanging) {
+ w.mOrientationChanging = false;
+ if (WindowManagerService.DEBUG_ORIENTATION) Slog.v(TAG,
+ "Orientation change skips hidden " + w);
+ }
+ } else if (w.mLastLayer != w.mAnimLayer
+ || w.mLastAlpha != w.mShownAlpha
+ || w.mLastDsDx != w.mDsDx
+ || w.mLastDtDx != w.mDtDx
+ || w.mLastDsDy != w.mDsDy
+ || w.mLastDtDy != w.mDtDy
+ || w.mLastHScale != w.mHScale
+ || w.mLastVScale != w.mVScale
+ || w.mLastHidden) {
+ displayed = true;
+ w.mLastAlpha = w.mShownAlpha;
+ w.mLastLayer = w.mAnimLayer;
+ w.mLastDsDx = w.mDsDx;
+ w.mLastDtDx = w.mDtDx;
+ w.mLastDsDy = w.mDsDy;
+ w.mLastDtDy = w.mDtDy;
+ w.mLastHScale = w.mHScale;
+ w.mLastVScale = w.mVScale;
+ if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
+ "alpha=" + w.mShownAlpha + " layer=" + w.mAnimLayer
+ + " matrix=[" + (w.mDsDx*w.mHScale)
+ + "," + (w.mDtDx*w.mVScale)
+ + "][" + (w.mDsDy*w.mHScale)
+ + "," + (w.mDtDy*w.mVScale) + "]", null);
+ if (w.mSurface != null) {
+ try {
+ w.mSurfaceAlpha = w.mShownAlpha;
+ w.mSurface.setAlpha(w.mShownAlpha);
+ w.mSurfaceLayer = w.mAnimLayer;
+ w.mSurface.setLayer(w.mAnimLayer);
+ w.mSurface.setMatrix(
+ w.mDsDx*w.mHScale, w.mDtDx*w.mVScale,
+ w.mDsDy*w.mHScale, w.mDtDy*w.mVScale);
+ } catch (RuntimeException e) {
+ Slog.w(TAG, "Error updating surface in " + w, e);
+ if (!recoveringMemory) {
+ mService.reclaimSomeSurfaceMemoryLocked(w, "update", true);
+ }
+ }
+ }
+
+ if (w.mLastHidden && w.isDrawnLw()
+ && !w.mReadyToShow) {
+ if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
+ "SHOW (performLayout)", null);
+ if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + w
+ + " during relayout");
+ if (mService.showSurfaceRobustlyLocked(w)) {
+ w.mHasDrawn = true;
+ w.mLastHidden = false;
+ } else {
+ w.mOrientationChanging = false;
+ }
+ }
+ if (w.mSurface != null) {
+ w.mToken.hasVisible = true;
+ }
+ } else {
+ displayed = true;
+ }
+
+ if (displayed) {
+ if (w.mOrientationChanging) {
+ if (!w.isDrawnLw()) {
+ mService.mInnerFields.mOrientationChangeComplete = false;
+ if (WindowManagerService.DEBUG_ORIENTATION) Slog.v(TAG,
+ "Orientation continue waiting for draw in " + w);
+ } else {
+ w.mOrientationChanging = false;
+ if (WindowManagerService.DEBUG_ORIENTATION) Slog.v(TAG,
+ "Orientation change complete in " + w);
+ }
+ }
+ w.mToken.hasVisible = true;
+ }
+ }
+
+ void animate() {
+ mPendingLayoutChanges = 0;
+ mCurrentTime = SystemClock.uptimeMillis();
+
+ // Update animations of all applications, including those
+ // associated with exiting/removed apps
+ Surface.openTransaction();
+
+ try {
+ updateWindowsAppsAndRotationAnimationsLocked();
+ performAnimationsLocked();
+
+ // THIRD LOOP: Update the surfaces of all windows.
+
+ if (mScreenRotationAnimation != null) {
+ mScreenRotationAnimation.updateSurfaces();
+ }
+
+ final int N = mService.mWindows.size();
+ for (int i=N-1; i>=0; i--) {
+ WindowState w = mService.mWindows.get(i);
+ prepareSurfaceLocked(w, true);
+ }
+
+ if (mService.mDimAnimator != null && mService.mDimAnimator.mDimShown) {
+ mAnimating |= mService.mDimAnimator.updateSurface(mService.mInnerFields.mDimming,
+ mCurrentTime, !mService.okToDisplay());
+ }
+
+ if (mService.mBlackFrame != null) {
+ if (mScreenRotationAnimation != null) {
+ mService.mBlackFrame.setMatrix(
+ mScreenRotationAnimation.getEnterTransformation().getMatrix());
+ } else {
+ mService.mBlackFrame.clearMatrix();
+ }
+ }
+ } catch (RuntimeException e) {
+ Log.wtf(TAG, "Unhandled exception in Window Manager", e);
+ } finally {
+ Surface.closeTransaction();
+ }
+ }
+
+ WindowState mCurrentFocus;
+ void setCurrentFocus(WindowState currentFocus) {
+ mCurrentFocus = currentFocus;
+ }
+
+ void setDisplayDimensions(final int curWidth, final int curHeight,
+ final int appWidth, final int appHeight) {
+ mDw = curWidth;
+ mDh = curHeight;
+ mInnerDw = appWidth;
+ mInnerDh = appHeight;
+ }
+
+}
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 22949f3..e430529 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -18,7 +18,6 @@
import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
-import static android.view.WindowManager.LayoutParams.FLAG_BLUR_BEHIND;
import static android.view.WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW;
import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND;
import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
@@ -90,6 +89,7 @@
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.EventLog;
+import android.util.FloatMath;
import android.util.Log;
import android.util.Pair;
import android.util.Slog;
@@ -118,8 +118,12 @@
import android.view.WindowManagerPolicy;
import android.view.WindowManager.LayoutParams;
import android.view.WindowManagerPolicy.FakeWindow;
+import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
+import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;
+import android.view.animation.Interpolator;
+import android.view.animation.ScaleAnimation;
import android.view.animation.Transformation;
import java.io.BufferedWriter;
@@ -167,13 +171,14 @@
static final boolean DEBUG_SCREEN_ON = false;
static final boolean DEBUG_SCREENSHOT = false;
static final boolean DEBUG_BOOT = false;
+ static final boolean DEBUG_LAYOUT_REPEATS = false;
static final boolean SHOW_SURFACE_ALLOC = false;
static final boolean SHOW_TRANSACTIONS = false;
static final boolean SHOW_LIGHT_TRANSACTIONS = false || SHOW_TRANSACTIONS;
static final boolean HIDE_STACK_CRAWLS = true;
+ static final int LAYOUT_REPEAT_THRESHOLD = 4;
static final boolean PROFILE_ORIENTATION = false;
- static final boolean BLUR = true;
static final boolean localLOGV = DEBUG;
/** How much to multiply the policy's type layer, to reserve room
@@ -201,6 +206,13 @@
static final int LAYER_OFFSET_BLUR = 2;
/**
+ * Animation thumbnail is as far as possible below the window above
+ * the thumbnail (or in other words as far as possible above the window
+ * below it).
+ */
+ static final int LAYER_OFFSET_THUMBNAIL = WINDOW_LAYER_MULTIPLIER-1;
+
+ /**
* Layer at which to put the rotation freeze snapshot.
*/
static final int FREEZE_LAYER = (TYPE_LAYER_MULTIPLIER * 200) + 1;
@@ -415,17 +427,12 @@
IInputMethodManager mInputMethodManager;
SurfaceSession mFxSession;
- private DimAnimator mDimAnimator = null;
- Surface mBlurSurface;
- boolean mBlurShown;
+ DimAnimator mDimAnimator = null;
Watermark mWatermark;
StrictModeFlash mStrictModeFlash;
- ScreenRotationAnimation mScreenRotationAnimation;
BlackFrame mBlackFrame;
- int mTransactionSequence = 0;
-
final float[] mTmpFloats = new float[9];
boolean mSafeMode;
@@ -461,6 +468,7 @@
= new ArrayList<IRotationWatcher>();
int mDeferredRotationPauseCount;
+ int mPendingLayoutChanges = 0;
boolean mLayoutNeeded = true;
boolean mTraversalScheduled = false;
boolean mDisplayFrozen = false;
@@ -490,8 +498,12 @@
// made visible or hidden at the next transition.
int mNextAppTransition = WindowManagerPolicy.TRANSIT_UNSET;
String mNextAppTransitionPackage;
+ Bitmap mNextAppTransitionThumbnail;
+ IRemoteCallback mNextAppTransitionCallback;
int mNextAppTransitionEnter;
int mNextAppTransitionExit;
+ int mNextAppTransitionStartX;
+ int mNextAppTransitionStartY;
boolean mAppTransitionReady = false;
boolean mAppTransitionRunning = false;
boolean mAppTransitionTimeout = false;
@@ -583,27 +595,24 @@
/** Pulled out of performLayoutAndPlaceSurfacesLockedInner in order to refactor into multiple
* methods. */
- private class LayoutAndSurfaceFields {
- private boolean mAnimating = false;
- private boolean mWallpaperForceHidingChanged = false;
- private boolean mTokenMayBeDrawn = false;
- private boolean mWallpaperMayChange = false;
- private boolean mForceHiding = false;
- private WindowState mDetachedWallpaper = null;
- private WindowState mWindowAnimationBackground = null;
- private int mWindowAnimationBackgroundColor = 0;
- private boolean mOrientationChangeComplete = true;
+ class LayoutAndSurfaceFields {
+ boolean mWallpaperForceHidingChanged = false;
+ boolean mWallpaperMayChange = false;
+ WindowState mDetachedWallpaper = null;
+ boolean mOrientationChangeComplete = true;
private int mAdjResult = 0;
private Session mHoldScreen = null;
private boolean mObscured = false;
- private boolean mBlurring = false;
- private boolean mDimming = false;
+ boolean mDimming = false;
private boolean mSyswin = false;
private float mScreenBrightness = -1;
private float mButtonBrightness = -1;
private boolean mUpdateRotation = false;
}
- private LayoutAndSurfaceFields mInnerFields = new LayoutAndSurfaceFields();
+ LayoutAndSurfaceFields mInnerFields = new LayoutAndSurfaceFields();
+
+ /** Only do a maximum of 6 repeated layouts. After that quit */
+ private int mLayoutRepeatCount;
private final class AnimationRunnable implements Runnable {
@Override
@@ -616,19 +625,9 @@
}
final AnimationRunnable mAnimationRunnable = new AnimationRunnable();
boolean mAnimationScheduled;
-
- interface StepAnimator {
- /**
- * Continue the stepping of an ongoing animation. When the animation completes this method
- * must disable the animation on the StepAnimator.
- * @param currentTime Animation time in milliseconds. Use SystemClock.uptimeMillis().
- * @return True if the animation is still going on, false if the animation has completed
- * and stepAnimation has cleared the animation locally.
- */
- boolean stepAnimation(long currentTime);
- }
- final ArrayList<StepAnimator> mStepAnimators = new ArrayList<StepAnimator>();
+ final WindowAnimator mAnimator;
+
final class DragInputEventReceiver extends InputEventReceiver {
public DragInputEventReceiver(InputChannel inputChannel, Looper looper) {
super(inputChannel, looper);
@@ -746,6 +745,7 @@
mAllowBootMessages = allowBootMsgs;
}
+ @Override
public void run() {
Looper.prepare();
WindowManagerService s = new WindowManagerService(mContext, mPM,
@@ -785,6 +785,7 @@
mPM = pm;
}
+ @Override
public void run() {
Looper.prepare();
WindowManagerPolicyThread.set(this, Looper.myLooper());
@@ -847,6 +848,7 @@
mHoldingScreenWakeLock.setReferenceCounted(false);
mInputManager = new InputManager(context, this);
+ mAnimator = new WindowAnimator(this, context, mPolicy);
PolicyThread thr = new PolicyThread(mPolicy, this, context, pm);
thr.start();
@@ -1592,8 +1594,7 @@
+ w.isReadyForDisplay() + " drawpending=" + w.mDrawPending
+ " commitdrawpending=" + w.mCommitDrawPending);
if ((w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0 && w.isReadyForDisplay()
- && (mWallpaperTarget == w
- || (!w.mDrawPending && !w.mCommitDrawPending))) {
+ && (mWallpaperTarget == w || w.isDrawnLw())) {
if (DEBUG_WALLPAPER) Slog.v(TAG,
"Found wallpaper activity: #" + i + "=" + w);
foundW = w;
@@ -1922,7 +1923,7 @@
rawChanged = true;
}
- if (rawChanged && (wallpaperWin.getAttrs().privateFlags &
+ if (rawChanged && (wallpaperWin.mAttrs.privateFlags &
WindowManager.LayoutParams.PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS) != 0) {
try {
if (DEBUG_WALLPAPER) Slog.v(TAG, "Report new wp offset "
@@ -2229,7 +2230,7 @@
if (mInTouchMode) {
res |= WindowManagerImpl.ADD_FLAG_IN_TOUCH_MODE;
}
- if (win == null || win.mAppToken == null || !win.mAppToken.clientHidden) {
+ if (win.mAppToken == null || !win.mAppToken.clientHidden) {
res |= WindowManagerImpl.ADD_FLAG_APP_VISIBLE;
}
@@ -2296,7 +2297,7 @@
+ ", surface=" + win.mSurface);
final long origId = Binder.clearCallingIdentity();
-
+
win.disposeInputChannel();
if (DEBUG_APP_TRANSITIONS) Slog.v(
@@ -2314,14 +2315,14 @@
// to hold off on removing the window until the animation is done.
// If the display is frozen, just remove immediately, since the
// animation wouldn't be seen.
- if (win.mSurface != null && !mDisplayFrozen && mDisplayEnabled
- && mPolicy.isScreenOnFully()) {
+ if (win.mSurface != null && okToDisplay()) {
// If we are not currently running the exit animation, we
// need to see about starting one.
- if (wasVisible=win.isWinVisibleLw()) {
+ wasVisible = win.isWinVisibleLw();
+ if (wasVisible) {
int transit = WindowManagerPolicy.TRANSIT_EXIT;
- if (win.getAttrs().type == TYPE_APPLICATION_STARTING) {
+ if (win.mAttrs.type == TYPE_APPLICATION_STARTING) {
transit = WindowManagerPolicy.TRANSIT_PREVIEW_DONE;
}
// Try starting an animation.
@@ -2466,6 +2467,15 @@
Slog.i(TAG, str);
}
}
+
+ static void logSurface(Surface s, String title, String msg, RuntimeException where) {
+ String str = " SURFACE " + s + ": " + msg + " / " + title;
+ if (where != null) {
+ Slog.i(TAG, str, where);
+ } else {
+ Slog.i(TAG, str);
+ }
+ }
void setTransparentRegionWindow(Session session, IWindow client, Region region) {
long origId = Binder.clearCallingIdentity();
@@ -2699,9 +2709,7 @@
win.mEnterAnimationPending = true;
}
if (displayed) {
- if (win.mSurface != null && !win.mDrawPending
- && !win.mCommitDrawPending && !mDisplayFrozen
- && mDisplayEnabled && mPolicy.isScreenOnFully()) {
+ if (win.isDrawnLw() && okToDisplay()) {
applyEnterAnimationLocked(win);
}
if ((win.mAttrs.flags
@@ -2788,7 +2796,7 @@
// Try starting an animation; if there isn't one, we
// can destroy the surface right away.
int transit = WindowManagerPolicy.TRANSIT_EXIT;
- if (win.getAttrs().type == TYPE_APPLICATION_STARTING) {
+ if (win.mAttrs.type == TYPE_APPLICATION_STARTING) {
transit = WindowManagerPolicy.TRANSIT_PREVIEW_DONE;
}
if (!win.mSurfacePendingDestroy && win.isWinVisibleLw() &&
@@ -2995,15 +3003,27 @@
}
void applyEnterAnimationLocked(WindowState win) {
- int transit = WindowManagerPolicy.TRANSIT_SHOW;
+ final int transit;
if (win.mEnterAnimationPending) {
win.mEnterAnimationPending = false;
transit = WindowManagerPolicy.TRANSIT_ENTER;
+ } else {
+ transit = WindowManagerPolicy.TRANSIT_SHOW;
}
applyAnimationLocked(win, transit, true);
}
+ /**
+ * Choose the correct animation and set it to the passed WindowState.
+ * @param win The window to add the animation to.
+ * @param transit If WindowManagerPolicy.TRANSIT_PREVIEW_DONE and the app window has been drawn
+ * then the animation will be app_starting_exit. Any other value loads the animation from
+ * the switch statement below.
+ * @param isEntrance The animation type the last time this was called. Used to keep from
+ * loading the same animation twice.
+ * @return true if an animation has been loaded.
+ */
boolean applyAnimationLocked(WindowState win,
int transit, boolean isEntrance) {
if (win.mLocalAnimating && win.mAnimationIsEntrance == isEntrance) {
@@ -3016,7 +3036,7 @@
// frozen, there is no reason to animate and it can cause strange
// artifacts when we unfreeze the display if some different animation
// is running.
- if (!mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOnFully()) {
+ if (okToDisplay()) {
int anim = mPolicy.selectAnimationLw(win, transit);
int attr = -1;
Animation a = null;
@@ -3096,15 +3116,76 @@
return null;
}
+ private Animation createThumbnailAnimationLocked(int transit,
+ boolean enter, boolean thumb) {
+ Animation a;
+ final float thumbWidth = mNextAppTransitionThumbnail.getWidth();
+ final float thumbHeight = mNextAppTransitionThumbnail.getHeight();
+ // Pick the desired duration. If this is an inter-activity transition,
+ // it is the standard duration for that. Otherwise we use the longer
+ // task transition duration.
+ int duration;
+ switch (transit) {
+ case WindowManagerPolicy.TRANSIT_ACTIVITY_OPEN:
+ case WindowManagerPolicy.TRANSIT_ACTIVITY_CLOSE:
+ duration = mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_shortAnimTime);
+ break;
+ default:
+ duration = 500;
+ break;
+
+ }
+ if (thumb) {
+ // Animation for zooming thumbnail from its initial size to
+ // filling the screen.
+ Animation scale = new ScaleAnimation(
+ 1, mAppDisplayWidth/thumbWidth,
+ 1, mAppDisplayHeight/thumbHeight,
+ mNextAppTransitionStartX + thumbWidth/2,
+ mNextAppTransitionStartY + thumbHeight/2);
+ AnimationSet set = new AnimationSet(true);
+ Animation alpha = new AlphaAnimation(1, 0);
+ scale.setDuration(duration);
+ set.addAnimation(scale);
+ alpha.setDuration(duration);
+ set.addAnimation(alpha);
+ a = set;
+ } else if (enter) {
+ // Entering app zooms out from the center of the thumbnail.
+ a = new ScaleAnimation(
+ thumbWidth/mAppDisplayWidth, 1,
+ thumbHeight/mAppDisplayHeight, 1,
+ mNextAppTransitionStartX + thumbWidth/2,
+ mNextAppTransitionStartY + thumbHeight/2);
+ a.setDuration(duration);
+ } else {
+ // Exiting app just holds in place.
+ a = new AlphaAnimation(1, 1);
+ a.setDuration(duration);
+ }
+ a.setFillAfter(true);
+ final Interpolator interpolator = AnimationUtils.loadInterpolator(mContext,
+ com.android.internal.R.interpolator.decelerate_quint);
+ a.setInterpolator(interpolator);
+ a.initialize(mAppDisplayWidth, mAppDisplayHeight,
+ mAppDisplayWidth, mAppDisplayHeight);
+ return a;
+ }
+
private boolean applyAnimationLocked(AppWindowToken wtoken,
WindowManager.LayoutParams lp, int transit, boolean enter) {
// Only apply an animation if the display isn't frozen. If it is
// frozen, there is no reason to animate and it can cause strange
// artifacts when we unfreeze the display if some different animation
// is running.
- if (!mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOnFully()) {
+ if (okToDisplay()) {
Animation a;
- if (mNextAppTransitionPackage != null) {
+ boolean initialized = false;
+ if (mNextAppTransitionThumbnail != null) {
+ a = createThumbnailAnimationLocked(transit, enter, false);
+ initialized = true;
+ } else if (mNextAppTransitionPackage != null) {
a = loadAnimation(mNextAppTransitionPackage, enter ?
mNextAppTransitionEnter : mNextAppTransitionExit);
} else {
@@ -3176,7 +3257,7 @@
}
Slog.v(TAG, "Loaded animation " + a + " for " + wtoken, e);
}
- wtoken.setAnimation(a);
+ wtoken.setAnimation(a, initialized);
}
} else {
wtoken.clearAnimation();
@@ -3235,6 +3316,10 @@
Slog.w(TAG, msg);
return false;
}
+
+ boolean okToDisplay() {
+ return !mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOnFully();
+ }
AppWindowToken findAppWindowToken(IBinder token) {
WindowToken wtoken = mTokenMap.get(token);
@@ -3244,6 +3329,7 @@
return wtoken.appWindowToken;
}
+ @Override
public void addWindowToken(IBinder token, int type) {
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
"addWindowToken()")) {
@@ -3666,7 +3752,7 @@
if (DEBUG_APP_TRANSITIONS) Slog.v(
TAG, "Prepare app transition: transit=" + transit
+ " mNextAppTransition=" + mNextAppTransition);
- if (!mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOnFully()) {
+ if (okToDisplay()) {
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET
|| mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
mNextAppTransition = transit;
@@ -3700,11 +3786,23 @@
int enterAnim, int exitAnim) {
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
mNextAppTransitionPackage = packageName;
+ mNextAppTransitionThumbnail = null;
mNextAppTransitionEnter = enterAnim;
mNextAppTransitionExit = exitAnim;
}
}
+ public void overridePendingAppTransitionThumb(Bitmap srcThumb, int startX,
+ int startY, IRemoteCallback startedCallback) {
+ if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
+ mNextAppTransitionPackage = null;
+ mNextAppTransitionThumbnail = srcThumb;
+ mNextAppTransitionStartX = startX;
+ mNextAppTransitionStartY = startY;
+ mNextAppTransitionCallback = startedCallback;
+ }
+ }
+
public void executeAppTransition() {
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
"executeAppTransition()")) {
@@ -3750,7 +3848,7 @@
// If the display is frozen, we won't do anything until the
// actual window is displayed so there is no reason to put in
// the starting window.
- if (mDisplayFrozen || !mDisplayEnabled || !mPolicy.isScreenOnFully()) {
+ if (!okToDisplay()) {
return;
}
@@ -3848,6 +3946,19 @@
mH.sendMessageAtFrontOfQueue(m);
return;
}
+ if (ttoken.thumbnail != null) {
+ // The old token is animating with a thumbnail, transfer
+ // that to the new token.
+ if (wtoken.thumbnail != null) {
+ wtoken.thumbnail.destroy();
+ }
+ wtoken.thumbnail = ttoken.thumbnail;
+ wtoken.thumbnailX = ttoken.thumbnailX;
+ wtoken.thumbnailY = ttoken.thumbnailY;
+ wtoken.thumbnailLayer = ttoken.thumbnailLayer;
+ wtoken.thumbnailAnimation = ttoken.thumbnailAnimation;
+ ttoken.thumbnail = null;
+ }
}
}
@@ -3982,8 +4093,7 @@
// If we are being set visible, and the starting window is
// not yet displayed, then make sure it doesn't get displayed.
WindowState swin = wtoken.startingWindow;
- if (swin != null && (swin.mDrawPending
- || swin.mCommitDrawPending)) {
+ if (swin != null && !swin.isDrawnLw()) {
swin.mPolicyVisibility = false;
swin.mPolicyVisibilityAfterAnim = false;
}
@@ -4041,8 +4151,7 @@
// If we are preparing an app transition, then delay changing
// the visibility of this token until we execute that transition.
- if (!mDisplayFrozen && mDisplayEnabled && mPolicy.isScreenOnFully()
- && mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
+ if (okToDisplay() && mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
// Already in requested state, don't do anything more.
if (wtoken.hiddenRequested != visible) {
return;
@@ -4170,7 +4279,7 @@
}
synchronized(mWindowMap) {
- if (configChanges == 0 && !mDisplayFrozen && mPolicy.isScreenOnFully()) {
+ if (configChanges == 0 && okToDisplay()) {
if (DEBUG_ORIENTATION) Slog.v(TAG, "Skipping set freeze of " + token);
return;
}
@@ -4245,6 +4354,7 @@
// Make sure there is no animation running on this token,
// so any windows associated with it will be removed as
// soon as their animations are complete
+ wtoken.clearAnimation();
wtoken.animation = null;
wtoken.animating = false;
}
@@ -5152,8 +5262,8 @@
synchronized(mWindowMap) {
long ident = Binder.clearCallingIdentity();
- dw = mAppDisplayWidth;
- dh = mAppDisplayHeight;
+ dw = mCurDisplayWidth;
+ dh = mCurDisplayHeight;
int aboveAppLayer = mPolicy.windowTypeToLayerLw(
WindowManager.LayoutParams.TYPE_APPLICATION) * TYPE_LAYER_MULTIPLIER
@@ -5273,7 +5383,7 @@
Bitmap bm = Bitmap.createBitmap(width, height, rawss.getConfig());
Matrix matrix = new Matrix();
ScreenRotationAnimation.createRotationMatrix(rot, dw, dh, matrix);
- matrix.postTranslate(-(int)(frame.left*scale), -(int)(frame.top*scale));
+ matrix.postTranslate(-FloatMath.ceil(frame.left*scale), -FloatMath.ceil(frame.top*scale));
Canvas canvas = new Canvas(bm);
canvas.drawBitmap(rawss, matrix, null);
canvas.setBitmap(null);
@@ -5391,7 +5501,8 @@
return false;
}
- if (mScreenRotationAnimation != null && mScreenRotationAnimation.isAnimating()) {
+ if (mAnimator.mScreenRotationAnimation != null &&
+ mAnimator.mScreenRotationAnimation.isAnimating()) {
// Rotation updates cannot be performed while the previous rotation change
// animation is still in progress. Skip this update. We will try updating
// again after the animation is finished and the display is unfrozen.
@@ -5461,9 +5572,9 @@
try {
// NOTE: We disable the rotation in the emulator because
// it doesn't support hardware OpenGL emulation yet.
- if (CUSTOM_SCREEN_ROTATION && mScreenRotationAnimation != null
- && mScreenRotationAnimation.hasScreenshot()) {
- if (mScreenRotationAnimation.setRotation(rotation, mFxSession,
+ if (CUSTOM_SCREEN_ROTATION && mAnimator.mScreenRotationAnimation != null
+ && mAnimator.mScreenRotationAnimation.hasScreenshot()) {
+ if (mAnimator.mScreenRotationAnimation.setRotation(rotation, mFxSession,
MAX_ANIMATION_DURATION, mTransitionAnimationScale,
mCurDisplayWidth, mCurDisplayHeight)) {
scheduleAnimationLocked();
@@ -5478,7 +5589,7 @@
}
}
- rebuildBlackFrame(inTransaction);
+ rebuildBlackFrame();
for (int i=mWindows.size()-1; i>=0; i--) {
WindowState w = mWindows.get(i);
@@ -6165,6 +6276,8 @@
synchronized(mDisplaySizeLock) {
mAppDisplayWidth = appWidth;
mAppDisplayHeight = appHeight;
+ mAnimator.setDisplayDimensions(mCurDisplayWidth, mCurDisplayHeight,
+ mAppDisplayWidth, mAppDisplayHeight);
}
if (false) {
Slog.i(TAG, "Set app display size: " + mAppDisplayWidth
@@ -6551,6 +6664,8 @@
}
mBaseDisplayWidth = mCurDisplayWidth = mAppDisplayWidth = mInitialDisplayWidth;
mBaseDisplayHeight = mCurDisplayHeight = mAppDisplayHeight = mInitialDisplayHeight;
+ mAnimator.setDisplayDimensions(mCurDisplayWidth, mCurDisplayHeight,
+ mAppDisplayWidth, mAppDisplayHeight);
}
mInputManager.setDisplaySize(Display.DEFAULT_DISPLAY,
mDisplay.getRawWidth(), mDisplay.getRawHeight(),
@@ -7153,45 +7268,32 @@
}
}
- private void rebuildBlackFrame(boolean inTransaction) {
- if (!inTransaction) {
- if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
- ">>> OPEN TRANSACTION rebuildBlackFrame");
- Surface.openTransaction();
+ private void rebuildBlackFrame() {
+ if (mBlackFrame != null) {
+ mBlackFrame.kill();
+ mBlackFrame = null;
}
- try {
- if (mBlackFrame != null) {
- mBlackFrame.kill();
- mBlackFrame = null;
+ if (mBaseDisplayWidth < mInitialDisplayWidth
+ || mBaseDisplayHeight < mInitialDisplayHeight) {
+ int initW, initH, baseW, baseH;
+ final boolean rotated = (mRotation == Surface.ROTATION_90
+ || mRotation == Surface.ROTATION_270);
+ if (rotated) {
+ initW = mInitialDisplayHeight;
+ initH = mInitialDisplayWidth;
+ baseW = mBaseDisplayHeight;
+ baseH = mBaseDisplayWidth;
+ } else {
+ initW = mInitialDisplayWidth;
+ initH = mInitialDisplayHeight;
+ baseW = mBaseDisplayWidth;
+ baseH = mBaseDisplayHeight;
}
- if (mBaseDisplayWidth < mInitialDisplayWidth
- || mBaseDisplayHeight < mInitialDisplayHeight) {
- int initW, initH, baseW, baseH;
- final boolean rotated = (mRotation == Surface.ROTATION_90
- || mRotation == Surface.ROTATION_270);
- if (rotated) {
- initW = mInitialDisplayHeight;
- initH = mInitialDisplayWidth;
- baseW = mBaseDisplayHeight;
- baseH = mBaseDisplayWidth;
- } else {
- initW = mInitialDisplayWidth;
- initH = mInitialDisplayHeight;
- baseW = mBaseDisplayWidth;
- baseH = mBaseDisplayHeight;
- }
- Rect outer = new Rect(0, 0, initW, initH);
- Rect inner = new Rect(0, 0, baseW, baseH);
- try {
- mBlackFrame = new BlackFrame(mFxSession, outer, inner, MASK_LAYER);
- } catch (Surface.OutOfResourcesException e) {
- }
- }
- } finally {
- if (!inTransaction) {
- Surface.closeTransaction();
- if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
- "<<< CLOSE TRANSACTION rebuildBlackFrame");
+ Rect outer = new Rect(0, 0, initW, initH);
+ Rect inner = new Rect(0, 0, baseW, baseH);
+ try {
+ mBlackFrame = new BlackFrame(mFxSession, outer, inner, MASK_LAYER);
+ } catch (Surface.OutOfResourcesException e) {
}
}
}
@@ -7242,7 +7344,7 @@
mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
}
- rebuildBlackFrame(false);
+ rebuildBlackFrame();
performLayoutAndPlaceSurfacesLocked();
}
@@ -7480,10 +7582,25 @@
} else {
mInLayout = false;
- if (mLayoutNeeded) {
- requestTraversalLocked();
- }
}
+
+ if (mLayoutNeeded) {
+ if (++mLayoutRepeatCount < 6) {
+ requestTraversalLocked();
+ } else {
+ Slog.e(TAG, "Performed 6 layouts in a row. Skipping");
+ mLayoutRepeatCount = 0;
+ }
+ } else {
+ mLayoutRepeatCount = 0;
+ }
+
+ if (mAnimator.mAnimating) {
+ // Do this even if requestTraversalLocked was called above so we get a frame drawn
+ // at the proper time as well as the one drawn early.
+ scheduleAnimationLocked();
+ }
+
if (mWindowsChanged && !mWindowChangeListeners.isEmpty()) {
mH.removeMessages(H.REPORT_WINDOWS_CHANGE);
mH.sendMessage(mH.obtainMessage(H.REPORT_WINDOWS_CHANGE));
@@ -7627,7 +7744,7 @@
// If the screen is currently frozen or off, then keep
// it frozen/off until this window draws at its new
// orientation.
- if (mDisplayFrozen || !mPolicy.isScreenOnFully()) {
+ if (!okToDisplay()) {
if (DEBUG_ORIENTATION) Slog.v(TAG,
"Changing surface while display frozen: " + w);
w.mOrientationChanging = true;
@@ -7643,318 +7760,6 @@
}
/**
- * Run through each of the animating objects saved in mStepAnimators.
- */
- private void stepAnimations() {
- final long currentTime = SystemClock.uptimeMillis();
- for (final StepAnimator stepAnimator : mStepAnimators) {
- final boolean more = stepAnimator.stepAnimation(currentTime);
- if (DEBUG_ANIM) {
- Slog.v(TAG, "stepAnimations: " + currentTime + ": Stepped " + stepAnimator
- + (more ? " more" : " done"));
- }
- }
- }
-
- /**
- * Extracted from {@link #performLayoutAndPlaceSurfacesLockedInner} to reduce size of method.
- * Update animations of all applications, including those associated with exiting/removed apps.
- *
- * @param currentTime The time which animations use for calculating transitions.
- * @param innerDw Width of app window.
- * @param innerDh Height of app window.
- */
- private void updateWindowsAppsAndRotationAnimationsLocked(long currentTime,
- int innerDw, int innerDh) {
- int i;
- final int NAT = mAppTokens.size();
- for (i=0; i<NAT; i++) {
- final AppWindowToken appToken = mAppTokens.get(i);
- if (appToken.startAndFinishAnimationLocked(currentTime, innerDw, innerDh)) {
- mStepAnimators.add(appToken);
- mInnerFields.mAnimating = true;
- }
- }
- final int NEAT = mExitingAppTokens.size();
- for (i=0; i<NEAT; i++) {
- final AppWindowToken appToken = mExitingAppTokens.get(i);
- if (appToken.startAndFinishAnimationLocked(currentTime, innerDw, innerDh)) {
- mStepAnimators.add(appToken);
- mInnerFields.mAnimating = true;
- }
- }
-
- if (mScreenRotationAnimation != null) {
- if (mScreenRotationAnimation.isAnimating() ||
- mScreenRotationAnimation.mFinishAnimReady) {
- if (mScreenRotationAnimation.startAndFinishAnimationLocked(currentTime)) {
- mInnerFields.mUpdateRotation = false;
- mInnerFields.mAnimating = true;
- mStepAnimators.add(mScreenRotationAnimation);
- } else {
- mInnerFields.mUpdateRotation = true;
- mScreenRotationAnimation.kill();
- mScreenRotationAnimation = null;
- }
- }
- }
- }
-
- /**
- * Extracted from {@link #performLayoutAndPlaceSurfacesLockedInner} to reduce size of method.
- *
- * @param currentTime The time which animations use for calculating transitions.
- * @param dw Width of app window.
- * @param dh Height of app window.
- * @param innerDw Width of app window.
- * @param innerDh Height of app window.
- */
- private int updateWindowsAndWallpaperLocked(final long currentTime, final int dw, final int dh,
- final int innerDw, final int innerDh) {
-
- mPolicy.beginAnimationLw(dw, dh);
-
- for (int i = mWindows.size() - 1; i >= 0; i--) {
- WindowState w = mWindows.get(i);
-
- final WindowManager.LayoutParams attrs = w.mAttrs;
-
- if (w.mSurface != null) {
- // Take care of the window being ready to display.
- if (w.commitFinishDrawingLocked(currentTime)) {
- if ((w.mAttrs.flags
- & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) {
- if (DEBUG_WALLPAPER) Slog.v(TAG,
- "First draw done in potential wallpaper target " + w);
- mInnerFields.mWallpaperMayChange = true;
- }
- }
-
- // If the window has moved due to its containing
- // content frame changing, then we'd like to animate
- // it. The checks here are ordered by what is least
- // likely to be true first.
- if (w.shouldAnimateMove()) {
- // Frame has moved, containing content frame
- // has also moved, and we're not currently animating...
- // let's do something.
- Animation a = AnimationUtils.loadAnimation(mContext,
- com.android.internal.R.anim.window_move_from_decor);
- w.setAnimation(a);
- w.mAnimDw = w.mLastFrame.left - w.mFrame.left;
- w.mAnimDh = w.mLastFrame.top - w.mFrame.top;
- } else {
- w.mAnimDw = innerDw;
- w.mAnimDh = innerDh;
- }
-
- final boolean wasAnimating = w.mWasAnimating;
-
-
- final boolean nowAnimating = w.startAndFinishAnimationLocked(currentTime);
- if (nowAnimating) {
- mStepAnimators.add(w);
- mInnerFields.mAnimating = true;
- }
-
- if (DEBUG_WALLPAPER) {
- Slog.v(TAG, w + ": wasAnimating=" + wasAnimating +
- ", nowAnimating=" + nowAnimating);
- }
-
- // If this window is animating, make a note that we have
- // an animating window and take care of a request to run
- // a detached wallpaper animation.
- if (nowAnimating) {
- if (w.mAnimation != null) {
- if ((w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0
- && w.mAnimation.getDetachWallpaper()) {
- mInnerFields.mDetachedWallpaper = w;
- }
- if (w.mAnimation.getBackgroundColor() != 0) {
- if (mInnerFields.mWindowAnimationBackground == null
- || (w.mAnimLayer <
- mInnerFields.mWindowAnimationBackground.mAnimLayer)) {
- mInnerFields.mWindowAnimationBackground = w;
- mInnerFields.mWindowAnimationBackgroundColor =
- w.mAnimation.getBackgroundColor();
- }
- }
- }
- mInnerFields.mAnimating = true;
- }
-
- // If this window's app token is running a detached wallpaper
- // animation, make a note so we can ensure the wallpaper is
- // displayed behind it.
- if (w.mAppToken != null && w.mAppToken.animation != null
- && w.mAppToken.animating) {
- if ((w.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0
- && w.mAppToken.animation.getDetachWallpaper()) {
- mInnerFields.mDetachedWallpaper = w;
- }
- if (w.mAppToken.animation.getBackgroundColor() != 0) {
- if (mInnerFields.mWindowAnimationBackground == null
- || (w.mAnimLayer <
- mInnerFields.mWindowAnimationBackground.mAnimLayer)) {
- mInnerFields.mWindowAnimationBackground = w;
- mInnerFields.mWindowAnimationBackgroundColor =
- w.mAppToken.animation.getBackgroundColor();
- }
- }
- }
-
- if (wasAnimating && !w.mAnimating && mWallpaperTarget == w) {
- mInnerFields.mWallpaperMayChange = true;
- }
-
- if (mPolicy.doesForceHide(w, attrs)) {
- if (!wasAnimating && nowAnimating) {
- if (DEBUG_VISIBILITY) Slog.v(TAG,
- "Animation started that could impact force hide: "
- + w);
- mInnerFields.mWallpaperForceHidingChanged = true;
- mFocusMayChange = true;
- } else if (w.isReadyForDisplay() && w.mAnimation == null) {
- mInnerFields.mForceHiding = true;
- }
- } else if (mPolicy.canBeForceHidden(w, attrs)) {
- boolean changed;
- if (mInnerFields.mForceHiding) {
- changed = w.hideLw(false, false);
- if (DEBUG_VISIBILITY && changed) Slog.v(TAG,
- "Now policy hidden: " + w);
- } else {
- changed = w.showLw(false, false);
- if (DEBUG_VISIBILITY && changed) Slog.v(TAG,
- "Now policy shown: " + w);
- if (changed) {
- if (mInnerFields.mWallpaperForceHidingChanged
- && w.isVisibleNow() /*w.isReadyForDisplay()*/) {
- // Assume we will need to animate. If
- // we don't (because the wallpaper will
- // stay with the lock screen), then we will
- // clean up later.
- Animation a = mPolicy.createForceHideEnterAnimation();
- if (a != null) {
- w.setAnimation(a);
- }
- }
- if (mCurrentFocus == null ||
- mCurrentFocus.mLayer < w.mLayer) {
- // We are showing on to of the current
- // focus, so re-evaluate focus to make
- // sure it is correct.
- mFocusMayChange = true;
- }
- }
- }
- if (changed && (attrs.flags
- & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) {
- mInnerFields.mWallpaperMayChange = true;
- }
- }
-
- mPolicy.animatingWindowLw(w, attrs);
- }
-
- final AppWindowToken atoken = w.mAppToken;
- if (atoken != null && (!atoken.allDrawn || atoken.freezingScreen)) {
- if (atoken.lastTransactionSequence != mTransactionSequence) {
- atoken.lastTransactionSequence = mTransactionSequence;
- atoken.numInterestingWindows = atoken.numDrawnWindows = 0;
- atoken.startingDisplayed = false;
- }
- if ((w.isOnScreen() || w.mAttrs.type
- == WindowManager.LayoutParams.TYPE_BASE_APPLICATION)
- && !w.mExiting && !w.mDestroying) {
- if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) {
- Slog.v(TAG, "Eval win " + w + ": isDrawn="
- + w.isDrawnLw()
- + ", isAnimating=" + w.isAnimating());
- if (!w.isDrawnLw()) {
- Slog.v(TAG, "Not displayed: s=" + w.mSurface
- + " pv=" + w.mPolicyVisibility
- + " dp=" + w.mDrawPending
- + " cdp=" + w.mCommitDrawPending
- + " ah=" + w.mAttachedHidden
- + " th=" + atoken.hiddenRequested
- + " a=" + w.mAnimating);
- }
- }
- if (w != atoken.startingWindow) {
- if (!atoken.freezingScreen || !w.mAppFreezing) {
- atoken.numInterestingWindows++;
- if (w.isDrawnLw()) {
- atoken.numDrawnWindows++;
- if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG,
- "tokenMayBeDrawn: " + atoken
- + " freezingScreen=" + atoken.freezingScreen
- + " mAppFreezing=" + w.mAppFreezing);
- mInnerFields.mTokenMayBeDrawn = true;
- }
- }
- } else if (w.isDrawnLw()) {
- atoken.startingDisplayed = true;
- }
- }
- } else if (w.mReadyToShow) {
- w.performShowLocked();
- }
- } // end forall windows
-
- return mPolicy.finishAnimationLw();
- }
-
- /**
- * Extracted from {@link #performLayoutAndPlaceSurfacesLockedInner} to reduce size of method.
- *
- * @return bitmap indicating if another pass through layout must be made.
- */
- private int testTokenMayBeDrawnLocked() {
- int changes = 0;
- // See if any windows have been drawn, so they (and others
- // associated with them) can now be shown.
- final int NT = mAppTokens.size();
- for (int i=0; i<NT; i++) {
- AppWindowToken wtoken = mAppTokens.get(i);
- if (wtoken.freezingScreen) {
- int numInteresting = wtoken.numInterestingWindows;
- if (numInteresting > 0 && wtoken.numDrawnWindows >= numInteresting) {
- if (DEBUG_VISIBILITY) Slog.v(TAG,
- "allDrawn: " + wtoken
- + " interesting=" + numInteresting
- + " drawn=" + wtoken.numDrawnWindows);
- wtoken.showAllWindowsLocked();
- unsetAppFreezingScreenLocked(wtoken, false, true);
- if (DEBUG_ORIENTATION) Slog.i(TAG,
- "Setting mOrientationChangeComplete=true because wtoken "
- + wtoken + " numInteresting=" + numInteresting
- + " numDrawn=" + wtoken.numDrawnWindows);
- mInnerFields.mOrientationChangeComplete = true;
- }
- } else if (!wtoken.allDrawn) {
- int numInteresting = wtoken.numInterestingWindows;
- if (numInteresting > 0 && wtoken.numDrawnWindows >= numInteresting) {
- if (DEBUG_VISIBILITY) Slog.v(TAG,
- "allDrawn: " + wtoken
- + " interesting=" + numInteresting
- + " drawn=" + wtoken.numDrawnWindows);
- wtoken.allDrawn = true;
- changes |= PhoneWindowManager.FINISH_LAYOUT_REDO_ANIM;
-
- // We can now show all of the drawn windows!
- if (!mOpeningApps.contains(wtoken)) {
- wtoken.showAllWindowsLocked();
- }
- }
- }
- }
-
- return changes;
- }
-
- /**
* Extracted from {@link #performLayoutAndPlaceSurfacesLockedInner} to reduce size of method.
*
* @return bitmap indicating if another pass through layout must be made.
@@ -8117,11 +7922,15 @@
animLp = null;
}
+ AppWindowToken topOpeningApp = null;
+ int topOpeningLayer = 0;
+
NN = mOpeningApps.size();
for (i=0; i<NN; i++) {
AppWindowToken wtoken = mOpeningApps.get(i);
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"Now opening app" + wtoken);
+ wtoken.clearThumbnail();
wtoken.reportedVisible = false;
wtoken.inPendingTransaction = false;
wtoken.animation = null;
@@ -8129,13 +7938,27 @@
transit, false);
wtoken.updateReportedVisibilityLocked();
wtoken.waitingToShow = false;
- wtoken.showAllWindowsLocked();
+ mAnimator.mAnimating |= wtoken.showAllWindowsLocked();
+ if (animLp != null) {
+ int layer = -1;
+ for (int j=0; j<wtoken.windows.size(); j++) {
+ WindowState win = wtoken.windows.get(j);
+ if (win.mAnimLayer > layer) {
+ layer = win.mAnimLayer;
+ }
+ }
+ if (topOpeningApp == null || layer > topOpeningLayer) {
+ topOpeningApp = wtoken;
+ topOpeningLayer = layer;
+ }
+ }
}
NN = mClosingApps.size();
for (i=0; i<NN; i++) {
AppWindowToken wtoken = mClosingApps.get(i);
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"Now closing app" + wtoken);
+ wtoken.clearThumbnail();
wtoken.inPendingTransaction = false;
wtoken.animation = null;
setTokenVisibilityLocked(wtoken, animLp, false,
@@ -8148,7 +7971,47 @@
wtoken.allDrawn = true;
}
+ if (mNextAppTransitionThumbnail != null && topOpeningApp != null
+ && topOpeningApp.animation != null) {
+ // This thumbnail animation is very special, we need to have
+ // an extra surface with the thumbnail included with the animation.
+ Rect dirty = new Rect(0, 0, mNextAppTransitionThumbnail.getWidth(),
+ mNextAppTransitionThumbnail.getHeight());
+ try {
+ Surface surface = new Surface(mFxSession, Process.myPid(),
+ "thumbnail anim", 0, dirty.width(), dirty.height(),
+ PixelFormat.TRANSLUCENT, Surface.HIDDEN);
+ topOpeningApp.thumbnail = surface;
+ if (SHOW_TRANSACTIONS) Slog.i(TAG, " THUMBNAIL "
+ + surface + ": CREATE");
+ Surface drawSurface = new Surface();
+ drawSurface.copyFrom(surface);
+ Canvas c = drawSurface.lockCanvas(dirty);
+ c.drawBitmap(mNextAppTransitionThumbnail, 0, 0, null);
+ drawSurface.unlockCanvasAndPost(c);
+ drawSurface.release();
+ topOpeningApp.thumbnailLayer = topOpeningLayer;
+ Animation anim = createThumbnailAnimationLocked(transit, true, true);
+ topOpeningApp.thumbnailAnimation = anim;
+ anim.restrictDuration(MAX_ANIMATION_DURATION);
+ anim.scaleCurrentDuration(mTransitionAnimationScale);
+ topOpeningApp.thumbnailX = mNextAppTransitionStartX;
+ topOpeningApp.thumbnailY = mNextAppTransitionStartY;
+ } catch (Surface.OutOfResourcesException e) {
+ Slog.e(TAG, "Can't allocate thumbnail surface w=" + dirty.width()
+ + " h=" + dirty.height(), e);
+ topOpeningApp.clearThumbnail();
+ }
+ }
+
mNextAppTransitionPackage = null;
+ mNextAppTransitionThumbnail = null;
+ if (mNextAppTransitionCallback != null) {
+ try {
+ mNextAppTransitionCallback.sendResult(null);
+ } catch (RemoteException e) {
+ }
+ }
mOpeningApps.clear();
mClosingApps.clear();
@@ -8227,14 +8090,14 @@
if (mLowerWallpaperTarget == null) {
// Whoops, we don't need a special wallpaper animation.
// Clear them out.
- mInnerFields.mForceHiding = false;
+ mAnimator.mForceHiding = false;
for (int i=mWindows.size()-1; i>=0; i--) {
WindowState w = mWindows.get(i);
if (w.mSurface != null) {
final WindowManager.LayoutParams attrs = w.mAttrs;
if (mPolicy.doesForceHide(w, attrs) && w.isVisibleLw()) {
if (DEBUG_FOCUS) Slog.i(TAG, "win=" + w + " force hides other windows");
- mInnerFields.mForceHiding = true;
+ mAnimator.mForceHiding = true;
} else if (mPolicy.canBeForceHidden(w, attrs)) {
if (!w.mAnimating) {
// We set the animation above so it
@@ -8265,14 +8128,14 @@
mInnerFields.mWallpaperMayChange = true;
}
- if (mInnerFields.mWindowAnimationBackgroundColor != 0) {
+ if (mAnimator.mWindowAnimationBackgroundColor != 0) {
// If the window that wants black is the current wallpaper
// target, then the black goes *below* the wallpaper so we
// don't cause the wallpaper to suddenly disappear.
- WindowState target = mInnerFields.mWindowAnimationBackground;
- if (mWallpaperTarget == mInnerFields.mWindowAnimationBackground
- || mLowerWallpaperTarget == mInnerFields.mWindowAnimationBackground
- || mUpperWallpaperTarget == mInnerFields.mWindowAnimationBackground) {
+ WindowState target = mAnimator.mWindowAnimationBackground;
+ if (mWallpaperTarget == target
+ || mLowerWallpaperTarget == target
+ || mUpperWallpaperTarget == target) {
for (int i=0; i<mWindows.size(); i++) {
WindowState w = mWindows.get(i);
if (w.mIsWallpaper) {
@@ -8288,7 +8151,7 @@
final int dh = mCurDisplayHeight;
mWindowAnimationBackgroundSurface.show(dw, dh,
target.mAnimLayer - LAYER_OFFSET_DIM,
- mInnerFields.mWindowAnimationBackgroundColor);
+ mAnimator.mWindowAnimationBackgroundColor);
} else if (mWindowAnimationBackgroundSurface != null) {
mWindowAnimationBackgroundSurface.hide();
}
@@ -8322,91 +8185,7 @@
return changes;
}
- /**
- * Extracted from {@link #performLayoutAndPlaceSurfacesLockedInner} to reduce size of method.
- *
- * @param w WindowState whos Surface is being prepared.
- * @param recoveringMemory true if the caller will reclaim surface memory on error.
- */
- public void prepareSurfaceLocked(final WindowState w, final boolean recoveringMemory) {
- // XXX NOTE: The logic here could be improved. We have
- // the decision about whether to resize a window separated
- // from whether to hide the surface. This can cause us to
- // resize a surface even if we are going to hide it. You
- // can see this by (1) holding device in landscape mode on
- // home screen; (2) tapping browser icon (device will rotate
- // to landscape; (3) tap home. The wallpaper will be resized
- // in step 2 but then immediately hidden, causing us to
- // have to resize and then redraw it again in step 3. It
- // would be nice to figure out how to avoid this, but it is
- // difficult because we do need to resize surfaces in some
- // cases while they are hidden such as when first showing a
- // window.
-
- boolean displayed = false;
-
- w.computeShownFrameLocked();
-
- int width, height;
- if ((w.mAttrs.flags & w.mAttrs.FLAG_SCALED) != 0) {
- // for a scaled surface, we just want to use
- // the requested size.
- width = w.mRequestedWidth;
- height = w.mRequestedHeight;
- } else {
- width = w.mCompatFrame.width();
- height = w.mCompatFrame.height();
- }
-
- if (width < 1) {
- width = 1;
- }
- if (height < 1) {
- height = 1;
- }
- final boolean surfaceResized = w.mSurfaceW != width || w.mSurfaceH != height;
- if (surfaceResized) {
- w.mSurfaceW = width;
- w.mSurfaceH = height;
- }
-
- if (w.mSurfaceX != w.mShownFrame.left
- || w.mSurfaceY != w.mShownFrame.top) {
- try {
- if (SHOW_TRANSACTIONS) logSurface(w,
- "POS " + w.mShownFrame.left
- + ", " + w.mShownFrame.top, null);
- w.mSurfaceX = w.mShownFrame.left;
- w.mSurfaceY = w.mShownFrame.top;
- w.mSurface.setPosition(w.mShownFrame.left, w.mShownFrame.top);
- } catch (RuntimeException e) {
- Slog.w(TAG, "Error positioning surface of " + w
- + " pos=(" + w.mShownFrame.left
- + "," + w.mShownFrame.top + ")", e);
- if (!recoveringMemory) {
- reclaimSomeSurfaceMemoryLocked(w, "position", true);
- }
- }
- }
-
- if (surfaceResized) {
- try {
- if (SHOW_TRANSACTIONS) logSurface(w,
- "SIZE " + width + "x" + height, null);
- w.mSurfaceResized = true;
- w.mSurface.setSize(width, height);
- } catch (RuntimeException e) {
- // If something goes wrong with the surface (such
- // as running out of memory), don't take down the
- // entire system.
- Slog.e(TAG, "Error resizing surface of " + w
- + " size=(" + width + "x" + height + ")", e);
- if (!recoveringMemory) {
- reclaimSomeSurfaceMemoryLocked(w, "size", true);
- }
- }
- }
-
+ private void updateResizingWindows(final WindowState w) {
if (!w.mAppFreezing && w.mLayoutSeq == mLayoutSeq) {
w.mContentInsetsChanged |=
!w.mLastContentInsets.equals(w.mContentInsets);
@@ -8462,7 +8241,7 @@
mResizingWindows.add(w);
}
} else if (w.mOrientationChanging) {
- if (!w.mDrawPending && !w.mCommitDrawPending) {
+ if (w.isDrawnLw()) {
if (DEBUG_ORIENTATION) Slog.v(TAG,
"Orientation not waiting for draw in "
+ w + ", surface " + w.mSurface);
@@ -8470,109 +8249,6 @@
}
}
}
-
- if (w.mAttachedHidden || !w.isReadyForDisplay()) {
- if (!w.mLastHidden) {
- //dump();
- w.mLastHidden = true;
- if (SHOW_TRANSACTIONS) logSurface(w,
- "HIDE (performLayout)", null);
- if (w.mSurface != null) {
- w.mSurfaceShown = false;
- try {
- w.mSurface.hide();
- } catch (RuntimeException e) {
- Slog.w(TAG, "Exception hiding surface in " + w);
- }
- }
- }
- // If we are waiting for this window to handle an
- // orientation change, well, it is hidden, so
- // doesn't really matter. Note that this does
- // introduce a potential glitch if the window
- // becomes unhidden before it has drawn for the
- // new orientation.
- if (w.mOrientationChanging) {
- w.mOrientationChanging = false;
- if (DEBUG_ORIENTATION) Slog.v(TAG,
- "Orientation change skips hidden " + w);
- }
- } else if (w.mLastLayer != w.mAnimLayer
- || w.mLastAlpha != w.mShownAlpha
- || w.mLastDsDx != w.mDsDx
- || w.mLastDtDx != w.mDtDx
- || w.mLastDsDy != w.mDsDy
- || w.mLastDtDy != w.mDtDy
- || w.mLastHScale != w.mHScale
- || w.mLastVScale != w.mVScale
- || w.mLastHidden) {
- displayed = true;
- w.mLastAlpha = w.mShownAlpha;
- w.mLastLayer = w.mAnimLayer;
- w.mLastDsDx = w.mDsDx;
- w.mLastDtDx = w.mDtDx;
- w.mLastDsDy = w.mDsDy;
- w.mLastDtDy = w.mDtDy;
- w.mLastHScale = w.mHScale;
- w.mLastVScale = w.mVScale;
- if (SHOW_TRANSACTIONS) logSurface(w,
- "alpha=" + w.mShownAlpha + " layer=" + w.mAnimLayer
- + " matrix=[" + (w.mDsDx*w.mHScale)
- + "," + (w.mDtDx*w.mVScale)
- + "][" + (w.mDsDy*w.mHScale)
- + "," + (w.mDtDy*w.mVScale) + "]", null);
- if (w.mSurface != null) {
- try {
- w.mSurfaceAlpha = w.mShownAlpha;
- w.mSurface.setAlpha(w.mShownAlpha);
- w.mSurfaceLayer = w.mAnimLayer;
- w.mSurface.setLayer(w.mAnimLayer);
- w.mSurface.setMatrix(
- w.mDsDx*w.mHScale, w.mDtDx*w.mVScale,
- w.mDsDy*w.mHScale, w.mDtDy*w.mVScale);
- } catch (RuntimeException e) {
- Slog.w(TAG, "Error updating surface in " + w, e);
- if (!recoveringMemory) {
- reclaimSomeSurfaceMemoryLocked(w, "update", true);
- }
- }
- }
-
- if (w.mLastHidden && !w.mDrawPending
- && !w.mCommitDrawPending
- && !w.mReadyToShow) {
- if (SHOW_TRANSACTIONS) logSurface(w,
- "SHOW (performLayout)", null);
- if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + w
- + " during relayout");
- if (showSurfaceRobustlyLocked(w)) {
- w.mHasDrawn = true;
- w.mLastHidden = false;
- } else {
- w.mOrientationChanging = false;
- }
- }
- if (w.mSurface != null) {
- w.mToken.hasVisible = true;
- }
- } else {
- displayed = true;
- }
-
- if (displayed) {
- if (w.mOrientationChanging) {
- if (w.mDrawPending || w.mCommitDrawPending) {
- mInnerFields.mOrientationChangeComplete = false;
- if (DEBUG_ORIENTATION) Slog.v(TAG,
- "Orientation continue waiting for draw in " + w);
- } else {
- w.mOrientationChanging = false;
- if (DEBUG_ORIENTATION) Slog.v(TAG,
- "Orientation change complete in " + w);
- }
- }
- w.mToken.hasVisible = true;
- }
}
/**
@@ -8612,68 +8288,24 @@
boolean opaqueDrawn = canBeSeen && w.isOpaqueDrawn();
if (opaqueDrawn && w.isFullscreen(innerDw, innerDh)) {
// This window completely covers everything behind it,
- // so we want to leave all of them as unblurred (for
+ // so we want to leave all of them as undimmed (for
// performance reasons).
mInnerFields.mObscured = true;
- } else if (canBeSeen && (attrFlags & (FLAG_BLUR_BEHIND | FLAG_DIM_BEHIND)) != 0) {
- if (localLOGV) Slog.v(TAG, "Win " + w
- + ": blurring=" + mInnerFields.mBlurring
- + " obscured=" + mInnerFields.mObscured);
- if ((attrFlags&FLAG_DIM_BEHIND) != 0) {
- if (!mInnerFields.mDimming) {
- //Slog.i(TAG, "DIM BEHIND: " + w);
- mInnerFields.mDimming = true;
- if (mDimAnimator == null) {
- mDimAnimator = new DimAnimator(mFxSession);
- }
- if (attrs.type == WindowManager.LayoutParams.TYPE_BOOT_PROGRESS) {
- mDimAnimator.show(mCurDisplayWidth, mCurDisplayHeight);
- } else {
- mDimAnimator.show(innerDw, innerDh);
- }
+ } else if (canBeSeen && (attrFlags & FLAG_DIM_BEHIND) != 0) {
+ if (localLOGV) Slog.v(TAG, "Win " + w + " obscured=" + mInnerFields.mObscured);
+ if (!mInnerFields.mDimming) {
+ //Slog.i(TAG, "DIM BEHIND: " + w);
+ mInnerFields.mDimming = true;
+ if (mDimAnimator == null) {
+ mDimAnimator = new DimAnimator(mFxSession);
+ }
+ if (attrs.type == WindowManager.LayoutParams.TYPE_BOOT_PROGRESS) {
+ mDimAnimator.show(mCurDisplayWidth, mCurDisplayHeight);
+ } else {
mDimAnimator.show(innerDw, innerDh);
- mDimAnimator.updateParameters(mContext.getResources(),
- w, currentTime);
}
- }
- if ((attrFlags & FLAG_BLUR_BEHIND) != 0) {
- if (!mInnerFields.mBlurring) {
- //Slog.i(TAG, "BLUR BEHIND: " + w);
- mInnerFields.mBlurring = true;
- if (mBlurSurface == null) {
- try {
- mBlurSurface = new Surface(mFxSession, 0,
- "BlurSurface",
- -1, 16, 16,
- PixelFormat.OPAQUE,
- Surface.FX_SURFACE_BLUR);
- } catch (Exception e) {
- Slog.e(TAG, "Exception creating Blur surface", e);
- }
- if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR "
- + mBlurSurface + ": CREATE");
- }
- final int dw = mCurDisplayWidth;
- final int dh = mCurDisplayHeight;
- if (mBlurSurface != null) {
- if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR "
- + mBlurSurface + ": pos=(0,0) (" +
- dw + "x" + dh + "), layer=" + (w.mAnimLayer-1));
- mBlurSurface.setPosition(0, 0);
- mBlurSurface.setSize(dw, dh);
- mBlurSurface.setLayer(w.mAnimLayer-LAYER_OFFSET_BLUR);
- if (!mBlurShown) {
- try {
- if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR "
- + mBlurSurface + ": SHOW");
- mBlurSurface.show();
- } catch (RuntimeException e) {
- Slog.w(TAG, "Failure showing blur surface", e);
- }
- mBlurShown = true;
- }
- }
- }
+ mDimAnimator.updateParameters(mContext.getResources(),
+ w, currentTime);
}
}
}
@@ -8715,7 +8347,7 @@
mInnerFields.mScreenBrightness = -1;
mInnerFields.mButtonBrightness = -1;
boolean focusDisplayed = false;
- mInnerFields.mAnimating = false;
+ mAnimator.mAnimating = false;
boolean createWatermark = false;
if (mFxSession == null) {
@@ -8741,7 +8373,6 @@
try {
mInnerFields.mWallpaperForceHidingChanged = false;
int repeats = 0;
- int changes = 0;
do {
repeats++;
@@ -8751,20 +8382,24 @@
break;
}
- if ((changes & WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) {
+ if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("On entry to LockedInner");
+
+ if ((mPendingLayoutChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) {
if ((adjustWallpaperWindowsLocked()&ADJUST_WALLPAPER_LAYERS_CHANGED) != 0) {
assignLayersLocked();
mLayoutNeeded = true;
}
}
- if ((changes & WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG) != 0) {
+
+ if ((mPendingLayoutChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG) != 0) {
if (DEBUG_LAYOUT) Slog.v(TAG, "Computing new config from layout");
if (updateOrientationFromAppTokensLocked(true)) {
mLayoutNeeded = true;
mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
}
}
- if ((changes & WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT) != 0) {
+
+ if ((mPendingLayoutChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT) != 0) {
mLayoutNeeded = true;
}
@@ -8775,107 +8410,34 @@
Slog.w(TAG, "Layout repeat skipped after too many iterations");
}
- ++mTransactionSequence;
-
- if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "*** ANIM STEP: seq="
- + mTransactionSequence + " mAnimating="
- + mInnerFields.mAnimating);
-
- mInnerFields.mTokenMayBeDrawn = false;
- mInnerFields.mWallpaperMayChange = false;
- mInnerFields.mForceHiding = false;
- mInnerFields.mDetachedWallpaper = null;
- mInnerFields.mWindowAnimationBackground = null;
- mInnerFields.mWindowAnimationBackgroundColor = 0;
-
- mStepAnimators.clear();
- changes = updateWindowsAndWallpaperLocked(currentTime, dw, dh, innerDw, innerDh);
-
- if (mInnerFields.mTokenMayBeDrawn) {
- changes |= testTokenMayBeDrawnLocked();
+ // FIRST AND ONE HALF LOOP: Make WindowManagerPolicy think
+ // it is animating.
+ mPendingLayoutChanges = 0;
+ if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("loop number " + mLayoutRepeatCount);
+ mPolicy.beginAnimationLw(dw, dh);
+ for (i = mWindows.size() - 1; i >= 0; i--) {
+ WindowState w = mWindows.get(i);
+ if (w.mSurface != null) {
+ mPolicy.animatingWindowLw(w, w.mAttrs);
+ }
}
+ mPendingLayoutChanges |= mPolicy.finishAnimationLw();
+ if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after finishAnimationLw");
+ } while (mPendingLayoutChanges != 0);
- // If we are ready to perform an app transition, check through
- // all of the app tokens to be shown and see if they are ready
- // to go.
- if (mAppTransitionReady) {
- changes |= handleAppTransitionReadyLocked();
- }
-
- mInnerFields.mAdjResult = 0;
-
- if (!mInnerFields.mAnimating && mAppTransitionRunning) {
- // We have finished the animation of an app transition. To do
- // this, we have delayed a lot of operations like showing and
- // hiding apps, moving apps in Z-order, etc. The app token list
- // reflects the correct Z-order, but the window list may now
- // be out of sync with it. So here we will just rebuild the
- // entire app window list. Fun!
- changes |= handleAnimatingStoppedAndTransitionLocked();
- }
-
- if (mInnerFields.mWallpaperForceHidingChanged && changes == 0 && !mAppTransitionReady) {
- // At this point, there was a window with a wallpaper that
- // was force hiding other windows behind it, but now it
- // is going away. This may be simple -- just animate
- // away the wallpaper and its window -- or it may be
- // hard -- the wallpaper now needs to be shown behind
- // something that was hidden.
- changes |= animateAwayWallpaperLocked();
- }
-
- changes |= testWallpaperAndBackgroundLocked();
-
- if (mLayoutNeeded) {
- changes |= PhoneWindowManager.FINISH_LAYOUT_REDO_LAYOUT;
- }
-
- if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "*** ANIM STEP: changes=0x"
- + Integer.toHexString(changes));
- } while (changes != 0);
-
- // Update animations of all applications, including those
- // associated with exiting/removed apps
-
- updateWindowsAppsAndRotationAnimationsLocked(currentTime, innerDw, innerDh);
-
- stepAnimations();
-
- // THIRD LOOP: Update the surfaces of all windows.
-
- final boolean someoneLosingFocus = mLosingFocus.size() != 0;
+ final boolean someoneLosingFocus = !mLosingFocus.isEmpty();
mInnerFields.mObscured = false;
- mInnerFields.mBlurring = false;
mInnerFields.mDimming = false;
mInnerFields.mSyswin = false;
-
- if (mScreenRotationAnimation != null) {
- mScreenRotationAnimation.updateSurfaces();
- }
-
+
final int N = mWindows.size();
-
for (i=N-1; i>=0; i--) {
WindowState w = mWindows.get(i);
+ //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing");
+ w.mContentChanged = false;
- if (w.mSurface != null) {
- prepareSurfaceLocked(w, recoveringMemory);
- } else if (w.mOrientationChanging) {
- if (DEBUG_ORIENTATION) {
- Slog.v(TAG, "Orientation change skips hidden " + w);
- }
- w.mOrientationChanging = false;
- }
-
- if (w.mContentChanged) {
- //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing");
- w.mContentChanged = false;
- }
-
- final boolean canBeSeen = w.isDisplayedLw();
-
- if (someoneLosingFocus && w == mCurrentFocus && canBeSeen) {
+ if (someoneLosingFocus && w == mCurrentFocus && w.isDisplayedLw()) {
focusDisplayed = true;
}
@@ -8894,37 +8456,65 @@
updateWallpaperVisibilityLocked();
}
}
-
- if (mDimAnimator != null && mDimAnimator.mDimShown) {
- mInnerFields.mAnimating |=
- mDimAnimator.updateSurface(mInnerFields.mDimming, currentTime,
- mDisplayFrozen || !mDisplayEnabled || !mPolicy.isScreenOnFully());
- }
-
- if (!mInnerFields.mBlurring && mBlurShown) {
- if (SHOW_TRANSACTIONS) Slog.i(TAG, " BLUR " + mBlurSurface
- + ": HIDE");
- try {
- mBlurSurface.hide();
- } catch (IllegalArgumentException e) {
- Slog.w(TAG, "Illegal argument exception hiding blur surface");
- }
- mBlurShown = false;
- }
-
- if (mBlackFrame != null) {
- if (mScreenRotationAnimation != null) {
- mBlackFrame.setMatrix(
- mScreenRotationAnimation.getEnterTransformation().getMatrix());
- } else {
- mBlackFrame.clearMatrix();
- }
- }
} catch (RuntimeException e) {
Log.wtf(TAG, "Unhandled exception in Window Manager", e);
+ } finally {
+ Surface.closeTransaction();
}
- Surface.closeTransaction();
+ // If we are ready to perform an app transition, check through
+ // all of the app tokens to be shown and see if they are ready
+ // to go.
+ if (mAppTransitionReady) {
+ mPendingLayoutChanges |= handleAppTransitionReadyLocked();
+ if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after handleAppTransitionReadyLocked");
+ }
+
+ mInnerFields.mAdjResult = 0;
+
+ if (!mAnimator.mAnimating && mAppTransitionRunning) {
+ // We have finished the animation of an app transition. To do
+ // this, we have delayed a lot of operations like showing and
+ // hiding apps, moving apps in Z-order, etc. The app token list
+ // reflects the correct Z-order, but the window list may now
+ // be out of sync with it. So here we will just rebuild the
+ // entire app window list. Fun!
+ mPendingLayoutChanges |= handleAnimatingStoppedAndTransitionLocked();
+ if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after handleAnimStopAndXitionLock");
+ }
+
+ if (mInnerFields.mWallpaperForceHidingChanged && mPendingLayoutChanges == 0 &&
+ !mAppTransitionReady) {
+ // At this point, there was a window with a wallpaper that
+ // was force hiding other windows behind it, but now it
+ // is going away. This may be simple -- just animate
+ // away the wallpaper and its window -- or it may be
+ // hard -- the wallpaper now needs to be shown behind
+ // something that was hidden.
+ mPendingLayoutChanges |= animateAwayWallpaperLocked();
+ if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after animateAwayWallpaperLocked");
+ }
+
+ mPendingLayoutChanges |= testWallpaperAndBackgroundLocked();
+ if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after testWallpaperAndBackgroundLocked");
+
+ if (mLayoutNeeded) {
+ mPendingLayoutChanges |= PhoneWindowManager.FINISH_LAYOUT_REDO_LAYOUT;
+ if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("mLayoutNeeded");
+ }
+
+ final int N = mWindows.size();
+ for (i=N-1; i>=0; i--) {
+ WindowState w = mWindows.get(i);
+ // TODO(cmautner): Can this move up to the loop at the end of try/catch above?
+ updateResizingWindows(w);
+ }
+
+ // Update animations of all applications, including those
+ // associated with exiting/removed apps
+ mAnimator.animate();
+ mPendingLayoutChanges |= mAnimator.mPendingLayoutChanges;
+ if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after animate()");
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
"<<< CLOSE TRANSACTION performLayoutAndPlaceSurfaces");
@@ -9017,6 +8607,7 @@
// Make sure there is no animation running on this token,
// so any windows associated with it will be removed as
// soon as their animations are complete
+ token.clearAnimation();
token.animation = null;
token.animating = false;
if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG,
@@ -9026,9 +8617,7 @@
}
}
- boolean needRelayout = false;
-
- if (!mInnerFields.mAnimating && mAppTransitionRunning) {
+ if (!mAnimator.mAnimating && mAppTransitionRunning) {
// We have finished the animation of an app transition. To do
// this, we have delayed a lot of operations like showing and
// hiding apps, moving apps in Z-order, etc. The app token list
@@ -9036,7 +8625,7 @@
// be out of sync with it. So here we will just rebuild the
// entire app window list. Fun!
mAppTransitionRunning = false;
- needRelayout = true;
+ mLayoutNeeded = true;
rebuildAppWindowListLocked();
assignLayersLocked();
// Clear information about apps that were moving.
@@ -9047,12 +8636,10 @@
mH.sendEmptyMessage(H.REPORT_LOSING_FOCUS);
}
if (wallpaperDestroyed) {
- needRelayout = adjustWallpaperWindowsLocked() != 0;
+ mLayoutNeeded |= adjustWallpaperWindowsLocked() != 0;
}
- if (needRelayout) {
- requestTraversalLocked();
- } else if (mInnerFields.mAnimating) {
- scheduleAnimationLocked();
+ if (mPendingLayoutChanges != 0) {
+ mLayoutNeeded = true;
}
// Finally update all input windows now that the window changes have stabilized.
@@ -9095,7 +8682,7 @@
}
}
- if (mInnerFields.mOrientationChangeComplete && !needRelayout &&
+ if (mInnerFields.mOrientationChangeComplete && !mLayoutNeeded &&
!mInnerFields.mUpdateRotation) {
checkDrawnWindowsLocked();
}
@@ -9317,6 +8904,7 @@
TAG, "Changing focus from " + mCurrentFocus + " to " + newFocus);
final WindowState oldFocus = mCurrentFocus;
mCurrentFocus = newFocus;
+ mAnimator.setCurrentFocus(mCurrentFocus);
mLosingFocus.remove(newFocus);
int focusChanged = mPolicy.focusChangedLw(oldFocus, newFocus);
@@ -9448,6 +9036,7 @@
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
mNextAppTransition = WindowManagerPolicy.TRANSIT_UNSET;
mNextAppTransitionPackage = null;
+ mNextAppTransitionThumbnail = null;
mAppTransitionReady = true;
}
@@ -9457,16 +9046,16 @@
}
if (CUSTOM_SCREEN_ROTATION) {
- if (mScreenRotationAnimation != null) {
- mScreenRotationAnimation.kill();
- mScreenRotationAnimation = null;
+ if (mAnimator.mScreenRotationAnimation != null) {
+ mAnimator.mScreenRotationAnimation.kill();
+ mAnimator.mScreenRotationAnimation = null;
}
- if (mScreenRotationAnimation == null) {
- mScreenRotationAnimation = new ScreenRotationAnimation(mContext,
+ if (mAnimator.mScreenRotationAnimation == null) {
+ mAnimator.mScreenRotationAnimation = new ScreenRotationAnimation(mContext,
mFxSession, inTransaction, mCurDisplayWidth, mCurDisplayHeight,
mDisplay.getRotation());
}
- if (!mScreenRotationAnimation.hasScreenshot()) {
+ if (!mAnimator.mScreenRotationAnimation.hasScreenshot()) {
Surface.freezeDisplay(0);
}
} else {
@@ -9491,20 +9080,20 @@
boolean updateRotation = false;
- if (CUSTOM_SCREEN_ROTATION && mScreenRotationAnimation != null
- && mScreenRotationAnimation.hasScreenshot()) {
+ if (CUSTOM_SCREEN_ROTATION && mAnimator.mScreenRotationAnimation != null
+ && mAnimator.mScreenRotationAnimation.hasScreenshot()) {
if (DEBUG_ORIENTATION) Slog.i(TAG, "**** Dismissing screen rotation animation");
- if (mScreenRotationAnimation.dismiss(mFxSession, MAX_ANIMATION_DURATION,
+ if (mAnimator.mScreenRotationAnimation.dismiss(mFxSession, MAX_ANIMATION_DURATION,
mTransitionAnimationScale, mCurDisplayWidth, mCurDisplayHeight)) {
scheduleAnimationLocked();
} else {
- mScreenRotationAnimation = null;
+ mAnimator.mScreenRotationAnimation = null;
updateRotation = true;
}
} else {
- if (mScreenRotationAnimation != null) {
- mScreenRotationAnimation.kill();
- mScreenRotationAnimation = null;
+ if (mAnimator.mScreenRotationAnimation != null) {
+ mAnimator.mScreenRotationAnimation.kill();
+ mAnimator.mScreenRotationAnimation = null;
}
updateRotation = true;
}
@@ -9971,8 +9560,7 @@
}
pw.print(" mSystemBooted="); pw.print(mSystemBooted);
pw.print(" mDisplayEnabled="); pw.println(mDisplayEnabled);
- pw.print(" mLayoutNeeded="); pw.print(mLayoutNeeded);
- pw.print(" mBlurShown="); pw.println(mBlurShown);
+ pw.print(" mLayoutNeeded="); pw.println(mLayoutNeeded);
if (mDimAnimator != null) {
pw.println(" mDimAnimator:");
mDimAnimator.printTo(" ", pw);
@@ -9988,9 +9576,9 @@
pw.print(" mLastWindowForcedOrientation"); pw.print(mLastWindowForcedOrientation);
pw.print(" mForcedAppOrientation="); pw.println(mForcedAppOrientation);
pw.print(" mDeferredRotationPauseCount="); pw.println(mDeferredRotationPauseCount);
- if (mScreenRotationAnimation != null) {
+ if (mAnimator.mScreenRotationAnimation != null) {
pw.println(" mScreenRotationAnimation:");
- mScreenRotationAnimation.printTo(" ", pw);
+ mAnimator.mScreenRotationAnimation.printTo(" ", pw);
}
pw.print(" mWindowAnimationScale="); pw.print(mWindowAnimationScale);
pw.print(" mTransitionWindowAnimationScale="); pw.print(mTransitionAnimationScale);
@@ -10009,6 +9597,12 @@
pw.print(" mNextAppTransitionExit=0x");
pw.print(Integer.toHexString(mNextAppTransitionExit));
}
+ if (mNextAppTransitionThumbnail != null) {
+ pw.print(" mNextAppTransitionThumbnail=");
+ pw.print(mNextAppTransitionThumbnail);
+ pw.print(" mNextAppTransitionStartX="); pw.print(mNextAppTransitionStartX);
+ pw.print(" mNextAppTransitionStartY="); pw.println(mNextAppTransitionStartY);
+ }
pw.print(" mStartingIconInTransition="); pw.print(mStartingIconInTransition);
pw.print(", mSkipAppTransitionAnimation="); pw.println(mSkipAppTransitionAnimation);
}
@@ -10176,4 +9770,11 @@
public interface OnHardKeyboardStatusChangeListener {
public void onHardKeyboardStatusChange(boolean available, boolean enabled);
}
+
+ void debugLayoutRepeats(final String msg) {
+ if (mLayoutRepeatCount >= LAYOUT_REPEAT_THRESHOLD) {
+ Slog.v(TAG, "Layouts looping: " + msg);
+ Slog.v(TAG, "mPendingLayoutChanges = 0x" + Integer.toHexString(mPendingLayoutChanges));
+ }
+ }
}
diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java
index e11c87a..1146189 100644
--- a/services/java/com/android/server/wm/WindowState.java
+++ b/services/java/com/android/server/wm/WindowState.java
@@ -54,8 +54,7 @@
/**
* A window in the window manager.
*/
-final class WindowState implements WindowManagerPolicy.WindowState,
- WindowManagerService.StepAnimator {
+final class WindowState implements WindowManagerPolicy.WindowState {
static final boolean DEBUG_VISIBILITY = WindowManagerService.DEBUG_VISIBILITY;
static final boolean SHOW_TRANSACTIONS = WindowManagerService.SHOW_TRANSACTIONS;
static final boolean SHOW_LIGHT_TRANSACTIONS = WindowManagerService.SHOW_LIGHT_TRANSACTIONS;
@@ -306,11 +305,6 @@
int mAnimDw;
int mAnimDh;
- static final int ANIM_STATE_IDLE = 0;
- static final int ANIM_STATE_RUNNING = 1;
- static final int ANIM_STATE_STOPPING = 2;
- int mAnimState = ANIM_STATE_IDLE;
-
WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
WindowState attachedWindow, int seq, WindowManager.LayoutParams a,
int viewVisibility) {
@@ -646,6 +640,10 @@
mAnimation = anim;
mAnimation.restrictDuration(WindowManagerService.MAX_ANIMATION_DURATION);
mAnimation.scaleCurrentDuration(mService.mWindowAnimationScale);
+ // Start out animation gone if window is gone, or visible if window is visible.
+ mTransformation.clear();
+ mTransformation.setAlpha(mLastHidden ? 0 : 1);
+ mHasLocalTransformation = true;
}
public void clearAnimation() {
@@ -654,7 +652,6 @@
mLocalAnimating = false;
mAnimation.cancel();
mAnimation = null;
- mAnimState = ANIM_STATE_IDLE;
}
}
@@ -666,7 +663,6 @@
mAnimation.cancel();
mAnimation = null;
destroySurfaceLocked();
- mAnimState = ANIM_STATE_IDLE;
}
mExiting = false;
}
@@ -941,13 +937,15 @@
if (!mService.showSurfaceRobustlyLocked(this)) {
return false;
}
+
+ mService.enableScreenIfNeededLocked();
+
+ mService.applyEnterAnimationLocked(this);
+
mLastAlpha = -1;
mHasDrawn = true;
mLastHidden = false;
mReadyToShow = false;
- mService.enableScreenIfNeededLocked();
-
- mService.applyEnterAnimationLocked(this);
int i = mChildWindows.size();
while (i > 0) {
@@ -972,7 +970,8 @@
mAppToken.firstWindowDrawn = true;
if (mAppToken.startingData != null) {
- if (WindowManagerService.DEBUG_STARTING_WINDOW || WindowManagerService.DEBUG_ANIM) Slog.v(WindowManagerService.TAG,
+ if (WindowManagerService.DEBUG_STARTING_WINDOW ||
+ WindowManagerService.DEBUG_ANIM) Slog.v(WindowManagerService.TAG,
"Finish starting " + mToken
+ ": first real window is shown, no animation");
// If this initial window is animating, stop it -- we
@@ -984,20 +983,20 @@
mAnimation = null;
// Make sure we clean up the animation.
mAnimating = true;
- mAnimState = ANIM_STATE_IDLE;
}
mService.mFinishedStarting.add(mAppToken);
mService.mH.sendEmptyMessage(H.FINISHED_STARTING);
}
mAppToken.updateReportedVisibilityLocked();
}
+ } else {
+ return false;
}
return true;
}
- @Override
- public boolean stepAnimation(long currentTime) {
- if ((mAnimation == null) || !mLocalAnimating || (mAnimState != ANIM_STATE_RUNNING)) {
+ private boolean stepAnimation(long currentTime) {
+ if ((mAnimation == null) || !mLocalAnimating) {
return false;
}
mTransformation.clear();
@@ -1005,22 +1004,19 @@
if (WindowManagerService.DEBUG_ANIM) Slog.v(
WindowManagerService.TAG, "Stepped animation in " + this +
": more=" + more + ", xform=" + mTransformation);
- if (!more) {
- mAnimState = ANIM_STATE_STOPPING;
- }
return more;
}
// This must be called while inside a transaction. Returns true if
// there is more animation to run.
- boolean startAndFinishAnimationLocked(long currentTime) {
+ boolean stepAnimationLocked(long currentTime) {
// Save the animation state as it was before this step so WindowManagerService can tell if
// we just started or just stopped animating by comparing mWasAnimating with isAnimating().
mWasAnimating = mAnimating;
- if (!mService.mDisplayFrozen && mService.mPolicy.isScreenOnFully()) {
+ if (mService.okToDisplay()) {
// We will run animations as long as the display isn't frozen.
- if (!mDrawPending && !mCommitDrawPending && mAnimation != null) {
+ if (isDrawnLw() && mAnimation != null) {
mHasTransformation = true;
mHasLocalTransformation = true;
if (!mLocalAnimating) {
@@ -1034,11 +1030,11 @@
mAnimation.setStartTime(currentTime);
mLocalAnimating = true;
mAnimating = true;
- mAnimState = ANIM_STATE_RUNNING;
}
- if ((mAnimation != null) && mLocalAnimating &&
- (mAnimState != ANIM_STATE_STOPPING)) {
- return true;
+ if ((mAnimation != null) && mLocalAnimating) {
+ if (stepAnimation(currentTime)) {
+ return true;
+ }
}
if (WindowManagerService.DEBUG_ANIM) Slog.v(
WindowManagerService.TAG, "Finished animation in " + this +
@@ -1133,12 +1129,13 @@
}
finishExit();
+ mService.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
+ if (WindowManagerService.DEBUG_LAYOUT_REPEATS) mService.debugLayoutRepeats("WindowState");
if (mAppToken != null) {
mAppToken.updateReportedVisibilityLocked();
}
- mAnimState = ANIM_STATE_IDLE;
return false;
}
@@ -1233,8 +1230,8 @@
}
}
- final boolean screenAnimation = mService.mScreenRotationAnimation != null
- && mService.mScreenRotationAnimation.isAnimating();
+ final boolean screenAnimation = mService.mAnimator.mScreenRotationAnimation != null
+ && mService.mAnimator.mScreenRotationAnimation.isAnimating();
if (selfTransformation || attachedTransformation != null
|| appTransformation != null || screenAnimation) {
// cache often used attributes locally
@@ -1274,7 +1271,7 @@
}
if (screenAnimation) {
tmpMatrix.postConcat(
- mService.mScreenRotationAnimation.getEnterTransformation().getMatrix());
+ mService.mAnimator.mScreenRotationAnimation.getEnterTransformation().getMatrix());
}
// "convert" it into SurfaceFlinger's format
@@ -1317,7 +1314,7 @@
}
if (screenAnimation) {
mShownAlpha *=
- mService.mScreenRotationAnimation.getEnterTransformation().getAlpha();
+ mService.mAnimator.mScreenRotationAnimation.getEnterTransformation().getAlpha();
}
} else {
//Slog.i(TAG, "Not applying alpha transform");
@@ -1479,8 +1476,7 @@
*/
public boolean isDisplayedLw() {
final AppWindowToken atoken = mAppToken;
- return mSurface != null && mPolicyVisibility && !mDestroying
- && !mDrawPending && !mCommitDrawPending
+ return isDrawnLw() && mPolicyVisibility
&& ((!mAttachedHidden &&
(atoken == null || !atoken.hiddenRequested))
|| mAnimating);
@@ -1501,7 +1497,6 @@
* complete UI in to.
*/
public boolean isDrawnLw() {
- final AppWindowToken atoken = mAppToken;
return mSurface != null && !mDestroying
&& !mDrawPending && !mCommitDrawPending;
}
@@ -1513,9 +1508,8 @@
boolean isOpaqueDrawn() {
return (mAttrs.format == PixelFormat.OPAQUE
|| mAttrs.type == TYPE_WALLPAPER)
- && mSurface != null && mAnimation == null
- && (mAppToken == null || mAppToken.animation == null)
- && !mDrawPending && !mCommitDrawPending;
+ && isDrawnLw() && mAnimation == null
+ && (mAppToken == null || mAppToken.animation == null);
}
/**
@@ -1524,11 +1518,10 @@
* sense to call from performLayoutAndPlaceSurfacesLockedInner().)
*/
boolean shouldAnimateMove() {
- return mContentChanged && !mExiting && !mLastHidden && !mService.mDisplayFrozen
+ return mContentChanged && !mExiting && !mLastHidden && mService.okToDisplay()
&& (mFrame.top != mLastFrame.top
|| mFrame.left != mLastFrame.left)
- && (mAttachedWindow == null || !mAttachedWindow.shouldAnimateMove())
- && mService.mPolicy.isScreenOnFully();
+ && (mAttachedWindow == null || !mAttachedWindow.shouldAnimateMove());
}
boolean isFullscreen(int screenWidth, int screenHeight) {
@@ -1608,13 +1601,14 @@
boolean showLw(boolean doAnimation, boolean requestAnim) {
if (mPolicyVisibility && mPolicyVisibilityAfterAnim) {
+ // Already showing.
return false;
}
if (DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG, "Policy visibility true: " + this);
if (doAnimation) {
if (DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG, "doAnimation: mPolicyVisibility="
+ mPolicyVisibility + " mAnimation=" + mAnimation);
- if (mService.mDisplayFrozen || !mService.mPolicy.isScreenOnFully()) {
+ if (!mService.okToDisplay()) {
doAnimation = false;
} else if (mPolicyVisibility && mAnimation == null) {
// Check for the case where we are currently visible and
@@ -1640,13 +1634,14 @@
boolean hideLw(boolean doAnimation, boolean requestAnim) {
if (doAnimation) {
- if (mService.mDisplayFrozen || !mService.mPolicy.isScreenOnFully()) {
+ if (!mService.okToDisplay()) {
doAnimation = false;
}
}
boolean current = doAnimation ? mPolicyVisibilityAfterAnim
: mPolicyVisibility;
if (!current) {
+ // Already hiding.
return false;
}
if (doAnimation) {
diff --git a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
index b4fd55e..88ee867 100644
--- a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
@@ -53,6 +53,7 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
+import android.content.pm.UserInfo;
import android.net.ConnectivityManager;
import android.net.IConnectivityManager;
import android.net.INetworkManagementEventObserver;
@@ -69,6 +70,7 @@
import android.os.INetworkManagementService;
import android.os.IPowerManager;
import android.os.MessageQueue.IdleHandler;
+import android.os.UserId;
import android.test.AndroidTestCase;
import android.test.mock.MockPackageManager;
import android.test.suitebuilder.annotation.LargeTest;
@@ -84,7 +86,9 @@
import org.easymock.IAnswer;
import java.io.File;
+import java.util.ArrayList;
import java.util.LinkedHashSet;
+import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -126,8 +130,16 @@
private long mStartTime;
private long mElapsedRealtime;
- private static final int UID_A = android.os.Process.FIRST_APPLICATION_UID + 800;
- private static final int UID_B = android.os.Process.FIRST_APPLICATION_UID + 801;
+ private static final int USER_ID = 0;
+ private static final int USER_ID_GUEST = 1;
+
+ private static final int APP_ID_A = android.os.Process.FIRST_APPLICATION_UID + 800;
+ private static final int APP_ID_B = android.os.Process.FIRST_APPLICATION_UID + 801;
+
+ private static final int UID_A = UserId.getUid(USER_ID, APP_ID_A);
+ private static final int UID_B = UserId.getUid(USER_ID, APP_ID_B);
+ private static final int UID_A_GUEST = UserId.getUid(USER_ID_GUEST, APP_ID_A);
+ private static final int UID_B_GUEST = UserId.getUid(USER_ID_GUEST, APP_ID_B);
private static final int PID_1 = 400;
private static final int PID_2 = 401;
@@ -161,6 +173,14 @@
info.signatures = new Signature[] { signature };
return info;
}
+
+ @Override
+ public List<UserInfo> getUsers() {
+ final ArrayList<UserInfo> users = new ArrayList<UserInfo>();
+ users.add(new UserInfo(USER_ID, "Primary", UserInfo.FLAG_PRIMARY));
+ users.add(new UserInfo(USER_ID_GUEST, "Guest", 0));
+ return users;
+ }
};
}
@@ -242,13 +262,13 @@
@Suppress
public void testPolicyChangeTriggersBroadcast() throws Exception {
- mService.setUidPolicy(UID_A, POLICY_NONE);
+ mService.setAppPolicy(APP_ID_A, POLICY_NONE);
// change background policy and expect broadcast
final Future<Intent> backgroundChanged = mServiceContext.nextBroadcastIntent(
ConnectivityManager.ACTION_BACKGROUND_DATA_SETTING_CHANGED);
- mService.setUidPolicy(UID_A, POLICY_REJECT_METERED_BACKGROUND);
+ mService.setAppPolicy(APP_ID_A, POLICY_REJECT_METERED_BACKGROUND);
backgroundChanged.get();
}
@@ -302,6 +322,7 @@
public void testScreenChangesRules() throws Exception {
Future<Void> future;
+ Future<Void> futureGuest;
expectSetUidNetworkRules(UID_A, false);
expectSetUidForeground(UID_A, true);
@@ -314,10 +335,14 @@
// push strict policy for foreground uid, verify ALLOW rule
expectSetUidNetworkRules(UID_A, false);
expectSetUidForeground(UID_A, true);
+ expectSetUidNetworkRules(UID_A_GUEST, true);
+ expectSetUidForeground(UID_A_GUEST, false);
future = expectRulesChanged(UID_A, RULE_ALLOW_ALL);
+ futureGuest = expectRulesChanged(UID_A_GUEST, RULE_REJECT_METERED);
replay();
- mService.setUidPolicy(UID_A, POLICY_REJECT_METERED_BACKGROUND);
+ mService.setAppPolicy(APP_ID_A, POLICY_REJECT_METERED_BACKGROUND);
future.get();
+ futureGuest.get();
verifyAndReset();
// now turn screen off and verify REJECT rule
@@ -343,6 +368,7 @@
public void testPolicyNone() throws Exception {
Future<Void> future;
+ Future<Void> futureGuest;
expectSetUidNetworkRules(UID_A, false);
expectSetUidForeground(UID_A, true);
@@ -355,10 +381,14 @@
// POLICY_NONE should RULE_ALLOW in foreground
expectSetUidNetworkRules(UID_A, false);
expectSetUidForeground(UID_A, true);
+ expectSetUidNetworkRules(UID_A_GUEST, false);
+ expectSetUidForeground(UID_A_GUEST, false);
future = expectRulesChanged(UID_A, RULE_ALLOW_ALL);
+ futureGuest = expectRulesChanged(UID_A_GUEST, RULE_ALLOW_ALL);
replay();
- mService.setUidPolicy(UID_A, POLICY_NONE);
+ mService.setAppPolicy(APP_ID_A, POLICY_NONE);
future.get();
+ futureGuest.get();
verifyAndReset();
// POLICY_NONE should RULE_ALLOW in background
@@ -373,14 +403,19 @@
public void testPolicyReject() throws Exception {
Future<Void> future;
+ Future<Void> futureGuest;
// POLICY_REJECT should RULE_ALLOW in background
expectSetUidNetworkRules(UID_A, true);
expectSetUidForeground(UID_A, false);
+ expectSetUidNetworkRules(UID_A_GUEST, true);
+ expectSetUidForeground(UID_A_GUEST, false);
future = expectRulesChanged(UID_A, RULE_REJECT_METERED);
+ futureGuest = expectRulesChanged(UID_A_GUEST, RULE_REJECT_METERED);
replay();
- mService.setUidPolicy(UID_A, POLICY_REJECT_METERED_BACKGROUND);
+ mService.setAppPolicy(APP_ID_A, POLICY_REJECT_METERED_BACKGROUND);
future.get();
+ futureGuest.get();
verifyAndReset();
// POLICY_REJECT should RULE_ALLOW in foreground
@@ -404,33 +439,46 @@
public void testPolicyRejectAddRemove() throws Exception {
Future<Void> future;
+ Future<Void> futureGuest;
// POLICY_NONE should have RULE_ALLOW in background
expectSetUidNetworkRules(UID_A, false);
expectSetUidForeground(UID_A, false);
+ expectSetUidNetworkRules(UID_A_GUEST, false);
+ expectSetUidForeground(UID_A_GUEST, false);
future = expectRulesChanged(UID_A, RULE_ALLOW_ALL);
+ futureGuest = expectRulesChanged(UID_A_GUEST, RULE_ALLOW_ALL);
replay();
mProcessObserver.onForegroundActivitiesChanged(PID_1, UID_A, false);
- mService.setUidPolicy(UID_A, POLICY_NONE);
+ mService.setAppPolicy(APP_ID_A, POLICY_NONE);
future.get();
+ futureGuest.get();
verifyAndReset();
// adding POLICY_REJECT should cause RULE_REJECT
expectSetUidNetworkRules(UID_A, true);
expectSetUidForeground(UID_A, false);
+ expectSetUidNetworkRules(UID_A_GUEST, true);
+ expectSetUidForeground(UID_A_GUEST, false);
future = expectRulesChanged(UID_A, RULE_REJECT_METERED);
+ futureGuest = expectRulesChanged(UID_A_GUEST, RULE_REJECT_METERED);
replay();
- mService.setUidPolicy(UID_A, POLICY_REJECT_METERED_BACKGROUND);
+ mService.setAppPolicy(APP_ID_A, POLICY_REJECT_METERED_BACKGROUND);
future.get();
+ futureGuest.get();
verifyAndReset();
// removing POLICY_REJECT should return us to RULE_ALLOW
expectSetUidNetworkRules(UID_A, false);
expectSetUidForeground(UID_A, false);
+ expectSetUidNetworkRules(UID_A_GUEST, false);
+ expectSetUidForeground(UID_A_GUEST, false);
future = expectRulesChanged(UID_A, RULE_ALLOW_ALL);
+ futureGuest = expectRulesChanged(UID_A_GUEST, RULE_ALLOW_ALL);
replay();
- mService.setUidPolicy(UID_A, POLICY_NONE);
+ mService.setAppPolicy(APP_ID_A, POLICY_NONE);
future.get();
+ futureGuest.get();
verifyAndReset();
}
@@ -599,25 +647,34 @@
public void testUidRemovedPolicyCleared() throws Exception {
Future<Void> future;
+ Future<Void> futureGuest;
// POLICY_REJECT should RULE_REJECT in background
expectSetUidNetworkRules(UID_A, true);
expectSetUidForeground(UID_A, false);
+ expectSetUidNetworkRules(UID_A_GUEST, true);
+ expectSetUidForeground(UID_A_GUEST, false);
future = expectRulesChanged(UID_A, RULE_REJECT_METERED);
+ futureGuest = expectRulesChanged(UID_A_GUEST, RULE_REJECT_METERED);
replay();
- mService.setUidPolicy(UID_A, POLICY_REJECT_METERED_BACKGROUND);
+ mService.setAppPolicy(APP_ID_A, POLICY_REJECT_METERED_BACKGROUND);
future.get();
+ futureGuest.get();
verifyAndReset();
// uninstall should clear RULE_REJECT
expectSetUidNetworkRules(UID_A, false);
expectSetUidForeground(UID_A, false);
+ expectSetUidNetworkRules(UID_A_GUEST, false);
+ expectSetUidForeground(UID_A_GUEST, false);
future = expectRulesChanged(UID_A, RULE_ALLOW_ALL);
+ futureGuest = expectRulesChanged(UID_A_GUEST, RULE_ALLOW_ALL);
replay();
final Intent intent = new Intent(ACTION_UID_REMOVED);
intent.putExtra(EXTRA_UID, UID_A);
mServiceContext.sendBroadcast(intent);
future.get();
+ futureGuest.get();
verifyAndReset();
}
diff --git a/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java b/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java
new file mode 100644
index 0000000..796372d
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/pm/PackageManagerSettingsTests.java
@@ -0,0 +1,205 @@
+/*
+ * 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.pm;
+
+import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
+import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
+import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER;
+import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+
+import com.android.internal.content.PackageHelper;
+import com.android.internal.os.AtomicFile;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.HashSet;
+
+import android.os.Debug;
+import android.os.Environment;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.os.storage.IMountService;
+import android.test.AndroidTestCase;
+import android.util.Log;
+
+public class PackageManagerSettingsTests extends AndroidTestCase {
+
+ private static final String PACKAGE_NAME_2 = "com.google.app2";
+ private static final String PACKAGE_NAME_3 = "com.android.app3";
+ private static final String PACKAGE_NAME_1 = "com.google.app1";
+ private static final boolean localLOGV = true;
+ public static final String TAG = "PackageManagerSettingsTests";
+ protected final String PREFIX = "android.content.pm";
+
+ private void writeFile(File file, byte[] data) {
+ file.mkdirs();
+ try {
+ AtomicFile aFile = new AtomicFile(file);
+ FileOutputStream fos = aFile.startWrite();
+ fos.write(data);
+ aFile.finishWrite(fos);
+ } catch (IOException ioe) {
+ Log.e(TAG, "Cannot write file " + file.getPath());
+ }
+ }
+
+ private void writePackagesXml() {
+ writeFile(new File(getContext().getFilesDir(), "system/packages.xml"),
+ ("<?xml version='1.0' encoding='utf-8' standalone='yes' ?>"
+ + "<packages>"
+ + "<last-platform-version internal=\"15\" external=\"0\" />"
+ + "<permission-trees>"
+ + "<item name=\"com.google.android.permtree\" package=\"com.google.android.permpackage\" />"
+ + "</permission-trees>"
+ + "<permissions>"
+ + "<item name=\"android.permission.WRITE_CALL_LOG\" package=\"android\" protection=\"1\" />"
+ + "<item name=\"android.permission.ASEC_ACCESS\" package=\"android\" protection=\"2\" />"
+ + "<item name=\"android.permission.ACCESS_WIMAX_STATE\" package=\"android\" />"
+ + "<item name=\"android.permission.REBOOT\" package=\"android\" protection=\"18\" />"
+ + "</permissions>"
+ + "<package name=\"com.google.app1\" codePath=\"/system/app/app1.apk\" nativeLibraryPath=\"/data/data/com.google.app1/lib\" flags=\"1\" ft=\"1360e2caa70\" it=\"135f2f80d08\" ut=\"1360e2caa70\" version=\"1109\" sharedUserId=\"11000\">"
+ + "<sigs count=\"1\">"
+ + "<cert index=\"0\" key=\"308886\" />"
+ + "</sigs>"
+ + "</package>"
+ + "<package name=\"com.google.app2\" codePath=\"/system/app/app2.apk\" nativeLibraryPath=\"/data/data/com.google.app2/lib\" flags=\"1\" ft=\"1360e578718\" it=\"135f2f80d08\" ut=\"1360e578718\" version=\"15\" enabled=\"3\" userId=\"11001\">"
+ + "<sigs count=\"1\">"
+ + "<cert index=\"0\" />"
+ + "</sigs>"
+ + "</package>"
+ + "<package name=\"com.android.app3\" codePath=\"/system/app/app3.apk\" nativeLibraryPath=\"/data/data/com.android.app3/lib\" flags=\"1\" ft=\"1360e577b60\" it=\"135f2f80d08\" ut=\"1360e577b60\" version=\"15\" userId=\"11030\">"
+ + "<sigs count=\"1\">"
+ + "<cert index=\"1\" key=\"308366\" />"
+ + "</sigs>"
+ + "</package>"
+ + "<shared-user name=\"com.android.shared1\" userId=\"11000\">"
+ + "<sigs count=\"1\">"
+ + "<cert index=\"1\" />"
+ + "</sigs>"
+ + "<perms>"
+ + "<item name=\"android.permission.REBOOT\" />"
+ + "</perms>"
+ + "</shared-user>"
+ + "</packages>").getBytes());
+ }
+
+ private void writeStoppedPackagesXml() {
+ writeFile(new File(getContext().getFilesDir(), "system/packages-stopped.xml"),
+ ( "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>"
+ + "<stopped-packages>"
+ + "<pkg name=\"com.google.app1\" nl=\"1\" />"
+ + "<pkg name=\"com.android.app3\" nl=\"1\" />"
+ + "</stopped-packages>")
+ .getBytes());
+ }
+
+ private void writePackagesList() {
+ writeFile(new File(getContext().getFilesDir(), "system/packages.list"),
+ ( "com.google.app1 11000 0 /data/data/com.google.app1"
+ + "com.google.app2 11001 0 /data/data/com.google.app2"
+ + "com.android.app3 11030 0 /data/data/com.android.app3")
+ .getBytes());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ private void writeOldFiles() {
+ writePackagesXml();
+ writeStoppedPackagesXml();
+ writePackagesList();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testSettingsReadOld() {
+ // Debug.waitForDebugger();
+
+ // Write the package files and make sure they're parsed properly the first time
+ writeOldFiles();
+ Settings settings = new Settings(getContext().getFilesDir());
+ assertEquals(true, settings.readLPw(null));
+ assertNotNull(settings.peekPackageLPr(PACKAGE_NAME_3));
+ assertNotNull(settings.peekPackageLPr(PACKAGE_NAME_1));
+
+ PackageSetting ps = settings.peekPackageLPr(PACKAGE_NAME_1);
+ assertEquals(COMPONENT_ENABLED_STATE_DEFAULT, ps.getEnabled(0));
+ assertEquals(true, ps.getNotLaunched(0));
+
+ ps = settings.peekPackageLPr(PACKAGE_NAME_2);
+ assertEquals(false, ps.getStopped(0));
+ assertEquals(COMPONENT_ENABLED_STATE_DISABLED_USER, ps.getEnabled(0));
+ assertEquals(COMPONENT_ENABLED_STATE_DEFAULT, ps.getEnabled(1));
+ }
+
+ public void testNewPackageRestrictionsFile() {
+ // Write the package files and make sure they're parsed properly the first time
+ writeOldFiles();
+ Settings settings = new Settings(getContext().getFilesDir());
+ assertEquals(true, settings.readLPw(null));
+
+ // Create Settings again to make it read from the new files
+ settings = new Settings(getContext().getFilesDir());
+ assertEquals(true, settings.readLPw(null));
+
+ PackageSetting ps = settings.peekPackageLPr(PACKAGE_NAME_2);
+ assertEquals(COMPONENT_ENABLED_STATE_DISABLED_USER, ps.getEnabled(0));
+ assertEquals(COMPONENT_ENABLED_STATE_DEFAULT, ps.getEnabled(1));
+ }
+
+ public void testEnableDisable() {
+ // Write the package files and make sure they're parsed properly the first time
+ writeOldFiles();
+ Settings settings = new Settings(getContext().getFilesDir());
+ assertEquals(true, settings.readLPw(null));
+
+ // Enable/Disable a package
+ PackageSetting ps = settings.peekPackageLPr(PACKAGE_NAME_1);
+ ps.setEnabled(COMPONENT_ENABLED_STATE_DISABLED, 0);
+ ps.setEnabled(COMPONENT_ENABLED_STATE_ENABLED, 1);
+ assertEquals(COMPONENT_ENABLED_STATE_DISABLED, ps.getEnabled(0));
+ assertEquals(COMPONENT_ENABLED_STATE_ENABLED, ps.getEnabled(1));
+
+ // Enable/Disable a component
+ HashSet<String> components = new HashSet<String>();
+ String component1 = PACKAGE_NAME_1 + "/.Component1";
+ components.add(component1);
+ ps.setDisabledComponents(components, 0);
+ HashSet<String> componentsDisabled = ps.getDisabledComponents(0);
+ assertEquals(1, componentsDisabled.size());
+ assertEquals(component1, componentsDisabled.toArray()[0]);
+ boolean hasEnabled =
+ ps.getEnabledComponents(0) != null && ps.getEnabledComponents(1).size() > 0;
+ assertEquals(false, hasEnabled);
+
+ // User 1 should not have any disabled components
+ boolean hasDisabled =
+ ps.getDisabledComponents(1) != null && ps.getDisabledComponents(1).size() > 0;
+ assertEquals(false, hasDisabled);
+ ps.setEnabledComponents(components, 1);
+ assertEquals(1, ps.getEnabledComponents(1).size());
+ hasEnabled = ps.getEnabledComponents(0) != null && ps.getEnabledComponents(0).size() > 0;
+ assertEquals(false, hasEnabled);
+ }
+}
diff --git a/telephony/java/com/android/internal/telephony/AdnRecordCache.java b/telephony/java/com/android/internal/telephony/AdnRecordCache.java
index a175d49..db5f4da 100644
--- a/telephony/java/com/android/internal/telephony/AdnRecordCache.java
+++ b/telephony/java/com/android/internal/telephony/AdnRecordCache.java
@@ -33,7 +33,7 @@
public final class AdnRecordCache extends Handler implements IccConstants {
//***** Instance Variables
- PhoneBase phone;
+ private IccFileHandler mFh;
private UsimPhoneBookManager mUsimPhoneBookManager;
// Indexed by EF ID
@@ -56,9 +56,9 @@
- public AdnRecordCache(PhoneBase phone) {
- this.phone = phone;
- mUsimPhoneBookManager = new UsimPhoneBookManager(phone, this);
+ public AdnRecordCache(IccFileHandler fh) {
+ mFh = fh;
+ mUsimPhoneBookManager = new UsimPhoneBookManager(mFh, this);
}
//***** Called from SIMRecords
@@ -155,7 +155,7 @@
userWriteResponse.put(efid, response);
- new AdnRecordLoader(phone).updateEF(adn, efid, extensionEF,
+ new AdnRecordLoader(mFh).updateEF(adn, efid, extensionEF,
recordIndex, pin2,
obtainMessage(EVENT_UPDATE_ADN_DONE, efid, recordIndex, adn));
}
@@ -233,7 +233,7 @@
userWriteResponse.put(efid, response);
- new AdnRecordLoader(phone).updateEF(newAdn, efid, extensionEF,
+ new AdnRecordLoader(mFh).updateEF(newAdn, efid, extensionEF,
index, pin2,
obtainMessage(EVENT_UPDATE_ADN_DONE, efid, index, newAdn));
}
@@ -296,7 +296,7 @@
return;
}
- new AdnRecordLoader(phone).loadAllFromEF(efid, extensionEf,
+ new AdnRecordLoader(mFh).loadAllFromEF(efid, extensionEf,
obtainMessage(EVENT_LOAD_ALL_ADN_LIKE_DONE, efid, 0));
}
diff --git a/telephony/java/com/android/internal/telephony/AdnRecordLoader.java b/telephony/java/com/android/internal/telephony/AdnRecordLoader.java
index 55bdc06..084fae6 100644
--- a/telephony/java/com/android/internal/telephony/AdnRecordLoader.java
+++ b/telephony/java/com/android/internal/telephony/AdnRecordLoader.java
@@ -20,16 +20,17 @@
import android.os.AsyncResult;
import android.os.Handler;
+import android.os.Looper;
import android.os.Message;
import android.util.Log;
public class AdnRecordLoader extends Handler {
- static String LOG_TAG;
+ final static String LOG_TAG = "RIL_AdnRecordLoader";
//***** Instance Variables
- PhoneBase phone;
+ private IccFileHandler mFh;
int ef;
int extensionEF;
int pendingExtLoads;
@@ -56,13 +57,11 @@
//***** Constructor
- public AdnRecordLoader(PhoneBase phone) {
+ public AdnRecordLoader(IccFileHandler fh) {
// The telephony unit-test cases may create AdnRecords
// in secondary threads
- super(phone.getHandler().getLooper());
-
- this.phone = phone;
- LOG_TAG = phone.getPhoneName();
+ super(Looper.getMainLooper());
+ mFh = fh;
}
/**
@@ -77,7 +76,7 @@
this.recordNumber = recordNumber;
this.userResponse = response;
- phone.mIccFileHandler.loadEFLinearFixed(
+ mFh.loadEFLinearFixed(
ef, recordNumber,
obtainMessage(EVENT_ADN_LOAD_DONE));
@@ -95,7 +94,7 @@
this.extensionEF = extensionEF;
this.userResponse = response;
- phone.mIccFileHandler.loadEFLinearFixedAll(
+ mFh.loadEFLinearFixedAll(
ef,
obtainMessage(EVENT_ADN_LOAD_ALL_DONE));
@@ -122,7 +121,7 @@
this.userResponse = response;
this.pin2 = pin2;
- phone.mIccFileHandler.getEFLinearRecordSize( ef,
+ mFh.getEFLinearRecordSize( ef,
obtainMessage(EVENT_EF_LINEAR_RECORD_SIZE_DONE, adn));
}
@@ -163,7 +162,7 @@
ar.exception);
}
- phone.mIccFileHandler.updateEFLinearFixed(ef, recordNumber,
+ mFh.updateEFLinearFixed(ef, recordNumber,
data, pin2, obtainMessage(EVENT_UPDATE_RECORD_DONE));
pendingExtLoads = 1;
@@ -203,7 +202,7 @@
pendingExtLoads = 1;
- phone.mIccFileHandler.loadEFLinearFixed(
+ mFh.loadEFLinearFixed(
extensionEF, adn.extRecord,
obtainMessage(EVENT_EXT_RECORD_LOAD_DONE, adn));
}
@@ -253,7 +252,7 @@
pendingExtLoads++;
- phone.mIccFileHandler.loadEFLinearFixed(
+ mFh.loadEFLinearFixed(
extensionEF, adn.extRecord,
obtainMessage(EVENT_EXT_RECORD_LOAD_DONE, adn));
}
diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java
index 965bafa..2139917 100644
--- a/telephony/java/com/android/internal/telephony/IccCard.java
+++ b/telephony/java/com/android/internal/telephony/IccCard.java
@@ -37,6 +37,7 @@
import com.android.internal.telephony.CommandsInterface.RadioState;
import com.android.internal.telephony.gsm.SIMFileHandler;
import com.android.internal.telephony.gsm.SIMRecords;
+import com.android.internal.telephony.cat.CatService;
import com.android.internal.telephony.cdma.CDMALTEPhone;
import com.android.internal.telephony.cdma.CdmaLteUiccFileHandler;
import com.android.internal.telephony.cdma.CdmaLteUiccRecords;
@@ -65,6 +66,8 @@
protected PhoneBase mPhone;
private IccRecords mIccRecords;
private IccFileHandler mIccFileHandler;
+ private CatService mCatService;
+
private RegistrantList mAbsentRegistrants = new RegistrantList();
private RegistrantList mPinLockedRegistrants = new RegistrantList();
private RegistrantList mNetworkLockedRegistrants = new RegistrantList();
@@ -185,14 +188,17 @@
mPhone.mCM, mHandler, EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
if (phone.mCM.getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE
&& phone instanceof CDMALTEPhone) {
- mIccRecords = new CdmaLteUiccRecords(phone);
mIccFileHandler = new CdmaLteUiccFileHandler(this, "", mPhone.mCM);
+ mIccRecords = new CdmaLteUiccRecords(this, mPhone.mContext, mPhone.mCM);
} else {
- mIccRecords = is3gpp ? new SIMRecords(phone) : new RuimRecords(phone);
// Correct aid will be set later (when GET_SIM_STATUS returns)
mIccFileHandler = is3gpp ? new SIMFileHandler(this, "", mPhone.mCM) :
new RuimFileHandler(this, "", mPhone.mCM);
+ mIccRecords = is3gpp ? new SIMRecords(this, mPhone.mContext, mPhone.mCM) :
+ new RuimRecords(this, mPhone.mContext, mPhone.mCM);
}
+ mCatService = CatService.getInstance(mPhone.mCM, mIccRecords,
+ mPhone.mContext, mIccFileHandler, this);
mPhone.mCM.registerForOffOrNotAvailable(mHandler, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
mPhone.mCM.registerForOn(mHandler, EVENT_RADIO_ON, null);
mPhone.mCM.registerForIccStatusChanged(mHandler, EVENT_ICC_STATUS_CHANGED, null);
@@ -203,6 +209,7 @@
mPhone.mCM.unregisterForIccStatusChanged(mHandler);
mPhone.mCM.unregisterForOffOrNotAvailable(mHandler);
mPhone.mCM.unregisterForOn(mHandler);
+ mCatService.dispose();
mCdmaSSM.dispose(mHandler);
mIccRecords.dispose();
mIccFileHandler.dispose();
diff --git a/telephony/java/com/android/internal/telephony/IccRecords.java b/telephony/java/com/android/internal/telephony/IccRecords.java
index 6e82903..41c9d5a 100644
--- a/telephony/java/com/android/internal/telephony/IccRecords.java
+++ b/telephony/java/com/android/internal/telephony/IccRecords.java
@@ -16,6 +16,7 @@
package com.android.internal.telephony;
+import android.content.Context;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
@@ -32,9 +33,16 @@
protected static final boolean DBG = true;
// ***** Instance Variables
+ protected boolean mDestroyed = false; // set to true once this object needs to be disposed of
+ protected Context mContext;
+ protected CommandsInterface mCi;
+ protected IccFileHandler mFh;
+ protected IccCard mParentCard;
- protected PhoneBase phone;
protected RegistrantList recordsLoadedRegistrants = new RegistrantList();
+ protected RegistrantList mRecordsEventsRegistrants = new RegistrantList();
+ protected RegistrantList mNewSmsRegistrants = new RegistrantList();
+ protected RegistrantList mNetworkSelectionModeAutomaticRegistrants = new RegistrantList();
protected int recordsToLoad; // number of pending load requests
@@ -71,6 +79,9 @@
// ***** Event Constants
protected static final int EVENT_SET_MSISDN_DONE = 30;
+ public static final int EVENT_MWI = 0;
+ public static final int EVENT_CFI = 1;
+ public static final int EVENT_SPN = 2;
public static final int EVENT_GET_ICC_RECORD_DONE = 100;
@@ -91,15 +102,23 @@
}
// ***** Constructor
-
- public IccRecords(PhoneBase p) {
- this.phone = p;
+ public IccRecords(IccCard card, Context c, CommandsInterface ci) {
+ mContext = c;
+ mCi = ci;
+ mFh = card.getIccFileHandler();
+ mParentCard = card;
}
/**
* Call when the IccRecords object is no longer going to be used.
*/
- public abstract void dispose();
+ public void dispose() {
+ mDestroyed = true;
+ mParentCard = null;
+ mFh = null;
+ mCi = null;
+ mContext = null;
+ }
protected abstract void onRadioOffOrNotAvailable();
public abstract void onReady();
@@ -109,7 +128,15 @@
return adnCache;
}
+ public IccCard getIccCard() {
+ return mParentCard;
+ }
+
public void registerForRecordsLoaded(Handler h, int what, Object obj) {
+ if (mDestroyed) {
+ return;
+ }
+
Registrant r = new Registrant(h, what, obj);
recordsLoadedRegistrants.add(r);
@@ -117,11 +144,35 @@
r.notifyRegistrant(new AsyncResult(null, null, null));
}
}
-
public void unregisterForRecordsLoaded(Handler h) {
recordsLoadedRegistrants.remove(h);
}
+ public void registerForRecordsEvents(Handler h, int what, Object obj) {
+ Registrant r = new Registrant (h, what, obj);
+ mRecordsEventsRegistrants.add(r);
+ }
+ public void unregisterForRecordsEvents(Handler h) {
+ mRecordsEventsRegistrants.remove(h);
+ }
+
+ public void registerForNewSms(Handler h, int what, Object obj) {
+ Registrant r = new Registrant (h, what, obj);
+ mNewSmsRegistrants.add(r);
+ }
+ public void unregisterForNewSms(Handler h) {
+ mNewSmsRegistrants.remove(h);
+ }
+
+ public void registerForNetworkSelectionModeAutomatic(
+ Handler h, int what, Object obj) {
+ Registrant r = new Registrant (h, what, obj);
+ mNetworkSelectionModeAutomaticRegistrants.add(r);
+ }
+ public void unregisterForNetworkSelectionModeAutomatic(Handler h) {
+ mNetworkSelectionModeAutomaticRegistrants.remove(h);
+ }
+
/**
* Get the International Mobile Subscriber ID (IMSI) on a SIM
* for GSM, UMTS and like networks. Default is null if IMSI is
@@ -163,7 +214,7 @@
AdnRecord adn = new AdnRecord(msisdnTag, msisdn);
- new AdnRecordLoader(phone).updateEF(adn, EF_MSISDN, EF_EXT1, 1, null,
+ new AdnRecordLoader(mFh).updateEF(adn, EF_MSISDN, EF_EXT1, 1, null,
obtainMessage(EVENT_SET_MSISDN_DONE, onComplete));
}
diff --git a/telephony/java/com/android/internal/telephony/MccTable.java b/telephony/java/com/android/internal/telephony/MccTable.java
index cdce841..e206783 100644
--- a/telephony/java/com/android/internal/telephony/MccTable.java
+++ b/telephony/java/com/android/internal/telephony/MccTable.java
@@ -18,6 +18,7 @@
import android.app.ActivityManagerNative;
import android.app.AlarmManager;
+import android.app.IActivityManager;
import android.content.Context;
import android.content.res.Configuration;
import android.net.wifi.WifiManager;
@@ -167,10 +168,10 @@
/**
* Updates MCC and MNC device configuration information for application retrieving
* correct version of resources. If either MCC or MNC is 0, they will be ignored (not set).
- * @param phone PhoneBae to act on.
+ * @param context Context to act on.
* @param mccmnc truncated imsi with just the MCC and MNC - MNC assumed to be from 4th to end
*/
- public static void updateMccMncConfiguration(PhoneBase phone, String mccmnc) {
+ public static void updateMccMncConfiguration(Context context, String mccmnc) {
if (!TextUtils.isEmpty(mccmnc)) {
int mcc, mnc;
@@ -185,9 +186,9 @@
Log.d(LOG_TAG, "updateMccMncConfiguration: mcc=" + mcc + ", mnc=" + mnc);
if (mcc != 0) {
- setTimezoneFromMccIfNeeded(phone, mcc);
- setLocaleFromMccIfNeeded(phone, mcc);
- setWifiCountryCodeFromMcc(phone, mcc);
+ setTimezoneFromMccIfNeeded(context, mcc);
+ setLocaleFromMccIfNeeded(context, mcc);
+ setWifiCountryCodeFromMcc(context, mcc);
}
try {
Configuration config = ActivityManagerNative.getDefault().getConfiguration();
@@ -205,16 +206,68 @@
}
/**
+ * Utility code to set the system locale if it's not set already
+ * @param context Context to act on.
+ * @param language Two character language code desired
+ * @param country Two character country code desired
+ *
+ * {@hide}
+ */
+ public static void setSystemLocale(Context context, String language, String country) {
+ String l = SystemProperties.get("persist.sys.language");
+ String c = SystemProperties.get("persist.sys.country");
+
+ if (null == language) {
+ return; // no match possible
+ }
+ language = language.toLowerCase();
+ if (null == country) {
+ country = "";
+ }
+ country = country.toUpperCase();
+
+ if((null == l || 0 == l.length()) && (null == c || 0 == c.length())) {
+ try {
+ // try to find a good match
+ String[] locales = context.getAssets().getLocales();
+ final int N = locales.length;
+ String bestMatch = null;
+ for(int i = 0; i < N; i++) {
+ // only match full (lang + country) locales
+ if (locales[i]!=null && locales[i].length() >= 5 &&
+ locales[i].substring(0,2).equals(language)) {
+ if (locales[i].substring(3,5).equals(country)) {
+ bestMatch = locales[i];
+ break;
+ } else if (null == bestMatch) {
+ bestMatch = locales[i];
+ }
+ }
+ }
+ if (null != bestMatch) {
+ IActivityManager am = ActivityManagerNative.getDefault();
+ Configuration config = am.getConfiguration();
+ config.locale = new Locale(bestMatch.substring(0,2),
+ bestMatch.substring(3,5));
+ config.userSetLocale = true;
+ am.updateConfiguration(config);
+ }
+ } catch (Exception e) {
+ // Intentionally left blank
+ }
+ }
+ }
+
+ /**
* If the timezone is not already set, set it based on the MCC of the SIM.
- * @param phone PhoneBase to act on (get context from).
+ * @param context Context to act on.
* @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA)
*/
- private static void setTimezoneFromMccIfNeeded(PhoneBase phone, int mcc) {
+ private static void setTimezoneFromMccIfNeeded(Context context, int mcc) {
String timezone = SystemProperties.get(ServiceStateTracker.TIMEZONE_PROPERTY);
if (timezone == null || timezone.length() == 0) {
String zoneId = defaultTimeZoneForMcc(mcc);
if (zoneId != null && zoneId.length() > 0) {
- Context context = phone.getContext();
// Set time zone based on MCC
AlarmManager alarm =
(AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
@@ -226,27 +279,31 @@
/**
* If the locale is not already set, set it based on the MCC of the SIM.
- * @param phone PhoneBase to act on.
+ * @param context Context to act on.
* @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA)
*/
- private static void setLocaleFromMccIfNeeded(PhoneBase phone, int mcc) {
+ private static void setLocaleFromMccIfNeeded(Context context, int mcc) {
+ if (BaseCommands.getLteOnCdmaModeStatic() == Phone.LTE_ON_CDMA_TRUE) {
+ // Avoid system locale is set from MCC table if CDMALTEPhone is used.
+ // The locale will be picked up based on EFpl/EFli once CSIM records are loaded.
+ return;
+ }
String language = MccTable.defaultLanguageForMcc(mcc);
String country = MccTable.countryCodeForMcc(mcc);
Log.d(LOG_TAG, "locale set to "+language+"_"+country);
- phone.setSystemLocale(language, country, true);
+ setSystemLocale(context, language, country);
}
/**
* If the number of allowed wifi channels has not been set, set it based on
* the MCC of the SIM.
- * @param phone PhoneBase to act on (get context from).
+ * @param context Context to act on.
* @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA)
*/
- private static void setWifiCountryCodeFromMcc(PhoneBase phone, int mcc) {
+ private static void setWifiCountryCodeFromMcc(Context context, int mcc) {
String country = MccTable.countryCodeForMcc(mcc);
if (!country.isEmpty()) {
- Context context = phone.getContext();
Log.d(LOG_TAG, "WIFI_COUNTRY_CODE set to " + country);
WifiManager wM = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
//persist
diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java
index 0b5a82c..3aa53eef 100644
--- a/telephony/java/com/android/internal/telephony/PhoneBase.java
+++ b/telephony/java/com/android/internal/telephony/PhoneBase.java
@@ -43,6 +43,7 @@
import com.android.internal.telephony.gsm.SIMRecords;
import java.util.Locale;
+import java.util.concurrent.atomic.AtomicReference;
/**
@@ -103,6 +104,10 @@
protected static final int EVENT_EMERGENCY_CALLBACK_MODE_ENTER = 25;
protected static final int EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE = 26;
protected static final int EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED = 27;
+ // other
+ protected static final int EVENT_SET_NETWORK_AUTOMATIC = 28;
+ protected static final int EVENT_NEW_ICC_SMS = 29;
+ protected static final int EVENT_ICC_RECORD_EVENTS = 30;
// Key used to read/write current CLIR setting
public static final String CLIR_KEY = "clir_key";
@@ -112,7 +117,6 @@
/* Instance Variables */
public CommandsInterface mCM;
- protected IccFileHandler mIccFileHandler;
boolean mDnsCheckDisabled;
public DataConnectionTracker mDataConnectionTracker;
boolean mDoesRilSendMultipleCallRing;
@@ -121,7 +125,7 @@
public boolean mIsTheCurrentActivePhone = true;
boolean mIsVoiceCapable = true;
public IccRecords mIccRecords;
- public IccCard mIccCard;
+ protected AtomicReference<IccCard> mIccCard = new AtomicReference<IccCard>();
public SmsStorageMonitor mSmsStorageMonitor;
public SmsUsageMonitor mSmsUsageMonitor;
public SMSDispatcher mSMS;
@@ -264,7 +268,7 @@
mSmsUsageMonitor = null;
mSMS = null;
mIccRecords = null;
- mIccCard = null;
+ mIccCard.set(null);
mDataConnectionTracker = null;
}
@@ -600,7 +604,7 @@
if (l.length() >=5) {
country = l.substring(3, 5);
}
- setSystemLocale(language, country, false);
+ MccTable.setSystemLocale(mContext, language, country);
if (!country.isEmpty()) {
try {
@@ -619,62 +623,6 @@
}
/**
- * Utility code to set the system locale if it's not set already
- * @param language Two character language code desired
- * @param country Two character country code desired
- * @param fromMcc Indicating whether the locale is set according to MCC table.
- * This flag wil be ignored by default implementation.
- * TODO: Use a source enumeration so that source of the locale
- * can be prioritized.
- *
- * {@hide}
- */
- public void setSystemLocale(String language, String country, boolean fromMcc) {
- String l = SystemProperties.get("persist.sys.language");
- String c = SystemProperties.get("persist.sys.country");
-
- if (null == language) {
- return; // no match possible
- }
- language = language.toLowerCase();
- if (null == country) {
- country = "";
- }
- country = country.toUpperCase();
-
- if((null == l || 0 == l.length()) && (null == c || 0 == c.length())) {
- try {
- // try to find a good match
- String[] locales = mContext.getAssets().getLocales();
- final int N = locales.length;
- String bestMatch = null;
- for(int i = 0; i < N; i++) {
- // only match full (lang + country) locales
- if (locales[i]!=null && locales[i].length() >= 5 &&
- locales[i].substring(0,2).equals(language)) {
- if (locales[i].substring(3,5).equals(country)) {
- bestMatch = locales[i];
- break;
- } else if (null == bestMatch) {
- bestMatch = locales[i];
- }
- }
- }
- if (null != bestMatch) {
- IActivityManager am = ActivityManagerNative.getDefault();
- Configuration config = am.getConfiguration();
- config.locale = new Locale(bestMatch.substring(0,2),
- bestMatch.substring(3,5));
- config.userSetLocale = true;
- am.updateConfiguration(config);
- }
- } catch (Exception e) {
- // Intentionally left blank
- }
- }
- }
-
- /**
* Get state
*/
public abstract Phone.State getState();
@@ -682,7 +630,11 @@
/**
* Retrieves the IccFileHandler of the Phone instance
*/
- public abstract IccFileHandler getIccFileHandler();
+ public IccFileHandler getIccFileHandler(){
+ IccCard iccCard = mIccCard.get();
+ if (iccCard == null) return null;
+ return iccCard.getIccFileHandler();
+ }
/*
* Retrieves the Handler of the Phone instance
@@ -707,7 +659,7 @@
@Override
public IccCard getIccCard() {
- return mIccCard;
+ return mIccCard.get();
}
@Override
diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
index 14a4b46..110d8bf 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java
@@ -35,6 +35,7 @@
import com.android.internal.telephony.PhoneProxy;
import com.android.internal.telephony.SMSDispatcher;
import com.android.internal.telephony.gsm.GsmSMSDispatcher;
+import com.android.internal.telephony.gsm.SmsMessage;
import com.android.internal.telephony.ims.IsimRecords;
import com.android.internal.telephony.uicc.UiccController;
@@ -62,17 +63,21 @@
public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier) {
super(context, ci, notifier, false);
m3gppSMS = new GsmSMSDispatcher(this, mSmsStorageMonitor, mSmsUsageMonitor);
+ mIccRecords.registerForNewSms(this, EVENT_NEW_ICC_SMS, null);
}
@Override
public void handleMessage (Message msg) {
AsyncResult ar;
- Message onComplete;
switch (msg.what) {
// handle the select network completion callbacks.
case EVENT_SET_NETWORK_MANUAL_COMPLETE:
handleSetSelectNetwork((AsyncResult) msg.obj);
break;
+ case EVENT_NEW_ICC_SMS:
+ ar = (AsyncResult)msg.obj;
+ m3gppSMS.dispatchMessage((SmsMessage)ar.result);
+ break;
default:
super.handleMessage(msg);
}
@@ -80,9 +85,8 @@
@Override
protected void initSstIcc() {
- mIccCard = UiccController.getInstance(this).getIccCard();
- mIccRecords = mIccCard.getIccRecords();
- mIccFileHandler = mIccCard.getIccFileHandler();
+ mIccCard.set(UiccController.getInstance(this).getIccCard());
+ mIccRecords = mIccCard.get().getIccRecords();
// CdmaLteServiceStateTracker registers with IccCard to know
// when the card is ready. So create mIccCard before the ServiceStateTracker
mSST = new CdmaLteServiceStateTracker(this);
@@ -93,6 +97,7 @@
synchronized(PhoneProxy.lockForRadioTechnologyChange) {
super.dispose();
m3gppSMS.dispose();
+ mIccRecords.unregisterForNewSms(this);
}
}
@@ -214,15 +219,6 @@
return false;
}
- @Override
- public void setSystemLocale(String language, String country, boolean fromMcc) {
- // Avoid system locale is set from MCC table if CDMALTEPhone is used.
- // The locale will be picked up based on EFpl/EFli once CSIM records are loaded.
- if (fromMcc) return;
-
- super.setSystemLocale(language, country, false);
- }
-
// return IMSI from USIM as subscriber ID.
@Override
public String getSubscriberId() {
diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
index e86e441..bb00d4b 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -103,7 +103,6 @@
PhoneSubInfo mSubInfo;
EriManager mEriManager;
WakeLock mWakeLock;
- CatService mCcatService;
// mEriFileLoadedRegistrants are informed after the ERI text has been loaded
private final RegistrantList mEriFileLoadedRegistrants = new RegistrantList();
@@ -150,9 +149,8 @@
}
protected void initSstIcc() {
- mIccCard = UiccController.getInstance(this).getIccCard();
- mIccRecords = mIccCard.getIccRecords();
- mIccFileHandler = mIccCard.getIccFileHandler();
+ mIccCard.set(UiccController.getInstance(this).getIccCard());
+ mIccRecords = mIccCard.get().getIccRecords();
// CdmaServiceStateTracker registers with IccCard to know
// when the Ruim card is ready. So create mIccCard before the ServiceStateTracker
mSST = new CdmaServiceStateTracker(this);
@@ -169,11 +167,9 @@
mRuimSmsInterfaceManager = new RuimSmsInterfaceManager(this, mSMS);
mSubInfo = new PhoneSubInfo(this);
mEriManager = new EriManager(this, context, EriManager.ERI_FROM_XML);
- mCcatService = CatService.getInstance(mCM, mIccRecords, mContext,
- mIccFileHandler, mIccCard);
mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
- mIccRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null);
+ registerForRuimRecordEvents();
mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
mCM.registerForOn(this, EVENT_RADIO_ON, null);
mCM.setOnSuppServiceNotification(this, EVENT_SSN, null);
@@ -225,7 +221,7 @@
log("dispose");
//Unregister from all former registered events
- mIccRecords.unregisterForRecordsLoaded(this); //EVENT_RUIM_RECORDS_LOADED
+ unregisterForRuimRecordEvents();
mCM.unregisterForAvailable(this); //EVENT_RADIO_AVAILABLE
mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
mCM.unregisterForOn(this); //EVENT_RADIO_ON
@@ -241,29 +237,24 @@
mSST.dispose();
mCdmaSSM.dispose(this);
mSMS.dispose();
- mIccFileHandler.dispose(); // instance of RuimFileHandler
- mIccRecords.dispose();
mRuimPhoneBookInterfaceManager.dispose();
mRuimSmsInterfaceManager.dispose();
mSubInfo.dispose();
mEriManager.dispose();
- mCcatService.dispose();
}
}
@Override
public void removeReferences() {
log("removeReferences");
- super.removeReferences();
mRuimPhoneBookInterfaceManager = null;
mRuimSmsInterfaceManager = null;
mSubInfo = null;
- mIccFileHandler = null;
mCT = null;
mSST = null;
mEriManager = null;
- mCcatService = null;
mExitEcmRunnable = null;
+ super.removeReferences();
}
@Override
@@ -999,6 +990,11 @@
}
break;
+ case EVENT_ICC_RECORD_EVENTS:
+ ar = (AsyncResult)msg.obj;
+ processIccRecordEvents((Integer)ar.result);
+ break;
+
case EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE:{
handleExitEmergencyCallbackMode(msg);
}
@@ -1063,10 +1059,22 @@
}
}
+ private void processIccRecordEvents(int eventCode) {
+ switch (eventCode) {
+ case RuimRecords.EVENT_MWI:
+ notifyMessageWaitingIndicator();
+ break;
+
+ default:
+ Log.e(LOG_TAG,"Unknown icc records event code " + eventCode);
+ break;
+ }
+ }
+
/**
* Handles the call to get the subscription source
*
- * @param holds the new CDMA subscription source value
+ * @param newSubscriptionSource holds the new CDMA subscription source value
*/
private void handleCdmaSubscriptionSource(int newSubscriptionSource) {
if (newSubscriptionSource != mCdmaSubscriptionSource) {
@@ -1117,13 +1125,6 @@
}
/**
- * {@inheritDoc}
- */
- public IccFileHandler getIccFileHandler() {
- return this.mIccFileHandler;
- }
-
- /**
* Activate or deactivate cell broadcast SMS.
*
* @param activate 0 = activate, 1 = deactivate
@@ -1423,7 +1424,7 @@
getContext().getContentResolver().insert(uri, map);
// Updates MCC MNC device configuration information
- MccTable.updateMccMncConfiguration(this, operatorNumeric);
+ MccTable.updateMccMncConfiguration(mContext, operatorNumeric);
return true;
} catch (SQLException e) {
@@ -1456,6 +1457,16 @@
return mEriManager.isEriFileLoaded();
}
+ private void registerForRuimRecordEvents() {
+ mIccRecords.registerForRecordsEvents(this, EVENT_ICC_RECORD_EVENTS, null);
+ mIccRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null);
+ }
+
+ private void unregisterForRuimRecordEvents() {
+ mIccRecords.unregisterForRecordsEvents(this);
+ mIccRecords.unregisterForRecordsLoaded(this);
+ }
+
protected void log(String s) {
if (DBG)
Log.d(LOG_TAG, "[CDMAPhone] " + s);
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
index cad2e22..09008cd 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
@@ -349,7 +349,7 @@
ss.setOperatorAlphaLong(eriText);
}
- if (phone.mIccCard.getState() == IccCard.State.READY) {
+ if (phone.getIccCard().getState() == IccCard.State.READY) {
// SIM is found on the device. If ERI roaming is OFF, and SID/NID matches
// one configfured in SIM, use operator name from CSIM record.
boolean showSpn =
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaLteUiccRecords.java b/telephony/java/com/android/internal/telephony/cdma/CdmaLteUiccRecords.java
index ca1e96d..eaa2ede 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaLteUiccRecords.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaLteUiccRecords.java
@@ -15,6 +15,7 @@
*/
package com.android.internal.telephony.cdma;
+import android.content.Context;
import android.os.AsyncResult;
import android.os.SystemProperties;
import android.util.Log;
@@ -22,6 +23,8 @@
import com.android.internal.telephony.AdnRecordLoader;
import com.android.internal.telephony.GsmAlphabet;
import com.android.internal.telephony.IccCardApplication.AppType;
+import com.android.internal.telephony.CommandsInterface;
+import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccFileHandler;
import com.android.internal.telephony.IccUtils;
import com.android.internal.telephony.MccTable;
@@ -54,8 +57,8 @@
private final IsimUiccRecords mIsimUiccRecords = new IsimUiccRecords();
- public CdmaLteUiccRecords(PhoneBase p) {
- super(p);
+ public CdmaLteUiccRecords(IccCard card, Context c, CommandsInterface ci) {
+ super(card, c, ci);
}
// Refer to ETSI TS 102.221
@@ -146,7 +149,7 @@
}
if (DBG) log("spn=" + spn);
if (DBG) log("spnCondition=" + mCsimSpnDisplayCondition);
- phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn);
+ SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, spn);
}
}
@@ -262,55 +265,54 @@
@Override
protected void fetchSimRecords() {
- IccFileHandler iccFh = phone.getIccFileHandler();
recordsRequested = true;
- phone.mCM.getIMSI(obtainMessage(EVENT_GET_IMSI_DONE));
+ mCi.getIMSIForApp(mParentCard.getAid(), obtainMessage(EVENT_GET_IMSI_DONE));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE));
+ mFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_AD, obtainMessage(EVENT_GET_AD_DONE));
+ mFh.loadEFTransparent(EF_AD, obtainMessage(EVENT_GET_AD_DONE));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_PL,
+ mFh.loadEFTransparent(EF_PL,
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfPlLoaded()));
recordsToLoad++;
- new AdnRecordLoader(phone).loadFromEF(EF_MSISDN, EF_EXT1, 1,
+ new AdnRecordLoader(mFh).loadFromEF(EF_MSISDN, EF_EXT1, 1,
obtainMessage(EVENT_GET_MSISDN_DONE));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_SST, obtainMessage(EVENT_GET_SST_DONE));
+ mFh.loadEFTransparent(EF_SST, obtainMessage(EVENT_GET_SST_DONE));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_CSIM_LI,
+ mFh.loadEFTransparent(EF_CSIM_LI,
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimLiLoaded()));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_CSIM_SPN,
+ mFh.loadEFTransparent(EF_CSIM_SPN,
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimSpnLoaded()));
recordsToLoad++;
- iccFh.loadEFLinearFixed(EF_CSIM_MDN, 1,
+ mFh.loadEFLinearFixed(EF_CSIM_MDN, 1,
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimMdnLoaded()));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_CSIM_IMSIM,
+ mFh.loadEFTransparent(EF_CSIM_IMSIM,
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimImsimLoaded()));
recordsToLoad++;
- iccFh.loadEFLinearFixedAll(EF_CSIM_CDMAHOME,
+ mFh.loadEFLinearFixedAll(EF_CSIM_CDMAHOME,
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimCdmaHomeLoaded()));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_CSIM_EPRL,
+ mFh.loadEFTransparent(EF_CSIM_EPRL,
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimEprlLoaded()));
recordsToLoad++;
// load ISIM records
- recordsToLoad += mIsimUiccRecords.fetchIsimRecords(iccFh, this);
+ recordsToLoad += mIsimUiccRecords.fetchIsimRecords(mFh, this);
}
private int adjstMinDigits (int digits) {
@@ -354,7 +356,7 @@
Integer.parseInt(imsi.substring(0,3)));
}
log("Setting locale to " + prefLang + "_" + country);
- phone.setSystemLocale(prefLang, country, false);
+ MccTable.setSystemLocale(mContext, prefLang, country);
} else {
log ("No suitable CSIM selected locale");
}
@@ -362,7 +364,7 @@
private String findBestLanguage(byte[] languages) {
String bestMatch = null;
- String[] locales = phone.getContext().getAssets().getLocales();
+ String[] locales = mContext.getAssets().getLocales();
if ((languages == null) || (locales == null)) return null;
@@ -436,23 +438,14 @@
return true;
}
- if (phone == null || phone.mIccCard == null) {
+ if (mParentCard == null) {
return false;
}
- if (phone.mIccCard.isApplicationOnIcc(AppType.APPTYPE_CSIM) &&
+ if (mParentCard.isApplicationOnIcc(AppType.APPTYPE_CSIM) &&
((mMdn == null) || (mMin == null))) {
return false;
}
return true;
}
-
- /**
- * Dispatch 3GPP format message. For CDMA/LTE phones,
- * send the message to the secondary 3GPP format SMS dispatcher.
- */
- @Override
- protected int dispatchGsmMessage(SmsMessageBase message) {
- return ((CDMALTEPhone) phone).m3gppSMS.dispatchMessage(message);
- }
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 75f5d47..9ec56fc 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -209,8 +209,7 @@
// Unregister for all events.
cm.unregisterForRadioStateChanged(this);
cm.unregisterForVoiceNetworkStateChanged(this);
- phone.mIccCard.unregisterForReady(this);
-
+ phone.getIccCard().unregisterForReady(this);
cm.unregisterForCdmaOtaProvision(this);
phone.unregisterForEriFileLoaded(this);
phone.mIccRecords.unregisterForRecordsLoaded(this);
@@ -498,7 +497,7 @@
// NV is ready when subscription source is NV
sendMessage(obtainMessage(EVENT_NV_READY));
} else {
- phone.mIccCard.registerForReady(this, EVENT_RUIM_READY, null);
+ phone.getIccCard().registerForReady(this, EVENT_RUIM_READY, null);
}
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java b/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java
index 9f30d36..f440935 100644
--- a/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java
+++ b/telephony/java/com/android/internal/telephony/cdma/RuimFileHandler.java
@@ -45,9 +45,6 @@
super(card, aid, ci);
}
- public void dispose() {
- }
-
protected void finalize() {
Log.d(LOG_TAG, "RuimFileHandler finalized");
}
diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
index 265dff7..3855515 100755
--- a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
+++ b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
@@ -18,6 +18,7 @@
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;
+import android.content.Context;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
@@ -78,19 +79,19 @@
private static final int EVENT_RUIM_REFRESH = 31;
- public RuimRecords(PhoneBase p) {
- super(p);
+ public RuimRecords(IccCard card, Context c, CommandsInterface ci) {
+ super(card, c, ci);
- adnCache = new AdnRecordCache(phone);
+ adnCache = new AdnRecordCache(mFh);
recordsRequested = false; // No load request is made till SIM ready
// recordsToLoad is set to 0 because no requests are made yet
recordsToLoad = 0;
- p.mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
+ mCi.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
// NOTE the EVENT_SMS_ON_RUIM is not registered
- p.mCM.registerForIccRefresh(this, EVENT_RUIM_REFRESH, null);
+ mCi.registerForIccRefresh(this, EVENT_RUIM_REFRESH, null);
// Start off by setting empty state
onRadioOffOrNotAvailable();
@@ -99,9 +100,11 @@
@Override
public void dispose() {
+ if (DBG) log("Disposing RuimRecords " + this);
//Unregister for all events
- phone.mCM.unregisterForOffOrNotAvailable( this);
- phone.mCM.unregisterForIccRefresh(this);
+ mCi.unregisterForOffOrNotAvailable( this);
+ mCi.unregisterForIccRefresh(this);
+ super.dispose();
}
@Override
@@ -196,7 +199,7 @@
boolean isRecordLoadResponse = false;
- if (!phone.mIsTheCurrentActivePhone) {
+ if (mDestroyed) {
loge("Received message " + msg +
"[" + msg.what + "] while being destroyed. Ignoring.");
return;
@@ -235,7 +238,7 @@
String operatorNumeric = getRUIMOperatorNumeric();
if (operatorNumeric != null) {
if(operatorNumeric.length() <= 6){
- MccTable.updateMccMncConfiguration(phone, operatorNumeric);
+ MccTable.updateMccMncConfiguration(mContext, operatorNumeric);
}
}
break;
@@ -314,6 +317,7 @@
// One record loaded successfully or failed, In either case
// we need to update the recordsToLoad count
recordsToLoad -= 1;
+ if (DBG) log("RuimRecords:onRecordLoaded " + recordsToLoad + " requested: " + recordsRequested);
if (recordsToLoad == 0 && recordsRequested == true) {
onAllRecordsLoaded();
@@ -338,7 +342,7 @@
}
recordsLoadedRegistrants.notifyRegistrants(
new AsyncResult(null, null, null));
- phone.mIccCard.broadcastIccStateChangedIntent(
+ mParentCard.broadcastIccStateChangedIntent(
IccCard.INTENT_VALUE_ICC_LOADED, null);
}
@@ -348,13 +352,12 @@
READY is sent before IMSI ready
*/
- phone.mIccCard.broadcastIccStateChangedIntent(
+ mParentCard.broadcastIccStateChangedIntent(
IccCard.INTENT_VALUE_ICC_READY, null);
fetchRuimRecords();
- phone.mCM.getCDMASubscription(obtainMessage(EVENT_GET_CDMA_SUBSCRIPTION_DONE));
-
+ mCi.getCDMASubscription(obtainMessage(EVENT_GET_CDMA_SUBSCRIPTION_DONE));
}
@@ -363,13 +366,14 @@
Log.v(LOG_TAG, "RuimRecords:fetchRuimRecords " + recordsToLoad);
- phone.mCM.getIMSI(obtainMessage(EVENT_GET_IMSI_DONE));
+ mCi.getIMSI(obtainMessage(EVENT_GET_IMSI_DONE));
recordsToLoad++;
- phone.getIccFileHandler().loadEFTransparent(EF_ICCID,
+ mFh.loadEFTransparent(EF_ICCID,
obtainMessage(EVENT_GET_ICCID_DONE));
recordsToLoad++;
+ log("RuimRecords:fetchRuimRecords " + recordsToLoad + " requested: " + recordsRequested);
// Further records that can be inserted are Operator/OEM dependent
}
@@ -401,7 +405,7 @@
}
countVoiceMessages = countWaiting;
- ((CDMAPhone) phone).notifyMessageWaitingIndicator();
+ mRecordsEventsRegistrants.notifyResult(EVENT_MWI);
}
private void handleRuimRefresh(IccRefreshResponse refreshResponse) {
@@ -411,7 +415,7 @@
}
if (refreshResponse.aid != null &&
- !refreshResponse.aid.equals(phone.getIccCard().getAid())) {
+ !refreshResponse.aid.equals(mParentCard.getAid())) {
// This is for different app. Ignore.
return;
}
@@ -429,7 +433,7 @@
break;
case IccRefreshResponse.REFRESH_RESULT_RESET:
if (DBG) log("handleRuimRefresh with SIM_REFRESH_RESET");
- phone.mCM.setRadioPower(false, null);
+ mCi.setRadioPower(false, null);
/* Note: no need to call setRadioPower(true). Assuming the desired
* radio power state is still ON (as tracked by ServiceStateTracker),
* ServiceStateTracker will call setRadioPower when it receives the
diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
index 5e9a4f2..be13c35 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
@@ -101,7 +101,6 @@
// Instance Variables
GsmCallTracker mCT;
GsmServiceStateTracker mSST;
- CatService mStkService;
ArrayList <GsmMmiCode> mPendingMMIs = new ArrayList<GsmMmiCode>();
SimPhoneBookInterfaceManager mSimPhoneBookIntManager;
SimSmsInterfaceManager mSimSmsIntManager;
@@ -137,22 +136,20 @@
}
mCM.setPhoneType(Phone.PHONE_TYPE_GSM);
- mIccCard = UiccController.getInstance(this).getIccCard();
+ mIccCard.set(UiccController.getInstance(this).getIccCard());
+ mIccRecords = mIccCard.get().getIccRecords();
mCT = new GsmCallTracker(this);
mSST = new GsmServiceStateTracker (this);
mSMS = new GsmSMSDispatcher(this, mSmsStorageMonitor, mSmsUsageMonitor);
- mIccFileHandler = mIccCard.getIccFileHandler();
- mIccRecords = mIccCard.getIccRecords();
mDataConnectionTracker = new GsmDataConnectionTracker (this);
if (!unitTestMode) {
mSimPhoneBookIntManager = new SimPhoneBookInterfaceManager(this);
mSimSmsIntManager = new SimSmsInterfaceManager(this, mSMS);
mSubInfo = new PhoneSubInfo(this);
}
- mStkService = CatService.getInstance(mCM, mIccRecords, mContext, mIccFileHandler, mIccCard);
mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
- mIccRecords.registerForRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
+ registerForSimRecordEvents();
mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
mCM.registerForOn(this, EVENT_RADIO_ON, null);
mCM.setOnUSSD(this, EVENT_USSD, null);
@@ -205,7 +202,7 @@
//Unregister from all former registered events
mCM.unregisterForAvailable(this); //EVENT_RADIO_AVAILABLE
- mIccRecords.unregisterForRecordsLoaded(this); //EVENT_SIM_RECORDS_LOADED
+ unregisterForSimRecordEvents();
mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
mCM.unregisterForOn(this); //EVENT_RADIO_ON
mSST.unregisterForNetworkAttached(this); //EVENT_REGISTERED_TO_NETWORK
@@ -215,12 +212,9 @@
mPendingMMIs.clear();
//Force all referenced classes to unregister their former registered events
- mStkService.dispose();
mCT.dispose();
mDataConnectionTracker.dispose();
mSST.dispose();
- mIccFileHandler.dispose(); // instance of SimFileHandler
- mIccRecords.dispose();
mSimPhoneBookIntManager.dispose();
mSimSmsIntManager.dispose();
mSubInfo.dispose();
@@ -230,15 +224,13 @@
@Override
public void removeReferences() {
Log.d(LOG_TAG, "removeReferences");
- super.removeReferences();
mSimulatedRadioControl = null;
- mStkService = null;
mSimPhoneBookIntManager = null;
mSimSmsIntManager = null;
mSubInfo = null;
- mIccFileHandler = null;
mCT = null;
mSST = null;
+ super.removeReferences();
}
protected void finalize() {
@@ -1288,6 +1280,21 @@
}
break;
+ case EVENT_NEW_ICC_SMS:
+ ar = (AsyncResult)msg.obj;
+ mSMS.dispatchMessage((SmsMessage)ar.result);
+ break;
+
+ case EVENT_SET_NETWORK_AUTOMATIC:
+ ar = (AsyncResult)msg.obj;
+ setNetworkSelectionModeAutomatic((Message)ar.result);
+ break;
+
+ case EVENT_ICC_RECORD_EVENTS:
+ ar = (AsyncResult)msg.obj;
+ processIccRecordEvents((Integer)ar.result);
+ break;
+
// handle the select network completion callbacks.
case EVENT_SET_NETWORK_MANUAL_COMPLETE:
case EVENT_SET_NETWORK_AUTOMATIC_COMPLETE:
@@ -1311,7 +1318,18 @@
}
}
- /**
+ private void processIccRecordEvents(int eventCode) {
+ switch (eventCode) {
+ case SIMRecords.EVENT_CFI:
+ notifyCallForwardingIndicator();
+ break;
+ case SIMRecords.EVENT_MWI:
+ notifyMessageWaitingIndicator();
+ break;
+ }
+ }
+
+ /**
* Sets the "current" field in the telephony provider according to the SIM's operator
*
* @return true for success; false otherwise.
@@ -1420,13 +1438,6 @@
}
/**
- * {@inheritDoc}
- */
- public IccFileHandler getIccFileHandler(){
- return this.mIccFileHandler;
- }
-
- /**
* Activate or deactivate cell broadcast SMS.
*
* @param activate 0 = activate, 1 = deactivate
@@ -1460,4 +1471,20 @@
public boolean isCspPlmnEnabled() {
return mIccRecords.isCspPlmnEnabled();
}
+
+ private void registerForSimRecordEvents() {
+ mIccRecords.registerForNetworkSelectionModeAutomatic(
+ this, EVENT_SET_NETWORK_AUTOMATIC, null);
+ mIccRecords.registerForNewSms(this, EVENT_NEW_ICC_SMS, null);
+ mIccRecords.registerForRecordsEvents(this, EVENT_ICC_RECORD_EVENTS, null);
+ mIccRecords.registerForRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
+ }
+
+ private void unregisterForSimRecordEvents() {
+ mIccRecords.unregisterForNetworkSelectionModeAutomatic(this);
+ mIccRecords.unregisterForNewSms(this);
+ mIccRecords.unregisterForRecordsEvents(this);
+ mIccRecords.unregisterForRecordsLoaded(this);
+ }
+
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java b/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java
index 205c73d..9b3d5cd 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java
@@ -765,7 +765,7 @@
// invalid length
handlePasswordError(com.android.internal.R.string.invalidPin);
} else if (sc.equals(SC_PIN) &&
- phone.mIccCard.getState() == IccCard.State.PUK_REQUIRED ) {
+ phone.getIccCard().getState() == IccCard.State.PUK_REQUIRED ) {
// Sim is puk-locked
handlePasswordError(com.android.internal.R.string.needPuk);
} else {
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index 148b139..080d90c 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -211,7 +211,7 @@
cm.setOnNITZTime(this, EVENT_NITZ_TIME, null);
cm.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null);
cm.setOnRestrictedStateChanged(this, EVENT_RESTRICTED_STATE_CHANGED, null);
- phone.mIccCard.registerForReady(this, EVENT_SIM_READY, null);
+ phone.getIccCard().registerForReady(this, EVENT_SIM_READY, null);
// system setting property AIRPLANE_MODE_ON is set in Settings.
int airplaneMode = Settings.System.getInt(
@@ -244,7 +244,7 @@
cm.unregisterForAvailable(this);
cm.unregisterForRadioStateChanged(this);
cm.unregisterForVoiceNetworkStateChanged(this);
- phone.mIccCard.unregisterForReady(this);
+ phone.getIccCard().unregisterForReady(this);
phone.mIccRecords.unregisterForRecordsLoaded(this);
cm.unSetOnSignalStrengthUpdate(this);
cm.unSetOnRestrictedStateChanged(this);
diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java b/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java
index 455ee74..dcc9cfd 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java
@@ -40,10 +40,6 @@
super(card, aid, ci);
}
- public void dispose() {
- super.dispose();
- }
-
protected void finalize() {
Log.d(LOG_TAG, "SIMFileHandler finalized");
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java
index 68d3b2a..b88af2c 100755
--- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java
@@ -21,6 +21,7 @@
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;
import android.content.Context;
import android.os.AsyncResult;
+import android.os.Handler;
import android.os.Message;
import android.os.SystemProperties;
import android.util.Log;
@@ -174,10 +175,10 @@
// ***** Constructor
- public SIMRecords(PhoneBase p) {
- super(p);
+ public SIMRecords(IccCard card, Context c, CommandsInterface ci) {
+ super(card, c, ci);
- adnCache = new AdnRecordCache(phone);
+ adnCache = new AdnRecordCache(mFh);
mVmConfig = new VoiceMailConstants();
mSpnOverride = new SpnOverride();
@@ -187,10 +188,10 @@
// recordsToLoad is set to 0 because no requests are made yet
recordsToLoad = 0;
- p.mCM.registerForOffOrNotAvailable(
+ mCi.registerForOffOrNotAvailable(
this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
- p.mCM.setOnSmsOnSim(this, EVENT_SMS_ON_SIM, null);
- p.mCM.registerForIccRefresh(this, EVENT_SIM_REFRESH, null);
+ mCi.setOnSmsOnSim(this, EVENT_SMS_ON_SIM, null);
+ mCi.registerForIccRefresh(this, EVENT_SIM_REFRESH, null);
// Start off by setting empty state
onRadioOffOrNotAvailable();
@@ -199,9 +200,12 @@
@Override
public void dispose() {
+ if (DBG) log("Disposing SIMRecords " + this);
//Unregister for all events
- phone.mCM.unregisterForOffOrNotAvailable( this);
- phone.mCM.unregisterForIccRefresh(this);
+ mCi.unregisterForOffOrNotAvailable( this);
+ mCi.unregisterForIccRefresh(this);
+ mCi.unSetOnSmsOnSim(this);
+ super.dispose();
}
protected void finalize() {
@@ -224,9 +228,9 @@
adnCache.reset();
- phone.setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, null);
- phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, null);
- phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, null);
+ SystemProperties.set(PROPERTY_ICC_OPERATOR_NUMERIC, null);
+ SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, null);
+ SystemProperties.set(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, null);
// recordsRequested is set to false indicating that the SIM
// read requests made so far are not valid. This is set to
@@ -280,7 +284,7 @@
AdnRecord adn = new AdnRecord(msisdnTag, msisdn);
- new AdnRecordLoader(phone).updateEF(adn, EF_MSISDN, EF_EXT1, 1, null,
+ new AdnRecordLoader(mFh).updateEF(adn, EF_MSISDN, EF_EXT1, 1, null,
obtainMessage(EVENT_SET_MSISDN_DONE, onComplete));
}
@@ -332,13 +336,13 @@
if (mailboxIndex != 0 && mailboxIndex != 0xff) {
- new AdnRecordLoader(phone).updateEF(adn, EF_MBDN, EF_EXT6,
+ new AdnRecordLoader(mFh).updateEF(adn, EF_MBDN, EF_EXT6,
mailboxIndex, null,
obtainMessage(EVENT_SET_MBDN_DONE, onComplete));
} else if (isCphsMailboxEnabled()) {
- new AdnRecordLoader(phone).updateEF(adn, EF_MAILBOX_CPHS,
+ new AdnRecordLoader(mFh).updateEF(adn, EF_MAILBOX_CPHS,
EF_EXT1, 1, null,
obtainMessage(EVENT_SET_CPHS_MAILBOX_DONE, onComplete));
@@ -379,7 +383,7 @@
countVoiceMessages = countWaiting;
- phone.notifyMessageWaitingIndicator();
+ mRecordsEventsRegistrants.notifyResult(EVENT_MWI);
try {
if (efMWIS != null) {
@@ -398,7 +402,7 @@
efMWIS[1] = (byte) countWaiting;
}
- phone.getIccFileHandler().updateEFLinearFixed(
+ mFh.updateEFLinearFixed(
EF_MWIS, 1, efMWIS, null,
obtainMessage (EVENT_UPDATE_DONE, EF_MWIS));
}
@@ -408,7 +412,7 @@
efCPHS_MWI[0] = (byte)((efCPHS_MWI[0] & 0xf0)
| (countVoiceMessages == 0 ? 0x5 : 0xa));
- phone.getIccFileHandler().updateEFTransparent(
+ mFh.updateEFTransparent(
EF_VOICE_MAIL_INDICATOR_CPHS, efCPHS_MWI,
obtainMessage (EVENT_UPDATE_DONE, EF_VOICE_MAIL_INDICATOR_CPHS));
}
@@ -435,7 +439,7 @@
callForwardingEnabled = enable;
- phone.notifyCallForwardingIndicator();
+ mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
try {
if (mEfCfis != null) {
@@ -449,7 +453,7 @@
// TODO: Should really update other fields in EF_CFIS, eg,
// dialing number. We don't read or use it right now.
- phone.getIccFileHandler().updateEFLinearFixed(
+ mFh.updateEFLinearFixed(
EF_CFIS, 1, mEfCfis, null,
obtainMessage (EVENT_UPDATE_DONE, EF_CFIS));
}
@@ -463,7 +467,7 @@
| CFF_UNCONDITIONAL_DEACTIVE);
}
- phone.getIccFileHandler().updateEFTransparent(
+ mFh.updateEFTransparent(
EF_CFF_CPHS, mEfCff,
obtainMessage (EVENT_UPDATE_DONE, EF_CFF_CPHS));
}
@@ -516,7 +520,7 @@
boolean isRecordLoadResponse = false;
- if (!phone.mIsTheCurrentActivePhone) {
+ if (mDestroyed) {
loge("Received message " + msg + "[" + msg.what + "] " +
" while being destroyed. Ignoring.");
return;
@@ -574,9 +578,9 @@
if (mncLength != UNKNOWN && mncLength != UNINITIALIZED) {
// finally have both the imsi and the mncLength and can parse the imsi properly
- MccTable.updateMccMncConfiguration(phone, imsi.substring(0, 3 + mncLength));
+ MccTable.updateMccMncConfiguration(mContext, imsi.substring(0, 3 + mncLength));
}
- phone.mIccCard.broadcastIccStateChangedIntent(
+ mParentCard.broadcastIccStateChangedIntent(
IccCard.INTENT_VALUE_ICC_IMSI, null);
break;
@@ -607,12 +611,12 @@
if (isValidMbdn) {
// Note: MBDN was not included in NUM_OF_SIM_RECORDS_LOADED
- new AdnRecordLoader(phone).loadFromEF(EF_MBDN, EF_EXT6,
+ new AdnRecordLoader(mFh).loadFromEF(EF_MBDN, EF_EXT6,
mailboxIndex, obtainMessage(EVENT_GET_MBDN_DONE));
} else {
// If this EF not present, try mailbox as in CPHS standard
// CPHS (CPHS4_2.WW6) is a european standard.
- new AdnRecordLoader(phone).loadFromEF(EF_MAILBOX_CPHS,
+ new AdnRecordLoader(mFh).loadFromEF(EF_MAILBOX_CPHS,
EF_EXT1, 1,
obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
}
@@ -644,7 +648,7 @@
// FIXME right now, only load line1's CPHS voice mail entry
recordsToLoad += 1;
- new AdnRecordLoader(phone).loadFromEF(
+ new AdnRecordLoader(mFh).loadFromEF(
EF_MAILBOX_CPHS, EF_EXT1, 1,
obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
}
@@ -661,7 +665,7 @@
// FIXME should use SST to decide
// FIXME right now, only load line1's CPHS voice mail entry
recordsToLoad += 1;
- new AdnRecordLoader(phone).loadFromEF(
+ new AdnRecordLoader(mFh).loadFromEF(
EF_MAILBOX_CPHS, EF_EXT1, 1,
obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
@@ -729,7 +733,7 @@
countVoiceMessages = -1;
}
- phone.notifyMessageWaitingIndicator();
+ mRecordsEventsRegistrants.notifyResult(EVENT_MWI);
break;
case EVENT_GET_VOICE_MAIL_INDICATOR_CPHS_DONE:
@@ -758,7 +762,7 @@
countVoiceMessages = 0;
}
- phone.notifyMessageWaitingIndicator();
+ mRecordsEventsRegistrants.notifyResult(EVENT_MWI);
}
break;
@@ -839,7 +843,8 @@
if (imsi != null && mncLength != UNKNOWN) {
// finally have both imsi and the length of the mnc and can parse
// the imsi properly
- MccTable.updateMccMncConfiguration(phone, imsi.substring(0, 3 + mncLength));
+ MccTable.updateMccMncConfiguration(mContext,
+ imsi.substring(0, 3 + mncLength));
}
}
break;
@@ -867,7 +872,7 @@
callForwardingEnabled =
((data[0] & CFF_LINE1_MASK) == CFF_UNCONDITIONAL_ACTIVE);
- phone.notifyCallForwardingIndicator();
+ mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
}
break;
@@ -940,7 +945,7 @@
+ ar.exception + " length " + index.length);
} else {
log("READ EF_SMS RECORD index=" + index[0]);
- phone.getIccFileHandler().loadEFLinearFixed(EF_SMS,index[0],
+ mFh.loadEFLinearFixed(EF_SMS,index[0],
obtainMessage(EVENT_GET_SMS_DONE));
}
break;
@@ -1012,7 +1017,7 @@
onCphsCompleted = null;
}
- new AdnRecordLoader(phone).
+ new AdnRecordLoader(mFh).
updateEF(adn, EF_MAILBOX_CPHS, EF_EXT1, 1, null,
obtainMessage(EVENT_SET_CPHS_MAILBOX_DONE,
onCphsCompleted));
@@ -1066,7 +1071,7 @@
// Refer TS 51.011 Section 10.3.46 for the content description
callForwardingEnabled = ((data[1] & 0x01) != 0);
- phone.notifyCallForwardingIndicator();
+ mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
break;
case EVENT_GET_CSP_CPHS_DONE:
@@ -1103,18 +1108,18 @@
switch(efid) {
case EF_MBDN:
recordsToLoad++;
- new AdnRecordLoader(phone).loadFromEF(EF_MBDN, EF_EXT6,
+ new AdnRecordLoader(mFh).loadFromEF(EF_MBDN, EF_EXT6,
mailboxIndex, obtainMessage(EVENT_GET_MBDN_DONE));
break;
case EF_MAILBOX_CPHS:
recordsToLoad++;
- new AdnRecordLoader(phone).loadFromEF(EF_MAILBOX_CPHS, EF_EXT1,
+ new AdnRecordLoader(mFh).loadFromEF(EF_MAILBOX_CPHS, EF_EXT1,
1, obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
break;
case EF_CSP_CPHS:
recordsToLoad++;
log("[CSP] SIM Refresh for EF_CSP_CPHS");
- phone.getIccFileHandler().loadEFTransparent(EF_CSP_CPHS,
+ mFh.loadEFTransparent(EF_CSP_CPHS,
obtainMessage(EVENT_GET_CSP_CPHS_DONE));
break;
default:
@@ -1134,7 +1139,7 @@
}
if (refreshResponse.aid != null &&
- !refreshResponse.aid.equals(phone.getIccCard().getAid())) {
+ !refreshResponse.aid.equals(mParentCard.getAid())) {
// This is for different app. Ignore.
return;
}
@@ -1152,7 +1157,7 @@
break;
case IccRefreshResponse.REFRESH_RESULT_RESET:
if (DBG) log("handleSimRefresh with SIM_REFRESH_RESET");
- phone.mCM.setRadioPower(false, null);
+ mCi.setRadioPower(false, null);
/* Note: no need to call setRadioPower(true). Assuming the desired
* radio power state is still ON (as tracked by ServiceStateTracker),
* ServiceStateTracker will call setRadioPower when it receives the
@@ -1174,7 +1179,8 @@
* to send messages to the secondary 3GPP format SMS dispatcher.
*/
protected int dispatchGsmMessage(SmsMessageBase message) {
- return phone.mSMS.dispatchMessage(message);
+ mNewSmsRegistrants.notifyResult(message);
+ return 0;
}
private void handleSms(byte[] ba) {
@@ -1226,7 +1232,7 @@
ba[0] = 1;
if (false) { // XXX writing seems to crash RdoServD
- phone.getIccFileHandler().updateEFLinearFixed(EF_SMS,
+ mFh.updateEFLinearFixed(EF_SMS,
i, ba, null, obtainMessage(EVENT_MARK_SMS_READ_DONE, i));
}
}
@@ -1237,6 +1243,7 @@
// One record loaded successfully or failed, In either case
// we need to update the recordsToLoad count
recordsToLoad -= 1;
+ if (DBG) log("onRecordLoaded " + recordsToLoad + " requested: " + recordsRequested);
if (recordsToLoad == 0 && recordsRequested == true) {
onAllRecordsLoaded();
@@ -1253,10 +1260,10 @@
// Some fields require more than one SIM record to set
- phone.setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, operator);
+ SystemProperties.set(PROPERTY_ICC_OPERATOR_NUMERIC, operator);
if (imsi != null) {
- phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
+ SystemProperties.set(PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
MccTable.countryCodeForMcc(Integer.parseInt(imsi.substring(0,3))));
}
else {
@@ -1268,7 +1275,7 @@
recordsLoadedRegistrants.notifyRegistrants(
new AsyncResult(null, null, null));
- phone.mIccCard.broadcastIccStateChangedIntent(
+ mParentCard.broadcastIccStateChangedIntent(
IccCard.INTENT_VALUE_ICC_LOADED, null);
}
@@ -1294,7 +1301,7 @@
/* broadcast intent SIM_READY here so that we can make sure
READY is sent before IMSI ready
*/
- phone.mIccCard.broadcastIccStateChangedIntent(
+ mParentCard.broadcastIccStateChangedIntent(
IccCard.INTENT_VALUE_ICC_READY, null);
fetchSimRecords();
@@ -1302,31 +1309,30 @@
protected void fetchSimRecords() {
recordsRequested = true;
- IccFileHandler iccFh = phone.getIccFileHandler();
- logv("fetchSimRecords " + recordsToLoad);
+ if (DBG) log("fetchSimRecords " + recordsToLoad);
- phone.mCM.getIMSIForApp(phone.getIccCard().getAid(), obtainMessage(EVENT_GET_IMSI_DONE));
+ mCi.getIMSIForApp(mParentCard.getAid(), obtainMessage(EVENT_GET_IMSI_DONE));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE));
+ mFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE));
recordsToLoad++;
// FIXME should examine EF[MSISDN]'s capability configuration
// to determine which is the voice/data/fax line
- new AdnRecordLoader(phone).loadFromEF(EF_MSISDN, EF_EXT1, 1,
+ new AdnRecordLoader(mFh).loadFromEF(EF_MSISDN, EF_EXT1, 1,
obtainMessage(EVENT_GET_MSISDN_DONE));
recordsToLoad++;
// Record number is subscriber profile
- iccFh.loadEFLinearFixed(EF_MBI, 1, obtainMessage(EVENT_GET_MBI_DONE));
+ mFh.loadEFLinearFixed(EF_MBI, 1, obtainMessage(EVENT_GET_MBI_DONE));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_AD, obtainMessage(EVENT_GET_AD_DONE));
+ mFh.loadEFTransparent(EF_AD, obtainMessage(EVENT_GET_AD_DONE));
recordsToLoad++;
// Record number is subscriber profile
- iccFh.loadEFLinearFixed(EF_MWIS, 1, obtainMessage(EVENT_GET_MWIS_DONE));
+ mFh.loadEFLinearFixed(EF_MWIS, 1, obtainMessage(EVENT_GET_MWIS_DONE));
recordsToLoad++;
@@ -1334,39 +1340,39 @@
// the same info as EF[MWIS]. If both exist, both are updated
// but the EF[MWIS] data is preferred
// Please note this must be loaded after EF[MWIS]
- iccFh.loadEFTransparent(
+ mFh.loadEFTransparent(
EF_VOICE_MAIL_INDICATOR_CPHS,
obtainMessage(EVENT_GET_VOICE_MAIL_INDICATOR_CPHS_DONE));
recordsToLoad++;
// Same goes for Call Forward Status indicator: fetch both
// EF[CFIS] and CPHS-EF, with EF[CFIS] preferred.
- iccFh.loadEFLinearFixed(EF_CFIS, 1, obtainMessage(EVENT_GET_CFIS_DONE));
+ mFh.loadEFLinearFixed(EF_CFIS, 1, obtainMessage(EVENT_GET_CFIS_DONE));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_CFF_CPHS, obtainMessage(EVENT_GET_CFF_DONE));
+ mFh.loadEFTransparent(EF_CFF_CPHS, obtainMessage(EVENT_GET_CFF_DONE));
recordsToLoad++;
getSpnFsm(true, null);
- iccFh.loadEFTransparent(EF_SPDI, obtainMessage(EVENT_GET_SPDI_DONE));
+ mFh.loadEFTransparent(EF_SPDI, obtainMessage(EVENT_GET_SPDI_DONE));
recordsToLoad++;
- iccFh.loadEFLinearFixed(EF_PNN, 1, obtainMessage(EVENT_GET_PNN_DONE));
+ mFh.loadEFLinearFixed(EF_PNN, 1, obtainMessage(EVENT_GET_PNN_DONE));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_SST, obtainMessage(EVENT_GET_SST_DONE));
+ mFh.loadEFTransparent(EF_SST, obtainMessage(EVENT_GET_SST_DONE));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_INFO_CPHS, obtainMessage(EVENT_GET_INFO_CPHS_DONE));
+ mFh.loadEFTransparent(EF_INFO_CPHS, obtainMessage(EVENT_GET_INFO_CPHS_DONE));
recordsToLoad++;
- iccFh.loadEFTransparent(EF_CSP_CPHS,obtainMessage(EVENT_GET_CSP_CPHS_DONE));
+ mFh.loadEFTransparent(EF_CSP_CPHS,obtainMessage(EVENT_GET_CSP_CPHS_DONE));
recordsToLoad++;
// XXX should seek instead of examining them all
if (false) { // XXX
- iccFh.loadEFLinearFixedAll(EF_SMS, obtainMessage(EVENT_GET_ALL_SMS_DONE));
+ mFh.loadEFLinearFixedAll(EF_SMS, obtainMessage(EVENT_GET_ALL_SMS_DONE));
recordsToLoad++;
}
@@ -1379,9 +1385,10 @@
+ "ffffffffffffffffffffffffffffff";
byte[] ba = IccUtils.hexStringToBytes(sms);
- iccFh.updateEFLinearFixed(EF_SMS, 1, ba, null,
+ mFh.updateEFLinearFixed(EF_SMS, 1, ba, null,
obtainMessage(EVENT_MARK_SMS_READ_DONE, 1));
}
+ if (DBG) log("fetchSimRecords " + recordsToLoad + " requested: " + recordsRequested);
}
/**
@@ -1467,7 +1474,7 @@
case INIT:
spn = null;
- phone.getIccFileHandler().loadEFTransparent( EF_SPN,
+ mFh.loadEFTransparent(EF_SPN,
obtainMessage(EVENT_GET_SPN_DONE));
recordsToLoad++;
@@ -1481,11 +1488,11 @@
if (DBG) log("Load EF_SPN: " + spn
+ " spnDisplayCondition: " + spnDisplayCondition);
- phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn);
+ SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, spn);
spnState = Get_Spn_Fsm_State.IDLE;
} else {
- phone.getIccFileHandler().loadEFTransparent( EF_SPN_CPHS,
+ mFh.loadEFTransparent( EF_SPN_CPHS,
obtainMessage(EVENT_GET_SPN_DONE));
recordsToLoad++;
@@ -1503,11 +1510,11 @@
data, 0, data.length - 1 );
if (DBG) log("Load EF_SPN_CPHS: " + spn);
- phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn);
+ SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, spn);
spnState = Get_Spn_Fsm_State.IDLE;
} else {
- phone.getIccFileHandler().loadEFTransparent(
+ mFh.loadEFTransparent(
EF_SPN_SHORT_CPHS, obtainMessage(EVENT_GET_SPN_DONE));
recordsToLoad++;
@@ -1521,7 +1528,7 @@
data, 0, data.length - 1);
if (DBG) log("Load EF_SPN_SHORT_CPHS: " + spn);
- phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn);
+ SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, spn);
}else {
if (DBG) log("No SPN loaded in either CHPS or 3GPP");
}
@@ -1638,7 +1645,7 @@
// Operator Selection menu should be disabled.
// Operator Selection Mode should be set to Automatic.
log("[CSP] Set Automatic Network Selection");
- phone.setNetworkSelectionModeAutomatic(null);
+ mNetworkSelectionModeAutomaticRegistrants.notifyRegistrants();
}
return;
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java b/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java
index a9efc98..8f5a420 100755
--- a/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java
+++ b/telephony/java/com/android/internal/telephony/gsm/UsimPhoneBookManager.java
@@ -24,6 +24,7 @@
import com.android.internal.telephony.AdnRecord;
import com.android.internal.telephony.AdnRecordCache;
import com.android.internal.telephony.IccConstants;
+import com.android.internal.telephony.IccFileHandler;
import com.android.internal.telephony.IccUtils;
import com.android.internal.telephony.PhoneBase;
@@ -42,7 +43,7 @@
private static final boolean DBG = true;
private PbrFile mPbrFile;
private Boolean mIsPbrPresent;
- private PhoneBase mPhone;
+ private IccFileHandler mFh;
private AdnRecordCache mAdnCache;
private Object mLock = new Object();
private ArrayList<AdnRecord> mPhoneBookRecords;
@@ -74,8 +75,8 @@
private static final int USIM_EFEMAIL_TAG = 0xCA;
private static final int USIM_EFCCP1_TAG = 0xCB;
- public UsimPhoneBookManager(PhoneBase phone, AdnRecordCache cache) {
- mPhone = phone;
+ public UsimPhoneBookManager(IccFileHandler fh, AdnRecordCache cache) {
+ mFh = fh;
mPhoneBookRecords = new ArrayList<AdnRecord>();
mPbrFile = null;
// We assume its present, after the first read this is updated.
@@ -138,7 +139,7 @@
}
private void readPbrFileAndWait() {
- mPhone.getIccFileHandler().loadEFLinearFixedAll(EF_PBR, obtainMessage(EVENT_PBR_LOAD_DONE));
+ mFh.loadEFLinearFixedAll(EF_PBR, obtainMessage(EVENT_PBR_LOAD_DONE));
try {
mLock.wait();
} catch (InterruptedException e) {
@@ -165,7 +166,7 @@
}
}
// Read the EFEmail file.
- mPhone.getIccFileHandler().loadEFLinearFixedAll(fileIds.get(USIM_EFEMAIL_TAG),
+ mFh.loadEFLinearFixedAll(fileIds.get(USIM_EFEMAIL_TAG),
obtainMessage(EVENT_EMAIL_LOAD_DONE));
try {
mLock.wait();
@@ -183,7 +184,7 @@
}
private void readIapFileAndWait(int efid) {
- mPhone.getIccFileHandler().loadEFLinearFixedAll(efid, obtainMessage(EVENT_IAP_LOAD_DONE));
+ mFh.loadEFLinearFixedAll(efid, obtainMessage(EVENT_IAP_LOAD_DONE));
try {
mLock.wait();
} catch (InterruptedException e) {
diff --git a/test-runner/src/android/test/BandwidthTestRunner.java b/test-runner/src/android/test/BandwidthTestRunner.java
deleted file mode 100644
index 9c5478d..0000000
--- a/test-runner/src/android/test/BandwidthTestRunner.java
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2011 Google Inc. All Rights Reserved.
-
-package android.test;
-
-import android.net.NetworkStats;
-import android.net.NetworkStats.Entry;
-import android.net.TrafficStats;
-import android.os.Bundle;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestListener;
-
-import java.lang.reflect.Method;
-
-/**
- * A specialized {@link android.app.Instrumentation} that can collect Bandwidth statistics during
- * the execution of the test.
- * This is used in place of {@link InstrumentationTestRunner}.
- * i.e. adb shell am instrumentation -w -e class com.android.foo.FooTest \
- * com.android.foo/android.test.BandwidthTestRunner
- *
- * @see NetworkStats and @see TrafficStats for details of the collected statistics
- * @hide
- */
-public class BandwidthTestRunner extends InstrumentationTestRunner implements TestListener {
- 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";
- private static final String REPORT_KEY_BYTES_RECEIVED = "rxBytes";
- private static final String REPORT_KEY_OPERATIONS = "operations";
-
- private boolean mHasClassAnnotation;
- private boolean mIsBandwidthTest;
- private Bundle mTestResult;
-
- @Override
- public void onCreate(Bundle arguments) {
- super.onCreate(arguments);
- addTestListener(this);
- }
-
- public void addError(Test test, Throwable t) {
- }
-
- public void addFailure(Test test, AssertionFailedError t) {
- }
-
- public void startTest(Test test) {
- String testClass = test.getClass().getName();
- String testName = ((TestCase)test).getName();
- Method testMethod = null;
- try {
- testMethod = test.getClass().getMethod(testName);
- } catch (NoSuchMethodException e) {
- // ignore- the test with given name does not exist. Will be handled during test
- // execution
- }
- try {
- // Look for BandwdthTest annotation on both test class and test method
- if (testMethod != null ) {
- if (testMethod.isAnnotationPresent(BandwidthTest.class) ){
- mIsBandwidthTest = true;
- TrafficStats.startDataProfiling(null);
- } else if (test.getClass().isAnnotationPresent(BandwidthTest.class)){
- mIsBandwidthTest = true;
- TrafficStats.startDataProfiling(null);
- }
- }
- } catch (SecurityException e) {
- // ignore - the test with given name cannot be accessed. Will be handled during
- // test execution
- }
- }
-
- public void endTest(Test test) {
- if (mIsBandwidthTest){
- mTestResult = new Bundle();
- mIsBandwidthTest=false;
- NetworkStats stats = TrafficStats.stopDataProfiling(null);
- Entry entry = stats.getTotal(null);
- mTestResult.putLong(REPORT_KEY_BYTES_RECEIVED, entry.rxBytes);
- mTestResult.putLong(REPORT_KEY_BYTES_SENT, entry.txBytes);
- mTestResult.putLong(REPORT_KEY_PACKETS_RECEIVED, entry.rxPackets);
- mTestResult.putLong(REPORT_KEY_PACKETS_SENT, entry.txPackets);
- mTestResult.putLong(REPORT_KEY_OPERATIONS, entry.operations);
- System.out.println(mTestResult.toString());
- sendStatus(0, mTestResult);
- }
- }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/mesh.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/mesh.rs
index 627ab99..1354897 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/mesh.rs
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/mesh.rs
@@ -11,29 +11,29 @@
static bool test_mesh_getters() {
bool failed = false;
- _RS_ASSERT(rsMeshGetVertexAllocationCount(mesh) == 2);
- _RS_ASSERT(rsMeshGetPrimitiveCount(mesh) == 3);
+ _RS_ASSERT(rsgMeshGetVertexAllocationCount(mesh) == 2);
+ _RS_ASSERT(rsgMeshGetPrimitiveCount(mesh) == 3);
- rs_allocation meshV0 = rsMeshGetVertexAllocation(mesh, 0);
- rs_allocation meshV1 = rsMeshGetVertexAllocation(mesh, 1);
- rs_allocation meshV2 = rsMeshGetVertexAllocation(mesh, 2);
+ rs_allocation meshV0 = rsgMeshGetVertexAllocation(mesh, 0);
+ rs_allocation meshV1 = rsgMeshGetVertexAllocation(mesh, 1);
+ rs_allocation meshV2 = rsgMeshGetVertexAllocation(mesh, 2);
_RS_ASSERT(meshV0.p == vertexAlloc0.p);
_RS_ASSERT(meshV1.p == vertexAlloc1.p);
_RS_ASSERT(!rsIsObject(meshV2));
- rs_allocation meshI0 = rsMeshGetIndexAllocation(mesh, 0);
- rs_allocation meshI1 = rsMeshGetIndexAllocation(mesh, 1);
- rs_allocation meshI2 = rsMeshGetIndexAllocation(mesh, 2);
- rs_allocation meshI3 = rsMeshGetIndexAllocation(mesh, 3);
+ rs_allocation meshI0 = rsgMeshGetIndexAllocation(mesh, 0);
+ rs_allocation meshI1 = rsgMeshGetIndexAllocation(mesh, 1);
+ rs_allocation meshI2 = rsgMeshGetIndexAllocation(mesh, 2);
+ rs_allocation meshI3 = rsgMeshGetIndexAllocation(mesh, 3);
_RS_ASSERT(meshI0.p == indexAlloc0.p);
_RS_ASSERT(!rsIsObject(meshI1));
_RS_ASSERT(meshI2.p == indexAlloc2.p);
_RS_ASSERT(!rsIsObject(meshI3));
- rs_primitive p0 = rsMeshGetPrimitive(mesh, 0);
- rs_primitive p1 = rsMeshGetPrimitive(mesh, 1);
- rs_primitive p2 = rsMeshGetPrimitive(mesh, 2);
- rs_primitive p3 = rsMeshGetPrimitive(mesh, 3);
+ rs_primitive p0 = rsgMeshGetPrimitive(mesh, 0);
+ rs_primitive p1 = rsgMeshGetPrimitive(mesh, 1);
+ rs_primitive p2 = rsgMeshGetPrimitive(mesh, 2);
+ rs_primitive p3 = rsgMeshGetPrimitive(mesh, 3);
_RS_ASSERT(p0 == RS_PRIMITIVE_POINT);
_RS_ASSERT(p1 == RS_PRIMITIVE_LINE);
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/sampler.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/sampler.rs
index ac9a549..ff1c0a7 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/sampler.rs
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/sampler.rs
@@ -9,35 +9,35 @@
static bool test_sampler_getters() {
bool failed = false;
- _RS_ASSERT(rsgSamplerGetMagnification(minification) == RS_SAMPLER_NEAREST);
- _RS_ASSERT(rsgSamplerGetMinification(minification) == RS_SAMPLER_LINEAR_MIP_LINEAR);
- _RS_ASSERT(rsgSamplerGetWrapS(minification) == RS_SAMPLER_CLAMP);
- _RS_ASSERT(rsgSamplerGetWrapT(minification) == RS_SAMPLER_CLAMP);
- _RS_ASSERT(rsgSamplerGetAnisotropy(minification) == 1.0f);
+ _RS_ASSERT(rsSamplerGetMagnification(minification) == RS_SAMPLER_NEAREST);
+ _RS_ASSERT(rsSamplerGetMinification(minification) == RS_SAMPLER_LINEAR_MIP_LINEAR);
+ _RS_ASSERT(rsSamplerGetWrapS(minification) == RS_SAMPLER_CLAMP);
+ _RS_ASSERT(rsSamplerGetWrapT(minification) == RS_SAMPLER_CLAMP);
+ _RS_ASSERT(rsSamplerGetAnisotropy(minification) == 1.0f);
- _RS_ASSERT(rsgSamplerGetMagnification(magnification) == RS_SAMPLER_LINEAR);
- _RS_ASSERT(rsgSamplerGetMinification(magnification) == RS_SAMPLER_NEAREST);
- _RS_ASSERT(rsgSamplerGetWrapS(magnification) == RS_SAMPLER_CLAMP);
- _RS_ASSERT(rsgSamplerGetWrapT(magnification) == RS_SAMPLER_CLAMP);
- _RS_ASSERT(rsgSamplerGetAnisotropy(magnification) == 1.0f);
+ _RS_ASSERT(rsSamplerGetMagnification(magnification) == RS_SAMPLER_LINEAR);
+ _RS_ASSERT(rsSamplerGetMinification(magnification) == RS_SAMPLER_NEAREST);
+ _RS_ASSERT(rsSamplerGetWrapS(magnification) == RS_SAMPLER_CLAMP);
+ _RS_ASSERT(rsSamplerGetWrapT(magnification) == RS_SAMPLER_CLAMP);
+ _RS_ASSERT(rsSamplerGetAnisotropy(magnification) == 1.0f);
- _RS_ASSERT(rsgSamplerGetMagnification(wrapS) == RS_SAMPLER_NEAREST);
- _RS_ASSERT(rsgSamplerGetMinification(wrapS) == RS_SAMPLER_NEAREST);
- _RS_ASSERT(rsgSamplerGetWrapS(wrapS) == RS_SAMPLER_WRAP);
- _RS_ASSERT(rsgSamplerGetWrapT(wrapS) == RS_SAMPLER_CLAMP);
- _RS_ASSERT(rsgSamplerGetAnisotropy(wrapS) == 1.0f);
+ _RS_ASSERT(rsSamplerGetMagnification(wrapS) == RS_SAMPLER_NEAREST);
+ _RS_ASSERT(rsSamplerGetMinification(wrapS) == RS_SAMPLER_NEAREST);
+ _RS_ASSERT(rsSamplerGetWrapS(wrapS) == RS_SAMPLER_WRAP);
+ _RS_ASSERT(rsSamplerGetWrapT(wrapS) == RS_SAMPLER_CLAMP);
+ _RS_ASSERT(rsSamplerGetAnisotropy(wrapS) == 1.0f);
- _RS_ASSERT(rsgSamplerGetMagnification(wrapT) == RS_SAMPLER_NEAREST);
- _RS_ASSERT(rsgSamplerGetMinification(wrapT) == RS_SAMPLER_NEAREST);
- _RS_ASSERT(rsgSamplerGetWrapS(wrapT) == RS_SAMPLER_CLAMP);
- _RS_ASSERT(rsgSamplerGetWrapT(wrapT) == RS_SAMPLER_WRAP);
- _RS_ASSERT(rsgSamplerGetAnisotropy(wrapT) == 1.0f);
+ _RS_ASSERT(rsSamplerGetMagnification(wrapT) == RS_SAMPLER_NEAREST);
+ _RS_ASSERT(rsSamplerGetMinification(wrapT) == RS_SAMPLER_NEAREST);
+ _RS_ASSERT(rsSamplerGetWrapS(wrapT) == RS_SAMPLER_CLAMP);
+ _RS_ASSERT(rsSamplerGetWrapT(wrapT) == RS_SAMPLER_WRAP);
+ _RS_ASSERT(rsSamplerGetAnisotropy(wrapT) == 1.0f);
- _RS_ASSERT(rsgSamplerGetMagnification(anisotropy) == RS_SAMPLER_NEAREST);
- _RS_ASSERT(rsgSamplerGetMinification(anisotropy) == RS_SAMPLER_NEAREST);
- _RS_ASSERT(rsgSamplerGetWrapS(anisotropy) == RS_SAMPLER_CLAMP);
- _RS_ASSERT(rsgSamplerGetWrapT(anisotropy) == RS_SAMPLER_CLAMP);
- _RS_ASSERT(rsgSamplerGetAnisotropy(anisotropy) == 8.0f);
+ _RS_ASSERT(rsSamplerGetMagnification(anisotropy) == RS_SAMPLER_NEAREST);
+ _RS_ASSERT(rsSamplerGetMinification(anisotropy) == RS_SAMPLER_NEAREST);
+ _RS_ASSERT(rsSamplerGetWrapS(anisotropy) == RS_SAMPLER_CLAMP);
+ _RS_ASSERT(rsSamplerGetWrapT(anisotropy) == RS_SAMPLER_CLAMP);
+ _RS_ASSERT(rsSamplerGetAnisotropy(anisotropy) == 8.0f);
if (failed) {
rsDebug("test_sampler_getters FAILED", 0);
diff --git a/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java b/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java
index 3efd658..b3a2600 100644
--- a/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java
+++ b/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java
@@ -120,13 +120,20 @@
* The method will launch the app, wait for 7 seconds, check for apps in the error state, send
* the Home intent, wait for 2 seconds, and then return.
*/
- public Collection<ProcessErrorStateInfo> runOneActivity(ResolveInfo app) {
+ public Collection<ProcessError> runOneActivity(ResolveInfo app) {
final long appLaunchWait = 7000;
final long homeLaunchWait = 2000;
Log.i(TAG, String.format("Running activity %s/%s", app.activityInfo.packageName,
app.activityInfo.name));
+ // We check for any Crash or ANR dialogs that are already up, and we ignore them. This is
+ // so that we don't report crashes that were caused by prior apps (which those particular
+ // tests should have caught and reported already). Otherwise, test failures would cascade
+ // from the initial broken app to many/all of the tests following that app's launch.
+ final Collection<ProcessError> preErrProcs =
+ ProcessError.fromCollection(mActivityManager.getProcessesInErrorState());
+
// launch app, and wait 7 seconds for it to start/settle
final Intent intent = intentForActivity(app);
getContext().startActivity(intent);
@@ -136,10 +143,6 @@
// ignore
}
- // See if there are any errors
- final Collection<ProcessErrorStateInfo> errProcs =
- mActivityManager.getProcessesInErrorState();
-
// Send the "home" intent and wait 2 seconds for us to get there
getContext().startActivity(mHomeIntent);
try {
@@ -148,28 +151,35 @@
// ignore
}
+ // See if there are any errors. We wait until down here to give ANRs as much time as
+ // possible to occur.
+ final Collection<ProcessError> errProcs =
+ ProcessError.fromCollection(mActivityManager.getProcessesInErrorState());
+ // Take the difference between the error processes we see now, and the ones that were
+ // present when we started
+ if (errProcs != null && preErrProcs != null) {
+ errProcs.removeAll(preErrProcs);
+ }
+
return errProcs;
}
/**
* A test that runs all Launcher-launchable activities and verifies that no ANRs or crashes
* happened while doing so.
- * <p />
- * FIXME: Doesn't detect multiple crashing apps properly, since the crash dialog for the
- * FIXME: first app doesn't go away.
*/
public void testRunAllActivities() throws Exception {
final Set<ProcessError> errSet = new HashSet<ProcessError>();
for (ResolveInfo app : getLauncherActivities(mPackageManager)) {
- final Collection<ProcessErrorStateInfo> errProcs = runOneActivity(app);
+ final Collection<ProcessError> errProcs = runOneActivity(app);
if (errProcs != null) {
- errSet.addAll(ProcessError.fromCollection(errProcs));
+ errSet.addAll(errProcs);
}
}
if (!errSet.isEmpty()) {
- fail(String.format("Got %d errors: %s", errSet.size(),
+ fail(String.format("Got %d errors:\n%s", errSet.size(),
reportWrappedListContents(errSet)));
}
}
@@ -200,19 +210,21 @@
String condition;
switch (entry.condition) {
case ActivityManager.ProcessErrorStateInfo.CRASHED:
- condition = "CRASHED";
+ condition = "a CRASH";
break;
case ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING:
- condition = "ANR";
+ condition = "an ANR";
break;
default:
- condition = "<unknown>";
+ condition = "an unknown error";
break;
}
- builder.append("Process error ").append(condition).append(" ");
- builder.append(" ").append(entry.shortMsg);
- builder.append(" detected in ").append(entry.processName).append(" ").append(entry.tag);
+ builder.append(String.format("Process %s encountered %s (%s)", entry.processName,
+ condition, entry.shortMsg));
+ if (entry.condition == ActivityManager.ProcessErrorStateInfo.CRASHED) {
+ builder.append(String.format(" with stack trace:\n%s\n", entry.stackTrace));
+ }
builder.append("\n");
}
return builder.toString();
@@ -231,6 +243,10 @@
public static Collection<ProcessError> fromCollection(Collection<ProcessErrorStateInfo> in)
{
+ if (in == null) {
+ return null;
+ }
+
List<ProcessError> out = new ArrayList<ProcessError>(in.size());
for (ProcessErrorStateInfo info : in) {
out.add(new ProcessError(info));
diff --git a/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java b/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java
index 40b11c5..51331fe 100644
--- a/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java
+++ b/tests/SmokeTest/tests/src/com/android/smoketest/SmokeTestRunner.java
@@ -73,13 +73,13 @@
@Override
public void runTest() throws Exception {
final Set<ProcessError> errSet = new HashSet<ProcessError>();
- final Collection<ProcessErrorStateInfo> errProcs = runOneActivity(app);
+ final Collection<ProcessError> errProcs = runOneActivity(app);
if (errProcs != null) {
- errSet.addAll(ProcessError.fromCollection(errProcs));
+ errSet.addAll(errProcs);
}
if (!errSet.isEmpty()) {
- fail(String.format("Got %d errors: %s", errSet.size(),
+ fail(String.format("Got %d errors:\n%s", errSet.size(),
reportWrappedListContents(errSet)));
}
}
diff --git a/tests/TileBenchmark/src/com/test/tilebenchmark/PlaybackGraphs.java b/tests/TileBenchmark/src/com/test/tilebenchmark/PlaybackGraphs.java
index a3ae9be..065e86f 100644
--- a/tests/TileBenchmark/src/com/test/tilebenchmark/PlaybackGraphs.java
+++ b/tests/TileBenchmark/src/com/test/tilebenchmark/PlaybackGraphs.java
@@ -37,10 +37,10 @@
private static Paint whiteLabels;
private static double viewportCoverage(TileData view, TileData tile) {
- if (tile.left < view.right
- && tile.right >= view.left
- && tile.top < view.bottom
- && tile.bottom >= view.top) {
+ if (tile.left < (view.right * view.scale)
+ && tile.right >= (view.left * view.scale)
+ && tile.top < (view.bottom * view.scale)
+ && tile.bottom >= (view.top * view.scale)) {
return 1.0f;
}
return 0.0f;
@@ -215,7 +215,7 @@
int lastBar = 0;
for (int frameIndex = 0; frameIndex < data.frames.length; frameIndex++) {
TileData frame[] = data.frames[frameIndex];
- int newBar = (frame[0].top + frame[0].bottom) / 2;
+ int newBar = (int)((frame[0].top + frame[0].bottom) * frame[0].scale / 2.0f);
MetricGen s = Metrics[metricIndex];
double absoluteValue = s.getValue(frame);
diff --git a/tests/TileBenchmark/src/com/test/tilebenchmark/RunData.java b/tests/TileBenchmark/src/com/test/tilebenchmark/RunData.java
index 2da61cc..5e48afd 100644
--- a/tests/TileBenchmark/src/com/test/tilebenchmark/RunData.java
+++ b/tests/TileBenchmark/src/com/test/tilebenchmark/RunData.java
@@ -46,7 +46,8 @@
public String toString() {
return "Tile (" + left + "," + top + ")->("
- + right + "," + bottom + ")";
+ + right + "," + bottom + ")"
+ + (isReady ? "ready" : "NOTready") + " at scale " + scale;
}
}
diff --git a/tests/permission/src/com/android/framework/permission/tests/ActivityManagerPermissionTests.java b/tests/permission/src/com/android/framework/permission/tests/ActivityManagerPermissionTests.java
index 4cacbc4..cceed16 100644
--- a/tests/permission/src/com/android/framework/permission/tests/ActivityManagerPermissionTests.java
+++ b/tests/permission/src/com/android/framework/permission/tests/ActivityManagerPermissionTests.java
@@ -39,7 +39,7 @@
@SmallTest
public void testREORDER_TASKS() {
try {
- mAm.moveTaskToFront(0, 0);
+ mAm.moveTaskToFront(0, 0, null);
fail("IActivityManager.moveTaskToFront did not throw SecurityException as"
+ " expected");
} catch (SecurityException e) {
diff --git a/tools/aapt/Bundle.h b/tools/aapt/Bundle.h
index 8e3a1c9..daeadc0 100644
--- a/tools/aapt/Bundle.h
+++ b/tools/aapt/Bundle.h
@@ -83,7 +83,7 @@
bool getForce(void) const { return mForce; }
void setForce(bool val) { mForce = val; }
void setGrayscaleTolerance(int val) { mGrayscaleTolerance = val; }
- int getGrayscaleTolerance() { return mGrayscaleTolerance; }
+ int getGrayscaleTolerance() const { return mGrayscaleTolerance; }
bool getMakePackageDirs(void) const { return mMakePackageDirs; }
void setMakePackageDirs(bool val) { mMakePackageDirs = val; }
bool getUpdate(void) const { return mUpdate; }
@@ -166,14 +166,14 @@
void setExtraPackages(const char* val) { mExtraPackages = val; }
const char* getMaxResVersion() const { return mMaxResVersion; }
void setMaxResVersion(const char * val) { mMaxResVersion = val; }
- bool getDebugMode() { return mDebugMode; }
+ bool getDebugMode() const { return mDebugMode; }
void setDebugMode(bool val) { mDebugMode = val; }
- bool getNonConstantId() { return mNonConstantId; }
+ bool getNonConstantId() const { return mNonConstantId; }
void setNonConstantId(bool val) { mNonConstantId = val; }
const char* getProduct() const { return mProduct; }
void setProduct(const char * val) { mProduct = val; }
void setUseCrunchCache(bool val) { mUseCrunchCache = val; }
- bool getUseCrunchCache() { return mUseCrunchCache; }
+ bool getUseCrunchCache() const { return mUseCrunchCache; }
/*
* Set and get the file specification.
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
index 6402e3c..2b9b056 100644
--- a/tools/aapt/Images.cpp
+++ b/tools/aapt/Images.cpp
@@ -964,7 +964,7 @@
compression_type));
}
-status_t preProcessImage(Bundle* bundle, const sp<AaptAssets>& assets,
+status_t preProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets,
const sp<AaptFile>& file, String8* outNewLeafName)
{
String8 ext(file->getPath().getPathExtension());
@@ -1084,7 +1084,7 @@
return error;
}
-status_t preProcessImageToCache(Bundle* bundle, String8 source, String8 dest)
+status_t preProcessImageToCache(const Bundle* bundle, const String8& source, const String8& dest)
{
png_structp read_ptr = NULL;
png_infop read_info = NULL;
diff --git a/tools/aapt/Images.h b/tools/aapt/Images.h
index 4816905..91b6554 100644
--- a/tools/aapt/Images.h
+++ b/tools/aapt/Images.h
@@ -15,10 +15,10 @@
using android::String8;
-status_t preProcessImage(Bundle* bundle, const sp<AaptAssets>& assets,
+status_t preProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets,
const sp<AaptFile>& file, String8* outNewLeafName);
-status_t preProcessImageToCache(Bundle* bundle, String8 source, String8 dest);
+status_t preProcessImageToCache(const Bundle* bundle, const String8& source, const String8& dest);
status_t postProcessImage(const sp<AaptAssets>& assets,
ResourceTable* table, const sp<AaptFile>& file);
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 7eaf528..b9ec30c 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -14,6 +14,8 @@
#include "FileFinder.h"
#include "CacheUpdater.h"
+#include <utils/WorkQueue.h>
+
#if HAVE_PRINTF_ZD
# define ZD "%zd"
# define ZD_TYPE ssize_t
@@ -24,6 +26,9 @@
#define NOISY(x) // x
+// Number of threads to use for preprocessing images.
+static const size_t MAX_THREADS = 4;
+
// ==========================================================================
// ==========================================================================
// ==========================================================================
@@ -302,21 +307,52 @@
return hasErrors ? UNKNOWN_ERROR : NO_ERROR;
}
-static status_t preProcessImages(Bundle* bundle, const sp<AaptAssets>& assets,
+class PreProcessImageWorkUnit : public WorkQueue::WorkUnit {
+public:
+ PreProcessImageWorkUnit(const Bundle* bundle, const sp<AaptAssets>& assets,
+ const sp<AaptFile>& file, volatile bool* hasErrors) :
+ mBundle(bundle), mAssets(assets), mFile(file), mHasErrors(hasErrors) {
+ }
+
+ virtual bool run() {
+ status_t status = preProcessImage(mBundle, mAssets, mFile, NULL);
+ if (status) {
+ *mHasErrors = true;
+ }
+ return true; // continue even if there are errors
+ }
+
+private:
+ const Bundle* mBundle;
+ sp<AaptAssets> mAssets;
+ sp<AaptFile> mFile;
+ volatile bool* mHasErrors;
+};
+
+static status_t preProcessImages(const Bundle* bundle, const sp<AaptAssets>& assets,
const sp<ResourceTypeSet>& set, const char* type)
{
- bool hasErrors = false;
+ volatile bool hasErrors = false;
ssize_t res = NO_ERROR;
if (bundle->getUseCrunchCache() == false) {
+ WorkQueue wq(MAX_THREADS, false);
ResourceDirIterator it(set, String8(type));
- Vector<sp<AaptFile> > newNameFiles;
- Vector<String8> newNamePaths;
while ((res=it.next()) == NO_ERROR) {
- res = preProcessImage(bundle, assets, it.getFile(), NULL);
- if (res < NO_ERROR) {
+ PreProcessImageWorkUnit* w = new PreProcessImageWorkUnit(
+ bundle, assets, it.getFile(), &hasErrors);
+ status_t status = wq.schedule(w);
+ if (status) {
+ fprintf(stderr, "preProcessImages failed: schedule() returned %d\n", status);
hasErrors = true;
+ delete w;
+ break;
}
}
+ status_t status = wq.finish();
+ if (status) {
+ fprintf(stderr, "preProcessImages failed: finish() returned %d\n", status);
+ hasErrors = true;
+ }
}
return (hasErrors || (res < NO_ERROR)) ? UNKNOWN_ERROR : NO_ERROR;
}
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index df6abe8..0195727 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -2598,7 +2598,7 @@
// Iterate through all data, collecting all values (strings,
// references, etc).
- StringPool valueStrings = StringPool(false, useUTF8);
+ StringPool valueStrings(useUTF8);
Vector<sp<Entry> > allEntries;
for (pi=0; pi<N; pi++) {
sp<Package> p = mOrderedPackages.itemAt(pi);
@@ -2607,8 +2607,8 @@
continue;
}
- StringPool typeStrings = StringPool(false, useUTF8);
- StringPool keyStrings = StringPool(false, useUTF8);
+ StringPool typeStrings(useUTF8);
+ StringPool keyStrings(useUTF8);
const size_t N = p->getOrderedTypes().size();
for (size_t ti=0; ti<N; ti++) {
diff --git a/tools/aapt/StringPool.cpp b/tools/aapt/StringPool.cpp
index 7f137ce..839eda5 100644
--- a/tools/aapt/StringPool.cpp
+++ b/tools/aapt/StringPool.cpp
@@ -9,6 +9,7 @@
#include <utils/ByteOrder.h>
#include <utils/SortedVector.h>
+#include <cutils/qsort_r_compat.h>
#if HAVE_PRINTF_ZD
# define ZD "%zd"
@@ -71,14 +72,16 @@
}
int StringPool::entry::compare(const entry& o) const {
- // Strings with styles go first, to reduce the size of the
- // styles array.
+ // Strings with styles go first, to reduce the size of the styles array.
+ // We don't care about the relative order of these strings.
if (hasStyles) {
return o.hasStyles ? 0 : -1;
}
if (o.hasStyles) {
return 1;
}
+
+ // Sort unstyled strings by type, then by logical configuration.
int comp = configTypeName.compare(o.configTypeName);
if (comp != 0) {
return comp;
@@ -98,39 +101,24 @@
return 0;
}
-StringPool::StringPool(bool sorted, bool utf8)
- : mSorted(sorted), mUTF8(utf8), mValues(-1), mIdents(-1)
+StringPool::StringPool(bool utf8) :
+ mUTF8(utf8), mValues(-1)
{
}
-ssize_t StringPool::add(const String16& value, bool mergeDuplicates,
- const String8* configTypeName, const ResTable_config* config)
-{
- return add(String16(), value, mergeDuplicates, configTypeName, config);
-}
-
ssize_t StringPool::add(const String16& value, const Vector<entry_style_span>& spans,
const String8* configTypeName, const ResTable_config* config)
{
- ssize_t res = add(String16(), value, false, configTypeName, config);
+ ssize_t res = add(value, false, configTypeName, config);
if (res >= 0) {
addStyleSpans(res, spans);
}
return res;
}
-ssize_t StringPool::add(const String16& ident, const String16& value,
+ssize_t StringPool::add(const String16& value,
bool mergeDuplicates, const String8* configTypeName, const ResTable_config* config)
{
- if (ident.size() > 0) {
- ssize_t idx = mIdents.valueFor(ident);
- if (idx >= 0) {
- fprintf(stderr, "ERROR: Duplicate string identifier %s\n",
- String8(mEntries[idx].value).string());
- return UNKNOWN_ERROR;
- }
- }
-
ssize_t vidx = mValues.indexOfKey(value);
ssize_t pos = vidx >= 0 ? mValues.valueAt(vidx) : -1;
ssize_t eidx = pos >= 0 ? mEntryArray.itemAt(pos) : -1;
@@ -181,14 +169,8 @@
if (first) {
vidx = mValues.add(value, pos);
}
- if (!mSorted) {
- entry& ent = mEntries.editItemAt(eidx);
- ent.indices.add(pos);
- }
- }
-
- if (ident.size() > 0) {
- mIdents.add(ident, vidx);
+ entry& ent = mEntries.editItemAt(eidx);
+ ent.indices.add(pos);
}
NOISY(printf("Adding string %s to pool: pos=%d eidx=%d vidx=%d\n",
@@ -221,8 +203,6 @@
status_t StringPool::addStyleSpan(size_t idx, const entry_style_span& span)
{
- LOG_ALWAYS_FATAL_IF(mSorted, "Can't use styles with sorted string pools.");
-
// Place blank entries in the span array up to this index.
while (mEntryStyleArray.size() <= idx) {
mEntryStyleArray.add();
@@ -234,37 +214,16 @@
return NO_ERROR;
}
-size_t StringPool::size() const
-{
- return mSorted ? mValues.size() : mEntryArray.size();
-}
-
-const StringPool::entry& StringPool::entryAt(size_t idx) const
-{
- if (!mSorted) {
- return mEntries[mEntryArray[idx]];
- } else {
- return mEntries[mEntryArray[mValues.valueAt(idx)]];
- }
-}
-
-size_t StringPool::countIdentifiers() const
-{
- return mIdents.size();
-}
-
-int StringPool::config_sort(const size_t* lhs, const size_t* rhs, void* state)
+int StringPool::config_sort(void* state, const void* lhs, const void* rhs)
{
StringPool* pool = (StringPool*)state;
- const entry& lhe = pool->mEntries[pool->mEntryArray[*lhs]];
- const entry& rhe = pool->mEntries[pool->mEntryArray[*rhs]];
+ const entry& lhe = pool->mEntries[pool->mEntryArray[*static_cast<const size_t*>(lhs)]];
+ const entry& rhe = pool->mEntries[pool->mEntryArray[*static_cast<const size_t*>(rhs)]];
return lhe.compare(rhe);
}
void StringPool::sortByConfig()
{
- LOG_ALWAYS_FATAL_IF(mSorted, "Can't sort string pool containing identifiers.");
- LOG_ALWAYS_FATAL_IF(mIdents.size() > 0, "Can't sort string pool containing identifiers.");
LOG_ALWAYS_FATAL_IF(mOriginalPosToNewPos.size() > 0, "Can't sort string pool after already sorted.");
const size_t N = mEntryArray.size();
@@ -274,13 +233,17 @@
// At that point it maps from the new position in the array to the
// original position the entry appeared.
Vector<size_t> newPosToOriginalPos;
- for (size_t i=0; i<mEntryArray.size(); i++) {
+ newPosToOriginalPos.setCapacity(N);
+ for (size_t i=0; i < N; i++) {
newPosToOriginalPos.add(i);
}
// Sort the array.
NOISY(printf("SORTING STRINGS BY CONFIGURATION...\n"));
- newPosToOriginalPos.sort(config_sort, this);
+ // Vector::sort uses insertion sort, which is very slow for this data set.
+ // Use quicksort instead because we don't need a stable sort here.
+ qsort_r_compat(newPosToOriginalPos.editArray(), N, sizeof(size_t), this, config_sort);
+ //newPosToOriginalPos.sort(config_sort, this);
NOISY(printf("DONE SORTING STRINGS BY CONFIGURATION.\n"));
// Create the reverse mapping from the original position in the array
@@ -432,7 +395,7 @@
}
}
- const size_t ENTRIES = size();
+ const size_t ENTRIES = mEntryArray.size();
// Now build the pool of unique strings.
@@ -566,9 +529,6 @@
header->header.size = htodl(pool->getSize());
header->stringCount = htodl(ENTRIES);
header->styleCount = htodl(STYLES);
- if (mSorted) {
- header->flags |= htodl(ResStringPool_header::SORTED_FLAG);
- }
if (mUTF8) {
header->flags |= htodl(ResStringPool_header::UTF8_FLAG);
}
@@ -578,33 +538,18 @@
// Write string index array.
uint32_t* index = (uint32_t*)(header+1);
- if (mSorted) {
- for (i=0; i<ENTRIES; i++) {
- entry& ent = const_cast<entry&>(entryAt(i));
- ent.indices.clear();
- ent.indices.add(i);
- *index++ = htodl(ent.offset);
- }
- } else {
- for (i=0; i<ENTRIES; i++) {
- entry& ent = mEntries.editItemAt(mEntryArray[i]);
- *index++ = htodl(ent.offset);
- NOISY(printf("Writing entry #%d: \"%s\" ent=%d off=%d\n", i,
- String8(ent.value).string(),
- mEntryArray[i], ent.offset));
- }
+ for (i=0; i<ENTRIES; i++) {
+ entry& ent = mEntries.editItemAt(mEntryArray[i]);
+ *index++ = htodl(ent.offset);
+ NOISY(printf("Writing entry #%d: \"%s\" ent=%d off=%d\n", i,
+ String8(ent.value).string(),
+ mEntryArray[i], ent.offset));
}
// Write style index array.
- if (mSorted) {
- for (i=0; i<STYLES; i++) {
- LOG_ALWAYS_FATAL("Shouldn't be here!");
- }
- } else {
- for (i=0; i<STYLES; i++) {
- *index++ = htodl(mEntryStyleArray[i].offset);
- }
+ for (i=0; i<STYLES; i++) {
+ *index++ = htodl(mEntryStyleArray[i].offset);
}
return NO_ERROR;
diff --git a/tools/aapt/StringPool.h b/tools/aapt/StringPool.h
index 86044ed..d501008 100644
--- a/tools/aapt/StringPool.h
+++ b/tools/aapt/StringPool.h
@@ -13,6 +13,7 @@
#include <androidfw/ResourceTypes.h>
#include <utils/String16.h>
#include <utils/TextOutput.h>
+#include <utils/TypeHelpers.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -79,16 +80,10 @@
};
/**
- * If 'sorted' is true, then the final strings in the resource data
- * structure will be generated in sorted order. This allow for fast
- * lookup with ResStringPool::indexOfString() (O(log n)), at the expense
- * of support for styled string entries (which requires the same string
- * be included multiple times in the pool).
- *
* If 'utf8' is true, strings will be encoded with UTF-8 instead of
* left in Java's native UTF-16.
*/
- explicit StringPool(bool sorted = false, bool utf8 = false);
+ explicit StringPool(bool utf8 = false);
/**
* Add a new string to the pool. If mergeDuplicates is true, thenif
@@ -96,9 +91,7 @@
* otherwise, or if the value doesn't already exist, a new entry is
* created.
*
- * Returns the index in the entry array of the new string entry. Note that
- * if this string pool is sorted, the returned index will not be valid
- * when the pool is finally written.
+ * Returns the index in the entry array of the new string entry.
*/
ssize_t add(const String16& value, bool mergeDuplicates = false,
const String8* configTypeName = NULL, const ResTable_config* config = NULL);
@@ -106,24 +99,14 @@
ssize_t add(const String16& value, const Vector<entry_style_span>& spans,
const String8* configTypeName = NULL, const ResTable_config* config = NULL);
- ssize_t add(const String16& ident, const String16& value,
- bool mergeDuplicates = false,
- const String8* configTypeName = NULL, const ResTable_config* config = NULL);
-
status_t addStyleSpan(size_t idx, const String16& name,
uint32_t start, uint32_t end);
status_t addStyleSpans(size_t idx, const Vector<entry_style_span>& spans);
status_t addStyleSpan(size_t idx, const entry_style_span& span);
- size_t size() const;
-
- const entry& entryAt(size_t idx) const;
-
- size_t countIdentifiers() const;
-
// Sort the contents of the string block by the configuration associated
// with each item. After doing this you can use mapOriginalPosToNewPos()
- // to find out the new position given the position originall returned by
+ // to find out the new position given the position originally returned by
// add().
void sortByConfig();
@@ -156,9 +139,8 @@
const Vector<size_t>* offsetsForString(const String16& val) const;
private:
- static int config_sort(const size_t* lhs, const size_t* rhs, void* state);
+ static int config_sort(void* state, const void* lhs, const void* rhs);
- const bool mSorted;
const bool mUTF8;
// The following data structures represent the actual structures
@@ -185,13 +167,18 @@
// Unique set of all the strings added to the pool, mapped to
// the first index of mEntryArray where the value was added.
DefaultKeyedVector<String16, ssize_t> mValues;
- // Unique set of all (optional) identifiers of strings in the
- // pool, mapping to indices in mEntries.
- DefaultKeyedVector<String16, ssize_t> mIdents;
// This array maps from the original position a string was placed at
// in mEntryArray to its new position after being sorted with sortByConfig().
Vector<size_t> mOriginalPosToNewPos;
};
+// The entry types are trivially movable because all fields they contain, including
+// the vectors and strings, are trivially movable.
+namespace android {
+ ANDROID_TRIVIAL_MOVE_TRAIT(StringPool::entry);
+ ANDROID_TRIVIAL_MOVE_TRAIT(StringPool::entry_style_span);
+ ANDROID_TRIVIAL_MOVE_TRAIT(StringPool::entry_style);
+};
+
#endif
diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index 8d7acee..0dba950 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -973,7 +973,7 @@
status_t XMLNode::flatten(const sp<AaptFile>& dest,
bool stripComments, bool stripRawValues) const
{
- StringPool strings = StringPool(false, mUTF8);
+ StringPool strings(mUTF8);
Vector<uint32_t> resids;
// First collect just the strings for attribute names that have a
diff --git a/tools/aapt/ZipFile.cpp b/tools/aapt/ZipFile.cpp
index 8057068..3994c31 100644
--- a/tools/aapt/ZipFile.cpp
+++ b/tools/aapt/ZipFile.cpp
@@ -20,8 +20,8 @@
#define LOG_TAG "zip"
-#include <androidfw/ZipUtils.h>
#include <utils/Log.h>
+#include <utils/ZipUtils.h>
#include "ZipFile.h"
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
index 7b672da..8794452 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
@@ -120,10 +120,8 @@
mProjectCallback = projectCallback;
}
- public BridgeTypedArray newTypeArray(int numEntries, boolean platformFile,
- boolean platformStyleable, String styleableName) {
- return new BridgeTypedArray(this, mContext, numEntries, platformFile,
- platformStyleable, styleableName);
+ public BridgeTypedArray newTypeArray(int numEntries, boolean platformFile) {
+ return new BridgeTypedArray(this, mContext, numEntries, platformFile);
}
private Pair<String, ResourceValue> getResourceValue(int id, boolean[] platformResFlag_out) {
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
index 8fdac02..cbc199a 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
@@ -16,7 +16,7 @@
package android.content.res;
-import com.android.ide.common.rendering.api.DeclareStyleableResourceValue;
+import com.android.ide.common.rendering.api.AttrResourceValue;
import com.android.ide.common.rendering.api.LayoutLog;
import com.android.ide.common.rendering.api.RenderResources;
import com.android.ide.common.rendering.api.ResourceValue;
@@ -51,28 +51,33 @@
private final BridgeResources mBridgeResources;
private final BridgeContext mContext;
private final boolean mPlatformFile;
- private final boolean mPlatformStyleable;
- private final String mStyleableName;
private ResourceValue[] mResourceData;
private String[] mNames;
+ private boolean[] mIsFramework;
public BridgeTypedArray(BridgeResources resources, BridgeContext context, int len,
- boolean platformFile, boolean platformStyleable, String styleableName) {
+ boolean platformFile) {
super(null, null, null, 0);
mBridgeResources = resources;
mContext = context;
mPlatformFile = platformFile;
- mPlatformStyleable = platformStyleable;
- mStyleableName = styleableName;
mResourceData = new ResourceValue[len];
mNames = new String[len];
+ mIsFramework = new boolean[len];
}
- /** A bridge-specific method that sets a value in the type array */
- public void bridgeSetValue(int index, String name, ResourceValue value) {
+ /**
+ * A bridge-specific method that sets a value in the type array
+ * @param index the index of the value in the TypedArray
+ * @param name the name of the attribute
+ * @param isFramework whether the attribute is in the android namespace.
+ * @param value the value of the attribute
+ */
+ public void bridgeSetValue(int index, String name, boolean isFramework, ResourceValue value) {
mResourceData[index] = value;
mNames[index] = name;
+ mIsFramework[index] = isFramework;
}
/**
@@ -213,8 +218,12 @@
return defValue;
}
+ if (s == null) {
+ return defValue;
+ }
+
try {
- return (s == null) ? defValue : XmlUtils.convertValueToInt(s, defValue);
+ return XmlUtils.convertValueToInt(s, defValue);
} catch (NumberFormatException e) {
// pass
}
@@ -223,15 +232,14 @@
// Check for possible constants and try to find them.
// Get the map of attribute-constant -> IntegerValue
Map<String, Integer> map = null;
- if (mPlatformStyleable) {
+ if (mIsFramework[index]) {
map = Bridge.getEnumValues(mNames[index]);
- } else if (mStyleableName != null) {
+ } else {
// get the styleable matching the resolved name
RenderResources res = mContext.getRenderResources();
- ResourceValue styleable = res.getProjectResource(ResourceType.DECLARE_STYLEABLE,
- mStyleableName);
- if (styleable instanceof DeclareStyleableResourceValue) {
- map = ((DeclareStyleableResourceValue) styleable).getAttributeValues(mNames[index]);
+ ResourceValue attr = res.getProjectResource(ResourceType.ATTR, mNames[index]);
+ if (attr instanceof AttrResourceValue) {
+ map = ((AttrResourceValue) attr).getAttributeValues();
}
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java
index 945b3cd7..5256b58 100644
--- a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory_Delegate.java
@@ -85,15 +85,18 @@
// ------ Native Delegates ------
@LayoutlibDelegate
- /*package*/ static void nativeSetDefaultConfig(int nativeConfig) {
- // pass
+ /*package*/ static Bitmap nativeDecodeStream(InputStream is, byte[] storage,
+ Rect padding, Options opts) {
+ return nativeDecodeStream(is, storage, padding, opts, false, 1.f);
}
@LayoutlibDelegate
- /*package*/ static Bitmap nativeDecodeStream(InputStream is, byte[] storage,
- Rect padding, Options opts) {
+ /*package*/ static Bitmap nativeDecodeStream(InputStream is, byte[] storage,
+ Rect padding, Options opts, boolean applyScale, float scale) {
Bitmap bm = null;
+ //TODO support rescaling
+
Density density = Density.MEDIUM;
if (opts != null) {
density = Density.getEnum(opts.inDensity);
@@ -147,6 +150,13 @@
}
@LayoutlibDelegate
+ /*package*/ static Bitmap nativeDecodeAsset(int asset, Rect padding, Options opts,
+ boolean applyScale, float scale) {
+ opts.inBitmap = null;
+ return null;
+ }
+
+ @LayoutlibDelegate
/*package*/ static Bitmap nativeDecodeByteArray(byte[] data, int offset,
int length, Options opts) {
opts.inBitmap = null;
diff --git a/tools/layoutlib/bridge/src/android/view/ViewRootImpl_Delegate.java b/tools/layoutlib/bridge/src/android/view/ViewRootImpl_Delegate.java
new file mode 100644
index 0000000..14b84ef
--- /dev/null
+++ b/tools/layoutlib/bridge/src/android/view/ViewRootImpl_Delegate.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view;
+
+import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
+
+/**
+ * Delegate used to provide new implementation of a select few methods of {@link ViewRootImpl}
+ *
+ * Through the layoutlib_create tool, the original methods of ViewRootImpl have been replaced
+ * by calls to methods of the same name in this delegate class.
+ *
+ */
+public class ViewRootImpl_Delegate {
+
+ @LayoutlibDelegate
+ /*package*/ static boolean isInTouchMode() {
+ return false; // this allows displaying selection.
+ }
+}
diff --git a/tools/layoutlib/bridge/src/com/android/internal/policy/PolicyManager.java b/tools/layoutlib/bridge/src/com/android/internal/policy/PolicyManager.java
new file mode 100644
index 0000000..0100dc5
--- /dev/null
+++ b/tools/layoutlib/bridge/src/com/android/internal/policy/PolicyManager.java
@@ -0,0 +1,72 @@
+/*
+ * 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.internal.policy;
+
+import com.android.ide.common.rendering.api.LayoutLog;
+import com.android.layoutlib.bridge.Bridge;
+import com.android.layoutlib.bridge.impl.RenderAction;
+
+import android.content.Context;
+import android.view.BridgeInflater;
+import android.view.FallbackEventHandler;
+import android.view.KeyEvent;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManagerPolicy;
+
+/**
+ * Custom implementation of PolicyManager that does nothing to run in LayoutLib.
+ *
+ */
+public class PolicyManager {
+
+ public static Window makeNewWindow(Context context) {
+ // this will likely crash somewhere beyond so we log it.
+ Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
+ "Call to PolicyManager.makeNewWindow is not supported", null);
+ return null;
+ }
+
+ public static LayoutInflater makeNewLayoutInflater(Context context) {
+ return new BridgeInflater(context, RenderAction.getCurrentContext().getProjectCallback());
+ }
+
+ public static WindowManagerPolicy makeNewWindowManager() {
+ // this will likely crash somewhere beyond so we log it.
+ Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
+ "Call to PolicyManager.makeNewWindowManager is not supported", null);
+ return null;
+ }
+
+ public static FallbackEventHandler makeNewFallbackEventHandler(Context context) {
+ return new FallbackEventHandler() {
+ @Override
+ public void setView(View v) {
+ }
+
+ @Override
+ public void preDispatchKeyEvent(KeyEvent event) {
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ return false;
+ }
+ };
+ }
+}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
index ff88209..66481fd 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
@@ -29,6 +29,7 @@
import com.android.layoutlib.bridge.impl.FontLoader;
import com.android.layoutlib.bridge.impl.RenderDrawable;
import com.android.layoutlib.bridge.impl.RenderSessionImpl;
+import com.android.layoutlib.bridge.util.DynamicIdMap;
import com.android.ninepatch.NinePatchChunk;
import com.android.resources.ResourceType;
import com.android.tools.layoutlib.create.MethodAdapter;
@@ -78,7 +79,7 @@
private final static ReentrantLock sLock = new ReentrantLock();
/**
- * Maps from id to resource type/name. This is for android.R only.
+ * Maps from id to resource type/name. This is for com.android.internal.R
*/
private final static Map<Integer, Pair<ResourceType, String>> sRMap =
new HashMap<Integer, Pair<ResourceType, String>>();
@@ -89,11 +90,17 @@
private final static Map<IntArray, String> sRArrayMap = new HashMap<IntArray, String>();
/**
* Reverse map compared to sRMap, resource type -> (resource name -> id).
- * This is for android.R only.
+ * This is for com.android.internal.R.
*/
- private final static Map<ResourceType, Map<String, Integer>> sRFullMap =
+ private final static Map<ResourceType, Map<String, Integer>> sRevRMap =
new EnumMap<ResourceType, Map<String,Integer>>(ResourceType.class);
+ // framework resources are defined as 0x01XX#### where XX is the resource type (layout,
+ // drawable, etc...). Using FF as the type allows for 255 resource types before we get a
+ // collision which should be fine.
+ private final static int DYNAMIC_ID_SEED_START = 0x01ff0000;
+ private final static DynamicIdMap sDynamicIds = new DynamicIdMap(DYNAMIC_ID_SEED_START);
+
private final static Map<Object, Map<String, SoftReference<Bitmap>>> sProjectBitmapCache =
new HashMap<Object, Map<String, SoftReference<Bitmap>>>();
private final static Map<Object, Map<String, SoftReference<NinePatchChunk>>> sProject9PatchCache =
@@ -257,7 +264,7 @@
ResourceType resType = ResourceType.getEnum(resTypeName);
if (resType != null) {
Map<String, Integer> fullMap = new HashMap<String, Integer>();
- sRFullMap.put(resType, fullMap);
+ sRevRMap.put(resType, fullMap);
for (Field f : inner.getDeclaredFields()) {
// only process static final fields. Since the final attribute may have
@@ -459,7 +466,14 @@
* does not match any resource.
*/
public static Pair<ResourceType, String> resolveResourceId(int value) {
- return sRMap.get(value);
+ Pair<ResourceType, String> pair = sRMap.get(value);
+ if (pair == null) {
+ pair = sDynamicIds.resolveId(value);
+ if (pair == null) {
+ System.out.println(String.format("Missing id: %1$08X (%1$d)", value));
+ }
+ }
+ return pair;
}
/**
@@ -478,12 +492,17 @@
* @return an {@link Integer} containing the resource id, or null if no resource were found.
*/
public static Integer getResourceId(ResourceType type, String name) {
- Map<String, Integer> map = sRFullMap.get(type);
+ Map<String, Integer> map = sRevRMap.get(type);
+ Integer value = null;
if (map != null) {
- return map.get(name);
+ value = map.get(name);
}
- return null;
+ if (value == null) {
+ value = sDynamicIds.getId(type, name);
+ }
+
+ return value;
}
/**
@@ -598,6 +617,4 @@
sFramework9PatchCache.put(value, new SoftReference<NinePatchChunk>(ninePatch));
}
}
-
-
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
index 529be97..f9f4b3a 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
@@ -70,13 +70,13 @@
@Override
public Result getProperty(Object objectView, String propertyName) {
- // TODO Auto-generated method stub
+ // pass
return super.getProperty(objectView, propertyName);
}
@Override
public Result setProperty(Object objectView, String propertyName, String propertyValue) {
- // TODO Auto-generated method stub
+ // pass
return super.setProperty(objectView, propertyName, propertyValue);
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index 6c49bab..f9e48e2b 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -60,6 +60,7 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
+import android.os.PowerManager;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
@@ -75,13 +76,11 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.IdentityHashMap;
+import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
/**
* Custom implementation of Context/Activity to handle non compiled resources.
@@ -246,15 +245,18 @@
public boolean resolveThemeAttribute(int resid, TypedValue outValue, boolean resolveRefs) {
Pair<ResourceType, String> resourceInfo = Bridge.resolveResourceId(resid);
+ boolean isFrameworkRes = true;
if (resourceInfo == null) {
resourceInfo = mProjectCallback.resolveResourceId(resid);
+ isFrameworkRes = false;
}
if (resourceInfo == null) {
return false;
}
- ResourceValue value = mRenderResources.findItemInTheme(resourceInfo.getSecond());
+ ResourceValue value = mRenderResources.findItemInTheme(resourceInfo.getSecond(),
+ isFrameworkRes);
if (resolveRefs) {
value = mRenderResources.resolveResValue(value);
}
@@ -314,12 +316,7 @@
if (isPlatformLayout == false && skipCallbackParser == false) {
// check if the project callback can provide us with a custom parser.
- ILayoutPullParser parser;
- if (resource instanceof ResourceValue) {
- parser = mProjectCallback.getParser((ResourceValue) resource);
- } else {
- parser = mProjectCallback.getParser(resource.getName());
- }
+ ILayoutPullParser parser = getParser(resource);
if (parser != null) {
BridgeXmlBlockParser blockParser = new BridgeXmlBlockParser(parser,
@@ -392,6 +389,17 @@
return Pair.of(null, false);
}
+ @SuppressWarnings("deprecation")
+ private ILayoutPullParser getParser(ResourceReference resource) {
+ ILayoutPullParser parser;
+ if (resource instanceof ResourceValue) {
+ parser = mProjectCallback.getParser((ResourceValue) resource);
+ } else {
+ parser = mProjectCallback.getParser(resource.getName());
+ }
+ return parser;
+ }
+
// ------------ Context methods
@Override
@@ -431,6 +439,10 @@
return null;
}
+ if (POWER_SERVICE.equals(service)) {
+ return new PowerManager(new BridgePowerManager(), new Handler());
+ }
+
throw new UnsupportedOperationException("Unsupported Service: " + service);
}
@@ -519,12 +531,10 @@
return null;
}
- AtomicBoolean frameworkAttributes = new AtomicBoolean();
- AtomicReference<String> attrName = new AtomicReference<String>();
- TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, frameworkAttributes, attrName);
+ List<Pair<String, Boolean>> attributeList = searchAttrs(attrs);
BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
- isPlatformFile, frameworkAttributes.get(), attrName.get());
+ isPlatformFile);
// look for a custom style.
String customStyle = null;
@@ -550,14 +560,19 @@
if (defStyleAttr != 0) {
// get the name from the int.
- String defStyleName = searchAttr(defStyleAttr);
+ Pair<String, Boolean> defStyleAttribute = searchAttr(defStyleAttr);
if (defaultPropMap != null) {
+ String defStyleName = defStyleAttribute.getFirst();
+ if (defStyleAttribute.getSecond()) {
+ defStyleName = "android:" + defStyleName;
+ }
defaultPropMap.put("style", defStyleName);
}
// look for the style in the current theme, and its parent:
- ResourceValue item = mRenderResources.findItemInTheme(defStyleName);
+ ResourceValue item = mRenderResources.findItemInTheme(defStyleAttribute.getFirst(),
+ defStyleAttribute.getSecond());
if (item != null) {
// item is a reference to a style entry. Search for it.
@@ -570,19 +585,23 @@
} else {
Bridge.getLog().error(LayoutLog.TAG_RESOURCES_RESOLVE_THEME_ATTR,
String.format(
- "Failed to find style '%s' in current theme", defStyleName),
+ "Failed to find style '%s' in current theme",
+ defStyleAttribute.getFirst()),
null /*data*/);
}
} else if (defStyleRes != 0) {
+ boolean isFrameworkRes = true;
Pair<ResourceType, String> value = Bridge.resolveResourceId(defStyleRes);
if (value == null) {
value = mProjectCallback.resolveResourceId(defStyleRes);
+ isFrameworkRes = false;
}
if (value != null) {
if (value.getFirst() == ResourceType.STYLE) {
// look for the style in the current theme, and its parent:
- ResourceValue item = mRenderResources.findItemInTheme(value.getSecond());
+ ResourceValue item = mRenderResources.findItemInTheme(value.getSecond(),
+ isFrameworkRes);
if (item != null) {
if (item instanceof StyleResourceValue) {
if (defaultPropMap != null) {
@@ -614,26 +633,28 @@
}
}
- String namespace = BridgeConstants.NS_RESOURCES;
- boolean useFrameworkNS = frameworkAttributes.get();
- if (useFrameworkNS == false) {
- // need to use the application namespace
- namespace = mProjectCallback.getNamespace();
- }
+ String appNamespace = mProjectCallback.getNamespace();
- if (styleNameMap != null) {
- for (Entry<Integer, String> styleAttribute : styleNameMap.entrySet()) {
- int index = styleAttribute.getKey().intValue();
+ if (attributeList != null) {
+ for (int index = 0 ; index < attributeList.size() ; index++) {
+ Pair<String, Boolean> attribute = attributeList.get(index);
- String name = styleAttribute.getValue();
+ if (attribute == null) {
+ continue;
+ }
+
+ String attrName = attribute.getFirst();
+ boolean frameworkAttr = attribute.getSecond().booleanValue();
String value = null;
if (set != null) {
- value = set.getAttributeValue(namespace, name);
+ value = set.getAttributeValue(
+ frameworkAttr ? BridgeConstants.NS_RESOURCES : appNamespace,
+ attrName);
// if this is an app attribute, and the first get fails, try with the
// new res-auto namespace as well
- if (useFrameworkNS == false && value == null) {
- value = set.getAttributeValue(BridgeConstants.NS_APP_RES_AUTO, name);
+ if (frameworkAttr == false && value == null) {
+ value = set.getAttributeValue(BridgeConstants.NS_APP_RES_AUTO, attrName);
}
}
@@ -644,18 +665,20 @@
// look for the value in the custom style first (and its parent if needed)
if (customStyleValues != null) {
- resValue = mRenderResources.findItemInStyle(customStyleValues, name);
+ resValue = mRenderResources.findItemInStyle(customStyleValues,
+ attrName, frameworkAttr);
}
// then look for the value in the default Style (and its parent if needed)
if (resValue == null && defStyleValues != null) {
- resValue = mRenderResources.findItemInStyle(defStyleValues, name);
+ resValue = mRenderResources.findItemInStyle(defStyleValues,
+ attrName, frameworkAttr);
}
// if the item is not present in the defStyle, we look in the main theme (and
// its parent themes)
if (resValue == null) {
- resValue = mRenderResources.findItemInTheme(name);
+ resValue = mRenderResources.findItemInTheme(attrName, frameworkAttr);
}
// if we found a value, we make sure this doesn't reference another value.
@@ -663,18 +686,18 @@
if (resValue != null) {
// put the first default value, before the resolution.
if (defaultPropMap != null) {
- defaultPropMap.put(name, resValue.getValue());
+ defaultPropMap.put(attrName, resValue.getValue());
}
resValue = mRenderResources.resolveResValue(resValue);
}
- ta.bridgeSetValue(index, name, resValue);
+ ta.bridgeSetValue(index, attrName, frameworkAttr, resValue);
} else {
// there is a value in the XML, but we need to resolve it in case it's
// referencing another resource or a theme value.
- ta.bridgeSetValue(index, name,
- mRenderResources.resolveValue(null, name, value, isPlatformFile));
+ ta.bridgeSetValue(index, attrName, frameworkAttr,
+ mRenderResources.resolveValue(null, attrName, value, isPlatformFile));
}
}
}
@@ -700,23 +723,23 @@
private BridgeTypedArray createStyleBasedTypedArray(StyleResourceValue style, int[] attrs)
throws Resources.NotFoundException {
+ List<Pair<String, Boolean>> attributes = searchAttrs(attrs);
+
BridgeTypedArray ta = ((BridgeResources) mSystemResources).newTypeArray(attrs.length,
- false, true, null);
+ false);
// for each attribute, get its name so that we can search it in the style
for (int i = 0 ; i < attrs.length ; i++) {
- Pair<ResourceType, String> resolvedResource = Bridge.resolveResourceId(attrs[i]);
- if (resolvedResource != null) {
- String attrName = resolvedResource.getSecond();
- // look for the value in the given style
- ResourceValue resValue = mRenderResources.findItemInStyle(style, attrName);
+ Pair<String, Boolean> attribute = attributes.get(i);
- if (resValue != null) {
- // resolve it to make sure there are no references left.
- ta.bridgeSetValue(i, attrName, mRenderResources.resolveResValue(resValue));
+ // look for the value in the given style
+ ResourceValue resValue = mRenderResources.findItemInStyle(style, attribute.getFirst(),
+ attribute.getSecond());
- resValue = mRenderResources.resolveResValue(resValue);
- }
+ if (resValue != null) {
+ // resolve it to make sure there are no references left.
+ ta.bridgeSetValue(i, attribute.getFirst(), attribute.getSecond(),
+ mRenderResources.resolveResValue(resValue));
}
}
@@ -727,91 +750,52 @@
/**
- * The input int[] attrs is one of com.android.internal.R.styleable fields where the name
- * of the field is the style being referenced and the array contains one index per attribute.
+ * The input int[] attrs is a list of attributes. The returns a list of information about
+ * each attributes. The information is (name, isFramework)
* <p/>
- * searchAttrs() finds all the names of the attributes referenced so for example if
- * attrs == com.android.internal.R.styleable.View, this returns the list of the "xyz" where
- * there's a field com.android.internal.R.styleable.View_xyz and the field value is the index
- * that is used to reference the attribute later in the TypedArray.
*
* @param attrs An attribute array reference given to obtainStyledAttributes.
- * @param outFrameworkFlag out value indicating if the attr array is a framework value
- * @param outAttrName out value for the resolved attr name.
- * @return A sorted map Attribute-Value to Attribute-Name for all attributes declared by the
- * attribute array. Returns null if nothing is found.
+ * @return List of attribute information.
*/
- private TreeMap<Integer,String> searchAttrs(int[] attrs, AtomicBoolean outFrameworkFlag,
- AtomicReference<String> outAttrName) {
- // get the name of the array from the framework resources
- String arrayName = Bridge.resolveResourceId(attrs);
- if (arrayName != null) {
- // if we found it, get the name of each of the int in the array.
- TreeMap<Integer,String> attributes = new TreeMap<Integer, String>();
- for (int i = 0 ; i < attrs.length ; i++) {
- Pair<ResourceType, String> info = Bridge.resolveResourceId(attrs[i]);
- if (info != null) {
- attributes.put(i, info.getSecond());
- } else {
- // FIXME Not sure what we should be doing here...
- attributes.put(i, null);
- }
+ private List<Pair<String, Boolean>> searchAttrs(int[] attrs) {
+ List<Pair<String, Boolean>> results = new ArrayList<Pair<String, Boolean>>(attrs.length);
+
+ // for each attribute, get its name so that we can search it in the style
+ for (int i = 0 ; i < attrs.length ; i++) {
+ Pair<ResourceType, String> resolvedResource = Bridge.resolveResourceId(attrs[i]);
+ boolean isFramework = false;
+ if (resolvedResource != null) {
+ isFramework = true;
+ } else {
+ resolvedResource = mProjectCallback.resolveResourceId(attrs[i]);
}
- if (outFrameworkFlag != null) {
- outFrameworkFlag.set(true);
+ if (resolvedResource != null) {
+ results.add(Pair.of(resolvedResource.getSecond(), isFramework));
+ } else {
+ results.add(null);
}
- if (outAttrName != null) {
- outAttrName.set(arrayName);
- }
-
- return attributes;
}
- // if the name was not found in the framework resources, look in the project
- // resources
- arrayName = mProjectCallback.resolveResourceId(attrs);
- if (arrayName != null) {
- TreeMap<Integer,String> attributes = new TreeMap<Integer, String>();
- for (int i = 0 ; i < attrs.length ; i++) {
- Pair<ResourceType, String> info = mProjectCallback.resolveResourceId(attrs[i]);
- if (info != null) {
- attributes.put(i, info.getSecond());
- } else {
- // FIXME Not sure what we should be doing here...
- attributes.put(i, null);
- }
- }
-
- if (outFrameworkFlag != null) {
- outFrameworkFlag.set(false);
- }
- if (outAttrName != null) {
- outAttrName.set(arrayName);
- }
-
- return attributes;
- }
-
- return null;
+ return results;
}
/**
* Searches for the attribute referenced by its internal id.
*
* @param attr An attribute reference given to obtainStyledAttributes such as defStyle.
- * @return The unique name of the attribute, if found, e.g. "buttonStyle". Returns null
+ * @return A (name, isFramework) pair describing the attribute if found. Returns null
* if nothing is found.
*/
- public String searchAttr(int attr) {
+ public Pair<String, Boolean> searchAttr(int attr) {
Pair<ResourceType, String> info = Bridge.resolveResourceId(attr);
if (info != null) {
- return info.getSecond();
+ return Pair.of(info.getSecond(), Boolean.TRUE);
}
info = mProjectCallback.resolveResourceId(attr);
if (info != null) {
- return info.getSecond();
+ return Pair.of(info.getSecond(), Boolean.FALSE);
}
return null;
@@ -871,149 +855,149 @@
@Override
public boolean bindService(Intent arg0, ServiceConnection arg1, int arg2) {
- // TODO Auto-generated method stub
+ // pass
return false;
}
@Override
public int checkCallingOrSelfPermission(String arg0) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public int checkCallingOrSelfUriPermission(Uri arg0, int arg1) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public int checkCallingPermission(String arg0) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public int checkCallingUriPermission(Uri arg0, int arg1) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public int checkPermission(String arg0, int arg1, int arg2) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public int checkUriPermission(Uri arg0, int arg1, int arg2, int arg3) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public int checkUriPermission(Uri arg0, String arg1, String arg2, int arg3,
int arg4, int arg5) {
- // TODO Auto-generated method stub
+ // pass
return 0;
}
@Override
public void clearWallpaper() {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public Context createPackageContext(String arg0, int arg1) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public String[] databaseList() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public boolean deleteDatabase(String arg0) {
- // TODO Auto-generated method stub
+ // pass
return false;
}
@Override
public boolean deleteFile(String arg0) {
- // TODO Auto-generated method stub
+ // pass
return false;
}
@Override
public void enforceCallingOrSelfPermission(String arg0, String arg1) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void enforceCallingOrSelfUriPermission(Uri arg0, int arg1,
String arg2) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void enforceCallingPermission(String arg0, String arg1) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void enforceCallingUriPermission(Uri arg0, int arg1, String arg2) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void enforcePermission(String arg0, int arg1, int arg2, String arg3) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void enforceUriPermission(Uri arg0, int arg1, int arg2, int arg3,
String arg4) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void enforceUriPermission(Uri arg0, String arg1, String arg2,
int arg3, int arg4, int arg5, String arg6) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public String[] fileList() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public AssetManager getAssets() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getCacheDir() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getExternalCacheDir() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@@ -1027,49 +1011,49 @@
@Override
public File getDatabasePath(String arg0) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getDir(String arg0, int arg1) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getFileStreamPath(String arg0) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getFilesDir() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getExternalFilesDir(String type) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public String getPackageCodePath() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public PackageManager getPackageManager() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public String getPackageName() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@@ -1080,25 +1064,25 @@
@Override
public String getPackageResourcePath() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public File getSharedPrefsFile(String name) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public SharedPreferences getSharedPreferences(String arg0, int arg1) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public Drawable getWallpaper() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@@ -1114,81 +1098,81 @@
@Override
public void grantUriPermission(String arg0, Uri arg1, int arg2) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public FileInputStream openFileInput(String arg0) throws FileNotFoundException {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public FileOutputStream openFileOutput(String arg0, int arg1) throws FileNotFoundException {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public SQLiteDatabase openOrCreateDatabase(String arg0, int arg1, CursorFactory arg2) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public SQLiteDatabase openOrCreateDatabase(String arg0, int arg1,
CursorFactory arg2, DatabaseErrorHandler arg3) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public Drawable peekWallpaper() {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public Intent registerReceiver(BroadcastReceiver arg0, IntentFilter arg1,
String arg2, Handler arg3) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public void removeStickyBroadcast(Intent arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void revokeUriPermission(Uri arg0, int arg1) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void sendBroadcast(Intent arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void sendBroadcast(Intent arg0, String arg1) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void sendOrderedBroadcast(Intent arg0, String arg1) {
- // TODO Auto-generated method stub
+ // pass
}
@@ -1196,13 +1180,13 @@
public void sendOrderedBroadcast(Intent arg0, String arg1,
BroadcastReceiver arg2, Handler arg3, int arg4, String arg5,
Bundle arg6) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void sendStickyBroadcast(Intent arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@@ -1210,79 +1194,79 @@
public void sendStickyOrderedBroadcast(Intent intent,
BroadcastReceiver resultReceiver, Handler scheduler, int initialCode, String initialData,
Bundle initialExtras) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void setTheme(int arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void setWallpaper(Bitmap arg0) throws IOException {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void setWallpaper(InputStream arg0) throws IOException {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void startActivity(Intent arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void startActivity(Intent arg0, Bundle arg1) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void startIntentSender(IntentSender intent,
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags)
throws IntentSender.SendIntentException {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void startIntentSender(IntentSender intent,
Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags,
Bundle options) throws IntentSender.SendIntentException {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public boolean startInstrumentation(ComponentName arg0, String arg1,
Bundle arg2) {
- // TODO Auto-generated method stub
+ // pass
return false;
}
@Override
public ComponentName startService(Intent arg0) {
- // TODO Auto-generated method stub
+ // pass
return null;
}
@Override
public boolean stopService(Intent arg0) {
- // TODO Auto-generated method stub
+ // pass
return false;
}
@Override
public void unbindService(ServiceConnection arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void unregisterReceiver(BroadcastReceiver arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@@ -1293,13 +1277,13 @@
@Override
public void startActivities(Intent[] arg0) {
- // TODO Auto-generated method stub
+ // pass
}
@Override
public void startActivities(Intent[] arg0, Bundle arg1) {
- // TODO Auto-generated method stub
+ // pass
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
new file mode 100644
index 0000000..6071a6b
--- /dev/null
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
@@ -0,0 +1,132 @@
+/*
+ * 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.layoutlib.bridge.android;
+
+import android.os.IBinder;
+import android.os.IPowerManager;
+import android.os.RemoteException;
+import android.os.WorkSource;
+
+/**
+ * Fake implementation of IPowerManager.
+ *
+ */
+public class BridgePowerManager implements IPowerManager {
+
+ @Override
+ public boolean isScreenOn() throws RemoteException {
+ return true;
+ }
+
+ @Override
+ public IBinder asBinder() {
+ // pass for now.
+ return null;
+ }
+
+ @Override
+ public void acquireWakeLock(int arg0, IBinder arg1, String arg2, WorkSource arg3)
+ throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void clearUserActivityTimeout(long arg0, long arg1) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void crash(String arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public int getSupportedWakeLockFlags() throws RemoteException {
+ // pass for now.
+ return 0;
+ }
+
+ @Override
+ public void goToSleep(long arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void goToSleepWithReason(long arg0, int arg1) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void preventScreenOn(boolean arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void reboot(String arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void releaseWakeLock(IBinder arg0, int arg1) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void setAttentionLight(boolean arg0, int arg1) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void setAutoBrightnessAdjustment(float arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void setBacklightBrightness(int arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void setMaximumScreenOffTimeount(int arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void setPokeLock(int arg0, IBinder arg1, String arg2) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void setStayOnSetting(int arg0) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void updateWakeLockWorkSource(IBinder arg0, WorkSource arg1) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void userActivity(long arg0, boolean arg1) throws RemoteException {
+ // pass for now.
+ }
+
+ @Override
+ public void userActivityWithForce(long arg0, boolean arg1, boolean arg2) throws RemoteException {
+ // pass for now.
+ }
+}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java
index bef2c95..8b1d41a 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java
@@ -340,6 +340,12 @@
}
@Override
+ public void overridePendingAppTransitionThumb(Bitmap srcThumb, int startX, int startY,
+ IRemoteCallback startedCallback) throws RemoteException {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
public void pauseKeyDispatching(IBinder arg0) throws RemoteException {
// TODO Auto-generated method stub
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/DynamicIdMap.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/DynamicIdMap.java
new file mode 100644
index 0000000..a1fae95
--- /dev/null
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/DynamicIdMap.java
@@ -0,0 +1,76 @@
+/*
+ * 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.layoutlib.bridge.util;
+
+import com.android.resources.ResourceType;
+import com.android.util.Pair;
+
+import android.util.SparseArray;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class DynamicIdMap {
+
+ private final Map<Pair<ResourceType, String>, Integer> mDynamicIds = new HashMap<Pair<ResourceType, String>, Integer>();
+ private final SparseArray<Pair<ResourceType, String>> mRevDynamicIds = new SparseArray<Pair<ResourceType, String>>();
+ private int mDynamicSeed;
+
+ public DynamicIdMap(int seed) {
+ mDynamicSeed = seed;
+ }
+
+ public void reset(int seed) {
+ mDynamicIds.clear();
+ mRevDynamicIds.clear();
+ mDynamicSeed = seed;
+ }
+
+ /**
+ * Returns a dynamic integer for the given resource type/name, creating it if it doesn't
+ * already exist.
+ *
+ * @param type the type of the resource
+ * @param name the name of the resource
+ * @return an integer.
+ */
+ public Integer getId(ResourceType type, String name) {
+ return getId(Pair.of(type, name));
+ }
+
+ /**
+ * Returns a dynamic integer for the given resource type/name, creating it if it doesn't
+ * already exist.
+ *
+ * @param resource the type/name of the resource
+ * @return an integer.
+ */
+ public Integer getId(Pair<ResourceType, String> resource) {
+ Integer value = mDynamicIds.get(resource);
+ if (value == null) {
+ value = Integer.valueOf(++mDynamicSeed);
+ mDynamicIds.put(resource, value);
+ mRevDynamicIds.put(value, resource);
+ }
+
+ return value;
+ }
+
+ public Pair<ResourceType, String> resolveId(int id) {
+ return mRevDynamicIds.get(id);
+ }
+}
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
index 4b33474..79e02c8 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
@@ -114,6 +114,7 @@
"android.view.LayoutInflater#rInflate",
"android.view.LayoutInflater#parseInclude",
"android.view.View#isInEditMode",
+ "android.view.ViewRootImpl#isInTouchMode",
"android.view.inputmethod.InputMethodManager#getInstance",
"android.util.Log#println_native",
"com.android.internal.util.XmlUtils#convertValueToInt",
@@ -183,10 +184,11 @@
*/
private final static String[] RENAMED_CLASSES =
new String[] {
- "android.os.ServiceManager", "android.os._Original_ServiceManager",
- "android.view.SurfaceView", "android.view._Original_SurfaceView",
+ "android.os.ServiceManager", "android.os._Original_ServiceManager",
+ "android.view.SurfaceView", "android.view._Original_SurfaceView",
"android.view.accessibility.AccessibilityManager", "android.view.accessibility._Original_AccessibilityManager",
- "android.webkit.WebView", "android.webkit._Original_WebView",
+ "android.webkit.WebView", "android.webkit._Original_WebView",
+ "com.android.internal.policy.PolicyManager", "com.android.internal.policy._Original_PolicyManager",
};
/**
diff --git a/voip/jni/rtp/Android.mk b/voip/jni/rtp/Android.mk
index 0815294..d725713 100644
--- a/voip/jni/rtp/Android.mk
+++ b/voip/jni/rtp/Android.mk
@@ -37,6 +37,7 @@
libcutils \
libutils \
libmedia \
+ libmedia_native \
libstagefright_amrnb_common
LOCAL_STATIC_LIBRARIES := libgsm libstagefright_amrnbdec libstagefright_amrnbenc
@@ -50,7 +51,7 @@
frameworks/base/media/libstagefright/codecs/amrnb/enc/src \
frameworks/base/media/libstagefright/codecs/amrnb/dec/include \
frameworks/base/media/libstagefright/codecs/amrnb/dec/src \
- system/media/audio_effects/include
+ $(call include-path-for, audio-effects)
LOCAL_CFLAGS += -fvisibility=hidden
diff --git a/voip/jni/rtp/AudioGroup.cpp b/voip/jni/rtp/AudioGroup.cpp
index 1139577..b9bbd16 100644
--- a/voip/jni/rtp/AudioGroup.cpp
+++ b/voip/jni/rtp/AudioGroup.cpp
@@ -809,9 +809,9 @@
AudioTrack track;
AudioRecord record;
if (track.set(AUDIO_STREAM_VOICE_CALL, sampleRate, AUDIO_FORMAT_PCM_16_BIT,
- AUDIO_CHANNEL_OUT_MONO, output) != NO_ERROR || record.set(
- AUDIO_SOURCE_VOICE_COMMUNICATION, sampleRate, AUDIO_FORMAT_PCM_16_BIT,
- AUDIO_CHANNEL_IN_MONO, input) != NO_ERROR) {
+ AUDIO_CHANNEL_OUT_MONO, output) != NO_ERROR ||
+ record.set(AUDIO_SOURCE_VOICE_COMMUNICATION, sampleRate, AUDIO_FORMAT_PCM_16_BIT,
+ AUDIO_CHANNEL_IN_MONO, input) != NO_ERROR) {
ALOGE("cannot initialize audio device");
return false;
}
diff --git a/wifi/java/android/net/wifi/NetworkUpdateResult.java b/wifi/java/android/net/wifi/NetworkUpdateResult.java
index 6b7b68b..234bbe1 100644
--- a/wifi/java/android/net/wifi/NetworkUpdateResult.java
+++ b/wifi/java/android/net/wifi/NetworkUpdateResult.java
@@ -22,6 +22,7 @@
int netId;
boolean ipChanged;
boolean proxyChanged;
+ boolean isNewNetwork = false;
public NetworkUpdateResult(int id) {
netId = id;
@@ -58,4 +59,12 @@
public boolean hasProxyChanged() {
return proxyChanged;
}
+
+ public boolean isNewNetwork() {
+ return isNewNetwork;
+ }
+
+ public void setIsNewNetwork(boolean isNew) {
+ isNewNetwork = isNew;
+ }
}
diff --git a/wifi/java/android/net/wifi/WifiConfigStore.java b/wifi/java/android/net/wifi/WifiConfigStore.java
index 46ad036..5dec269 100644
--- a/wifi/java/android/net/wifi/WifiConfigStore.java
+++ b/wifi/java/android/net/wifi/WifiConfigStore.java
@@ -273,7 +273,8 @@
mConfiguredNetworks.get(netId).status = Status.ENABLED;
}
mWifiNative.saveConfig();
- sendConfiguredNetworksChangedBroadcast();
+ sendConfiguredNetworksChangedBroadcast(config, result.isNewNetwork() ?
+ WifiManager.CHANGE_REASON_ADDED : WifiManager.CHANGE_REASON_CONFIG_CHANGE);
return result;
}
@@ -307,13 +308,16 @@
boolean forgetNetwork(int netId) {
if (mWifiNative.removeNetwork(netId)) {
mWifiNative.saveConfig();
+ WifiConfiguration target = null;
WifiConfiguration config = mConfiguredNetworks.get(netId);
if (config != null) {
- mConfiguredNetworks.remove(netId);
+ target = mConfiguredNetworks.remove(netId);
mNetworkIds.remove(configKey(config));
}
- writeIpAndProxyConfigurations();
- sendConfiguredNetworksChangedBroadcast();
+ if (target != null) {
+ writeIpAndProxyConfigurations();
+ sendConfiguredNetworksChangedBroadcast(target, WifiManager.CHANGE_REASON_REMOVED);
+ }
return true;
} else {
loge("Failed to remove network " + netId);
@@ -332,7 +336,11 @@
*/
int addOrUpdateNetwork(WifiConfiguration config) {
NetworkUpdateResult result = addOrUpdateNetworkNative(config);
- sendConfiguredNetworksChangedBroadcast();
+ if (result.getNetworkId() != WifiConfiguration.INVALID_NETWORK_ID) {
+ sendConfiguredNetworksChangedBroadcast(mConfiguredNetworks.get(result.getNetworkId()),
+ result.isNewNetwork ? WifiManager.CHANGE_REASON_ADDED :
+ WifiManager.CHANGE_REASON_CONFIG_CHANGE);
+ }
return result.getNetworkId();
}
@@ -347,14 +355,17 @@
*/
boolean removeNetwork(int netId) {
boolean ret = mWifiNative.removeNetwork(netId);
+ WifiConfiguration config = null;
if (ret) {
- WifiConfiguration config = mConfiguredNetworks.get(netId);
+ config = mConfiguredNetworks.get(netId);
if (config != null) {
- mConfiguredNetworks.remove(netId);
+ config = mConfiguredNetworks.remove(netId);
mNetworkIds.remove(configKey(config));
}
}
- sendConfiguredNetworksChangedBroadcast();
+ if (config != null) {
+ sendConfiguredNetworksChangedBroadcast(config, WifiManager.CHANGE_REASON_REMOVED);
+ }
return ret;
}
@@ -364,12 +375,24 @@
* API. The more powerful selectNetwork()/saveNetwork() is used by the
* state machine for connecting to a network
*
- * @param netId network to be removed
+ * @param netId network to be enabled
* @return {@code true} if it succeeds, {@code false} otherwise
*/
boolean enableNetwork(int netId, boolean disableOthers) {
boolean ret = enableNetworkWithoutBroadcast(netId, disableOthers);
- sendConfiguredNetworksChangedBroadcast();
+ if (disableOthers) {
+ sendConfiguredNetworksChangedBroadcast();
+ } else {
+ WifiConfiguration enabledNetwork = null;
+ synchronized(mConfiguredNetworks) {
+ enabledNetwork = mConfiguredNetworks.get(netId);
+ }
+ // check just in case the network was removed by someone else.
+ if (enabledNetwork != null) {
+ sendConfiguredNetworksChangedBroadcast(enabledNetwork,
+ WifiManager.CHANGE_REASON_CONFIG_CHANGE);
+ }
+ }
return ret;
}
@@ -402,13 +425,18 @@
*/
boolean disableNetwork(int netId, int reason) {
boolean ret = mWifiNative.disableNetwork(netId);
+ WifiConfiguration network = null;
WifiConfiguration config = mConfiguredNetworks.get(netId);
/* Only change the reason if the network was not previously disabled */
if (config != null && config.status != Status.DISABLED) {
config.status = Status.DISABLED;
config.disableReason = reason;
+ network = config;
}
- sendConfiguredNetworksChangedBroadcast();
+ if (network != null) {
+ sendConfiguredNetworksChangedBroadcast(network,
+ WifiManager.CHANGE_REASON_CONFIG_CHANGE);
+ }
return ret;
}
@@ -574,9 +602,29 @@
return false;
}
+ /**
+ * Should be called when a single network configuration is made.
+ * @param network The network configuration that changed.
+ * @param reason The reason for the change, should be one of WifiManager.CHANGE_REASON_ADDED,
+ * WifiManager.CHANGE_REASON_REMOVED, or WifiManager.CHANGE_REASON_CHANGE.
+ */
+ private void sendConfiguredNetworksChangedBroadcast(WifiConfiguration network,
+ int reason) {
+ Intent intent = new Intent(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION);
+ intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+ intent.putExtra(WifiManager.EXTRA_MULTIPLE_NETWORKS_CHANGED, false);
+ intent.putExtra(WifiManager.EXTRA_WIFI_CONFIGURATION, network);
+ intent.putExtra(WifiManager.EXTRA_CHANGE_REASON, reason);
+ mContext.sendBroadcast(intent);
+ }
+
+ /**
+ * Should be called when multiple network configuration changes are made.
+ */
private void sendConfiguredNetworksChangedBroadcast() {
Intent intent = new Intent(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION);
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+ intent.putExtra(WifiManager.EXTRA_MULTIPLE_NETWORKS_CHANGED, true);
mContext.sendBroadcast(intent);
}
@@ -1135,6 +1183,7 @@
mNetworkIds.put(configKey(currentConfig), netId);
NetworkUpdateResult result = writeIpAndProxyConfigurationsOnChange(currentConfig, config);
+ result.setIsNewNetwork(newNetwork);
result.setNetworkId(netId);
return result;
}
@@ -1234,7 +1283,8 @@
if (ipChanged || proxyChanged) {
currentConfig.linkProperties = linkProperties;
writeIpAndProxyConfigurations();
- sendConfiguredNetworksChangedBroadcast();
+ sendConfiguredNetworksChangedBroadcast(currentConfig,
+ WifiManager.CHANGE_REASON_CONFIG_CHANGE);
}
return new NetworkUpdateResult(ipChanged, proxyChanged);
}
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index d746810..8aa613b 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -294,12 +294,53 @@
/**
* Broadcast intent action indicating that the configured networks changed.
- * This can be as a result of adding/updating/deleting a network
+ * This can be as a result of adding/updating/deleting a network. If
+ * {@link #EXTRA_MULTIPLE_NETWORKS_CHANGED} is set to true the new configuration
+ * can be retreived with the {@link #EXTRA_WIFI_CONFIGURATION} extra. If multiple
+ * Wi-Fi configurations changed, {@link #EXTRA_WIFI_CONFIGURATION} will not be present.
* @hide
*/
public static final String CONFIGURED_NETWORKS_CHANGED_ACTION =
"android.net.wifi.CONFIGURED_NETWORKS_CHANGE";
/**
+ * The lookup key for a (@link android.net.wifi.WifiConfiguration} object representing
+ * the changed Wi-Fi configuration when the {@link #CONFIGURED_NETWORKS_CHANGED_ACTION}
+ * broadcast is sent.
+ * @hide
+ */
+ public static final String EXTRA_WIFI_CONFIGURATION = "wifiConfiguration";
+ /**
+ * Multiple network configurations have changed.
+ * @see #CONFIGURED_NETWORKS_CHANGED_ACTION
+ *
+ * @hide
+ */
+ public static final String EXTRA_MULTIPLE_NETWORKS_CHANGED = "multipleChanges";
+ /**
+ * The lookup key for an integer indicating the reason a Wi-Fi network configuration
+ * has changed. Only present if {@link #EXTRA_MULTIPLE_NETWORKS_CHANGED} is {@code false}
+ * @see #CONFIGURED_NETWORKS_CHANGED_ACTION
+ * @hide
+ */
+ public static final String EXTRA_CHANGE_REASON = "changeReason";
+ /**
+ * The configuration is new and was added.
+ * @hide
+ */
+ public static final int CHANGE_REASON_ADDED = 0;
+ /**
+ * The configuration was removed and is no longer present in the system's list of
+ * configured networks.
+ * @hide
+ */
+ public static final int CHANGE_REASON_REMOVED = 1;
+ /**
+ * The configuration has changed as a result of explicit action or because the system
+ * took an automated action such as disabling a malfunctioning configuration.
+ * @hide
+ */
+ public static final int CHANGE_REASON_CONFIG_CHANGE = 2;
+ /**
* An access point scan has completed, and results are available from the supplicant.
* Call {@link #getScanResults()} to obtain the results.
*/
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 05a8ca7..cbf7bf8 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -394,7 +394,7 @@
* Starting and shutting down driver too quick causes problems leading to driver
* being in a bad state. Delay driver stop.
*/
- private static final int DELAYED_DRIVER_STOP_MS = 2 * 60 * 1000; /* 2 minutes */
+ private final int mDriverStopDelayMs;
private int mDelayedStopCounter;
private boolean mInDelayedStop = false;
@@ -563,6 +563,9 @@
mDefaultSupplicantScanIntervalMs = mContext.getResources().getInteger(
com.android.internal.R.integer.config_wifi_supplicant_scan_interval);
+ mDriverStopDelayMs = mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_wifi_driver_stop_delay);
+
mContext.registerReceiver(
new BroadcastReceiver() {
@Override
@@ -2589,7 +2592,7 @@
} else {
/* send regular delayed shut down */
sendMessageDelayed(obtainMessage(CMD_DELAYED_STOP_DRIVER,
- mDelayedStopCounter, 0), DELAYED_DRIVER_STOP_MS);
+ mDelayedStopCounter, 0), mDriverStopDelayMs);
}
break;
case CMD_START_DRIVER: