diff options
406 files changed, 18312 insertions, 5253 deletions
@@ -110,6 +110,7 @@ LOCAL_SRC_FILES += \ core/java/android/content/pm/IPackageStatsObserver.aidl \ core/java/android/database/IContentObserver.aidl \ core/java/android/hardware/ISerialManager.aidl \ + core/java/android/hardware/input/IInputManager.aidl \ core/java/android/hardware/usb/IUsbManager.aidl \ core/java/android/net/IConnectivityManager.aidl \ core/java/android/net/INetworkManagementEventObserver.aidl \ @@ -117,6 +118,8 @@ LOCAL_SRC_FILES += \ core/java/android/net/INetworkPolicyListener.aidl \ core/java/android/net/INetworkPolicyManager.aidl \ core/java/android/net/INetworkStatsService.aidl \ + core/java/android/net/INetworkStatsSession.aidl \ + core/java/android/net/nsd/INsdManager.aidl \ core/java/android/nfc/INdefPushCallback.aidl \ core/java/android/nfc/INfcAdapter.aidl \ core/java/android/nfc/INfcAdapterExtras.aidl \ @@ -170,6 +173,7 @@ LOCAL_SRC_FILES += \ core/java/com/android/internal/view/IInputMethodClient.aidl \ core/java/com/android/internal/view/IInputMethodManager.aidl \ core/java/com/android/internal/view/IInputMethodSession.aidl \ + core/java/com/android/internal/widget/ILockSettings.aidl \ core/java/com/android/internal/widget/IRemoteViewsFactory.aidl \ core/java/com/android/internal/widget/IRemoteViewsAdapterConnection.aidl \ keystore/java/android/security/IKeyChainAliasCallback.aidl \ @@ -56,6 +56,17 @@ the Apache2 License. ========================================================================= == NOTICE file corresponding to the section 4 d of == == the Apache License, Version 2.0, == + == in this case for the mDnsResponder code. == + ========================================================================= + +mDnsResponder TXTRecord +This file is Copyright 2004 Apple Computer, Inc. but released under +the Apache2 License. + + + ========================================================================= + == NOTICE file corresponding to the section 4 d of == + == the Apache License, Version 2.0, == == in this case for the TagSoup code. == ========================================================================= diff --git a/api/current.txt b/api/current.txt index 95007b5..180ac91 100644 --- a/api/current.txt +++ b/api/current.txt @@ -80,7 +80,7 @@ package android { field public static final java.lang.String READ_EXTERNAL_STORAGE = "android.permission.READ_EXTERNAL_STORAGE"; field public static final java.lang.String READ_FRAME_BUFFER = "android.permission.READ_FRAME_BUFFER"; field public static final java.lang.String READ_HISTORY_BOOKMARKS = "com.android.browser.permission.READ_HISTORY_BOOKMARKS"; - field public static final java.lang.String READ_INPUT_STATE = "android.permission.READ_INPUT_STATE"; + field public static final deprecated java.lang.String READ_INPUT_STATE = "android.permission.READ_INPUT_STATE"; field public static final java.lang.String READ_LOGS = "android.permission.READ_LOGS"; field public static final java.lang.String READ_PHONE_STATE = "android.permission.READ_PHONE_STATE"; field public static final java.lang.String READ_PROFILE = "android.permission.READ_PROFILE"; @@ -570,6 +570,7 @@ package android { field public static final int itemIconDisabledAlpha = 16843057; // 0x1010131 field public static final int itemPadding = 16843565; // 0x101032d field public static final int itemTextAppearance = 16843052; // 0x101012c + field public static final int kcm = 16843696; // 0x10103b0 field public static final int keepScreenOn = 16843286; // 0x1010216 field public static final int key = 16843240; // 0x10101e8 field public static final int keyBackground = 16843315; // 0x1010233 @@ -596,7 +597,7 @@ package android { field public static final int layerType = 16843604; // 0x1010354 field public static final int layout = 16842994; // 0x10100f2 field public static final int layoutAnimation = 16842988; // 0x10100ec - field public static final int layoutDirection = 16843690; // 0x10103aa + field public static final int layoutDirection = 16843691; // 0x10103ab field public static final int layout_above = 16843140; // 0x1010184 field public static final int layout_alignBaseline = 16843142; // 0x1010186 field public static final int layout_alignBottom = 16843146; // 0x101018a @@ -618,10 +619,10 @@ package android { field public static final int layout_height = 16842997; // 0x10100f5 field public static final int layout_margin = 16842998; // 0x10100f6 field public static final int layout_marginBottom = 16843002; // 0x10100fa - field public static final int layout_marginEnd = 16843694; // 0x10103ae + field public static final int layout_marginEnd = 16843695; // 0x10103af field public static final int layout_marginLeft = 16842999; // 0x10100f7 field public static final int layout_marginRight = 16843001; // 0x10100f9 - field public static final int layout_marginStart = 16843693; // 0x10103ad + field public static final int layout_marginStart = 16843694; // 0x10103ae field public static final int layout_marginTop = 16843000; // 0x10100f8 field public static final int layout_row = 16843643; // 0x101037b field public static final int layout_rowSpan = 16843644; // 0x101037c @@ -717,16 +718,17 @@ package android { field public static final int packageNames = 16843649; // 0x1010381 field public static final int padding = 16842965; // 0x10100d5 field public static final int paddingBottom = 16842969; // 0x10100d9 - field public static final int paddingEnd = 16843692; // 0x10103ac + field public static final int paddingEnd = 16843693; // 0x10103ad field public static final int paddingLeft = 16842966; // 0x10100d6 field public static final int paddingRight = 16842968; // 0x10100d8 - field public static final int paddingStart = 16843691; // 0x10103ab + field public static final int paddingStart = 16843692; // 0x10103ac field public static final int paddingTop = 16842967; // 0x10100d7 field public static final int panelBackground = 16842846; // 0x101005e field public static final int panelColorBackground = 16842849; // 0x1010061 field public static final int panelColorForeground = 16842848; // 0x1010060 field public static final int panelFullBackground = 16842847; // 0x101005f field public static final int panelTextAppearance = 16842850; // 0x1010062 + field public static final int parentActivityName = 16843697; // 0x10103b1 field public static final deprecated int password = 16843100; // 0x101015c field public static final int path = 16842794; // 0x101002a field public static final int pathPattern = 16842796; // 0x101002c @@ -932,6 +934,7 @@ package android { field public static final int summaryOff = 16843248; // 0x10101f0 field public static final int summaryOn = 16843247; // 0x10101ef field public static final int supportsRtl = 16843688; // 0x10103a8 + field public static final int supportsSentenceSpellCheck = 16843698; // 0x10103b2 field public static final int supportsUploading = 16843419; // 0x101029b field public static final int switchMinWidth = 16843632; // 0x1010370 field public static final int switchPadding = 16843633; // 0x1010371 @@ -962,6 +965,7 @@ package android { field public static final int tension = 16843370; // 0x101026a field public static final int testOnly = 16843378; // 0x1010272 field public static final int text = 16843087; // 0x101014f + field public static final int textAlignment = 16843690; // 0x10103aa field public static final int textAllCaps = 16843660; // 0x101038c field public static final int textAppearance = 16842804; // 0x1010034 field public static final int textAppearanceButton = 16843271; // 0x1010207 @@ -2577,6 +2581,7 @@ package android.app { method public java.lang.String getLocalClassName(); method public android.view.MenuInflater getMenuInflater(); method public final android.app.Activity getParent(); + method public android.content.Intent getParentActivityIntent(); method public android.content.SharedPreferences getPreferences(int); method public int getRequestedOrientation(); method public int getTaskId(); @@ -2593,6 +2598,8 @@ package android.app { method public boolean isTaskRoot(); method public final deprecated android.database.Cursor managedQuery(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String); method public boolean moveTaskToBack(boolean); + method public boolean navigateUpTo(android.content.Intent); + method public boolean navigateUpToFromChild(android.app.Activity, android.content.Intent); method public void onActionModeFinished(android.view.ActionMode); method public void onActionModeStarted(android.view.ActionMode); method protected void onActivityResult(int, int, android.content.Intent); @@ -2609,6 +2616,7 @@ package android.app { method public java.lang.CharSequence onCreateDescription(); method protected deprecated android.app.Dialog onCreateDialog(int); method protected deprecated android.app.Dialog onCreateDialog(int, android.os.Bundle); + method public void onCreateNavigateUpTaskStack(android.app.TaskStackBuilder); method public boolean onCreateOptionsMenu(android.view.Menu); method public boolean onCreatePanelMenu(int, android.view.Menu); method public android.view.View onCreatePanelView(int); @@ -2626,6 +2634,8 @@ package android.app { method public void onLowMemory(); method public boolean onMenuItemSelected(int, android.view.MenuItem); method public boolean onMenuOpened(int, android.view.Menu); + method public boolean onNavigateUp(); + method public boolean onNavigateUpFromChild(android.app.Activity); method protected void onNewIntent(android.content.Intent); method public boolean onOptionsItemSelected(android.view.MenuItem); method public void onOptionsMenuClosed(android.view.Menu); @@ -2635,6 +2645,7 @@ package android.app { method protected void onPostResume(); method protected deprecated void onPrepareDialog(int, android.app.Dialog); method protected deprecated void onPrepareDialog(int, android.app.Dialog, android.os.Bundle); + method public void onPrepareNavigateUpTaskStack(android.app.TaskStackBuilder); method public boolean onPrepareOptionsMenu(android.view.Menu); method public boolean onPreparePanel(int, android.view.View, android.view.Menu); method protected void onRestart(); @@ -2685,6 +2696,7 @@ package android.app { method public void setTitleColor(int); method public void setVisible(boolean); method public final void setVolumeControlStream(int); + method public boolean shouldUpRecreateTask(android.content.Intent); method public final deprecated void showDialog(int); method public final deprecated boolean showDialog(int, android.os.Bundle); method public android.view.ActionMode startActionMode(android.view.ActionMode.Callback); @@ -3931,6 +3943,18 @@ package android.app { method public void setDefaultTab(int); } + public class TaskStackBuilder implements java.lang.Iterable { + method public android.app.TaskStackBuilder addNextIntent(android.content.Intent); + method public android.app.TaskStackBuilder addParentStack(android.app.Activity); + method public android.app.TaskStackBuilder addParentStack(java.lang.Class<?>); + method public static android.app.TaskStackBuilder from(android.content.Context); + method public android.content.Intent getIntent(int); + method public int getIntentCount(); + method public android.app.PendingIntent getPendingIntent(int, int); + method public java.util.Iterator<android.content.Intent> iterator(); + method public void startActivities(); + } + public class TimePickerDialog extends android.app.AlertDialog implements android.content.DialogInterface.OnClickListener android.widget.TimePicker.OnTimeChangedListener { ctor public TimePickerDialog(android.content.Context, android.app.TimePickerDialog.OnTimeSetListener, int, int, boolean); ctor public TimePickerDialog(android.content.Context, int, android.app.TimePickerDialog.OnTimeSetListener, int, int, boolean); @@ -5210,6 +5234,7 @@ package android.content { field public static final java.lang.String DOWNLOAD_SERVICE = "download"; field public static final java.lang.String DROPBOX_SERVICE = "dropbox"; field public static final java.lang.String INPUT_METHOD_SERVICE = "input_method"; + field public static final java.lang.String INPUT_SERVICE = "input"; field public static final java.lang.String KEYGUARD_SERVICE = "keyguard"; field public static final java.lang.String LAYOUT_INFLATER_SERVICE = "layout_inflater"; field public static final java.lang.String LOCATION_SERVICE = "location"; @@ -6101,6 +6126,7 @@ package android.content.pm { field public int configChanges; field public int flags; field public int launchMode; + field public java.lang.String parentActivityName; field public java.lang.String permission; field public int screenOrientation; field public int softInputMode; @@ -9794,6 +9820,15 @@ package android.hardware { } +package android.hardware.input { + + public final class InputManager { + field public static final java.lang.String ACTION_QUERY_KEYBOARD_LAYOUTS = "android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS"; + field public static final java.lang.String META_DATA_KEYBOARD_LAYOUTS = "android.hardware.input.metadata.KEYBOARD_LAYOUTS"; + } + +} + package android.hardware.usb { public class UsbAccessory implements android.os.Parcelable { @@ -12899,6 +12934,7 @@ package android.nfc.tech { method public byte[] getHistoricalBytes(); method public int getMaxTransceiveLength(); method public int getTimeout(); + method public boolean isExtendedLengthApduSupported(); method public void setTimeout(int); method public byte[] transceive(byte[]) throws java.io.IOException; } @@ -16652,6 +16688,7 @@ package android.provider { field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2"; field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2"; field public static final android.net.Uri CONTENT_URI; + field public static final java.lang.String NORMALIZED_NUMBER = "data4"; field public static final java.lang.String NUMBER = "data1"; field public static final int TYPE_ASSISTANT = 19; // 0x13 field public static final int TYPE_CALLBACK = 8; // 0x8 @@ -17012,6 +17049,7 @@ package android.provider { protected static abstract interface ContactsContract.PhoneLookupColumns { field public static final java.lang.String LABEL = "label"; + field public static final java.lang.String NORMALIZED_NUMBER = "normalized_number"; field public static final java.lang.String NUMBER = "number"; field public static final java.lang.String TYPE = "type"; } @@ -22223,6 +22261,7 @@ package android.view { public final class InputDevice implements android.os.Parcelable { method public int describeContents(); + method public java.lang.String getDescriptor(); method public static android.view.InputDevice getDevice(int); method public static int[] getDeviceIds(); method public int getId(); @@ -23209,6 +23248,7 @@ package android.view { method public void buildLayer(); method public boolean callOnClick(); method public boolean canResolveLayoutDirection(); + method public boolean canResolveTextAlignment(); method public boolean canResolveTextDirection(); method public boolean canScrollHorizontally(int); method public boolean canScrollVertically(int); @@ -23311,6 +23351,8 @@ package android.view { method public final int getMeasuredState(); method public final int getMeasuredWidth(); method public final int getMeasuredWidthAndState(); + method public int getMinimumHeight(); + method public int getMinimumWidth(); method public int getNextFocusDownId(); method public int getNextFocusForwardId(); method public int getNextFocusLeftId(); @@ -23329,6 +23371,7 @@ package android.view { method public float getPivotY(); method public int getResolvedLayoutDirection(); method public int getResolvedLayoutDirection(android.graphics.drawable.Drawable); + method public int getResolvedTextAlignment(); method public int getResolvedTextDirection(); method public android.content.res.Resources getResources(); method public final int getRight(); @@ -23340,6 +23383,9 @@ package android.view { method public float getRotationY(); method public float getScaleX(); method public float getScaleY(); + method public int getScrollBarDefaultDelayBeforeFade(); + method public int getScrollBarFadeDuration(); + method public int getScrollBarSize(); method public int getScrollBarStyle(); method public final int getScrollX(); method public final int getScrollY(); @@ -23349,6 +23395,7 @@ package android.view { method public int getSystemUiVisibility(); method public java.lang.Object getTag(); method public java.lang.Object getTag(int); + method public int getTextAlignment(); method public int getTextDirection(); method public final int getTop(); method protected float getTopFadingEdgeStrength(); @@ -23409,6 +23456,7 @@ package android.view { method public boolean isPressed(); method public boolean isSaveEnabled(); method public boolean isSaveFromParentEnabled(); + method public boolean isScrollContainer(); method public boolean isScrollbarFadingEnabled(); method public boolean isSelected(); method public boolean isShown(); @@ -23456,6 +23504,8 @@ package android.view { method public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent); method public void onResolvedLayoutDirectionChanged(); method public void onResolvedLayoutDirectionReset(); + method public void onResolvedTextAlignmentChanged(); + method public void onResolvedTextAlignmentReset(); method public void onResolvedTextDirectionChanged(); method public void onResolvedTextDirectionReset(); method protected void onRestoreInstanceState(android.os.Parcelable); @@ -23496,11 +23546,13 @@ package android.view { method public boolean requestRectangleOnScreen(android.graphics.Rect); method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean); method public void resetResolvedLayoutDirection(); + method public void resetResolvedTextAlignment(); 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); + method public void resolveTextAlignment(); method public void resolveTextDirection(); method public void restoreHierarchyState(android.util.SparseArray<android.os.Parcelable>); method public void saveHierarchyState(android.util.SparseArray<android.os.Parcelable>); @@ -23513,8 +23565,9 @@ package android.view { method public void setActivated(boolean); method public void setAlpha(float); method public void setAnimation(android.view.animation.Animation); + method public void setBackground(android.graphics.drawable.Drawable); method public void setBackgroundColor(int); - method public void setBackgroundDrawable(android.graphics.drawable.Drawable); + method public deprecated void setBackgroundDrawable(android.graphics.drawable.Drawable); method public void setBackgroundResource(int); method public final void setBottom(int); method public void setCameraDistance(float); @@ -23574,6 +23627,9 @@ package android.view { method public void setSaveFromParentEnabled(boolean); method public void setScaleX(float); method public void setScaleY(float); + method public void setScrollBarDefaultDelayBeforeFade(int); + method public void setScrollBarFadeDuration(int); + method public void setScrollBarSize(int); method public void setScrollBarStyle(int); method public void setScrollContainer(boolean); method public void setScrollX(int); @@ -23584,6 +23640,7 @@ package android.view { method public void setSystemUiVisibility(int); method public void setTag(java.lang.Object); method public void setTag(int, java.lang.Object); + method public void setTextAlignment(int); method public void setTextDirection(int); method public final void setTop(int); method public void setTouchDelegate(android.view.TouchDelegate); @@ -23694,6 +23751,15 @@ package android.view { 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 SYSTEM_UI_LAYOUT_FLAGS = 1536; // 0x600 + field public static final int TEXT_ALIGNMENT_CENTER = 4; // 0x4 + field protected static int TEXT_ALIGNMENT_DEFAULT; + field public static final int TEXT_ALIGNMENT_GRAVITY = 1; // 0x1 + field public static final int TEXT_ALIGNMENT_INHERIT = 0; // 0x0 + field public static final int TEXT_ALIGNMENT_RESOLVED_DEFAULT = 131072; // 0x20000 + field public static final int TEXT_ALIGNMENT_TEXT_END = 3; // 0x3 + field public static final int TEXT_ALIGNMENT_TEXT_START = 2; // 0x2 + field public static final int TEXT_ALIGNMENT_VIEW_END = 6; // 0x6 + field public static final int TEXT_ALIGNMENT_VIEW_START = 5; // 0x5 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 @@ -24119,15 +24185,18 @@ package android.view { } public final class ViewTreeObserver { + method public void addOnDrawListener(android.view.ViewTreeObserver.OnDrawListener); method public void addOnGlobalFocusChangeListener(android.view.ViewTreeObserver.OnGlobalFocusChangeListener); method public void addOnGlobalLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener); method public void addOnPreDrawListener(android.view.ViewTreeObserver.OnPreDrawListener); method public void addOnScrollChangedListener(android.view.ViewTreeObserver.OnScrollChangedListener); method public void addOnTouchModeChangeListener(android.view.ViewTreeObserver.OnTouchModeChangeListener); + method public final void dispatchOnDraw(); method public final void dispatchOnGlobalLayout(); method public final boolean dispatchOnPreDraw(); method public boolean isAlive(); method public deprecated void removeGlobalOnLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener); + method public void removeOnDrawListener(android.view.ViewTreeObserver.OnDrawListener); method public void removeOnGlobalFocusChangeListener(android.view.ViewTreeObserver.OnGlobalFocusChangeListener); method public void removeOnGlobalLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener); method public void removeOnPreDrawListener(android.view.ViewTreeObserver.OnPreDrawListener); @@ -24135,6 +24204,10 @@ package android.view { method public void removeOnTouchModeChangeListener(android.view.ViewTreeObserver.OnTouchModeChangeListener); } + public static abstract interface ViewTreeObserver.OnDrawListener { + method public abstract void onDraw(); + } + public static abstract interface ViewTreeObserver.OnGlobalFocusChangeListener { method public abstract void onGlobalFocusChanged(android.view.View, android.view.View); } @@ -25210,11 +25283,13 @@ package android.view.textservice { method public android.view.textservice.SpellCheckerInfo getSpellChecker(); method public void getSuggestions(android.view.textservice.TextInfo, int); method public void getSuggestions(android.view.textservice.TextInfo[], int, boolean); + method public boolean isSentenceSpellCheckSupported(); method public boolean isSessionDisconnected(); field public static final java.lang.String SERVICE_META_DATA = "android.view.textservice.scs"; } public static abstract interface SpellCheckerSession.SpellCheckerSessionListener { + method public abstract void onGetSentenceSuggestions(android.view.textservice.SentenceSuggestionsInfo[]); method public abstract void onGetSuggestions(android.view.textservice.SuggestionsInfo[]); } @@ -25698,7 +25773,8 @@ package android.webkit { method public deprecated void emulateShiftHeld(); method public static deprecated void enablePlatformNotifications(); method public static java.lang.String findAddress(java.lang.String); - method public int findAll(java.lang.String); + method public deprecated int findAll(java.lang.String); + method public void findAllAsync(java.lang.String); method public void findNext(boolean); method public void flingScroll(int, int); method public void freeMemory(); @@ -25749,6 +25825,7 @@ package android.webkit { method public void saveWebArchive(java.lang.String, boolean, android.webkit.ValueCallback<java.lang.String>); method public void setCertificate(android.net.http.SslCertificate); method public void setDownloadListener(android.webkit.DownloadListener); + method public void setFindListener(android.webkit.WebView.FindListener); method public void setHorizontalScrollbarOverlay(boolean); method public void setHttpAuthUsernamePassword(java.lang.String, java.lang.String, java.lang.String, java.lang.String); method public void setInitialScale(int); @@ -25767,6 +25844,10 @@ package android.webkit { field public static final java.lang.String SCHEME_TEL = "tel:"; } + public static abstract interface WebView.FindListener { + method public abstract void onFindResultReceived(int, int, boolean); + } + public static class WebView.HitTestResult { method public java.lang.String getExtra(); method public int getType(); diff --git a/cmds/app_process/Android.mk b/cmds/app_process/Android.mk index 2391b72..b39c335 100644 --- a/cmds/app_process/Android.mk +++ b/cmds/app_process/Android.mk @@ -13,3 +13,29 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_MODULE:= app_process include $(BUILD_EXECUTABLE) + + +# Build a variant of app_process binary linked with ASan runtime. +# ARM-only at the moment. +ifeq ($(TARGET_ARCH),arm) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + app_main.cpp + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + libutils \ + libbinder \ + libandroid_runtime + +LOCAL_MODULE := app_process__asan +LOCAL_MODULE_TAGS := eng +LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)/asan +LOCAL_MODULE_STEM := app_process +LOCAL_ADDRESS_SANITIZER := true + +include $(BUILD_EXECUTABLE) + +endif # ifeq($(TARGET_ARCH),arm) diff --git a/cmds/input/src/com/android/commands/input/Input.java b/cmds/input/src/com/android/commands/input/Input.java index c4c3b8a..3037881 100755 --- a/cmds/input/src/com/android/commands/input/Input.java +++ b/cmds/input/src/com/android/commands/input/Input.java @@ -16,11 +16,12 @@ package com.android.commands.input; +import android.hardware.input.InputManager; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.util.Log; -import android.view.IWindowManager; +import android.view.InputDevice; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.MotionEvent; @@ -33,8 +34,6 @@ import android.view.MotionEvent; public class Input { private static final String TAG = "Input"; - private IWindowManager mWindowManager; - /** * Command-line entry point. * @@ -44,13 +43,6 @@ public class Input { (new Input()).run(args); } - private IWindowManager getWindowManager() { - if (mWindowManager == null) { - mWindowManager = (IWindowManager.Stub.asInterface(ServiceManager.getService("window"))); - } - return mWindowManager; - } - private void run(String[] args) { if (args.length < 1) { showUsage(); @@ -127,8 +119,10 @@ public class Input { private void sendKeyEvent(int keyCode) { long now = SystemClock.uptimeMillis(); - injectKeyEvent(new KeyEvent(now, now, KeyEvent.ACTION_DOWN, keyCode, 0)); - injectKeyEvent(new KeyEvent(now, now, KeyEvent.ACTION_UP, keyCode, 0)); + injectKeyEvent(new KeyEvent(now, now, KeyEvent.ACTION_DOWN, keyCode, 0, 0, + KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, InputDevice.SOURCE_KEYBOARD)); + injectKeyEvent(new KeyEvent(now, now, KeyEvent.ACTION_UP, keyCode, 0, 0, + KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, InputDevice.SOURCE_KEYBOARD)); } private void sendTap(float x, float y) { @@ -150,23 +144,14 @@ public class Input { } private void injectKeyEvent(KeyEvent event) { - try { - Log.i(TAG, "InjectKeyEvent: " + event); - getWindowManager().injectKeyEvent(event, true); - } catch (RemoteException ex) { - Log.i(TAG, "RemoteException", ex); - } + Log.i(TAG, "InjectKeyEvent: " + event); + InputManager.injectInputEvent(event, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); } private void injectPointerEvent(MotionEvent event) { - try { - Log.i("Input", "InjectPointerEvent: " + event); - getWindowManager().injectPointerEvent(event, true); - } catch (RemoteException ex) { - Log.i(TAG, "RemoteException", ex); - } finally { - event.recycle(); - } + event.setSource(InputDevice.SOURCE_TOUCHSCREEN); + Log.i("Input", "InjectPointerEvent: " + event); + InputManager.injectInputEvent(event, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); } private static final float lerp(float a, float b, float alpha) { @@ -174,7 +159,7 @@ public class Input { } private void showUsage() { - System.err.println("usage: input [text|keyevent]"); + System.err.println("usage: input ..."); System.err.println(" input text <string>"); System.err.println(" input keyevent <key code>"); System.err.println(" input tap <x> <y>"); diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index b277efb..7207e29 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -29,6 +29,8 @@ import android.content.Intent; import android.content.IntentSender; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; @@ -65,13 +67,13 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; -import android.view.WindowManagerImpl; import android.view.View.OnCreateContextMenuListener; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.ViewManager; import android.view.Window; import android.view.WindowManager; +import android.view.WindowManagerImpl; import android.view.accessibility.AccessibilityEvent; import android.widget.AdapterView; @@ -704,6 +706,7 @@ public class Activity extends ContextThemeWrapper /*package*/ boolean mVisibleFromServer = false; /*package*/ boolean mVisibleFromClient = true; /*package*/ ActionBarImpl mActionBar = null; + private boolean mEnableDefaultActionBarUp; private CharSequence mTitle; private int mTitleColor = 0; @@ -865,6 +868,13 @@ public class Activity extends ContextThemeWrapper if (mLastNonConfigurationInstances != null) { mAllLoaderManagers = mLastNonConfigurationInstances.loaders; } + if (mActivityInfo.parentActivityName != null) { + if (mActionBar == null) { + mEnableDefaultActionBarUp = true; + } else { + mActionBar.setDefaultDisplayHomeAsUpEnabled(true); + } + } if (savedInstanceState != null) { Parcelable p = savedInstanceState.getParcelable(FRAGMENTS_TAG); mFragments.restoreAllState(p, mLastNonConfigurationInstances != null @@ -1829,6 +1839,7 @@ public class Activity extends ContextThemeWrapper } mActionBar = new ActionBarImpl(this); + mActionBar.setDefaultDisplayHomeAsUpEnabled(mEnableDefaultActionBarUp); } /** @@ -2511,7 +2522,19 @@ public class Activity extends ContextThemeWrapper if (onOptionsItemSelected(item)) { return true; } - return mFragments.dispatchOptionsItemSelected(item); + if (mFragments.dispatchOptionsItemSelected(item)) { + return true; + } + if (item.getItemId() == android.R.id.home && mActionBar != null && + (mActionBar.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0) { + if (mParent == null) { + onNavigateUp(); + } else { + mParent.onNavigateUpFromChild(this); + } + return true; + } + return false; case Window.FEATURE_CONTEXT_MENU: EventLog.writeEvent(50000, 1, item.getTitleCondensed()); @@ -2630,7 +2653,7 @@ public class Activity extends ContextThemeWrapper * facilities. * * <p>Derived classes should call through to the base class for it to - * perform the default menu handling. + * perform the default menu handling.</p> * * @param item The menu item that was selected. * @@ -2647,6 +2670,92 @@ public class Activity extends ContextThemeWrapper } /** + * This method is called whenever the user chooses to navigate Up within your application's + * activity hierarchy from the action bar. + * + * <p>If the attribute {@link android.R.attr#parentActivityName parentActivityName} + * was specified in the manifest for this activity or an activity-alias to it, + * default Up navigation will be handled automatically. If any activity + * along the parent chain requires extra Intent arguments, the Activity subclass + * should override the method {@link #onPrepareNavigateUpTaskStack(TaskStackBuilder)} + * to supply those arguments.</p> + * + * <p>See <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back Stack</a> + * from the developer guide and <a href="{@docRoot}design/patterns/navigation.html">Navigation</a> + * from the design guide for more information about navigating within your app.</p> + * + * <p>See the {@link TaskStackBuilder} class and the Activity methods + * {@link #getParentActivityIntent()}, {@link #shouldUpRecreateTask(Intent)}, and + * {@link #navigateUpTo(Intent)} for help implementing custom Up navigation. + * The AppNavigation sample application in the Android SDK is also available for reference.</p> + * + * @return true if Up navigation completed successfully and this Activity was finished, + * false otherwise. + */ + public boolean onNavigateUp() { + // Automatically handle hierarchical Up navigation if the proper + // metadata is available. + Intent upIntent = getParentActivityIntent(); + if (upIntent != null) { + if (shouldUpRecreateTask(upIntent)) { + TaskStackBuilder b = TaskStackBuilder.from(this); + onCreateNavigateUpTaskStack(b); + onPrepareNavigateUpTaskStack(b); + b.startActivities(); + finish(); + } else { + navigateUpTo(upIntent); + } + return true; + } + return false; + } + + /** + * This is called when a child activity of this one attempts to navigate up. + * The default implementation simply calls onNavigateUp() on this activity (the parent). + * + * @param child The activity making the call. + */ + public boolean onNavigateUpFromChild(Activity child) { + return onNavigateUp(); + } + + /** + * Define the synthetic task stack that will be generated during Up navigation from + * a different task. + * + * <p>The default implementation of this method adds the parent chain of this activity + * as specified in the manifest to the supplied {@link TaskStackBuilder}. Applications + * may choose to override this method to construct the desired task stack in a different + * way.</p> + * + * <p>Applications that wish to supply extra Intent parameters to the parent stack defined + * by the manifest should override {@link #onPrepareNavigateUpTaskStack(TaskStackBuilder)}.</p> + * + * @param builder An empty TaskStackBuilder - the application should add intents representing + * the desired task stack + */ + public void onCreateNavigateUpTaskStack(TaskStackBuilder builder) { + builder.addParentStack(this); + } + + /** + * Prepare the synthetic task stack that will be generated during Up navigation + * from a different task. + * + * <p>This method receives the {@link TaskStackBuilder} with the constructed series of + * Intents as generated by {@link #onCreateNavigateUpTaskStack(TaskStackBuilder)}. + * If any extra data should be added to these intents before launching the new task, + * the application should override this method and add that data here.</p> + * + * @param builder A TaskStackBuilder that has been populated with Intents by + * onCreateNavigateUpTaskStack. + */ + public void onPrepareNavigateUpTaskStack(TaskStackBuilder builder) { + } + + /** * This hook is called whenever the options menu is being closed (either by the user canceling * the menu with the back/menu button, or when an item is selected). * @@ -4658,6 +4767,122 @@ public class Activity extends ContextThemeWrapper public void onActionModeFinished(ActionMode mode) { } + /** + * Returns true if the app should recreate the task when navigating 'up' from this activity + * by using targetIntent. + * + * <p>If this method returns false the app can trivially call + * {@link #navigateUpTo(Intent)} using the same parameters to correctly perform + * up navigation. If this method returns false, the app should synthesize a new task stack + * by using {@link TaskStackBuilder} or another similar mechanism to perform up navigation.</p> + * + * @param targetIntent An intent representing the target destination for up navigation + * @return true if navigating up should recreate a new task stack, false if the same task + * should be used for the destination + */ + public boolean shouldUpRecreateTask(Intent targetIntent) { + try { + PackageManager pm = getPackageManager(); + ComponentName cn = targetIntent.getComponent(); + if (cn == null) { + cn = targetIntent.resolveActivity(pm); + } + ActivityInfo info = pm.getActivityInfo(cn, 0); + if (info.taskAffinity == null) { + return false; + } + return !ActivityManagerNative.getDefault() + .targetTaskAffinityMatchesActivity(mToken, info.taskAffinity); + } catch (RemoteException e) { + return false; + } catch (NameNotFoundException e) { + return false; + } + } + + /** + * Navigate from this activity to the activity specified by upIntent, finishing this activity + * in the process. If the activity indicated by upIntent already exists in the task's history, + * this activity and all others before the indicated activity in the history stack will be + * finished. If the indicated activity does not appear in the history stack, this is equivalent + * to simply calling finish() on this activity. + * + * <p>This method should be used when performing up navigation from within the same task + * as the destination. If up navigation should cross tasks in some cases, see + * {@link #shouldUpRecreateTask(Intent)}.</p> + * + * @param upIntent An intent representing the target destination for up navigation + * + * @return true if up navigation successfully reached the activity indicated by upIntent and + * upIntent was delivered to it. false if an instance of the indicated activity could + * not be found and this activity was simply finished normally. + */ + public boolean navigateUpTo(Intent upIntent) { + if (mParent == null) { + ComponentName destInfo = upIntent.getComponent(); + if (destInfo == null) { + destInfo = upIntent.resolveActivity(getPackageManager()); + if (destInfo == null) { + return false; + } + upIntent = new Intent(upIntent); + upIntent.setComponent(destInfo); + } + int resultCode; + Intent resultData; + synchronized (this) { + resultCode = mResultCode; + resultData = mResultData; + } + if (resultData != null) { + resultData.setAllowFds(false); + } + try { + return ActivityManagerNative.getDefault().navigateUpTo(mToken, upIntent, + resultCode, resultData); + } catch (RemoteException e) { + return false; + } + } else { + return mParent.navigateUpToFromChild(this, upIntent); + } + } + + /** + * This is called when a child activity of this one calls its + * {@link #navigateUpTo} method. The default implementation simply calls + * navigateUpTo(upIntent) on this activity (the parent). + * + * @param child The activity making the call. + * @param upIntent An intent representing the target destination for up navigation + * + * @return true if up navigation successfully reached the activity indicated by upIntent and + * upIntent was delivered to it. false if an instance of the indicated activity could + * not be found and this activity was simply finished normally. + */ + public boolean navigateUpToFromChild(Activity child, Intent upIntent) { + return navigateUpTo(upIntent); + } + + /** + * Obtain an {@link Intent} that will launch an explicit target activity specified by + * this activity's logical parent. The logical parent is named in the application's manifest + * by the {@link android.R.attr#parentActivityName parentActivityName} attribute. + * Activity subclasses may override this method to modify the Intent returned by + * super.getParentActivityIntent() or to implement a different mechanism of retrieving + * the parent intent entirely. + * + * @return a new Intent targeting the defined parent of this activity or null if + * there is no valid parent. + */ + public Intent getParentActivityIntent() { + final String parentName = mActivityInfo.parentActivityName; + if (TextUtils.isEmpty(parentName)) { + return null; + } + return new Intent().setClassName(this, parentName); + } + // ------------------ Internal API ------------------ final void setParent(Activity parent) { diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 531a695..11b4c3a 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -1774,5 +1774,4 @@ public class ActivityManager { return false; } } - } diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 5917cbf..a3fdf3e 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -17,10 +17,10 @@ package android.app; import android.content.ComponentName; +import android.content.IIntentReceiver; +import android.content.IIntentSender; import android.content.Intent; import android.content.IntentFilter; -import android.content.IIntentSender; -import android.content.IIntentReceiver; import android.content.IntentSender; import android.content.pm.ApplicationInfo; import android.content.pm.ConfigurationInfo; @@ -32,11 +32,11 @@ import android.net.Uri; import android.os.Binder; import android.os.Bundle; import android.os.Debug; -import android.os.Parcelable; -import android.os.ParcelFileDescriptor; -import android.os.RemoteException; import android.os.IBinder; import android.os.Parcel; +import android.os.ParcelFileDescriptor; +import android.os.Parcelable; +import android.os.RemoteException; import android.os.ServiceManager; import android.os.StrictMode; import android.text.TextUtils; @@ -867,6 +867,16 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } + case GET_UID_FOR_INTENT_SENDER_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + IIntentSender r = IIntentSender.Stub.asInterface( + data.readStrongBinder()); + int res = getUidForIntentSender(r); + reply.writeNoException(); + reply.writeInt(res); + return true; + } + case SET_PROCESS_LIMIT_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int max = data.readInt(); @@ -1605,6 +1615,31 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } + case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + IBinder token = data.readStrongBinder(); + String destAffinity = data.readString(); + boolean res = targetTaskAffinityMatchesActivity(token, destAffinity); + reply.writeNoException(); + reply.writeInt(res ? 1 : 0); + return true; + } + + case NAVIGATE_UP_TO_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + IBinder token = data.readStrongBinder(); + Intent target = Intent.CREATOR.createFromParcel(data); + int resultCode = data.readInt(); + Intent resultData = null; + if (data.readInt() != 0) { + resultData = Intent.CREATOR.createFromParcel(data); + } + boolean res = navigateUpTo(token, target, resultCode, resultData); + reply.writeNoException(); + reply.writeInt(res ? 1 : 0); + return true; + } + } return super.onTransact(code, data, reply, flags); @@ -2689,6 +2724,18 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); return res; } + public int getUidForIntentSender(IIntentSender sender) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(sender.asBinder()); + mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); + reply.readException(); + int res = reply.readInt(); + data.recycle(); + reply.recycle(); + return res; + } public void setProcessLimit(int max) throws RemoteException { Parcel data = Parcel.obtain(); @@ -3662,5 +3709,42 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); } + public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity) + throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(token); + data.writeString(destAffinity); + mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0); + reply.readException(); + boolean result = reply.readInt() != 0; + data.recycle(); + reply.recycle(); + return result; + } + + public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData) + throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeStrongBinder(token); + target.writeToParcel(data, 0); + data.writeInt(resultCode); + if (resultData != null) { + data.writeInt(1); + resultData.writeToParcel(data, 0); + } else { + data.writeInt(0); + } + mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0); + reply.readException(); + boolean result = reply.readInt() != 0; + data.recycle(); + reply.recycle(); + return result; + } + private IBinder mRemote; } diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index d758eca..c5d7b91 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -45,6 +45,8 @@ import android.graphics.drawable.Drawable; import android.hardware.ISerialManager; import android.hardware.SensorManager; import android.hardware.SerialManager; +import android.hardware.input.IInputManager; +import android.hardware.input.InputManager; import android.hardware.usb.IUsbManager; import android.hardware.usb.UsbManager; import android.location.CountryDetector; @@ -59,6 +61,8 @@ import android.net.NetworkPolicyManager; import android.net.ThrottleManager; import android.net.IThrottleManager; import android.net.Uri; +import android.net.nsd.INsdManager; +import android.net.nsd.NsdManager; import android.net.wifi.IWifiManager; import android.net.wifi.WifiManager; import android.net.wifi.p2p.IWifiP2pManager; @@ -321,6 +325,11 @@ class ContextImpl extends Context { return createDropBoxManager(); }}); + registerService(INPUT_SERVICE, new ServiceFetcher() { + public Object createService(ContextImpl ctx) { + return new InputManager(ctx); + }}); + registerService(INPUT_METHOD_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { return InputMethodManager.getInstance(ctx); @@ -372,6 +381,14 @@ class ContextImpl extends Context { ctx.mMainThread.getHandler()); }}); + registerService(NSD_SERVICE, new ServiceFetcher() { + @Override + public Object createService(ContextImpl ctx) { + IBinder b = ServiceManager.getService(NSD_SERVICE); + INsdManager service = INsdManager.Stub.asInterface(b); + return new NsdManager(service); + }}); + // Note: this was previously cached in a static variable, but // constructed using mMainThread.getHandler(), so converting // it to be a regular Context-cached service... diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java index ad8d41f..dd58397 100644 --- a/core/java/android/app/DownloadManager.java +++ b/core/java/android/app/DownloadManager.java @@ -1097,6 +1097,18 @@ public class DownloadManager { } } + /** {@hide} */ + public static boolean isActiveNetworkExpensive(Context context) { + // TODO: connect to NetworkPolicyManager + return false; + } + + /** {@hide} */ + public static long getActiveNetworkWarningBytes(Context context) { + // TODO: connect to NetworkPolicyManager + return -1; + } + /** * Adds a file to the downloads database system, so it could appear in Downloads App * (and thus become eligible for management by the Downloads App). diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index 2b1eb43..c71b186 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -175,6 +175,7 @@ public interface IActivityManager extends IInterface { public boolean clearApplicationUserData(final String packageName, final IPackageDataObserver observer, int userId) throws RemoteException; public String getPackageForIntentSender(IIntentSender sender) throws RemoteException; + public int getUidForIntentSender(IIntentSender sender) throws RemoteException; public void setProcessLimit(int max) throws RemoteException; public int getProcessLimit() throws RemoteException; @@ -341,6 +342,12 @@ public interface IActivityManager extends IInterface { public void dismissKeyguardOnNextActivity() throws RemoteException; + public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity) + throws RemoteException; + + public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData) + throws RemoteException; + /* * Private non-Binder interfaces */ @@ -525,6 +532,7 @@ public interface IActivityManager extends IInterface { int START_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+89; int BACKUP_AGENT_CREATED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+90; int UNBIND_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+91; + int GET_UID_FOR_INTENT_SENDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+92; int START_ACTIVITY_IN_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+94; @@ -578,4 +586,6 @@ public interface IActivityManager extends IInterface { int GET_MY_MEMORY_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+142; int KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+143; int GET_CURRENT_USER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+144; + int TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+145; + int NAVIGATE_UP_TO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+146; } diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index e4f7950..f955713 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -23,6 +23,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.content.res.Configuration; +import android.hardware.input.InputManager; import android.os.Bundle; import android.os.Debug; import android.os.IBinder; @@ -35,6 +36,7 @@ import android.os.SystemClock; import android.util.AndroidRuntimeException; import android.util.Log; import android.view.IWindowManager; +import android.view.InputDevice; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.MotionEvent; @@ -859,11 +861,30 @@ public class Instrumentation { */ public void sendKeySync(KeyEvent event) { validateNotAppThread(); - try { - (IWindowManager.Stub.asInterface(ServiceManager.getService("window"))) - .injectKeyEvent(event, true); - } catch (RemoteException e) { + + long downTime = event.getDownTime(); + long eventTime = event.getEventTime(); + int action = event.getAction(); + int code = event.getKeyCode(); + int repeatCount = event.getRepeatCount(); + int metaState = event.getMetaState(); + int deviceId = event.getDeviceId(); + int scancode = event.getScanCode(); + int source = event.getSource(); + int flags = event.getFlags(); + if (source == InputDevice.SOURCE_UNKNOWN) { + source = InputDevice.SOURCE_KEYBOARD; + } + if (eventTime == 0) { + eventTime = SystemClock.uptimeMillis(); + } + if (downTime == 0) { + downTime = eventTime; } + KeyEvent newEvent = new KeyEvent(downTime, eventTime, action, code, repeatCount, metaState, + deviceId, scancode, flags | KeyEvent.FLAG_FROM_SYSTEM, source); + InputManager.injectInputEvent(newEvent, + InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); } /** @@ -902,11 +923,10 @@ public class Instrumentation { */ public void sendPointerSync(MotionEvent event) { validateNotAppThread(); - try { - (IWindowManager.Stub.asInterface(ServiceManager.getService("window"))) - .injectPointerEvent(event, true); - } catch (RemoteException e) { + if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) == 0) { + event.setSource(InputDevice.SOURCE_TOUCHSCREEN); } + InputManager.injectInputEvent(event, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); } /** @@ -922,11 +942,10 @@ public class Instrumentation { */ public void sendTrackballEventSync(MotionEvent event) { validateNotAppThread(); - try { - (IWindowManager.Stub.asInterface(ServiceManager.getService("window"))) - .injectTrackballEvent(event, true); - } catch (RemoteException e) { + if ((event.getSource() & InputDevice.SOURCE_CLASS_TRACKBALL) == 0) { + event.setSource(InputDevice.SOURCE_TRACKBALL); } + InputManager.injectInputEvent(event, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); } /** diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 096af93..04c64a0 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -26,6 +26,7 @@ import android.os.Bundle; import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; +import android.os.SystemClock; import android.text.TextUtils; import android.util.IntProperty; import android.util.Log; @@ -808,6 +809,7 @@ public class Notification implements Parcelable @Deprecated public void setLatestEventInfo(Context context, CharSequence contentTitle, CharSequence contentText, PendingIntent contentIntent) { + // TODO: rewrite this to use Builder RemoteViews contentView = new RemoteViews(context.getPackageName(), R.layout.notification_template_base); if (this.icon != 0) { @@ -820,6 +822,7 @@ public class Notification implements Parcelable contentView.setTextViewText(R.id.text, contentText); } if (this.when != 0) { + contentView.setViewVisibility(R.id.time, View.VISIBLE); contentView.setLong(R.id.time, "setTime", when); } @@ -942,6 +945,7 @@ public class Notification implements Parcelable private ArrayList<Action> mActions = new ArrayList<Action>(3); private boolean mCanHasIntruder; private boolean mIntruderActionsShowText; + private boolean mUseChronometer; /** * Constructs a new Builder with the defaults: @@ -983,6 +987,18 @@ public class Notification implements Parcelable } /** + * @hide + * + * Show the {@link Notification#when} field as a countdown (or count-up) timer instead of a timestamp. + * + * @see Notification#when + */ + public Builder setUsesChronometer(boolean b) { + mUseChronometer = b; + return this; + } + + /** * Set the small icon resource, which will be used to represent the notification in the * status bar. * @@ -1434,7 +1450,15 @@ public class Notification implements Parcelable } } if (mWhen != 0) { - contentView.setLong(R.id.time, "setTime", mWhen); + if (mUseChronometer) { + contentView.setViewVisibility(R.id.chronometer, View.VISIBLE); + contentView.setLong(R.id.chronometer, "setBase", + mWhen + (SystemClock.elapsedRealtime() - System.currentTimeMillis())); + contentView.setBoolean(R.id.chronometer, "setStarted", true); + } else { + contentView.setViewVisibility(R.id.time, View.VISIBLE); + contentView.setLong(R.id.time, "setTime", mWhen); + } } contentView.setViewVisibility(R.id.line3, hasLine3 ? View.VISIBLE : View.GONE); return contentView; diff --git a/core/java/android/app/TaskStackBuilder.java b/core/java/android/app/TaskStackBuilder.java new file mode 100644 index 0000000..7fd4747 --- /dev/null +++ b/core/java/android/app/TaskStackBuilder.java @@ -0,0 +1,220 @@ +/* + * 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.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; +import android.util.Log; + +import java.util.ArrayList; +import java.util.Iterator; + +/** + * Utility class for constructing synthetic back stacks for cross-task navigation + * on Android 3.0 and newer. + * + * <p>In API level 11 (Android 3.0/Honeycomb) the recommended conventions for + * app navigation using the back key changed. The back key's behavior is local + * to the current task and does not capture navigation across different tasks. + * Navigating across tasks and easily reaching the previous task is accomplished + * through the "recents" UI, accessible through the software-provided Recents key + * on the navigation or system bar. On devices with the older hardware button configuration + * the recents UI can be accessed with a long press on the Home key.</p> + * + * <p>When crossing from one task stack to another post-Android 3.0, + * the application should synthesize a back stack/history for the new task so that + * the user may navigate out of the new task and back to the Launcher by repeated + * presses of the back key. Back key presses should not navigate across task stacks.</p> + * + * <p>TaskStackBuilder provides a way to obey the correct conventions + * around cross-task navigation.</p> + * + * <div class="special reference"> + * <h3>About Navigation</h3> + * For more detailed information about tasks, the back stack, and navigation design guidelines, + * please read + * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back Stack</a> + * from the developer guide and <a href="{@docRoot}design/patterns/navigation.html">Navigation</a> + * from the design guide. + * </div> + */ +public class TaskStackBuilder implements Iterable<Intent> { + private static final String TAG = "TaskStackBuilder"; + + private final ArrayList<Intent> mIntents = new ArrayList<Intent>(); + private final Context mSourceContext; + + private TaskStackBuilder(Context a) { + mSourceContext = a; + } + + /** + * Return a new TaskStackBuilder for launching a fresh task stack consisting + * of a series of activities. + * + * @param context The context that will launch the new task stack or generate a PendingIntent + * @return A new TaskStackBuilder + */ + public static TaskStackBuilder from(Context context) { + return new TaskStackBuilder(context); + } + + /** + * Add a new Intent to the task stack. The most recently added Intent will invoke + * the Activity at the top of the final task stack. + * + * @param nextIntent Intent for the next Activity in the synthesized task stack + * @return This TaskStackBuilder for method chaining + */ + public TaskStackBuilder addNextIntent(Intent nextIntent) { + mIntents.add(nextIntent); + return this; + } + + /** + * Add the activity parent chain as specified by the + * {@link android.R.attr#parentActivityName parentActivityName} attribute of the activity + * (or activity-alias) element in the application's manifest to the task stack builder. + * + * @param sourceActivity All parents of this activity will be added + * @return This TaskStackBuilder for method chaining + */ + public TaskStackBuilder addParentStack(Activity sourceActivity) { + final int insertAt = mIntents.size(); + Intent parent = sourceActivity.getParentActivityIntent(); + PackageManager pm = sourceActivity.getPackageManager(); + while (parent != null) { + mIntents.add(insertAt, parent); + try { + ActivityInfo info = pm.getActivityInfo(parent.getComponent(), 0); + String parentActivity = info.parentActivityName; + if (parentActivity != null) { + parent = new Intent().setComponent( + new ComponentName(mSourceContext, parentActivity)); + } else { + parent = null; + } + } catch (NameNotFoundException e) { + Log.e(TAG, "Bad ComponentName while traversing activity parent metadata"); + throw new IllegalArgumentException(e); + } + } + return this; + } + + /** + * Add the activity parent chain as specified by the + * {@link android.R.attr#parentActivityName parentActivityName} attribute of the activity + * (or activity-alias) element in the application's manifest to the task stack builder. + * + * @param sourceActivityClass All parents of this activity will be added + * @return This TaskStackBuilder for method chaining + */ + public TaskStackBuilder addParentStack(Class<?> sourceActivityClass) { + final int insertAt = mIntents.size(); + PackageManager pm = mSourceContext.getPackageManager(); + try { + ActivityInfo info = pm.getActivityInfo( + new ComponentName(mSourceContext, sourceActivityClass), 0); + String parentActivity = info.parentActivityName; + Intent parent = new Intent().setComponent( + new ComponentName(mSourceContext, parentActivity)); + while (parent != null) { + mIntents.add(insertAt, parent); + info = pm.getActivityInfo(parent.getComponent(), 0); + parentActivity = info.parentActivityName; + if (parentActivity != null) { + parent = new Intent().setComponent( + new ComponentName(mSourceContext, parentActivity)); + } else { + parent = null; + } + } + } catch (NameNotFoundException e) { + Log.e(TAG, "Bad ComponentName while traversing activity parent metadata"); + throw new IllegalArgumentException(e); + } + return this; + } + + /** + * @return the number of intents added so far. + */ + public int getIntentCount() { + return mIntents.size(); + } + + /** + * Get the intent at the specified index. + * Useful if you need to modify the flags or extras of an intent that was previously added, + * for example with {@link #addParentStack(Activity)}. + * + * @param index Index from 0-getIntentCount() + * @return the intent at position index + */ + public Intent getIntent(int index) { + return mIntents.get(index); + } + + public Iterator<Intent> iterator() { + return mIntents.iterator(); + } + + /** + * Start the task stack constructed by this builder. + */ + public void startActivities() { + if (mIntents.isEmpty()) { + throw new IllegalStateException( + "No intents added to TaskStackBuilder; cannot startActivities"); + } + + Intent[] intents = mIntents.toArray(new Intent[mIntents.size()]); + intents[0].addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | + Intent.FLAG_ACTIVITY_CLEAR_TASK | + Intent.FLAG_ACTIVITY_TASK_ON_HOME); + mSourceContext.startActivities(intents); + } + + /** + * Obtain a {@link PendingIntent} for launching the task constructed by this builder so far. + * + * @param requestCode Private request code for the sender + * @param flags May be {@link PendingIntent#FLAG_ONE_SHOT}, + * {@link PendingIntent#FLAG_NO_CREATE}, {@link PendingIntent#FLAG_CANCEL_CURRENT}, + * {@link PendingIntent#FLAG_UPDATE_CURRENT}, or any of the flags supported by + * {@link Intent#fillIn(Intent, int)} to control which unspecified parts of the + * intent that can be supplied when the actual send happens. + * @return The obtained PendingIntent + */ + public PendingIntent getPendingIntent(int requestCode, int flags) { + if (mIntents.isEmpty()) { + throw new IllegalStateException( + "No intents added to TaskStackBuilder; cannot getPendingIntent"); + } + + Intent[] intents = mIntents.toArray(new Intent[mIntents.size()]); + intents[0].addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | + Intent.FLAG_ACTIVITY_CLEAR_TASK | + Intent.FLAG_ACTIVITY_TASK_ON_HOME); + return PendingIntent.getActivities(mSourceContext, requestCode, intents, flags); + } +} diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 2902504..36638f9 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -1769,6 +1769,18 @@ public abstract class Context { public static final String WIFI_P2P_SERVICE = "wifip2p"; /** + * Use with {@link #getSystemService} to retrieve a {@link + * android.net.NsdManager} for handling management of network service + * discovery + * + * @hide + * @see #getSystemService + * @see android.net.NsdManager + */ + public static final String NSD_SERVICE = "servicediscovery"; + + + /** * Use with {@link #getSystemService} to retrieve a * {@link android.media.AudioManager} for handling management of volume, * ringer modes and audio routing. @@ -1907,6 +1919,15 @@ public abstract class Context { public static final String SERIAL_SERVICE = "serial"; /** + * Use with {@link #getSystemService} to retrieve a + * {@link android.hardware.input.InputManager} for interacting with input devices. + * + * @see #getSystemService + * @see android.hardware.input.InputManager + */ + public static final String INPUT_SERVICE = "input"; + + /** * Determine whether the given permission is allowed for a particular * process and user ID running in the system. * diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 2a9f1af..18d682d 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -2000,8 +2000,8 @@ public class Intent implements Parcelable, Cloneable { * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String ACTION_USB_ANLG_HEADSET_PLUG = - "android.intent.action.USB_ANLG_HEADSET_PLUG"; + public static final String ACTION_ANALOG_AUDIO_DOCK_PLUG = + "android.intent.action.ANALOG_AUDIO_DOCK_PLUG"; /** * Broadcast Action: A digital audio speaker/headset plugged in or unplugged. @@ -2015,8 +2015,8 @@ public class Intent implements Parcelable, Cloneable { * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String ACTION_USB_DGTL_HEADSET_PLUG = - "android.intent.action.USB_DGTL_HEADSET_PLUG"; + public static final String ACTION_DIGITAL_AUDIO_DOCK_PLUG = + "android.intent.action.DIGITAL_AUDIO_DOCK_PLUG"; /** * Broadcast Action: A HMDI cable was plugged or unplugged @@ -2034,6 +2034,38 @@ public class Intent implements Parcelable, Cloneable { "android.intent.action.HDMI_AUDIO_PLUG"; /** + * Broadcast Action: A USB audio accessory was plugged in or unplugged. + * + * <p>The intent will have the following extra values: + * <ul> + * <li><em>state</em> - 0 for unplugged, 1 for plugged. </li> + * <li><em>card</em> - ALSA card number (integer) </li> + * <li><em>device</em> - ALSA device number (integer) </li> + * </ul> + * </ul> + * @hide + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_USB_AUDIO_ACCESSORY_PLUG = + "android.intent.action.USB_AUDIO_ACCESSORY_PLUG"; + + /** + * Broadcast Action: A USB audio device was plugged in or unplugged. + * + * <p>The intent will have the following extra values: + * <ul> + * <li><em>state</em> - 0 for unplugged, 1 for plugged. </li> + * <li><em>card</em> - ALSA card number (integer) </li> + * <li><em>device</em> - ALSA device number (integer) </li> + * </ul> + * </ul> + * @hide + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_USB_AUDIO_DEVICE_PLUG = + "android.intent.action.USB_AUDIO_DEVICE_PLUG"; + + /** * <p>Broadcast Action: The user has switched on advanced settings in the settings app:</p> * <ul> * <li><em>state</em> - A boolean value indicating whether the settings is on or off.</li> diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java index 0e6694d..6b16e74 100644 --- a/core/java/android/content/pm/ActivityInfo.java +++ b/core/java/android/content/pm/ActivityInfo.java @@ -450,6 +450,11 @@ public class ActivityInfo extends ComponentInfo */ public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1; + /** + * If defined, the activity named here is the logical parent of this activity. + */ + public String parentActivityName; + public ActivityInfo() { } @@ -465,6 +470,7 @@ public class ActivityInfo extends ComponentInfo configChanges = orig.configChanges; softInputMode = orig.softInputMode; uiOptions = orig.uiOptions; + parentActivityName = orig.parentActivityName; } /** @@ -524,6 +530,7 @@ public class ActivityInfo extends ComponentInfo dest.writeInt(configChanges); dest.writeInt(softInputMode); dest.writeInt(uiOptions); + dest.writeString(parentActivityName); } public static final Parcelable.Creator<ActivityInfo> CREATOR @@ -548,5 +555,6 @@ public class ActivityInfo extends ComponentInfo configChanges = source.readInt(); softInputMode = source.readInt(); uiOptions = source.readInt(); + parentActivityName = source.readString(); } } diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index a79b86a..7571993 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -94,10 +94,12 @@ public class PackageParser { public static class SplitPermissionInfo { public final String rootPerm; public final String[] newPerms; + public final int targetSdk; - public SplitPermissionInfo(String rootPerm, String[] newPerms) { + public SplitPermissionInfo(String rootPerm, String[] newPerms, int targetSdk) { this.rootPerm = rootPerm; this.newPerms = newPerms; + this.targetSdk = targetSdk; } } @@ -126,7 +128,14 @@ public class PackageParser { public static final PackageParser.SplitPermissionInfo SPLIT_PERMISSIONS[] = new PackageParser.SplitPermissionInfo[] { new PackageParser.SplitPermissionInfo(android.Manifest.permission.WRITE_EXTERNAL_STORAGE, - new String[] { android.Manifest.permission.READ_EXTERNAL_STORAGE }) + new String[] { android.Manifest.permission.READ_EXTERNAL_STORAGE }, + android.os.Build.VERSION_CODES.CUR_DEVELOPMENT+1), + new PackageParser.SplitPermissionInfo(android.Manifest.permission.READ_CONTACTS, + new String[] { android.Manifest.permission.READ_CALL_LOG }, + android.os.Build.VERSION_CODES.JELLY_BEAN), + new PackageParser.SplitPermissionInfo(android.Manifest.permission.WRITE_CONTACTS, + new String[] { android.Manifest.permission.WRITE_CALL_LOG }, + android.os.Build.VERSION_CODES.JELLY_BEAN) }; private String mArchiveSourcePath; @@ -1293,8 +1302,9 @@ public class PackageParser { for (int is=0; is<NS; is++) { final PackageParser.SplitPermissionInfo spi = PackageParser.SPLIT_PERMISSIONS[is]; - if (!pkg.requestedPermissions.contains(spi.rootPerm)) { - break; + if (pkg.applicationInfo.targetSdkVersion >= spi.targetSdk + || !pkg.requestedPermissions.contains(spi.rootPerm)) { + continue; } for (int in=0; in<spi.newPerms.length; in++) { final String perm = spi.newPerms[in]; @@ -2030,6 +2040,19 @@ public class PackageParser { com.android.internal.R.styleable.AndroidManifestActivity_uiOptions, a.info.applicationInfo.uiOptions); + String parentName = sa.getNonConfigurationString( + com.android.internal.R.styleable.AndroidManifestActivity_parentActivityName, 0); + if (parentName != null) { + String parentClassName = buildClassName(a.info.packageName, parentName, outError); + if (outError[0] == null) { + a.info.parentActivityName = parentClassName; + } else { + Log.e(TAG, "Activity " + a.info.name + " specified invalid parentActivityName " + + parentName); + outError[0] = null; + } + } + String str; str = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifestActivity_permission, 0); @@ -2274,6 +2297,7 @@ public class PackageParser { info.theme = target.info.theme; info.softInputMode = target.info.softInputMode; info.uiOptions = target.info.uiOptions; + info.parentActivityName = target.info.parentActivityName; Activity a = new Activity(mParseActivityAliasArgs, info); if (outError[0] != null) { @@ -2295,6 +2319,20 @@ public class PackageParser { a.info.permission = str.length() > 0 ? str.toString().intern() : null; } + String parentName = sa.getNonConfigurationString( + com.android.internal.R.styleable.AndroidManifestActivityAlias_parentActivityName, + 0); + if (parentName != null) { + String parentClassName = buildClassName(a.info.packageName, parentName, outError); + if (outError[0] == null) { + a.info.parentActivityName = parentClassName; + } else { + Log.e(TAG, "Activity alias " + a.info.name + + " specified invalid parentActivityName " + parentName); + outError[0] = null; + } + } + sa.recycle(); if (outError[0] != null) { diff --git a/core/java/android/hardware/input/IInputManager.aidl b/core/java/android/hardware/input/IInputManager.aidl new file mode 100644 index 0000000..c2abce5 --- /dev/null +++ b/core/java/android/hardware/input/IInputManager.aidl @@ -0,0 +1,37 @@ +/* + * 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.hardware.input; + +import android.view.InputDevice; +import android.view.InputEvent; + +/** @hide */ +interface IInputManager { + // Gets input device information. + InputDevice getInputDevice(int deviceId); + int[] getInputDeviceIds(); + + // Reports whether the hardware supports the given keys; returns true if successful + boolean hasKeys(int deviceId, int sourceMask, in int[] keyCodes, out boolean[] keyExists); + + // Temporarily changes the pointer speed. + void tryPointerSpeed(int speed); + + // Injects an input event into the system. To inject into windows owned by other + // applications, the caller must have the INJECT_EVENTS permission. + boolean injectInputEvent(in InputEvent ev, int mode); +} diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java new file mode 100755 index 0000000..5ead1f4 --- /dev/null +++ b/core/java/android/hardware/input/InputManager.java @@ -0,0 +1,651 @@ +/* + * 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.hardware.input; + +import com.android.internal.util.XmlUtils; + +import android.annotation.SdkConstant; +import android.annotation.SdkConstant.SdkConstantType; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.content.res.XmlResourceParser; +import android.os.Bundle; +import android.os.IBinder; +import android.os.Parcel; +import android.os.Parcelable; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.provider.Settings; +import android.provider.Settings.SettingNotFoundException; +import android.util.Log; +import android.view.InputDevice; +import android.view.InputEvent; +import android.view.KeyCharacterMap; +import android.view.KeyCharacterMap.UnavailableException; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * Provides information about input devices and available key layouts. + * <p> + * Get an instance of this class by calling + * {@link android.content.Context#getSystemService(java.lang.String) + * Context.getSystemService()} with the argument + * {@link android.content.Context#INPUT_SERVICE}. + * </p> + */ +public final class InputManager { + private static final String TAG = "InputManager"; + + private static final IInputManager sIm; + + private final Context mContext; + + // Used to simulate a persistent data store. + // TODO: Replace with the real thing. + private static final HashMap<String, String> mFakeRegistry = new HashMap<String, String>(); + + /** + * Broadcast Action: Query available keyboard layouts. + * <p> + * The input manager service locates available keyboard layouts + * by querying broadcast receivers that are registered for this action. + * An application can offer additional keyboard layouts to the user + * by declaring a suitable broadcast receiver in its manifest. + * </p><p> + * Here is an example broadcast receiver declaration that an application + * might include in its AndroidManifest.xml to advertise keyboard layouts. + * The meta-data specifies a resource that contains a description of each keyboard + * layout that is provided by the application. + * <pre><code> + * <receiver android:name=".InputDeviceReceiver"> + * <intent-filter> + * <action android:name="android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS" /> + * </intent-filter> + * <meta-data android:name="android.hardware.input.metadata.KEYBOARD_LAYOUTS" + * android:resource="@xml/keyboard_layouts" /> + * </receiver> + * </code></pre> + * </p><p> + * In the above example, the <code>@xml/keyboard_layouts</code> resource refers to + * an XML resource whose root element is <code><keyboard-layouts></code> that + * contains zero or more <code><keyboard-layout></code> elements. + * Each <code><keyboard-layout></code> element specifies the name, label, and location + * of a key character map for a particular keyboard layout. + * <pre></code> + * <?xml version="1.0" encoding="utf-8"?> + * <keyboard-layouts xmlns:android="http://schemas.android.com/apk/res/android"> + * <keyboard-layout android:name="keyboard_layout_english_us" + * android:label="@string/keyboard_layout_english_us_label" + * android:kcm="@raw/keyboard_layout_english_us" /> + * </keyboard-layouts> + * </p><p> + * The <code>android:name</code> attribute specifies an identifier by which + * the keyboard layout will be known in the package. + * The <code>android:label</code> attributes specifies a human-readable descriptive + * label to describe the keyboard layout in the user interface, such as "English (US)". + * The <code>android:kcm</code> attribute refers to a + * <a href="http://source.android.com/tech/input/key-character-map-files.html"> + * key character map</a> resource that defines the keyboard layout. + * </p> + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_QUERY_KEYBOARD_LAYOUTS = + "android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS"; + + /** + * Metadata Key: Keyboard layout metadata associated with + * {@link #ACTION_QUERY_KEYBOARD_LAYOUTS}. + * <p> + * Specifies the resource id of a XML resource that describes the keyboard + * layouts that are provided by the application. + * </p> + */ + public static final String META_DATA_KEYBOARD_LAYOUTS = + "android.hardware.input.metadata.KEYBOARD_LAYOUTS"; + + /** + * Pointer Speed: The minimum (slowest) pointer speed (-7). + * @hide + */ + public static final int MIN_POINTER_SPEED = -7; + + /** + * Pointer Speed: The maximum (fastest) pointer speed (7). + * @hide + */ + public static final int MAX_POINTER_SPEED = 7; + + /** + * Pointer Speed: The default pointer speed (0). + * @hide + */ + public static final int DEFAULT_POINTER_SPEED = 0; + + /** + * Input Event Injection Synchronization Mode: None. + * Never blocks. Injection is asynchronous and is assumed always to be successful. + * @hide + */ + public static final int INJECT_INPUT_EVENT_MODE_ASYNC = 0; // see InputDispatcher.h + + /** + * Input Event Injection Synchronization Mode: Wait for result. + * Waits for previous events to be dispatched so that the input dispatcher can + * determine whether input event injection will be permitted based on the current + * input focus. Does not wait for the input event to finish being handled + * by the application. + * @hide + */ + public static final int INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT = 1; // see InputDispatcher.h + + /** + * Input Event Injection Synchronization Mode: Wait for finish. + * Waits for the event to be delivered to the application and handled. + * @hide + */ + public static final int INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH = 2; // see InputDispatcher.h + + static { + IBinder b = ServiceManager.getService(Context.INPUT_SERVICE); + sIm = IInputManager.Stub.asInterface(b); + } + + /** @hide */ + public InputManager(Context context) { + mContext = context; + } + + /** + * Gets information about all supported keyboard layouts. + * <p> + * The input manager consults the built-in keyboard layouts as well + * as all keyboard layouts advertised by applications using a + * {@link #ACTION_QUERY_KEYBOARD_LAYOUTS} broadcast receiver. + * </p> + * + * @return A list of all supported keyboard layouts. + * @hide + */ + public List<KeyboardLayout> getKeyboardLayouts() { + ArrayList<KeyboardLayout> list = new ArrayList<KeyboardLayout>(); + + final PackageManager pm = mContext.getPackageManager(); + Intent intent = new Intent(ACTION_QUERY_KEYBOARD_LAYOUTS); + for (ResolveInfo resolveInfo : pm.queryBroadcastReceivers(intent, + PackageManager.GET_META_DATA)) { + loadKeyboardLayouts(pm, resolveInfo.activityInfo, list, null); + } + return list; + } + + /** + * Gets the keyboard layout with the specified descriptor. + * + * @param keyboardLayoutDescriptor The keyboard layout descriptor, as returned by + * {@link KeyboardLayout#getDescriptor()}. + * @return The keyboard layout, or null if it could not be loaded. + * + * @hide + */ + public KeyboardLayout getKeyboardLayout(String keyboardLayoutDescriptor) { + if (keyboardLayoutDescriptor == null) { + throw new IllegalArgumentException("keyboardLayoutDescriptor must not be null"); + } + + KeyboardLayoutDescriptor d = parseKeyboardLayoutDescriptor(keyboardLayoutDescriptor); + if (d == null) { + return null; + } + + final PackageManager pm = mContext.getPackageManager(); + try { + ActivityInfo receiver = pm.getReceiverInfo( + new ComponentName(d.packageName, d.receiverName), + PackageManager.GET_META_DATA); + return loadKeyboardLayouts(pm, receiver, null, d.keyboardLayoutName); + } catch (NameNotFoundException ex) { + Log.w(TAG, "Could not load keyboard layout '" + d.keyboardLayoutName + + "' from receiver " + d.packageName + "/" + d.receiverName, ex); + return null; + } + } + + /** + * Gets the keyboard layout descriptor for the specified input device. + * + * @param inputDeviceDescriptor The input device descriptor. + * @return The keyboard layout descriptor, or null if unknown or if the default + * keyboard layout will be used. + * + * @hide + */ + public String getInputDeviceKeyboardLayoutDescriptor(String inputDeviceDescriptor) { + if (inputDeviceDescriptor == null) { + throw new IllegalArgumentException("inputDeviceDescriptor must not be null"); + } + + return mFakeRegistry.get(inputDeviceDescriptor); + } + + /** + * Sets the keyboard layout descriptor for the specified input device. + * <p> + * This method may have the side-effect of causing the input device in question + * to be reconfigured. + * </p> + * + * @param inputDeviceDescriptor The input device descriptor. + * @param keyboardLayoutDescriptor The keyboard layout descriptor, or null to remove + * the mapping so that the default keyboard layout will be used for the input device. + * + * @hide + */ + public void setInputDeviceKeyboardLayoutDescriptor(String inputDeviceDescriptor, + String keyboardLayoutDescriptor) { + if (inputDeviceDescriptor == null) { + throw new IllegalArgumentException("inputDeviceDescriptor must not be null"); + } + + mFakeRegistry.put(inputDeviceDescriptor, keyboardLayoutDescriptor); + } + + private KeyboardLayout loadKeyboardLayouts( + PackageManager pm, ActivityInfo receiver, + List<KeyboardLayout> list, String keyboardName) { + Bundle metaData = receiver.metaData; + if (metaData == null) { + return null; + } + + int configResId = metaData.getInt(META_DATA_KEYBOARD_LAYOUTS); + if (configResId == 0) { + Log.w(TAG, "Missing meta-data '" + META_DATA_KEYBOARD_LAYOUTS + "' on receiver " + + receiver.packageName + "/" + receiver.name); + return null; + } + + try { + Resources resources = pm.getResourcesForApplication(receiver.applicationInfo); + XmlResourceParser parser = resources.getXml(configResId); + try { + XmlUtils.beginDocument(parser, "keyboard-layouts"); + + for (;;) { + XmlUtils.nextElement(parser); + String element = parser.getName(); + if (element == null) { + break; + } + if (element.equals("keyboard-layout")) { + TypedArray a = resources.obtainAttributes( + parser, com.android.internal.R.styleable.KeyboardLayout); + try { + String name = a.getString( + com.android.internal.R.styleable.KeyboardLayout_name); + String label = a.getString( + com.android.internal.R.styleable.KeyboardLayout_label); + int kcmResId = a.getResourceId( + com.android.internal.R.styleable.KeyboardLayout_kcm, 0); + if (name == null || label == null || kcmResId == 0) { + Log.w(TAG, "Missing required 'name', 'label' or 'kcm' " + + "attributes in keyboard layout " + + "resource from receiver " + + receiver.packageName + "/" + receiver.name); + } else { + String descriptor = makeKeyboardLayoutDescriptor( + receiver.packageName, receiver.name, name); + KeyboardLayout c = new KeyboardLayout( + descriptor, label, kcmResId); + if (keyboardName != null && name.equals(keyboardName)) { + return c; + } + if (list != null) { + list.add(c); + } + } + } finally { + a.recycle(); + } + } else { + Log.w(TAG, "Skipping unrecognized element '" + element + + "' in keyboard layout resource from receiver " + + receiver.packageName + "/" + receiver.name); + } + } + } finally { + parser.close(); + } + } catch (Exception ex) { + Log.w(TAG, "Could not load keyboard layout resource from receiver " + + receiver.packageName + "/" + receiver.name, ex); + return null; + } + if (keyboardName != null) { + Log.w(TAG, "Could not load keyboard layout '" + keyboardName + + "' from receiver " + receiver.packageName + "/" + receiver.name + + " because it was not declared in the keyboard layout resource."); + } + return null; + } + + /** + * Gets the mouse pointer speed. + * <p> + * Only returns the permanent mouse pointer speed. Ignores any temporary pointer + * speed set by {@link #tryPointerSpeed}. + * </p> + * + * @return The pointer speed as a value between {@link #MIN_POINTER_SPEED} and + * {@link #MAX_POINTER_SPEED}, or the default value {@link #DEFAULT_POINTER_SPEED}. + * + * @hide + */ + public int getPointerSpeed() { + int speed = DEFAULT_POINTER_SPEED; + try { + speed = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.POINTER_SPEED); + } catch (SettingNotFoundException snfe) { + } + return speed; + } + + /** + * Sets the mouse pointer speed. + * <p> + * Requires {@link android.Manifest.permissions.WRITE_SETTINGS}. + * </p> + * + * @param speed The pointer speed as a value between {@link #MIN_POINTER_SPEED} and + * {@link #MAX_POINTER_SPEED}, or the default value {@link #DEFAULT_POINTER_SPEED}. + * + * @hide + */ + public void setPointerSpeed(int speed) { + if (speed < MIN_POINTER_SPEED || speed > MAX_POINTER_SPEED) { + throw new IllegalArgumentException("speed out of range"); + } + + Settings.System.putInt(mContext.getContentResolver(), + Settings.System.POINTER_SPEED, speed); + } + + /** + * Changes the mouse pointer speed temporarily, but does not save the setting. + * <p> + * Requires {@link android.Manifest.permission.SET_POINTER_SPEED}. + * </p> + * + * @param speed The pointer speed as a value between {@link #MIN_POINTER_SPEED} and + * {@link #MAX_POINTER_SPEED}, or the default value {@link #DEFAULT_POINTER_SPEED}. + * + * @hide + */ + public void tryPointerSpeed(int speed) { + if (speed < MIN_POINTER_SPEED || speed > MAX_POINTER_SPEED) { + throw new IllegalArgumentException("speed out of range"); + } + + try { + sIm.tryPointerSpeed(speed); + } catch (RemoteException ex) { + Log.w(TAG, "Could not set temporary pointer speed.", ex); + } + } + + /** + * Gets information about the input device with the specified id. + * @param id The device id. + * @return The input device or null if not found. + * + * @hide + */ + public static InputDevice getInputDevice(int id) { + try { + return sIm.getInputDevice(id); + } catch (RemoteException ex) { + throw new RuntimeException("Could not get input device information.", ex); + } + } + + /** + * Gets the ids of all input devices in the system. + * @return The input device ids. + * + * @hide + */ + public static int[] getInputDeviceIds() { + try { + return sIm.getInputDeviceIds(); + } catch (RemoteException ex) { + throw new RuntimeException("Could not get input device ids.", ex); + } + } + + /** + * Queries the framework about whether any physical keys exist on the + * any keyboard attached to the device that are capable of producing the given + * array of key codes. + * + * @param keyCodes The array of key codes to query. + * @return A new array of the same size as the key codes array whose elements + * are set to true if at least one attached keyboard supports the corresponding key code + * at the same index in the key codes array. + * + * @hide + */ + public static boolean[] deviceHasKeys(int[] keyCodes) { + boolean[] ret = new boolean[keyCodes.length]; + try { + sIm.hasKeys(-1, InputDevice.SOURCE_ANY, keyCodes, ret); + } catch (RemoteException e) { + // no fallback; just return the empty array + } + return ret; + } + + /** + * Injects an input event into the event system on behalf of an application. + * The synchronization mode determines whether the method blocks while waiting for + * input injection to proceed. + * <p> + * Requires {@link android.Manifest.permission.INJECT_EVENTS} to inject into + * windows that are owned by other applications. + * </p><p> + * Make sure you correctly set the event time and input source of the event + * before calling this method. + * </p> + * + * @param event The event to inject. + * @param mode The synchronization mode. One of: + * {@link #INJECT_INPUT_EVENT_MODE_ASYNC}, + * {@link #INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT}, or + * {@link #INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH}. + * @return True if input event injection succeeded. + * + * @hide + */ + public static boolean injectInputEvent(InputEvent event, int mode) { + if (event == null) { + throw new IllegalArgumentException("event must not be null"); + } + if (mode != INJECT_INPUT_EVENT_MODE_ASYNC + && mode != INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH + && mode != INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT) { + throw new IllegalArgumentException("mode is invalid"); + } + + try { + return sIm.injectInputEvent(event, mode); + } catch (RemoteException ex) { + return false; + } + } + + private static String makeKeyboardLayoutDescriptor(String packageName, + String receiverName, String keyboardName) { + return packageName + "/" + receiverName + "/" + keyboardName; + } + + private static KeyboardLayoutDescriptor parseKeyboardLayoutDescriptor(String descriptor) { + int pos = descriptor.indexOf('/'); + if (pos < 0 || pos + 1 == descriptor.length()) { + return null; + } + int pos2 = descriptor.indexOf('/', pos + 1); + if (pos2 < pos + 2 || pos2 + 1 == descriptor.length()) { + return null; + } + + KeyboardLayoutDescriptor result = new KeyboardLayoutDescriptor(); + result.packageName = descriptor.substring(0, pos); + result.receiverName = descriptor.substring(pos + 1, pos2); + result.keyboardLayoutName = descriptor.substring(pos2 + 1); + return result; + } + + /** + * Describes a keyboard layout. + * + * @hide + */ + public static final class KeyboardLayout implements Parcelable, + Comparable<KeyboardLayout> { + private final String mDescriptor; + private final String mLabel; + private final int mKeyCharacterMapResId; + + private KeyCharacterMap mKeyCharacterMap; + + public static final Parcelable.Creator<KeyboardLayout> CREATOR = + new Parcelable.Creator<KeyboardLayout>() { + public KeyboardLayout createFromParcel(Parcel source) { + return new KeyboardLayout(source); + } + public KeyboardLayout[] newArray(int size) { + return new KeyboardLayout[size]; + } + }; + + private KeyboardLayout(String descriptor, + String label, int keyCharacterMapResId) { + mDescriptor = descriptor; + mLabel = label; + mKeyCharacterMapResId = keyCharacterMapResId; + } + + private KeyboardLayout(Parcel source) { + mDescriptor = source.readString(); + mLabel = source.readString(); + mKeyCharacterMapResId = source.readInt(); + } + + /** + * Gets the keyboard layout descriptor, which can be used to retrieve + * the keyboard layout again later using + * {@link InputManager#getKeyboardLayout(String)}. + * + * @return The keyboard layout descriptor. + */ + public String getDescriptor() { + return mDescriptor; + } + + /** + * Gets the keyboard layout descriptive label to show in the user interface. + * @return The keyboard layout descriptive label. + */ + public String getLabel() { + return mLabel; + } + + /** + * Loads the key character map associated with the keyboard layout. + * + * @param pm The package manager. + * @return The key character map, or null if it could not be loaded for any reason. + */ + public KeyCharacterMap loadKeyCharacterMap(PackageManager pm) { + if (pm == null) { + throw new IllegalArgumentException("pm must not be null"); + } + + if (mKeyCharacterMap == null) { + KeyboardLayoutDescriptor d = parseKeyboardLayoutDescriptor(mDescriptor); + if (d == null) { + Log.e(TAG, "Could not load key character map '" + mDescriptor + + "' because the descriptor could not be parsed."); + return null; + } + + CharSequence cs = pm.getText(d.packageName, mKeyCharacterMapResId, null); + if (cs == null) { + Log.e(TAG, "Could not load key character map '" + mDescriptor + + "' because its associated resource could not be loaded."); + return null; + } + + try { + mKeyCharacterMap = KeyCharacterMap.load(cs); + } catch (UnavailableException ex) { + Log.e(TAG, "Could not load key character map '" + mDescriptor + + "' due to an error while parsing.", ex); + return null; + } + } + return mKeyCharacterMap; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(mDescriptor); + dest.writeString(mLabel); + dest.writeInt(mKeyCharacterMapResId); + } + + @Override + public int compareTo(KeyboardLayout another) { + return mLabel.compareToIgnoreCase(another.mLabel); + } + + @Override + public String toString() { + return mLabel; + } + } + + private static final class KeyboardLayoutDescriptor { + public String packageName; + public String receiverName; + public String keyboardLayoutName; + } +} diff --git a/core/java/android/hardware/usb/UsbManager.java b/core/java/android/hardware/usb/UsbManager.java index 93f93c7..c40504a 100644 --- a/core/java/android/hardware/usb/UsbManager.java +++ b/core/java/android/hardware/usb/UsbManager.java @@ -66,6 +66,8 @@ public class UsbManager { * PTP function is enabled * <li> {@link #USB_FUNCTION_PTP} boolean extra indicating whether the * accessory function is enabled + * <li> {@link #USB_FUNCTION_AUDIO_SOURCE} boolean extra indicating whether the + * audio source function is enabled * </ul> * * {@hide} @@ -178,6 +180,14 @@ public class UsbManager { public static final String USB_FUNCTION_PTP = "ptp"; /** + * Name of the audio source USB function. + * Used in extras for the {@link #ACTION_USB_STATE} broadcast + * + * {@hide} + */ + public static final String USB_FUNCTION_AUDIO_SOURCE = "audio_source"; + + /** * Name of the Accessory USB function. * Used in extras for the {@link #ACTION_USB_STATE} broadcast * diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 2eef8f4..de16985 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -20,6 +20,7 @@ import static com.android.internal.util.Preconditions.checkNotNull; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; +import android.content.Context; import android.os.Binder; import android.os.Build.VERSION_CODES; import android.os.RemoteException; @@ -610,6 +611,11 @@ public class ConnectivityManager { mService = checkNotNull(service, "missing IConnectivityManager"); } + /** {@hide} */ + public static ConnectivityManager from(Context context) { + return (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + } + /** * {@hide} */ diff --git a/core/java/android/net/INetworkStatsService.aidl b/core/java/android/net/INetworkStatsService.aidl index 0e883cf..b4f6367 100644 --- a/core/java/android/net/INetworkStatsService.aidl +++ b/core/java/android/net/INetworkStatsService.aidl @@ -16,6 +16,7 @@ package android.net; +import android.net.INetworkStatsSession; import android.net.NetworkStats; import android.net.NetworkStatsHistory; import android.net.NetworkTemplate; @@ -23,15 +24,11 @@ import android.net.NetworkTemplate; /** {@hide} */ interface INetworkStatsService { - /** Return historical network layer stats for traffic that matches template. */ - NetworkStatsHistory getHistoryForNetwork(in NetworkTemplate template, int fields); - /** Return historical network layer stats for specific UID traffic that matches template. */ - NetworkStatsHistory getHistoryForUid(in NetworkTemplate template, int uid, int set, int tag, int fields); + /** Start a statistics query session. */ + INetworkStatsSession openSession(); - /** Return network layer usage summary for traffic that matches template. */ - NetworkStats getSummaryForNetwork(in NetworkTemplate template, long start, long end); - /** Return network layer usage summary per UID for traffic that matches template. */ - NetworkStats getSummaryForAllUid(in NetworkTemplate template, long start, long end, boolean includeTags); + /** Return network layer usage total for traffic that matches template. */ + long getNetworkTotalBytes(in NetworkTemplate template, long start, long end); /** Return data layer snapshot of UID network usage. */ NetworkStats getDataLayerSnapshotForUid(int uid); diff --git a/core/java/android/net/INetworkStatsSession.aidl b/core/java/android/net/INetworkStatsSession.aidl new file mode 100644 index 0000000..1596fa2 --- /dev/null +++ b/core/java/android/net/INetworkStatsSession.aidl @@ -0,0 +1,38 @@ +/* + * 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.net; + +import android.net.NetworkStats; +import android.net.NetworkStatsHistory; +import android.net.NetworkTemplate; + +/** {@hide} */ +interface INetworkStatsSession { + + /** Return network layer usage summary for traffic that matches template. */ + NetworkStats getSummaryForNetwork(in NetworkTemplate template, long start, long end); + /** Return historical network layer stats for traffic that matches template. */ + NetworkStatsHistory getHistoryForNetwork(in NetworkTemplate template, int fields); + + /** Return network layer usage summary per UID for traffic that matches template. */ + NetworkStats getSummaryForAllUid(in NetworkTemplate template, long start, long end, boolean includeTags); + /** Return historical network layer stats for specific UID traffic that matches template. */ + NetworkStatsHistory getHistoryForUid(in NetworkTemplate template, int uid, int set, int tag, int fields); + + void close(); + +} diff --git a/core/java/android/net/NetworkIdentity.java b/core/java/android/net/NetworkIdentity.java index ee12989..4ac5e76 100644 --- a/core/java/android/net/NetworkIdentity.java +++ b/core/java/android/net/NetworkIdentity.java @@ -16,9 +16,13 @@ package android.net; +import static android.net.ConnectivityManager.TYPE_WIFI; +import static android.net.ConnectivityManager.getNetworkTypeName; import static android.net.ConnectivityManager.isNetworkTypeMobile; import android.content.Context; +import android.net.wifi.WifiInfo; +import android.net.wifi.WifiManager; import android.os.Build; import android.telephony.TelephonyManager; @@ -42,18 +46,21 @@ public class NetworkIdentity { final int mType; final int mSubType; final String mSubscriberId; + final String mNetworkId; final boolean mRoaming; - public NetworkIdentity(int type, int subType, String subscriberId, boolean roaming) { - this.mType = type; - this.mSubType = COMBINE_SUBTYPE_ENABLED ? SUBTYPE_COMBINED : subType; - this.mSubscriberId = subscriberId; - this.mRoaming = roaming; + public NetworkIdentity( + int type, int subType, String subscriberId, String networkId, boolean roaming) { + mType = type; + mSubType = COMBINE_SUBTYPE_ENABLED ? SUBTYPE_COMBINED : subType; + mSubscriberId = subscriberId; + mNetworkId = networkId; + mRoaming = roaming; } @Override public int hashCode() { - return Objects.hashCode(mType, mSubType, mSubscriberId, mRoaming); + return Objects.hashCode(mType, mSubType, mSubscriberId, mNetworkId, mRoaming); } @Override @@ -61,27 +68,34 @@ public class NetworkIdentity { if (obj instanceof NetworkIdentity) { final NetworkIdentity ident = (NetworkIdentity) obj; return mType == ident.mType && mSubType == ident.mSubType && mRoaming == ident.mRoaming - && Objects.equal(mSubscriberId, ident.mSubscriberId); + && Objects.equal(mSubscriberId, ident.mSubscriberId) + && Objects.equal(mNetworkId, ident.mNetworkId); } return false; } @Override public String toString() { - final String typeName = ConnectivityManager.getNetworkTypeName(mType); - final String subTypeName; + final StringBuilder builder = new StringBuilder("["); + builder.append("type=").append(getNetworkTypeName(mType)); + builder.append(", subType="); if (COMBINE_SUBTYPE_ENABLED) { - subTypeName = "COMBINED"; + builder.append("COMBINED"); } else if (ConnectivityManager.isNetworkTypeMobile(mType)) { - subTypeName = TelephonyManager.getNetworkTypeName(mSubType); + builder.append(TelephonyManager.getNetworkTypeName(mSubType)); } else { - subTypeName = Integer.toString(mSubType); + builder.append(mSubType); } - - final String scrubSubscriberId = scrubSubscriberId(mSubscriberId); - final String roaming = mRoaming ? ", ROAMING" : ""; - return "[type=" + typeName + ", subType=" + subTypeName + ", subscriberId=" - + scrubSubscriberId + roaming + "]"; + if (mSubscriberId != null) { + builder.append(", subscriberId=").append(scrubSubscriberId(mSubscriberId)); + } + if (mNetworkId != null) { + builder.append(", networkId=").append(mNetworkId); + } + if (mRoaming) { + builder.append(", ROAMING"); + } + return builder.append("]").toString(); } public int getType() { @@ -96,6 +110,10 @@ public class NetworkIdentity { return mSubscriberId; } + public String getNetworkId() { + return mNetworkId; + } + public boolean getRoaming() { return mRoaming; } @@ -106,8 +124,11 @@ public class NetworkIdentity { public static String scrubSubscriberId(String subscriberId) { if ("eng".equals(Build.TYPE)) { return subscriberId; + } else if (subscriberId != null) { + // TODO: parse this as MCC+MNC instead of hard-coding + return subscriberId.substring(0, Math.min(6, subscriberId.length())) + "..."; } else { - return subscriberId != null ? "valid" : "null"; + return "null"; } } @@ -122,8 +143,10 @@ public class NetworkIdentity { // TODO: consider moving subscriberId over to LinkCapabilities, so it // comes from an authoritative source. - final String subscriberId; - final boolean roaming; + String subscriberId = null; + String networkId = null; + boolean roaming = false; + if (isNetworkTypeMobile(type)) { final TelephonyManager telephony = (TelephonyManager) context.getSystemService( Context.TELEPHONY_SERVICE); @@ -133,10 +156,13 @@ public class NetworkIdentity { } else { subscriberId = telephony.getSubscriberId(); } - } else { - subscriberId = null; - roaming = false; + + } else if (type == TYPE_WIFI) { + final WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); + final WifiInfo info = wifi.getConnectionInfo(); + networkId = info != null ? info.getSSID() : null; } - return new NetworkIdentity(type, subType, subscriberId, roaming); + + return new NetworkIdentity(type, subType, subscriberId, networkId, roaming); } } diff --git a/core/java/android/net/NetworkPolicy.java b/core/java/android/net/NetworkPolicy.java index c1f58a3..441db7a 100644 --- a/core/java/android/net/NetworkPolicy.java +++ b/core/java/android/net/NetworkPolicy.java @@ -30,6 +30,7 @@ import com.android.internal.util.Objects; * @hide */ public class NetworkPolicy implements Parcelable, Comparable<NetworkPolicy> { + public static final int CYCLE_NONE = -1; public static final long WARNING_DISABLED = -1; public static final long LIMIT_DISABLED = -1; public static final long SNOOZE_NEVER = -1; @@ -123,6 +124,13 @@ public class NetworkPolicy implements Parcelable, Comparable<NetworkPolicy> { lastLimitSnooze = SNOOZE_NEVER; } + /** + * Test if this policy has a cycle defined, after which usage should reset. + */ + public boolean hasCycle() { + return cycleDay != CYCLE_NONE; + } + @Override public int compareTo(NetworkPolicy another) { if (another == null || another.limitBytes == LIMIT_DISABLED) { @@ -159,10 +167,17 @@ public class NetworkPolicy implements Parcelable, Comparable<NetworkPolicy> { @Override public String toString() { - return "NetworkPolicy[" + template + "]: cycleDay=" + cycleDay + ", cycleTimezone=" - + cycleTimezone + ", warningBytes=" + warningBytes + ", limitBytes=" + limitBytes - + ", lastWarningSnooze=" + lastWarningSnooze + ", lastLimitSnooze=" - + lastLimitSnooze + ", metered=" + metered + ", inferred=" + inferred; + final StringBuilder builder = new StringBuilder("NetworkPolicy"); + builder.append("[").append(template).append("]:"); + builder.append(" cycleDay=").append(cycleDay); + builder.append(", cycleTimezone=").append(cycleTimezone); + builder.append(", warningBytes=").append(warningBytes); + builder.append(", limitBytes=").append(limitBytes); + builder.append(", lastWarningSnooze=").append(lastWarningSnooze); + builder.append(", lastLimitSnooze=").append(lastLimitSnooze); + builder.append(", metered=").append(metered); + builder.append(", inferred=").append(inferred); + return builder.toString(); } 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 c09c676..2b36131 100644 --- a/core/java/android/net/NetworkPolicyManager.java +++ b/core/java/android/net/NetworkPolicyManager.java @@ -17,6 +17,7 @@ package android.net; import static android.content.pm.PackageManager.GET_SIGNATURES; +import static android.net.NetworkPolicy.CYCLE_NONE; import static android.text.format.Time.MONTH_DAY; import android.content.Context; @@ -66,27 +67,10 @@ public class NetworkPolicyManager { mService = service; } - public static NetworkPolicyManager getSystemService(Context context) { + public static NetworkPolicyManager from(Context context) { return (NetworkPolicyManager) context.getSystemService(Context.NETWORK_POLICY_SERVICE); } - /** {@hide} */ - public void setNetworkPolicies(NetworkPolicy[] policies) { - try { - mService.setNetworkPolicies(policies); - } catch (RemoteException e) { - } - } - - /** {@hide} */ - public NetworkPolicy[] getNetworkPolicies() { - try { - return mService.getNetworkPolicies(); - } catch (RemoteException e) { - return null; - } - } - /** * Set policy flags for specific application. * @@ -122,6 +106,36 @@ public class NetworkPolicyManager { } } + public void setNetworkPolicies(NetworkPolicy[] policies) { + try { + mService.setNetworkPolicies(policies); + } catch (RemoteException e) { + } + } + + public NetworkPolicy[] getNetworkPolicies() { + try { + return mService.getNetworkPolicies(); + } catch (RemoteException e) { + return null; + } + } + + public void setRestrictBackground(boolean restrictBackground) { + try { + mService.setRestrictBackground(restrictBackground); + } catch (RemoteException e) { + } + } + + public boolean getRestrictBackground() { + try { + return mService.getRestrictBackground(); + } catch (RemoteException e) { + return false; + } + } + /** * Compute the last cycle boundary for the given {@link NetworkPolicy}. For * example, if cycle day is 20th, and today is June 15th, it will return May @@ -131,6 +145,10 @@ public class NetworkPolicyManager { * @hide */ public static long computeLastCycleBoundary(long currentTime, NetworkPolicy policy) { + if (policy.cycleDay == CYCLE_NONE) { + throw new IllegalArgumentException("Unable to compute boundary without cycleDay"); + } + final Time now = new Time(policy.cycleTimezone); now.set(currentTime); @@ -157,6 +175,10 @@ public class NetworkPolicyManager { /** {@hide} */ public static long computeNextCycleBoundary(long currentTime, NetworkPolicy policy) { + if (policy.cycleDay == CYCLE_NONE) { + throw new IllegalArgumentException("Unable to compute boundary without cycleDay"); + } + final Time now = new Time(policy.cycleTimezone); now.set(currentTime); diff --git a/core/java/android/net/NetworkQuotaInfo.java b/core/java/android/net/NetworkQuotaInfo.java index 6535256..1725ed7 100644 --- a/core/java/android/net/NetworkQuotaInfo.java +++ b/core/java/android/net/NetworkQuotaInfo.java @@ -57,12 +57,12 @@ public class NetworkQuotaInfo implements Parcelable { return mHardLimitBytes; } - /** {@inheritDoc} */ + @Override public int describeContents() { return 0; } - /** {@inheritDoc} */ + @Override public void writeToParcel(Parcel out, int flags) { out.writeLong(mEstimatedBytes); out.writeLong(mSoftLimitBytes); @@ -70,10 +70,12 @@ public class NetworkQuotaInfo implements Parcelable { } public static final Creator<NetworkQuotaInfo> CREATOR = new Creator<NetworkQuotaInfo>() { + @Override public NetworkQuotaInfo createFromParcel(Parcel in) { return new NetworkQuotaInfo(in); } + @Override public NetworkQuotaInfo[] newArray(int size) { return new NetworkQuotaInfo[size]; } diff --git a/core/java/android/net/NetworkState.java b/core/java/android/net/NetworkState.java index 704111b..2fc69ad 100644 --- a/core/java/android/net/NetworkState.java +++ b/core/java/android/net/NetworkState.java @@ -52,12 +52,12 @@ public class NetworkState implements Parcelable { subscriberId = in.readString(); } - /** {@inheritDoc} */ + @Override public int describeContents() { return 0; } - /** {@inheritDoc} */ + @Override public void writeToParcel(Parcel out, int flags) { out.writeParcelable(networkInfo, flags); out.writeParcelable(linkProperties, flags); @@ -66,10 +66,12 @@ public class NetworkState implements Parcelable { } public static final Creator<NetworkState> CREATOR = new Creator<NetworkState>() { + @Override public NetworkState createFromParcel(Parcel in) { return new NetworkState(in); } + @Override public NetworkState[] newArray(int size) { return new NetworkState[size]; } diff --git a/core/java/android/net/NetworkStats.java b/core/java/android/net/NetworkStats.java index 7a1ef66..844d055 100644 --- a/core/java/android/net/NetworkStats.java +++ b/core/java/android/net/NetworkStats.java @@ -155,7 +155,7 @@ public class NetworkStats implements Parcelable { operations = parcel.createLongArray(); } - /** {@inheritDoc} */ + @Override public void writeToParcel(Parcel dest, int flags) { dest.writeLong(elapsedRealtime); dest.writeInt(size); @@ -352,10 +352,9 @@ public class NetworkStats implements Parcelable { * on matching {@link #uid} and {@link #tag} rows. Ignores {@link #iface}, * since operation counts are at data layer. */ - @Deprecated public void spliceOperationsFrom(NetworkStats stats) { for (int i = 0; i < size; i++) { - final int j = stats.findIndex(IFACE_ALL, uid[i], set[i], tag[i]); + final int j = stats.findIndex(iface[i], uid[i], set[i], tag[i]); if (j == -1) { operations[i] = 0; } else { @@ -663,16 +662,18 @@ public class NetworkStats implements Parcelable { return writer.toString(); } - /** {@inheritDoc} */ + @Override public int describeContents() { return 0; } public static final Creator<NetworkStats> CREATOR = new Creator<NetworkStats>() { + @Override public NetworkStats createFromParcel(Parcel in) { return new NetworkStats(in); } + @Override public NetworkStats[] newArray(int size) { return new NetworkStats[size]; } diff --git a/core/java/android/net/NetworkStatsHistory.java b/core/java/android/net/NetworkStatsHistory.java index faf8a3f..0003c6e 100644 --- a/core/java/android/net/NetworkStatsHistory.java +++ b/core/java/android/net/NetworkStatsHistory.java @@ -130,7 +130,7 @@ public class NetworkStatsHistory implements Parcelable { totalBytes = in.readLong(); } - /** {@inheritDoc} */ + @Override public void writeToParcel(Parcel out, int flags) { out.writeLong(bucketDuration); writeLongArray(out, bucketStart, bucketCount); @@ -191,7 +191,7 @@ public class NetworkStatsHistory implements Parcelable { writeVarLongArray(out, operations, bucketCount); } - /** {@inheritDoc} */ + @Override public int describeContents() { return 0; } @@ -586,10 +586,12 @@ public class NetworkStatsHistory implements Parcelable { } public static final Creator<NetworkStatsHistory> CREATOR = new Creator<NetworkStatsHistory>() { + @Override public NetworkStatsHistory createFromParcel(Parcel in) { return new NetworkStatsHistory(in); } + @Override public NetworkStatsHistory[] newArray(int size) { return new NetworkStatsHistory[size]; } diff --git a/core/java/android/net/NetworkTemplate.java b/core/java/android/net/NetworkTemplate.java index e1fbdcc..50432a1 100644 --- a/core/java/android/net/NetworkTemplate.java +++ b/core/java/android/net/NetworkTemplate.java @@ -43,15 +43,10 @@ import com.android.internal.util.Objects; */ public class NetworkTemplate implements Parcelable { - /** {@hide} */ public static final int MATCH_MOBILE_ALL = 1; - /** {@hide} */ public static final int MATCH_MOBILE_3G_LOWER = 2; - /** {@hide} */ public static final int MATCH_MOBILE_4G = 3; - /** {@hide} */ public static final int MATCH_WIFI = 4; - /** {@hide} */ public static final int MATCH_ETHERNET = 5; /** @@ -65,37 +60,50 @@ public class NetworkTemplate implements Parcelable { } /** - * Template to combine all {@link ConnectivityManager#TYPE_MOBILE} style - * networks together. Only uses statistics for requested IMSI. + * Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with + * the given IMSI. */ public static NetworkTemplate buildTemplateMobileAll(String subscriberId) { - return new NetworkTemplate(MATCH_MOBILE_ALL, subscriberId); + return new NetworkTemplate(MATCH_MOBILE_ALL, subscriberId, null); } /** - * Template to combine all {@link ConnectivityManager#TYPE_MOBILE} style - * networks together that roughly meet a "3G" definition, or lower. Only - * uses statistics for requested IMSI. + * Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with + * the given IMSI that roughly meet a "3G" definition, or lower. */ + @Deprecated public static NetworkTemplate buildTemplateMobile3gLower(String subscriberId) { - return new NetworkTemplate(MATCH_MOBILE_3G_LOWER, subscriberId); + return new NetworkTemplate(MATCH_MOBILE_3G_LOWER, subscriberId, null); } /** - * Template to combine all {@link ConnectivityManager#TYPE_MOBILE} style - * networks together that meet a "4G" definition. Only uses statistics for - * requested IMSI. + * Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with + * the given IMSI that roughly meet a "4G" definition. */ + @Deprecated public static NetworkTemplate buildTemplateMobile4g(String subscriberId) { - return new NetworkTemplate(MATCH_MOBILE_4G, subscriberId); + return new NetworkTemplate(MATCH_MOBILE_4G, subscriberId, null); } /** - * Template to combine all {@link ConnectivityManager#TYPE_WIFI} style - * networks together. + * Template to match all {@link ConnectivityManager#TYPE_WIFI} networks, + * regardless of SSID. */ + public static NetworkTemplate buildTemplateWifiWildcard() { + return new NetworkTemplate(MATCH_WIFI, null, null); + } + + @Deprecated public static NetworkTemplate buildTemplateWifi() { - return new NetworkTemplate(MATCH_WIFI, null); + return buildTemplateWifiWildcard(); + } + + /** + * Template to match {@link ConnectivityManager#TYPE_WIFI} networks with the + * given SSID. + */ + public static NetworkTemplate buildTemplateWifi(String networkId) { + return new NetworkTemplate(MATCH_WIFI, null, networkId); } /** @@ -103,44 +111,53 @@ public class NetworkTemplate implements Parcelable { * networks together. */ public static NetworkTemplate buildTemplateEthernet() { - return new NetworkTemplate(MATCH_ETHERNET, null); + return new NetworkTemplate(MATCH_ETHERNET, null, null); } private final int mMatchRule; private final String mSubscriberId; + private final String mNetworkId; - /** {@hide} */ - public NetworkTemplate(int matchRule, String subscriberId) { - this.mMatchRule = matchRule; - this.mSubscriberId = subscriberId; + public NetworkTemplate(int matchRule, String subscriberId, String networkId) { + mMatchRule = matchRule; + mSubscriberId = subscriberId; + mNetworkId = networkId; } private NetworkTemplate(Parcel in) { mMatchRule = in.readInt(); mSubscriberId = in.readString(); + mNetworkId = in.readString(); } - /** {@inheritDoc} */ + @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(mMatchRule); dest.writeString(mSubscriberId); + dest.writeString(mNetworkId); } - /** {@inheritDoc} */ + @Override public int describeContents() { return 0; } @Override public String toString() { - final String scrubSubscriberId = scrubSubscriberId(mSubscriberId); - return "NetworkTemplate: matchRule=" + getMatchRuleName(mMatchRule) + ", subscriberId=" - + scrubSubscriberId; + final StringBuilder builder = new StringBuilder("NetworkTemplate: "); + builder.append("matchRule=").append(getMatchRuleName(mMatchRule)); + if (mSubscriberId != null) { + builder.append(", subscriberId=").append(scrubSubscriberId(mSubscriberId)); + } + if (mNetworkId != null) { + builder.append(", networkId=").append(mNetworkId); + } + return builder.toString(); } @Override public int hashCode() { - return Objects.hashCode(mMatchRule, mSubscriberId); + return Objects.hashCode(mMatchRule, mSubscriberId, mNetworkId); } @Override @@ -148,21 +165,24 @@ public class NetworkTemplate implements Parcelable { if (obj instanceof NetworkTemplate) { final NetworkTemplate other = (NetworkTemplate) obj; return mMatchRule == other.mMatchRule - && Objects.equal(mSubscriberId, other.mSubscriberId); + && Objects.equal(mSubscriberId, other.mSubscriberId) + && Objects.equal(mNetworkId, other.mNetworkId); } return false; } - /** {@hide} */ public int getMatchRule() { return mMatchRule; } - /** {@hide} */ public String getSubscriberId() { return mSubscriberId; } + public String getNetworkId() { + return mNetworkId; + } + /** * Test if given {@link NetworkIdentity} matches this template. */ @@ -237,8 +257,13 @@ public class NetworkTemplate implements Parcelable { private boolean matchesWifi(NetworkIdentity ident) { switch (ident.mType) { case TYPE_WIFI: + if (mNetworkId == null) { + return true; + } else { + return Objects.equal(mNetworkId, ident.mNetworkId); + } case TYPE_WIFI_P2P: - return true; + return mNetworkId == null; default: return false; } @@ -279,10 +304,12 @@ public class NetworkTemplate implements Parcelable { } public static final Creator<NetworkTemplate> CREATOR = new Creator<NetworkTemplate>() { + @Override public NetworkTemplate createFromParcel(Parcel in) { return new NetworkTemplate(in); } + @Override public NetworkTemplate[] newArray(int size) { return new NetworkTemplate[size]; } diff --git a/core/java/android/net/TrafficStats.java b/core/java/android/net/TrafficStats.java index 973fac1..ee3e165 100644 --- a/core/java/android/net/TrafficStats.java +++ b/core/java/android/net/TrafficStats.java @@ -238,6 +238,19 @@ public class TrafficStats { } } + /** {@hide} */ + public static void closeQuietly(INetworkStatsSession session) { + // TODO: move to NetworkStatsService once it exists + if (session != null) { + try { + session.close(); + } catch (RuntimeException rethrown) { + throw rethrown; + } catch (Exception ignored) { + } + } + } + /** * Get the total number of packets transmitted through the mobile interface. * diff --git a/core/java/android/net/nsd/DnsSdServiceInfo.java b/core/java/android/net/nsd/DnsSdServiceInfo.java new file mode 100644 index 0000000..47d6ec6 --- /dev/null +++ b/core/java/android/net/nsd/DnsSdServiceInfo.java @@ -0,0 +1,136 @@ +/* + * 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.net.nsd; + +import android.os.Parcelable; +import android.os.Parcel; + +/** + * Defines a service based on DNS service discovery + * {@hide} + */ +public class DnsSdServiceInfo implements NetworkServiceInfo, Parcelable { + + private String mServiceName; + + private String mRegistrationType; + + private DnsSdTxtRecord mTxtRecord; + + private String mHostname; + + private int mPort; + + DnsSdServiceInfo() { + } + + DnsSdServiceInfo(String sn, String rt, DnsSdTxtRecord tr) { + mServiceName = sn; + mRegistrationType = rt; + mTxtRecord = tr; + } + + @Override + /** @hide */ + public String getServiceName() { + return mServiceName; + } + + @Override + /** @hide */ + public void setServiceName(String s) { + mServiceName = s; + } + + @Override + /** @hide */ + public String getServiceType() { + return mRegistrationType; + } + + @Override + /** @hide */ + public void setServiceType(String s) { + mRegistrationType = s; + } + + public DnsSdTxtRecord getTxtRecord() { + return mTxtRecord; + } + + public void setTxtRecord(DnsSdTxtRecord t) { + mTxtRecord = new DnsSdTxtRecord(t); + } + + public String getHostName() { + return mHostname; + } + + public void setHostName(String s) { + mHostname = s; + } + + public int getPort() { + return mPort; + } + + public void setPort(int p) { + mPort = p; + } + + public String toString() { + StringBuffer sb = new StringBuffer(); + + sb.append("name: ").append(mServiceName). + append("type: ").append(mRegistrationType). + append("txtRecord: ").append(mTxtRecord); + return sb.toString(); + } + + /** Implement the Parcelable interface */ + public int describeContents() { + return 0; + } + + /** Implement the Parcelable interface */ + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(mServiceName); + dest.writeString(mRegistrationType); + dest.writeParcelable(mTxtRecord, flags); + dest.writeString(mHostname); + dest.writeInt(mPort); + } + + /** Implement the Parcelable interface */ + public static final Creator<DnsSdServiceInfo> CREATOR = + new Creator<DnsSdServiceInfo>() { + public DnsSdServiceInfo createFromParcel(Parcel in) { + DnsSdServiceInfo info = new DnsSdServiceInfo(); + info.mServiceName = in.readString(); + info.mRegistrationType = in.readString(); + info.mTxtRecord = in.readParcelable(null); + info.mHostname = in.readString(); + info.mPort = in.readInt(); + return info; + } + + public DnsSdServiceInfo[] newArray(int size) { + return new DnsSdServiceInfo[size]; + } + }; + +} diff --git a/core/java/android/net/nsd/DnsSdTxtRecord.java b/core/java/android/net/nsd/DnsSdTxtRecord.java new file mode 100644 index 0000000..6d4342c --- /dev/null +++ b/core/java/android/net/nsd/DnsSdTxtRecord.java @@ -0,0 +1,305 @@ +/* -*- Mode: Java; tab-width: 4 -*- + * + * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. + * + * 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. + + To do: + - implement remove() + - fix set() to replace existing values + */ + +package android.net.nsd; + +import android.os.Parcelable; +import android.os.Parcel; + +/** + * This class handles TXT record data for DNS based service discovery as specified at + * http://tools.ietf.org/html/draft-cheshire-dnsext-dns-sd-11 + * + * DNS-SD specifies that a TXT record corresponding to an SRV record consist of + * a packed array of bytes, each preceded by a length byte. Each string + * is an attribute-value pair. + * + * The DnsSdTxtRecord object stores the entire TXT data as a single byte array, traversing it + * as need be to implement its various methods. + * + * @hide + */ +public class DnsSdTxtRecord implements Parcelable { + private static final byte mSeperator = '='; + + private byte[] mData; + + /** Constructs a new, empty TXT record. */ + public DnsSdTxtRecord() { + mData = new byte[0]; + } + + /** Constructs a new TXT record from a byte array in the standard format. */ + public DnsSdTxtRecord(byte[] data) { + mData = (byte[]) data.clone(); + } + + /** Copy constructor */ + public DnsSdTxtRecord(DnsSdTxtRecord src) { + if (src != null && src.mData != null) { + mData = (byte[]) src.mData.clone(); + } + } + + /** + * Set a key/value pair. Setting an existing key will replace its value. + * @param key Must be ascii with no '=' + * @param value matching value to key + */ + public void set(String key, String value) { + byte[] keyBytes; + byte[] valBytes; + int valLen; + + if (value != null) { + valBytes = value.getBytes(); + valLen = valBytes.length; + } else { + valBytes = null; + valLen = 0; + } + + try { + keyBytes = key.getBytes("US-ASCII"); + } + catch (java.io.UnsupportedEncodingException e) { + throw new IllegalArgumentException("key should be US-ASCII"); + } + + for (int i = 0; i < keyBytes.length; i++) { + if (keyBytes[i] == '=') { + throw new IllegalArgumentException("= is not a valid character in key"); + } + } + + if (keyBytes.length + valLen >= 255) { + throw new IllegalArgumentException("Key and Value length cannot exceed 255 bytes"); + } + + int currentLoc = remove(key); + if (currentLoc == -1) + currentLoc = keyCount(); + + insert(keyBytes, valBytes, currentLoc); + } + + /** + * Get a value for a key + * + * @param key + * @return The value associated with the key + */ + public String get(String key) { + byte[] val = this.getValue(key); + return val != null ? new String(val) : null; + } + + /** Remove a key/value pair. If found, returns the index or -1 if not found */ + public int remove(String key) { + int avStart = 0; + + for (int i=0; avStart < mData.length; i++) { + int avLen = mData[avStart]; + if (key.length() <= avLen && + (key.length() == avLen || mData[avStart + key.length() + 1] == mSeperator)) { + String s = new String(mData, avStart + 1, key.length()); + if (0 == key.compareToIgnoreCase(s)) { + byte[] oldBytes = mData; + mData = new byte[oldBytes.length - avLen - 1]; + System.arraycopy(oldBytes, 0, mData, 0, avStart); + System.arraycopy(oldBytes, avStart + avLen + 1, mData, avStart, + oldBytes.length - avStart - avLen - 1); + return i; + } + } + avStart += (0xFF & (avLen + 1)); + } + return -1; + } + + /** Return the count of keys */ + public int keyCount() { + int count = 0, nextKey; + for (nextKey = 0; nextKey < mData.length; count++) { + nextKey += (0xFF & (mData[nextKey] + 1)); + } + return count; + } + + /** Return true if key is present, false if not. */ + public boolean contains(String key) { + String s = null; + for (int i = 0; null != (s = this.getKey(i)); i++) { + if (0 == key.compareToIgnoreCase(s)) return true; + } + return false; + } + + /* Gets the size in bytes */ + public int size() { + return mData.length; + } + + /* Gets the raw data in bytes */ + public byte[] getRawData() { + return mData; + } + + private void insert(byte[] keyBytes, byte[] value, int index) { + byte[] oldBytes = mData; + int valLen = (value != null) ? value.length : 0; + int insertion = 0; + int newLen, avLen; + + for (int i = 0; i < index && insertion < mData.length; i++) { + insertion += (0xFF & (mData[insertion] + 1)); + } + + avLen = keyBytes.length + valLen + (value != null ? 1 : 0); + newLen = avLen + oldBytes.length + 1; + + mData = new byte[newLen]; + System.arraycopy(oldBytes, 0, mData, 0, insertion); + int secondHalfLen = oldBytes.length - insertion; + System.arraycopy(oldBytes, insertion, mData, newLen - secondHalfLen, secondHalfLen); + mData[insertion] = (byte) avLen; + System.arraycopy(keyBytes, 0, mData, insertion + 1, keyBytes.length); + if (value != null) { + mData[insertion + 1 + keyBytes.length] = mSeperator; + System.arraycopy(value, 0, mData, insertion + keyBytes.length + 2, valLen); + } + } + + /** Return a key in the TXT record by zero-based index. Returns null if index exceeds the total number of keys. */ + private String getKey(int index) { + int avStart = 0; + + for (int i=0; i < index && avStart < mData.length; i++) { + avStart += mData[avStart] + 1; + } + + if (avStart < mData.length) { + int avLen = mData[avStart]; + int aLen = 0; + + for (aLen=0; aLen < avLen; aLen++) { + if (mData[avStart + aLen + 1] == mSeperator) break; + } + return new String(mData, avStart + 1, aLen); + } + return null; + } + + /** + * Look up a key in the TXT record by zero-based index and return its value. + * Returns null if index exceeds the total number of keys. + * Returns null if the key is present with no value. + */ + private byte[] getValue(int index) { + int avStart = 0; + byte[] value = null; + + for (int i=0; i < index && avStart < mData.length; i++) { + avStart += mData[avStart] + 1; + } + + if (avStart < mData.length) { + int avLen = mData[avStart]; + int aLen = 0; + + for (aLen=0; aLen < avLen; aLen++) { + if (mData[avStart + aLen + 1] == mSeperator) { + value = new byte[avLen - aLen - 1]; + System.arraycopy(mData, avStart + aLen + 2, value, 0, avLen - aLen - 1); + break; + } + } + } + return value; + } + + private String getValueAsString(int index) { + byte[] value = this.getValue(index); + return value != null ? new String(value) : null; + } + + private byte[] getValue(String forKey) { + String s = null; + int i; + + for (i = 0; null != (s = this.getKey(i)); i++) { + if (0 == forKey.compareToIgnoreCase(s)) { + return this.getValue(i); + } + } + + return null; + } + + /** + * Return a string representation. + * Example : {key1=value1},{key2=value2}.. + * + * For a key say like "key3" with null value + * {key1=value1},{key2=value2}{key3} + */ + public String toString() { + String a, result = null; + + for (int i = 0; null != (a = this.getKey(i)); i++) { + String av = "{" + a; + String val = this.getValueAsString(i); + if (val != null) + av += "=" + val + "}"; + else + av += "}"; + if (result == null) + result = av; + else + result = result + ", " + av; + } + return result != null ? result : ""; + } + + /** Implement the Parcelable interface */ + public int describeContents() { + return 0; + } + + /** Implement the Parcelable interface */ + public void writeToParcel(Parcel dest, int flags) { + dest.writeByteArray(mData); + } + + /** Implement the Parcelable interface */ + public static final Creator<DnsSdTxtRecord> CREATOR = + new Creator<DnsSdTxtRecord>() { + public DnsSdTxtRecord createFromParcel(Parcel in) { + DnsSdTxtRecord info = new DnsSdTxtRecord(); + in.readByteArray(info.mData); + return info; + } + + public DnsSdTxtRecord[] newArray(int size) { + return new DnsSdTxtRecord[size]; + } + }; +} diff --git a/core/java/android/net/nsd/INsdManager.aidl b/core/java/android/net/nsd/INsdManager.aidl new file mode 100644 index 0000000..077a675 --- /dev/null +++ b/core/java/android/net/nsd/INsdManager.aidl @@ -0,0 +1,29 @@ +/** + * 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.net.nsd; + +import android.os.Messenger; + +/** + * Interface that NsdService implements + * + * {@hide} + */ +interface INsdManager +{ + Messenger getMessenger(); +} diff --git a/core/java/android/net/nsd/NetworkServiceInfo.java b/core/java/android/net/nsd/NetworkServiceInfo.java new file mode 100644 index 0000000..34d83d1 --- /dev/null +++ b/core/java/android/net/nsd/NetworkServiceInfo.java @@ -0,0 +1,32 @@ +/* + * 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.net.nsd; + +/** + * Interface for a network service. + * + * {@hide} + */ +public interface NetworkServiceInfo { + + String getServiceName(); + void setServiceName(String s); + + String getServiceType(); + void setServiceType(String s); + +} diff --git a/core/java/android/net/nsd/NsdManager.java b/core/java/android/net/nsd/NsdManager.java new file mode 100644 index 0000000..a109a98 --- /dev/null +++ b/core/java/android/net/nsd/NsdManager.java @@ -0,0 +1,394 @@ +/* + * 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.net.nsd; + +import android.content.Context; +import android.os.Binder; +import android.os.IBinder; +import android.os.Handler; +import android.os.Looper; +import android.os.Message; +import android.os.RemoteException; +import android.os.Messenger; +import android.util.Log; + +import com.android.internal.util.AsyncChannel; +import com.android.internal.util.Protocol; + +/** + * The Network Service Discovery Manager class provides the API for service + * discovery. Service discovery enables applications to discover and connect with services + * on a network. Example applications include a game application discovering another instance + * of the game application or a printer application discovering other printers on a network. + * + * <p> The API is asynchronous and responses to requests from an application are on listener + * callbacks provided by the application. The application needs to do an initialization with + * {@link #initialize} before doing any operation. + * + * <p> Android currently supports DNS based service discovery and it is limited to a local + * network with the use of multicast DNS. In future, this class will be + * extended to support other service discovery mechanisms. + * + * Get an instance of this class by calling {@link android.content.Context#getSystemService(String) + * Context.getSystemService(Context.NSD_SERVICE)}. + * @hide + * + */ +public class NsdManager { + private static final String TAG = "NsdManager"; + INsdManager mService; + + private static final int BASE = Protocol.BASE_NSD_MANAGER; + + /** @hide */ + public static final int DISCOVER_SERVICES = BASE + 1; + /** @hide */ + public static final int DISCOVER_SERVICES_STARTED = BASE + 2; + /** @hide */ + public static final int DISCOVER_SERVICES_FAILED = BASE + 3; + /** @hide */ + public static final int SERVICE_FOUND = BASE + 4; + /** @hide */ + public static final int SERVICE_LOST = BASE + 5; + + /** @hide */ + public static final int STOP_DISCOVERY = BASE + 6; + /** @hide */ + public static final int STOP_DISCOVERY_FAILED = BASE + 7; + /** @hide */ + public static final int STOP_DISCOVERY_SUCCEEDED = BASE + 8; + + /** @hide */ + public static final int REGISTER_SERVICE = BASE + 9; + /** @hide */ + public static final int REGISTER_SERVICE_FAILED = BASE + 10; + /** @hide */ + public static final int REGISTER_SERVICE_SUCCEEDED = BASE + 11; + + /** @hide */ + public static final int UPDATE_SERVICE = BASE + 12; + /** @hide */ + public static final int UPDATE_SERVICE_FAILED = BASE + 13; + /** @hide */ + public static final int UPDATE_SERVICE_SUCCEEDED = BASE + 14; + + /** @hide */ + public static final int RESOLVE_SERVICE = BASE + 15; + /** @hide */ + public static final int RESOLVE_SERVICE_FAILED = BASE + 16; + /** @hide */ + public static final int RESOLVE_SERVICE_SUCCEEDED = BASE + 17; + + /** + * Create a new Nsd instance. Applications use + * {@link android.content.Context#getSystemService Context.getSystemService()} to retrieve + * {@link android.content.Context#NSD_SERVICE Context.NSD_SERVICE}. + * @param service the Binder interface + * @hide - hide this because it takes in a parameter of type INsdManager, which + * is a system private class. + */ + public NsdManager(INsdManager service) { + mService = service; + } + + /** + * Indicates that the operation failed due to an internal error. + */ + public static final int ERROR = 0; + + /** + * Indicates that the operation failed because service discovery is unsupported on the device. + */ + public static final int UNSUPPORTED = 1; + + /** + * Indicates that the operation failed because the framework is busy and + * unable to service the request + */ + public static final int BUSY = 2; + + /** Interface for callback invocation when framework channel is connected or lost */ + public interface ChannelListener { + public void onChannelConnected(Channel c); + /** + * The channel to the framework has been disconnected. + * Application could try re-initializing using {@link #initialize} + */ + public void onChannelDisconnected(); + } + + public interface ActionListener { + + public void onFailure(int errorCode); + + public void onSuccess(); + } + + public interface DnsSdDiscoveryListener { + + public void onFailure(int errorCode); + + public void onStarted(String registrationType); + + public void onServiceFound(DnsSdServiceInfo serviceInfo); + + public void onServiceLost(DnsSdServiceInfo serviceInfo); + + } + + public interface DnsSdRegisterListener { + + public void onFailure(int errorCode); + + public void onServiceRegistered(int registeredId, DnsSdServiceInfo serviceInfo); + } + + public interface DnsSdUpdateRegistrationListener { + + public void onFailure(int errorCode); + + public void onServiceUpdated(int registeredId, DnsSdTxtRecord txtRecord); + } + + public interface DnsSdResolveListener { + + public void onFailure(int errorCode); + + public void onServiceResolved(DnsSdServiceInfo serviceInfo); + } + + /** + * A channel that connects the application to the NetworkService framework. + * Most service operations require a Channel as an argument. An instance of Channel is obtained + * by doing a call on {@link #initialize} + */ + public static class Channel { + Channel(Looper looper, ChannelListener l) { + mAsyncChannel = new AsyncChannel(); + mHandler = new ServiceHandler(looper); + mChannelListener = l; + } + private ChannelListener mChannelListener; + private DnsSdDiscoveryListener mDnsSdDiscoveryListener; + private ActionListener mDnsSdStopDiscoveryListener; + private DnsSdRegisterListener mDnsSdRegisterListener; + private DnsSdUpdateRegistrationListener mDnsSdUpdateListener; + private DnsSdResolveListener mDnsSdResolveListener; + + AsyncChannel mAsyncChannel; + ServiceHandler mHandler; + class ServiceHandler extends Handler { + ServiceHandler(Looper looper) { + super(looper); + } + + @Override + public void handleMessage(Message message) { + switch (message.what) { + case AsyncChannel.CMD_CHANNEL_HALF_CONNECTED: + mAsyncChannel.sendMessage(AsyncChannel.CMD_CHANNEL_FULL_CONNECTION); + break; + case AsyncChannel.CMD_CHANNEL_FULLY_CONNECTED: + if (mChannelListener != null) { + mChannelListener.onChannelConnected(Channel.this); + } + break; + case AsyncChannel.CMD_CHANNEL_DISCONNECTED: + if (mChannelListener != null) { + mChannelListener.onChannelDisconnected(); + mChannelListener = null; + } + break; + case DISCOVER_SERVICES_STARTED: + if (mDnsSdDiscoveryListener != null) { + mDnsSdDiscoveryListener.onStarted((String) message.obj); + } + break; + case DISCOVER_SERVICES_FAILED: + if (mDnsSdDiscoveryListener != null) { + mDnsSdDiscoveryListener.onFailure(message.arg1); + } + break; + case SERVICE_FOUND: + if (mDnsSdDiscoveryListener != null) { + mDnsSdDiscoveryListener.onServiceFound( + (DnsSdServiceInfo) message.obj); + } + break; + case SERVICE_LOST: + if (mDnsSdDiscoveryListener != null) { + mDnsSdDiscoveryListener.onServiceLost( + (DnsSdServiceInfo) message.obj); + } + break; + case STOP_DISCOVERY_FAILED: + if (mDnsSdStopDiscoveryListener != null) { + mDnsSdStopDiscoveryListener.onFailure(message.arg1); + } + break; + case STOP_DISCOVERY_SUCCEEDED: + if (mDnsSdStopDiscoveryListener != null) { + mDnsSdStopDiscoveryListener.onSuccess(); + } + break; + case REGISTER_SERVICE_FAILED: + if (mDnsSdRegisterListener != null) { + mDnsSdRegisterListener.onFailure(message.arg1); + } + break; + case REGISTER_SERVICE_SUCCEEDED: + if (mDnsSdRegisterListener != null) { + mDnsSdRegisterListener.onServiceRegistered(message.arg1, + (DnsSdServiceInfo) message.obj); + } + break; + case UPDATE_SERVICE_FAILED: + if (mDnsSdUpdateListener != null) { + mDnsSdUpdateListener.onFailure(message.arg1); + } + break; + case UPDATE_SERVICE_SUCCEEDED: + if (mDnsSdUpdateListener != null) { + mDnsSdUpdateListener.onServiceUpdated(message.arg1, + (DnsSdTxtRecord) message.obj); + } + break; + case RESOLVE_SERVICE_FAILED: + if (mDnsSdResolveListener != null) { + mDnsSdResolveListener.onFailure(message.arg1); + } + break; + case RESOLVE_SERVICE_SUCCEEDED: + if (mDnsSdResolveListener != null) { + mDnsSdResolveListener.onServiceResolved( + (DnsSdServiceInfo) message.obj); + } + break; + default: + Log.d(TAG, "Ignored " + message); + break; + } + } + } + } + + /** + * Registers the application with the service discovery framework. This function + * must be the first to be called before any other operations are performed. No service + * discovery operations must be performed until the ChannelListener callback notifies + * that the channel is connected + * + * @param srcContext is the context of the source + * @param srcLooper is the Looper on which the callbacks are receivied + * @param listener for callback at loss of framework communication. + */ + public void initialize(Context srcContext, Looper srcLooper, ChannelListener listener) { + Messenger messenger = getMessenger(); + if (messenger == null) throw new RuntimeException("Failed to initialize"); + if (listener == null) throw new IllegalArgumentException("ChannelListener cannot be null"); + + Channel c = new Channel(srcLooper, listener); + c.mAsyncChannel.connect(srcContext, c.mHandler, messenger); + } + + /** + * Set the listener for service discovery. Can be null. + */ + public void setDiscoveryListener(Channel c, DnsSdDiscoveryListener b) { + if (c == null) throw new IllegalArgumentException("Channel needs to be initialized"); + c.mDnsSdDiscoveryListener = b; + } + + /** + * Set the listener for stop service discovery. Can be null. + */ + public void setStopDiscoveryListener(Channel c, ActionListener a) { + if (c == null) throw new IllegalArgumentException("Channel needs to be initialized"); + c.mDnsSdStopDiscoveryListener = a; + } + + /** + * Set the listener for service registration. Can be null. + */ + public void setRegisterListener(Channel c, DnsSdRegisterListener b) { + if (c == null) throw new IllegalArgumentException("Channel needs to be initialized"); + c.mDnsSdRegisterListener = b; + } + + /** + * Set the listener for service registration. Can be null. + */ + public void setUpdateRegistrationListener(Channel c, DnsSdUpdateRegistrationListener b) { + if (c == null) throw new IllegalArgumentException("Channel needs to be initialized"); + c.mDnsSdUpdateListener = b; + } + + /** + * Set the listener for service resolution. Can be null. + */ + public void setResolveListener(Channel c, DnsSdResolveListener b) { + if (c == null) throw new IllegalArgumentException("Channel needs to be initialized"); + c.mDnsSdResolveListener = b; + } + + public void registerService(Channel c, DnsSdServiceInfo serviceInfo) { + if (c == null) throw new IllegalArgumentException("Channel needs to be initialized"); + if (serviceInfo == null) throw new IllegalArgumentException("Null serviceInfo"); + c.mAsyncChannel.sendMessage(REGISTER_SERVICE, serviceInfo); + } + + public void updateService(Channel c, int registeredId, DnsSdTxtRecord txtRecord) { + if (c == null) throw new IllegalArgumentException("Channel needs to be initialized"); + c.mAsyncChannel.sendMessage(UPDATE_SERVICE, registeredId, 0, txtRecord); + } + + public void discoverServices(Channel c, String serviceType) { + if (c == null) throw new IllegalArgumentException("Channel needs to be initialized"); + if (c.mDnsSdDiscoveryListener == null) throw new + IllegalStateException("Discovery listener needs to be set first"); + DnsSdServiceInfo s = new DnsSdServiceInfo(); + s.setServiceType(serviceType); + c.mAsyncChannel.sendMessage(DISCOVER_SERVICES, s); + } + + public void stopServiceDiscovery(Channel c) { + if (c == null) throw new IllegalArgumentException("Channel needs to be initialized"); + c.mAsyncChannel.sendMessage(STOP_DISCOVERY); + } + + public void resolveService(Channel c, DnsSdServiceInfo serviceInfo) { + if (c == null) throw new IllegalArgumentException("Channel needs to be initialized"); + if (serviceInfo == null) throw new IllegalArgumentException("Null serviceInfo"); + if (c.mDnsSdResolveListener == null) throw new + IllegalStateException("Resolve listener needs to be set first"); + c.mAsyncChannel.sendMessage(RESOLVE_SERVICE, serviceInfo); + } + + /** + * Get a reference to NetworkService handler. This is used to establish + * an AsyncChannel communication with the service + * + * @return Messenger pointing to the NetworkService handler + */ + private Messenger getMessenger() { + try { + return mService.getMessenger(); + } catch (RemoteException e) { + return null; + } + } +} diff --git a/core/java/android/nfc/INdefPushCallback.aidl b/core/java/android/nfc/INdefPushCallback.aidl index e60a5b0..4e79822 100644 --- a/core/java/android/nfc/INdefPushCallback.aidl +++ b/core/java/android/nfc/INdefPushCallback.aidl @@ -17,6 +17,7 @@ package android.nfc; import android.nfc.NdefMessage; +import android.net.Uri; /** * @hide @@ -24,5 +25,7 @@ import android.nfc.NdefMessage; interface INdefPushCallback { NdefMessage createMessage(); + Uri getUri(); + String getMimeType(); void onNdefPushComplete(); } diff --git a/core/java/android/nfc/INfcTag.aidl b/core/java/android/nfc/INfcTag.aidl index 2223255..3ac1dcc 100644 --- a/core/java/android/nfc/INfcTag.aidl +++ b/core/java/android/nfc/INfcTag.aidl @@ -45,4 +45,5 @@ interface INfcTag void resetTimeouts(); boolean canMakeReadOnly(int ndefType); int getMaxTransceiveLength(int technology); + boolean getExtendedLengthApdusSupported(); } diff --git a/core/java/android/nfc/NfcActivityManager.java b/core/java/android/nfc/NfcActivityManager.java index 2c73056..f80dae4 100644 --- a/core/java/android/nfc/NfcActivityManager.java +++ b/core/java/android/nfc/NfcActivityManager.java @@ -18,6 +18,7 @@ package android.nfc; import android.app.Activity; import android.app.Application; +import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; import android.util.Log; @@ -107,10 +108,16 @@ public final class NfcActivityManager extends INdefPushCallback.Stub NdefMessage ndefMessage = null; // static NDEF message NfcAdapter.CreateNdefMessageCallback ndefMessageCallback = null; NfcAdapter.OnNdefPushCompleteCallback onNdefPushCompleteCallback = null; + Uri uri = null; + String mimeType = null; public NfcActivityState(Activity activity) { if (activity.getWindow().isDestroyed()) { throw new IllegalStateException("activity is already destroyed"); } + // Check if activity is resumed right now, as we will not + // immediately get a callback for that. + resumed = activity.isResumed(); + this.activity = activity; registerApplication(activity.getApplication()); } @@ -121,12 +128,14 @@ public final class NfcActivityManager extends INdefPushCallback.Stub ndefMessage = null; ndefMessageCallback = null; onNdefPushCompleteCallback = null; + uri = null; + mimeType = null; } @Override public String toString() { StringBuilder s = new StringBuilder("[").append(" "); s.append(ndefMessage).append(" ").append(ndefMessageCallback).append(" "); - s.append(onNdefPushCompleteCallback).append("]"); + s.append(onNdefPushCompleteCallback).append(" ").append(uri).append("]"); return s.toString(); } } @@ -175,6 +184,19 @@ public final class NfcActivityManager extends INdefPushCallback.Stub mDefaultEvent = new NfcEvent(mAdapter); } + public void setNdefPushContentUri(Activity activity, String mimeType, Uri uri) { + boolean isResumed; + synchronized (NfcActivityManager.this) { + NfcActivityState state = getActivityState(activity); + state.uri = uri; + state.mimeType = mimeType; + isResumed = state.resumed; + } + if (isResumed) { + requestNfcServiceCallback(true); + } + } + public void setNdefPushMessage(Activity activity, NdefMessage message) { boolean isResumed; synchronized (NfcActivityManager.this) { @@ -249,6 +271,26 @@ public final class NfcActivityManager extends INdefPushCallback.Stub /** Callback from NFC service, usually on binder thread */ @Override + public Uri getUri() { + synchronized (NfcActivityManager.this) { + NfcActivityState state = findResumedActivityState(); + if (state == null) return null; + + return state.uri; + } + } + /** Callback from NFC service, usually on binder thread */ + @Override + public String getMimeType() { + synchronized (NfcActivityManager.this) { + NfcActivityState state = findResumedActivityState(); + if (state == null) return null; + + return state.mimeType; + } + } + /** Callback from NFC service, usually on binder thread */ + @Override public void onNdefPushComplete() { NfcAdapter.OnNdefPushCompleteCallback callback; synchronized (NfcActivityManager.this) { diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java index b7a7bd5..917751c 100644 --- a/core/java/android/nfc/NfcAdapter.java +++ b/core/java/android/nfc/NfcAdapter.java @@ -28,6 +28,7 @@ import android.content.Context; import android.content.IntentFilter; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; +import android.net.Uri; import android.nfc.tech.MifareClassic; import android.nfc.tech.Ndef; import android.nfc.tech.NfcA; @@ -555,6 +556,18 @@ public final class NfcAdapter { } } + //TODO: Consider a callback alternative + //TOOD: See if we get rid of mimeType + //TODO: make sure NFC service has permission for URI + //TODO: javadoc + /** @hide */ + public void setBeamPushUri(String mimeType, Uri uri, Activity activity) { + if (activity == null) { + throw new NullPointerException("activity cannot be null"); + } + mNfcActivityManager.setNdefPushContentUri(activity, mimeType, uri); + } + /** * Set a static {@link NdefMessage} to send using Android Beam (TM). * @@ -580,7 +593,18 @@ public final class NfcAdapter { * and/or {@link #setNdefPushMessageCallback} is called with a null callback, * then NDEF push will be completely disabled for the specified activity(s). * This also disables any default NDEF message the Android OS would have - * otherwise sent on your behalf. + * otherwise sent on your behalf for those activity(s). + * + * <p>If you want to prevent the Android OS from sending default NDEF + * messages completely (for all activities), you can include a + * <code><meta-data></code> element inside the <code><application></code> + * element of your AndroidManifest.xml file, like this: + * <pre>{@code + * <application ...> + * <meta-data android:name="android.nfc.disable_beam_default" + * android:value="true" /> + * </application> + * }</pre> * * <p>The API allows for multiple activities to be specified at a time, * but it is strongly recommended to just register one at a time, @@ -664,7 +688,18 @@ public final class NfcAdapter { * and/or {@link #setNdefPushMessageCallback} is called with a null callback, * then NDEF push will be completely disabled for the specified activity(s). * This also disables any default NDEF message the Android OS would have - * otherwise sent on your behalf. + * otherwise sent on your behalf for those activity(s). + * + * <p>If you want to prevent the Android OS from sending default NDEF + * messages completely (for all activities), you can include a + * <code><meta-data></code> element inside the <code><application></code> + * element of your AndroidManifest.xml file, like this: + * <pre>{@code + * <application ...> + * <meta-data android:name="android.nfc.disable_beam_default" + * android:value="true" /> + * </application> + * }</pre> * * <p>The API allows for multiple activities to be specified at a time, * but it is strongly recommended to just register one at a time, diff --git a/core/java/android/nfc/tech/IsoDep.java b/core/java/android/nfc/tech/IsoDep.java index 1859877..089b159 100644 --- a/core/java/android/nfc/tech/IsoDep.java +++ b/core/java/android/nfc/tech/IsoDep.java @@ -179,4 +179,27 @@ public final class IsoDep extends BasicTagTechnology { public int getMaxTransceiveLength() { return getMaxTransceiveLengthInternal(); } + + /** + * <p>Standard APDUs have a 1-byte length field, allowing a maximum of + * 255 payload bytes, which results in a maximum APDU length of 261 bytes. + * + * <p>Extended length APDUs have a 3-byte length field, allowing 65535 + * payload bytes. + * + * <p>Some NFC adapters, like the one used in the Nexus S and the Galaxy Nexus + * do not support extended length APDUs. They are expected to be well-supported + * in the future though. Use this method to check for extended length APDU + * support. + * + * @return whether the NFC adapter on this device supports extended length APDUs. + */ + public boolean isExtendedLengthApduSupported() { + try { + return mTag.getTagService().getExtendedLengthApdusSupported(); + } catch (RemoteException e) { + Log.e(TAG, "NFC service dead", e); + return false; + } + } } diff --git a/core/java/android/nfc/tech/MifareClassic.java b/core/java/android/nfc/tech/MifareClassic.java index 9d1e6a1..8c92288 100644 --- a/core/java/android/nfc/tech/MifareClassic.java +++ b/core/java/android/nfc/tech/MifareClassic.java @@ -150,6 +150,7 @@ public final class MifareClassic extends BasicTagTechnology { mIsEmulated = false; switch (a.getSak()) { + case 0x01: case 0x08: mType = TYPE_CLASSIC; mSize = SIZE_1K; diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java index 74a376d..8df4339 100644 --- a/core/java/android/preference/Preference.java +++ b/core/java/android/preference/Preference.java @@ -497,27 +497,30 @@ public class Preference implements Comparable<Preference>, OnDependencyChangeLis * @see #onCreateView(ViewGroup) */ protected void onBindView(View view) { - TextView textView = (TextView) view.findViewById(com.android.internal.R.id.title); - if (textView != null) { - textView.setText(getTitle()); + final TextView titleView = (TextView) view.findViewById( + com.android.internal.R.id.title); + if (titleView != null) { + final CharSequence title = getTitle(); + if (!TextUtils.isEmpty(title)) { + titleView.setText(title); + titleView.setVisibility(View.VISIBLE); + } else { + titleView.setVisibility(View.GONE); + } } - - textView = (TextView) view.findViewById(com.android.internal.R.id.summary); - if (textView != null) { + + final TextView summaryView = (TextView) view.findViewById( + com.android.internal.R.id.summary); + if (summaryView != null) { final CharSequence summary = getSummary(); if (!TextUtils.isEmpty(summary)) { - if (textView.getVisibility() != View.VISIBLE) { - textView.setVisibility(View.VISIBLE); - } - - textView.setText(getSummary()); + summaryView.setText(summary); + summaryView.setVisibility(View.VISIBLE); } else { - if (textView.getVisibility() != View.GONE) { - textView.setVisibility(View.GONE); - } + summaryView.setVisibility(View.GONE); } } - + ImageView imageView = (ImageView) view.findViewById(com.android.internal.R.id.icon); if (imageView != null) { if (mIconResId != 0 || mIcon != null) { diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index d724d56..0e9306b 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -4531,8 +4531,6 @@ public final class ContactsContract { /** * The phone number's E164 representation. * <P>Type: TEXT</P> - * - * @hide */ public static final String NORMALIZED_NUMBER = "normalized_number"; } @@ -5408,10 +5406,10 @@ public final class ContactsContract { public static final String NUMBER = DATA; /** - * The phone number's E164 representation. + * The phone number's E164 representation. This value can be omitted in which + * case the provider will try to automatically infer it. If present, {@link #NUMBER} + * has to be set as well (it will be ignored otherwise). * <P>Type: TEXT</P> - * - * @hide */ public static final String NORMALIZED_NUMBER = DATA4; diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index d74ccb8..2aaf548 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -36,14 +36,20 @@ import android.net.Uri; import android.net.wifi.WifiManager; import android.os.BatteryManager; import android.os.Bundle; +import android.os.IBinder; +import android.os.Process; import android.os.RemoteException; +import android.os.ServiceManager; import android.os.SystemProperties; +import android.os.UserId; import android.speech.tts.TextToSpeech; import android.text.TextUtils; import android.util.AndroidException; import android.util.Log; import android.view.WindowOrientationListener; +import com.android.internal.widget.ILockSettings; + import java.net.URISyntaxException; import java.util.HashMap; import java.util.HashSet; @@ -1506,13 +1512,22 @@ public final class Settings { public static final String VOLUME_MASTER = "volume_master"; /** - * Whether the notifications should use the ring volume (value of 1) or a separate - * notification volume (value of 0). In most cases, users will have this enabled so the - * notification and ringer volumes will be the same. However, power users can disable this - * and use the separate notification volume control. + * Master volume mute (int 1 = mute, 0 = not muted). + * + * @hide + */ + public static final String VOLUME_MASTER_MUTE = "volume_master_mute"; + + /** + * Whether the notifications should use the ring volume (value of 1) or + * a separate notification volume (value of 0). In most cases, users + * will have this enabled so the notification and ringer volumes will be + * the same. However, power users can disable this and use the separate + * notification volume control. * <p> - * Note: This is a one-off setting that will be removed in the future when there is profile - * support. For this reason, it is kept hidden from the public APIs. + * Note: This is a one-off setting that will be removed in the future + * when there is profile support. For this reason, it is kept hidden + * from the public APIs. * * @hide * @deprecated @@ -2244,6 +2259,17 @@ public final class Settings { // Populated lazily, guarded by class object: private static NameValueCache sNameValueCache = null; + private static ILockSettings sLockSettings = null; + + private static boolean sIsSystemProcess; + private static final HashSet<String> MOVED_TO_LOCK_SETTINGS; + static { + MOVED_TO_LOCK_SETTINGS = new HashSet<String>(3); + MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED); + MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE); + MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); + } + /** * Look up a name in the database. * @param resolver to access the database with @@ -2255,6 +2281,21 @@ public final class Settings { sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI, CALL_METHOD_GET_SECURE); } + + if (sLockSettings == null) { + sLockSettings = ILockSettings.Stub.asInterface( + (IBinder) ServiceManager.getService("lock_settings")); + sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID; + } + if (sLockSettings != null && !sIsSystemProcess + && MOVED_TO_LOCK_SETTINGS.contains(name)) { + try { + return sLockSettings.getString(name, "0", UserId.getCallingUserId()); + } catch (RemoteException re) { + // Fall through + } + } + return sNameValueCache.getString(resolver, name); } diff --git a/core/java/android/text/SpannableStringBuilder.java b/core/java/android/text/SpannableStringBuilder.java index f7a7eb8..ae9042c 100644 --- a/core/java/android/text/SpannableStringBuilder.java +++ b/core/java/android/text/SpannableStringBuilder.java @@ -125,28 +125,24 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable } private void resizeFor(int size) { - int newlen = ArrayUtils.idealCharArraySize(size + 1); - char[] newtext = new char[newlen]; + final int oldLength = mText.length; + final int newLength = ArrayUtils.idealCharArraySize(size + 1); + final int after = oldLength - (mGapStart + mGapLength); - int after = mText.length - (mGapStart + mGapLength); + char[] newText = new char[newLength]; + System.arraycopy(mText, 0, newText, 0, mGapStart); + System.arraycopy(mText, oldLength - after, newText, newLength - after, after); + mText = newText; - System.arraycopy(mText, 0, newtext, 0, mGapStart); - System.arraycopy(mText, mText.length - after, - newtext, newlen - after, after); + final int delta = newLength - oldLength; + mGapLength += delta; + if (mGapLength < 1) + new Exception("mGapLength < 1").printStackTrace(); for (int i = 0; i < mSpanCount; i++) { - if (mSpanStarts[i] > mGapStart) - mSpanStarts[i] += newlen - mText.length; - if (mSpanEnds[i] > mGapStart) - mSpanEnds[i] += newlen - mText.length; + if (mSpanStarts[i] > mGapStart) mSpanStarts[i] += delta; + if (mSpanEnds[i] > mGapStart) mSpanEnds[i] += delta; } - - int oldlen = mText.length; - mText = newtext; - mGapLength += mText.length - oldlen; - - if (mGapLength < 1) - new Exception("mGapLength < 1").printStackTrace(); } private void moveGapTo(int where) { @@ -157,14 +153,10 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable if (where < mGapStart) { int overlap = mGapStart - where; - - System.arraycopy(mText, where, - mText, mGapStart + mGapLength - overlap, overlap); + System.arraycopy(mText, where, mText, mGapStart + mGapLength - overlap, overlap); } else /* where > mGapStart */ { int overlap = where - mGapStart; - - System.arraycopy(mText, where + mGapLength - overlap, - mText, mGapStart, overlap); + System.arraycopy(mText, where + mGapLength - overlap, mText, mGapStart, overlap); } // XXX be more clever @@ -340,18 +332,17 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable boolean atEnd = (mGapStart + mGapLength == mText.length); for (int i = mSpanCount - 1; i >= 0; i--) { - if (mSpanStarts[i] >= start && - mSpanStarts[i] < mGapStart + mGapLength) { + if (mSpanStarts[i] >= start && mSpanStarts[i] < mGapStart + mGapLength) { int flag = (mSpanFlags[i] & START_MASK) >> START_SHIFT; - if (flag == POINT || (flag == PARAGRAPH && atEnd)) - mSpanStarts[i] = mGapStart + mGapLength; - else - mSpanStarts[i] = start; + if (flag == POINT || (flag == PARAGRAPH && atEnd)) { + mSpanStarts[i] = mGapStart + mGapLength; + } else { + mSpanStarts[i] = start; + } } - if (mSpanEnds[i] >= start && - mSpanEnds[i] < mGapStart + mGapLength) { + if (mSpanEnds[i] >= start && mSpanEnds[i] < mGapStart + mGapLength) { int flag = (mSpanFlags[i] & END_MASK); if (flag == POINT || (flag == PARAGRAPH && atEnd)) @@ -360,7 +351,8 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable mSpanEnds[i] = start; } - // remove 0-length SPAN_EXCLUSIVE_EXCLUSIVE + // remove 0-length SPAN_EXCLUSIVE_EXCLUSIVE, which are POINT_MARK and could + // get their boundaries swapped by the above code if (mSpanEnds[i] < mSpanStarts[i]) { removeSpan(i); } @@ -520,6 +512,11 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable } } + if (flags == Spanned.SPAN_EXCLUSIVE_EXCLUSIVE && start == end) { + throw new IllegalArgumentException( + "SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length"); + } + if (start > mGapStart) { start += mGapLength; } else if (start == mGapStart) { diff --git a/core/java/android/view/GLES20TextureLayer.java b/core/java/android/view/GLES20TextureLayer.java index cbb908b..16a13cf 100644 --- a/core/java/android/view/GLES20TextureLayer.java +++ b/core/java/android/view/GLES20TextureLayer.java @@ -42,6 +42,12 @@ class GLES20TextureLayer extends GLES20Layer { } } + GLES20TextureLayer(SurfaceTexture surface, boolean isOpaque) { + this(isOpaque); + mSurface = surface; + mSurface.attachToGLContext(mTexture); + } + @Override boolean isValid() { return mLayer != 0 && mTexture != 0; @@ -72,6 +78,14 @@ class GLES20TextureLayer extends GLES20Layer { return mSurface; } + void setSurfaceTexture(SurfaceTexture surfaceTexture) { + if (mSurface != null) { + mSurface.release(); + } + mSurface = surfaceTexture; + mSurface.attachToGLContext(mTexture); + } + @Override void update(int width, int height, boolean isOpaque) { super.update(width, height, isOpaque); diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 9ef2621..b0399fd 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -87,7 +87,7 @@ public abstract class HardwareRenderer { /** * System property used to enable or disable hardware rendering profiling. * The default value of this property is assumed to be false. - * + * * When profiling is enabled, the adb shell dumpsys gfxinfo command will * output extra information about the time taken to execute by the last * frames. @@ -99,6 +99,20 @@ public abstract class HardwareRenderer { static final String PROFILE_PROPERTY = "hwui.profile"; /** + * System property used to specify the number of frames to be used + * when doing hardware rendering profiling. + * The default value of this property is #PROFILE_MAX_FRAMES. + * + * When profiling is enabled, the adb shell dumpsys gfxinfo command will + * output extra information about the time taken to execute by the last + * frames. + * + * Possible values: + * "60", to set the limit of frames to 60 + */ + static final String PROFILE_MAXFRAMES_PROPERTY = "hwui.profile.maxframes"; + + /** * System property used to debug EGL configuration choice. * * Possible values: @@ -134,7 +148,7 @@ public abstract class HardwareRenderer { /** * Number of frames to profile. */ - private static final int PROFILE_MAX_FRAMES = 120; + private static final int PROFILE_MAX_FRAMES = 64; /** * Number of floats per profiled frame. @@ -377,9 +391,9 @@ public abstract class HardwareRenderer { * @param isOpaque Whether the layer should be opaque or not * * @return A hardware layer - */ + */ abstract HardwareLayer createHardwareLayer(boolean isOpaque); - + /** * Creates a new hardware layer. * @@ -403,6 +417,15 @@ public abstract class HardwareRenderer { abstract SurfaceTexture createSurfaceTexture(HardwareLayer layer); /** + * Sets the {@link android.graphics.SurfaceTexture} that will be used to + * render into the specified hardware layer. + * + * @param layer The layer to render into using a {@link android.graphics.SurfaceTexture} + * @param surfaceTexture The {@link android.graphics.SurfaceTexture} to use for the layer + */ + abstract void setSurfaceTexture(HardwareLayer layer, SurfaceTexture surfaceTexture); + + /** * Initializes the hardware renderer for the specified surface and setup the * renderer for drawing, if needed. This is invoked when the ViewAncestor has * potentially lost the hardware renderer. The hardware renderer should be @@ -503,7 +526,7 @@ public abstract class HardwareRenderer { static final int SURFACE_STATE_SUCCESS = 1; static final int SURFACE_STATE_UPDATED = 2; - static final int FUNCTOR_PROCESS_DELAY = 2; + static final int FUNCTOR_PROCESS_DELAY = 4; static EGL10 sEgl; static EGLDisplay sEglDisplay; @@ -579,7 +602,13 @@ public abstract class HardwareRenderer { } if (mProfileEnabled) { - mProfileData = new float[PROFILE_MAX_FRAMES * PROFILE_FRAME_DATA_COUNT]; + property = SystemProperties.get(PROFILE_MAXFRAMES_PROPERTY, + Integer.toString(PROFILE_MAX_FRAMES)); + int maxProfileFrames = Integer.valueOf(property); + mProfileData = new float[maxProfileFrames * PROFILE_FRAME_DATA_COUNT]; + for (int i = 0; i < mProfileData.length; i += PROFILE_FRAME_DATA_COUNT) { + mProfileData[i] = mProfileData[i + 1] = mProfileData[i + 2] = -1; + } } else { mProfileData = null; } @@ -596,9 +625,14 @@ public abstract class HardwareRenderer { if (mProfileEnabled) { pw.printf("\n\tDraw\tProcess\tExecute\n"); for (int i = 0; i < mProfileData.length; i += PROFILE_FRAME_DATA_COUNT) { + if (mProfileData[i] < 0) { + break; + } pw.printf("\t%3.2f\t%3.2f\t%3.2f\n", mProfileData[i], mProfileData[i + 1], mProfileData[i + 2]); + mProfileData[i] = mProfileData[i + 1] = mProfileData[i + 2] = -1; } + mProfileCurrentFrame = mProfileData.length; } } @@ -1320,6 +1354,11 @@ public abstract class HardwareRenderer { } @Override + void setSurfaceTexture(HardwareLayer layer, SurfaceTexture surfaceTexture) { + ((GLES20TextureLayer) layer).setSurfaceTexture(surfaceTexture); + } + + @Override void destroyLayers(View view) { if (view != null && isEnabled() && checkCurrent() != SURFACE_STATE_ERROR) { destroyHardwareLayer(view); diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index 14cd48f..8fe8e40 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -62,18 +62,9 @@ interface IWindowManager void setForcedDisplaySize(int longDimen, int shortDimen); void clearForcedDisplaySize(); - // Is device configured with a hideable status bar or a tablet system bar? - boolean canStatusBarHide(); - - // These can only be called when injecting events to your own window, - // or by holding the INJECT_EVENTS permission. These methods may block - // until pending input events are finished being dispatched even when 'sync' is false. - // Avoid calling these methods on your UI thread or use the 'NoWait' version instead. - boolean injectKeyEvent(in KeyEvent ev, boolean sync); - boolean injectPointerEvent(in MotionEvent ev, boolean sync); - boolean injectTrackballEvent(in MotionEvent ev, boolean sync); - boolean injectInputEventNoWait(in InputEvent ev); - + // Is the device configured to have a full system bar for larger screens? + boolean hasSystemNavBar(); + // These can only be called when holding the MANAGE_APP_TOKENS permission. void pauseKeyDispatching(IBinder token); void resumeKeyDispatching(IBinder token); @@ -128,26 +119,6 @@ interface IWindowManager void setAnimationScale(int which, float scale); void setAnimationScales(in float[] scales); - // These require the READ_INPUT_STATE permission. - int getSwitchState(int sw); - int getSwitchStateForDevice(int devid, int sw); - int getScancodeState(int sw); - int getScancodeStateForDevice(int devid, int sw); - int getTrackballScancodeState(int sw); - int getDPadScancodeState(int sw); - int getKeycodeState(int sw); - int getKeycodeStateForDevice(int devid, int sw); - int getTrackballKeycodeState(int sw); - int getDPadKeycodeState(int sw); - InputChannel monitorInput(String inputChannelName); - - // Report whether the hardware supports the given keys; returns true if successful - boolean hasKeys(in int[] keycodes, inout boolean[] keyExists); - - // Get input device information. - InputDevice getInputDevice(int deviceId); - int[] getInputDeviceIds(); - // For testing void setInTouchMode(boolean showFocus); @@ -171,8 +142,10 @@ interface IWindowManager * @param alwaysSendConfiguration Flag to force a new configuration to * be evaluated. This can be used when there are other parameters in * configuration that are changing. + * @param forceRelayout If true, the window manager will always do a relayout + * of its windows even if the rotation hasn't changed. */ - void updateRotation(boolean alwaysSendConfiguration); + void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout); /** * Retrieve the current screen orientation, constants as per @@ -218,11 +191,6 @@ interface IWindowManager void statusBarVisibilityChanged(int visibility); /** - * Called by the settings application to temporarily set the pointer speed. - */ - void setPointerSpeed(int speed); - - /** * Block until the given window has been drawn to the screen. */ void waitForWindowDrawn(IBinder token, in IRemoteCallback callback); diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java index 8115b36..6f8d09b 100755 --- a/core/java/android/view/InputDevice.java +++ b/core/java/android/view/InputDevice.java @@ -16,9 +16,9 @@ package android.view; +import android.hardware.input.InputManager; import android.os.Parcel; import android.os.Parcelable; -import android.os.RemoteException; import java.util.ArrayList; import java.util.List; @@ -26,7 +26,7 @@ import java.util.List; /** * Describes the capabilities of a particular input device. * <p> - * Each input device may support multiple classes of input. For example, a multifunction + * Each input device may support multiple classes of input. For example, a multi-function * keyboard may compose the capabilities of a standard keyboard together with a track pad mouse * or other pointing device. * </p><p> @@ -41,6 +41,7 @@ import java.util.List; public final class InputDevice implements Parcelable { private int mId; private String mName; + private String mDescriptor; private int mSources; private int mKeyboardType; private String mKeyCharacterMapFile; @@ -118,7 +119,11 @@ public final class InputDevice implements Parcelable { /** * The input source is a keyboard. - * + * + * This source indicates pretty much anything that has buttons. Use + * {@link #getKeyboardType()} to determine whether the keyboard has alphabetic keys + * and can be used to enter text. + * * @see #SOURCE_CLASS_BUTTON */ public static final int SOURCE_KEYBOARD = 0x00000100 | SOURCE_CLASS_BUTTON; @@ -297,13 +302,7 @@ public final class InputDevice implements Parcelable { * @return The input device or null if not found. */ public static InputDevice getDevice(int id) { - IWindowManager wm = Display.getWindowManager(); - try { - return wm.getInputDevice(id); - } catch (RemoteException ex) { - throw new RuntimeException( - "Could not get input device information from Window Manager.", ex); - } + return InputManager.getInputDevice(id); } /** @@ -311,23 +310,51 @@ public final class InputDevice implements Parcelable { * @return The input device ids. */ public static int[] getDeviceIds() { - IWindowManager wm = Display.getWindowManager(); - try { - return wm.getInputDeviceIds(); - } catch (RemoteException ex) { - throw new RuntimeException( - "Could not get input device ids from Window Manager.", ex); - } + return InputManager.getInputDeviceIds(); } - + /** * Gets the input device id. + * <p> + * Each input device receives a unique id when it is first configured + * by the system. The input device id may change when the system is restarted or if the + * input device is disconnected, reconnected or reconfigured at any time. + * If you require a stable identifier for a device that persists across + * boots and reconfigurations, use {@link #getDescriptor()}. + * </p> + * * @return The input device id. */ public int getId() { return mId; } - + + /** + * Gets the input device descriptor, which is a stable identifier for an input device. + * <p> + * An input device descriptor uniquely identifies an input device. Its value + * is intended to be persistent across system restarts, and should not change even + * if the input device is disconnected, reconnected or reconfigured at any time. + * </p><p> + * It is possible for there to be multiple {@link InputDevice} instances that have the + * same input device descriptor. This might happen in situations where a single + * human input device registers multiple {@link InputDevice} instances (HID collections) + * that describe separate features of the device, such as a keyboard that also + * has a trackpad. Alternately, it may be that the input devices are simply + * indistinguishable, such as two keyboards made by the same manufacturer. + * </p><p> + * The input device descriptor returned by {@link #getDescriptor} should only bt + * used when an application needs to remember settings associated with a particular + * input device. For all other purposes when referring to a logical + * {@link InputDevice} instance at runtime use the id returned by {@link #getId()}. + * </p> + * + * @return The input device descriptor. + */ + public String getDescriptor() { + return mDescriptor; + } + /** * Gets the name of this input device. * @return The input device name. @@ -534,6 +561,7 @@ public final class InputDevice implements Parcelable { private void readFromParcel(Parcel in) { mId = in.readInt(); mName = in.readString(); + mDescriptor = in.readString(); mSources = in.readInt(); mKeyboardType = in.readInt(); mKeyCharacterMapFile = in.readString(); @@ -552,6 +580,7 @@ public final class InputDevice implements Parcelable { public void writeToParcel(Parcel out, int flags) { out.writeInt(mId); out.writeString(mName); + out.writeString(mDescriptor); out.writeInt(mSources); out.writeInt(mKeyboardType); out.writeString(mKeyCharacterMapFile); @@ -578,7 +607,8 @@ public final class InputDevice implements Parcelable { public String toString() { StringBuilder description = new StringBuilder(); description.append("Input Device ").append(mId).append(": ").append(mName).append("\n"); - + description.append(" Descriptor: ").append(mDescriptor).append("\n"); + description.append(" Keyboard Type: "); switch (mKeyboardType) { case KEYBOARD_TYPE_NONE: diff --git a/core/java/android/view/KeyCharacterMap.java b/core/java/android/view/KeyCharacterMap.java index 575af3b..b03f086 100644 --- a/core/java/android/view/KeyCharacterMap.java +++ b/core/java/android/view/KeyCharacterMap.java @@ -19,7 +19,7 @@ package android.view; import android.text.method.MetaKeyKeyListener; import android.util.AndroidRuntimeException; import android.util.SparseIntArray; -import android.os.RemoteException; +import android.hardware.input.InputManager; import android.util.SparseArray; import java.lang.Character; @@ -196,6 +196,14 @@ public class KeyCharacterMap { } /** + * TODO implement this + * @hide + */ + public static KeyCharacterMap load(CharSequence contents) { + return null; + } + + /** * Gets the Unicode character generated by the specified key and meta * key state combination. * <p> @@ -456,7 +464,8 @@ public class KeyCharacterMap { /** * Gets the keyboard type. - * Returns {@link #NUMERIC}, {@link #PREDICTIVE}, {@link #ALPHA} or {@link #FULL}. + * Returns {@link #NUMERIC}, {@link #PREDICTIVE}, {@link #ALPHA}, {@link #FULL} + * or {@link #SPECIAL_FUNCTION}. * <p> * Different keyboard types have different semantics. Refer to the documentation * associated with the keyboard type constants for details. @@ -518,10 +527,7 @@ public class KeyCharacterMap { * @return True if at least one attached keyboard supports the specified key code. */ public static boolean deviceHasKey(int keyCode) { - int[] codeArray = new int[1]; - codeArray[0] = keyCode; - boolean[] ret = deviceHasKeys(codeArray); - return ret[0]; + return InputManager.deviceHasKeys(new int[] { keyCode })[0]; } /** @@ -535,14 +541,7 @@ public class KeyCharacterMap { * at the same index in the key codes array. */ public static boolean[] deviceHasKeys(int[] keyCodes) { - boolean[] ret = new boolean[keyCodes.length]; - IWindowManager wm = Display.getWindowManager(); - try { - wm.hasKeys(keyCodes, ret); - } catch (RemoteException e) { - // no fallback; just return the empty array - } - return ret; + return InputManager.deviceHasKeys(keyCodes); } /** diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java index 83999a1..3cd8b71 100644 --- a/core/java/android/view/TextureView.java +++ b/core/java/android/view/TextureView.java @@ -115,6 +115,7 @@ public class TextureView extends View { private final Object[] mLock = new Object[0]; private boolean mUpdateLayer; + private boolean mUpdateSurface; private SurfaceTexture.OnFrameAvailableListener mUpdateListener; @@ -208,6 +209,8 @@ public class TextureView extends View { private void destroySurface() { if (mLayer != null) { + mSurface.detachFromGLContext(); + boolean shouldRelease = true; if (mListener != null) { shouldRelease = mListener.onSurfaceTextureDestroyed(mSurface); @@ -322,9 +325,13 @@ public class TextureView extends View { } mLayer = mAttachInfo.mHardwareRenderer.createHardwareLayer(mOpaque); - mSurface = mAttachInfo.mHardwareRenderer.createSurfaceTexture(mLayer); + if (!mUpdateSurface) { + // We already have a SurfaceTexture to use, and we will pass it + // to mLayer below. + mSurface = mAttachInfo.mHardwareRenderer.createSurfaceTexture(mLayer); + } nSetDefaultBufferSize(mSurface, getWidth(), getHeight()); - nCreateNativeWindow(mSurface); + nCreateNativeWindow(mSurface); mUpdateListener = new SurfaceTexture.OnFrameAvailableListener() { @Override @@ -344,6 +351,15 @@ public class TextureView extends View { } } + if (mUpdateSurface) { + // Someone has requested that we use a specific SurfaceTexture, so + // tell mLayer about it and set the SurfaceTexture to use the + // current view size. + mUpdateSurface = false; + mAttachInfo.mHardwareRenderer.setSurfaceTexture(mLayer, mSurface); + nSetDefaultBufferSize(mSurface, getWidth(), getHeight()); + } + applyUpdate(); applyTransformMatrix(); @@ -371,7 +387,7 @@ public class TextureView extends View { mUpdateLayer = true; invalidate(); } - + private void applyUpdate() { if (mLayer == null) { return; @@ -636,6 +652,32 @@ public class TextureView extends View { } /** + * Set the {@link SurfaceTexture} for this view to use. If a {@link + * SurfaceTexture} is already being used by this view, it is immediately + * released and not be usable any more. The {@link + * SurfaceTextureListener#onSurfaceTextureDestroyed} callback is <b>not</b> + * called. + * + * The {@link SurfaceTexture} object must be detached from all OpenGL ES + * contexts prior to calling this method. + * + * @param surfaceTexture The {@link SurfaceTexture} that the view should use. + * @see SurfaceTexture#detachFromGLContext() + * @hide + */ + public void setSurfaceTexture(SurfaceTexture surfaceTexture) { + if (surfaceTexture == null) { + throw new NullPointerException("surfaceTexture must not be null"); + } + if (mSurface != null) { + mSurface.release(); + } + mSurface = surfaceTexture; + mUpdateSurface = true; + invalidateParentIfNeeded(); + } + + /** * Returns the {@link SurfaceTextureListener} currently associated with this * texture view. * diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index c40a7d5..d62e32f 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -71,6 +71,7 @@ import android.view.inputmethod.InputMethodManager; import android.widget.ScrollBarDrawable; import static android.os.Build.VERSION_CODES.*; +import static java.lang.Math.max; import com.android.internal.R; import com.android.internal.util.Predicate; @@ -126,7 +127,7 @@ import java.util.concurrent.CopyOnWriteArrayList; * example, all views will let you set a listener to be notified when the view * gains or loses focus. You can register such a listener using * {@link #setOnFocusChangeListener(android.view.View.OnFocusChangeListener)}. - * Other view subclasses offer more specialized listeners. For example, a Button + * Other view subclasses offer more specialized listeners. For example, a Button * exposes a listener to notify clients when the button is clicked.</li> * <li><strong>Set visibility:</strong> You can hide or show views using * {@link #setVisibility(int)}.</li> @@ -579,6 +580,7 @@ import java.util.concurrent.CopyOnWriteArrayList; * @attr ref android.R.styleable#View_duplicateParentState * @attr ref android.R.styleable#View_id * @attr ref android.R.styleable#View_requiresFadingEdge + * @attr ref android.R.styleable#View_fadeScrollbars * @attr ref android.R.styleable#View_fadingEdgeLength * @attr ref android.R.styleable#View_filterTouchesWhenObscured * @attr ref android.R.styleable#View_fitsSystemWindows @@ -624,6 +626,7 @@ import java.util.concurrent.CopyOnWriteArrayList; * @attr ref android.R.styleable#View_scrollbarAlwaysDrawVerticalTrack * @attr ref android.R.styleable#View_soundEffectsEnabled * @attr ref android.R.styleable#View_tag + * @attr ref android.R.styleable#View_textAlignment * @attr ref android.R.styleable#View_transformPivotX * @attr ref android.R.styleable#View_transformPivotY * @attr ref android.R.styleable#View_translationX @@ -1827,15 +1830,15 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal public static final int TEXT_DIRECTION_LOCALE = 5; /** - * Bit shift to get the horizontal layout direction. (bits after LAYOUT_DIRECTION_RESOLVED) - * @hide + * Default text direction is inherited */ - static final int TEXT_DIRECTION_MASK_SHIFT = 6; + protected static int TEXT_DIRECTION_DEFAULT = TEXT_DIRECTION_INHERIT; /** - * Default text direction is inherited + * Bit shift to get the horizontal layout direction. (bits after LAYOUT_DIRECTION_RESOLVED) + * @hide */ - protected static int TEXT_DIRECTION_DEFAULT = TEXT_DIRECTION_INHERIT; + static final int TEXT_DIRECTION_MASK_SHIFT = 6; /** * Mask for use with private flags indicating bits used for text direction. @@ -1882,6 +1885,113 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal static final int TEXT_DIRECTION_RESOLVED_DEFAULT = TEXT_DIRECTION_FIRST_STRONG << TEXT_DIRECTION_RESOLVED_MASK_SHIFT; + /* + * Default text alignment. The text alignment of this View is inherited from its parent. + * Use with {@link #setTextAlignment(int)} + */ + public static final int TEXT_ALIGNMENT_INHERIT = 0; + + /** + * Default for the root view. The gravity determines the text alignment, ALIGN_NORMAL, + * ALIGN_CENTER, or ALIGN_OPPOSITE, which are relative to each paragraph’s text direction. + * + * Use with {@link #setTextAlignment(int)} + */ + public static final int TEXT_ALIGNMENT_GRAVITY = 1; + + /** + * Align to the start of the paragraph, e.g. ALIGN_NORMAL. + * + * Use with {@link #setTextAlignment(int)} + */ + public static final int TEXT_ALIGNMENT_TEXT_START = 2; + + /** + * Align to the end of the paragraph, e.g. ALIGN_OPPOSITE. + * + * Use with {@link #setTextAlignment(int)} + */ + public static final int TEXT_ALIGNMENT_TEXT_END = 3; + + /** + * Center the paragraph, e.g. ALIGN_CENTER. + * + * Use with {@link #setTextAlignment(int)} + */ + public static final int TEXT_ALIGNMENT_CENTER = 4; + + /** + * Align to the start of the view, which is ALIGN_LEFT if the view’s resolved + * layoutDirection is LTR, and ALIGN_RIGHT otherwise. + * + * Use with {@link #setTextAlignment(int)} + */ + public static final int TEXT_ALIGNMENT_VIEW_START = 5; + + /** + * Align to the end of the view, which is ALIGN_RIGHT if the view’s resolved + * layoutDirection is LTR, and ALIGN_LEFT otherwise. + * + * Use with {@link #setTextAlignment(int)} + */ + public static final int TEXT_ALIGNMENT_VIEW_END = 6; + + /** + * Default text alignment is inherited + */ + protected static int TEXT_ALIGNMENT_DEFAULT = TEXT_ALIGNMENT_GRAVITY; + + /** + * Bit shift to get the horizontal layout direction. (bits after DRAG_HOVERED) + * @hide + */ + static final int TEXT_ALIGNMENT_MASK_SHIFT = 13; + + /** + * Mask for use with private flags indicating bits used for text alignment. + * @hide + */ + static final int TEXT_ALIGNMENT_MASK = 0x00000007 << TEXT_ALIGNMENT_MASK_SHIFT; + + /** + * Array of text direction flags for mapping attribute "textAlignment" to correct + * flag value. + * @hide + */ + private static final int[] TEXT_ALIGNMENT_FLAGS = { + TEXT_ALIGNMENT_INHERIT << TEXT_ALIGNMENT_MASK_SHIFT, + TEXT_ALIGNMENT_GRAVITY << TEXT_ALIGNMENT_MASK_SHIFT, + TEXT_ALIGNMENT_TEXT_START << TEXT_ALIGNMENT_MASK_SHIFT, + TEXT_ALIGNMENT_TEXT_END << TEXT_ALIGNMENT_MASK_SHIFT, + TEXT_ALIGNMENT_CENTER << TEXT_ALIGNMENT_MASK_SHIFT, + TEXT_ALIGNMENT_VIEW_START << TEXT_ALIGNMENT_MASK_SHIFT, + TEXT_ALIGNMENT_VIEW_END << TEXT_ALIGNMENT_MASK_SHIFT + }; + + /** + * Indicates whether the view text alignment has been resolved. + * @hide + */ + static final int TEXT_ALIGNMENT_RESOLVED = 0x00000008 << TEXT_ALIGNMENT_MASK_SHIFT; + + /** + * Bit shift to get the resolved text alignment. + * @hide + */ + static final int TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT = 17; + + /** + * Mask for use with private flags indicating bits used for text alignment. + * @hide + */ + static final int TEXT_ALIGNMENT_RESOLVED_MASK = 0x00000007 << TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT; + + /** + * Indicates whether if the view text alignment has been resolved to gravity + */ + public static final int TEXT_ALIGNMENT_RESOLVED_DEFAULT = + TEXT_ALIGNMENT_GRAVITY << TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT; + /* End of masks for mPrivateFlags2 */ @@ -1926,7 +2036,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * system UI to enter an unobtrusive "low profile" mode. * * <p>This is for use in games, book readers, video players, or any other - * "immersive" application where the usual system chrome is deemed too distracting. + * "immersive" application where the usual system chrome is deemed too distracting. * * <p>In low profile mode, the status bar and/or navigation icons may dim. * @@ -1942,7 +2052,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * {@link #SYSTEM_UI_FLAG_LOW_PROFILE}; on devices that draw essential navigation controls * (Home, Back, and the like) on screen, <code>SYSTEM_UI_FLAG_HIDE_NAVIGATION</code> will cause * those to disappear. This is useful (in conjunction with the - * {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN FLAG_FULLSCREEN} and + * {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN FLAG_FULLSCREEN} and * {@link android.view.WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN FLAG_LAYOUT_IN_SCREEN} * window flags) for displaying content using every last pixel on the display. * @@ -2339,7 +2449,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal */ private int mPrevWidth = -1; private int mPrevHeight = -1; - + /** * The degrees rotation around the vertical axis through the pivot point. */ @@ -2546,7 +2656,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal */ int mOldHeightMeasureSpec = Integer.MIN_VALUE; - private Drawable mBGDrawable; + private Drawable mBackground; private int mBackgroundResource; private boolean mBackgroundSizeChanged; @@ -2620,7 +2730,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal /** * Set to true when drawing cache is enabled and cannot be created. - * + * * @hide */ public boolean mCachingFailed; @@ -2841,7 +2951,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal 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); + (TEXT_DIRECTION_DEFAULT << TEXT_DIRECTION_MASK_SHIFT) | + (TEXT_ALIGNMENT_DEFAULT << TEXT_ALIGNMENT_MASK_SHIFT); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); setOverScrollMode(OVER_SCROLL_IF_CONTENT_SCROLLS); mUserPaddingStart = -1; @@ -3222,6 +3333,13 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal mPrivateFlags2 |= TEXT_DIRECTION_FLAGS[textDirection]; } break; + case R.styleable.View_textAlignment: + // Clear any text alignment flag already set + mPrivateFlags2 &= ~TEXT_ALIGNMENT_MASK; + // Set the text alignment flag depending on the value of the attribute + final int textAlignment = a.getInt(attr, TEXT_ALIGNMENT_DEFAULT); + mPrivateFlags2 |= TEXT_ALIGNMENT_FLAGS[textAlignment]; + break; } } @@ -3230,7 +3348,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal setOverScrollMode(overScrollMode); if (background != null) { - setBackgroundDrawable(background); + setBackground(background); } // Cache user padding as we cannot fully resolve padding here (we dont have yet the resolved @@ -3494,6 +3612,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } } + private ScrollabilityCache getScrollCache() { + initScrollCache(); + return mScrollCache; + } + /** * Set the position of the vertical scroll bar. Should be one of * {@link #SCROLLBAR_POSITION_DEFAULT}, {@link #SCROLLBAR_POSITION_LEFT} or @@ -3909,8 +4032,9 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * <p> * <strong>Note:</strong> When a View clears focus the framework is trying * to give focus to the first focusable View from the top. Hence, if this - * View is the first from the top that can take focus, then its focus will - * not be cleared nor will the focus change callback be invoked. + * View is the first from the top that can take focus, then all callbacks + * related to clearing focus will be invoked after wich the framework will + * give focus to this view. * </p> */ public void clearFocus() { @@ -3927,25 +4051,15 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal onFocusChanged(false, 0, null); refreshDrawableState(); + + ensureInputFocusOnFirstFocusable(); } } - /** - * Called to clear the focus of a view that is about to be removed. - * Doesn't call clearChildFocus, which prevents this view from taking - * focus again before it has been removed from the parent - */ - void clearFocusForRemoval() { - if ((mPrivateFlags & FOCUSED) != 0) { - mPrivateFlags &= ~FOCUSED; - - onFocusChanged(false, 0, null); - refreshDrawableState(); - - // The view cleared focus and invoked the callbacks, so now is the - // time to give focus to the the first focusable from the top to - // ensure that the gain focus is announced after clear focus. - getRootView().requestFocus(FOCUS_FORWARD); + void ensureInputFocusOnFirstFocusable() { + View root = getRootView(); + if (root != null) { + root.requestFocus(FOCUS_FORWARD); } } @@ -4562,11 +4676,26 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } /** + * Indicates whether this view is one of the set of scrollable containers in + * its window. + * + * @return whether this view is one of the set of scrollable containers in + * its window + * + * @attr ref android.R.styleable#View_isScrollContainer + */ + public boolean isScrollContainer() { + return (mPrivateFlags & SCROLL_CONTAINER_ADDED) != 0; + } + + /** * Change whether this view is one of the set of scrollable containers in * its window. This will be used to determine whether the window can * resize or must pan when a soft input area is open -- scrollable * containers allow the window to use resize mode since the container * will appropriately shrink. + * + * @attr ref android.R.styleable#View_isScrollContainer */ public void setScrollContainer(boolean isScrollContainer) { if (isScrollContainer) { @@ -4898,7 +5027,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal @RemotableViewMethod public void setVisibility(int visibility) { setFlags(visibility, VISIBILITY_MASK); - if (mBGDrawable != null) mBGDrawable.setVisible(visibility == VISIBLE, false); + if (mBackground != null) mBackground.setVisible(visibility == VISIBLE, false); } /** @@ -5279,7 +5408,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * {@link #setPressed(boolean)} is explicitly called, only clickable views can enter * the pressed state. * - * @see #setPressed(boolean) + * @see #setPressed(boolean) * @see #isClickable() * @see #setClickable(boolean) * @@ -5965,7 +6094,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal /** * Dispatch a hover event. * <p> - * Do not call this method directly. + * Do not call this method directly. * Call {@link #dispatchGenericMotionEvent(MotionEvent)} instead. * </p> * @@ -6152,7 +6281,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @param visibility The new visibility of the window. * - * @see #onWindowVisibilityChanged(int) + * @see #onWindowVisibilityChanged(int) */ public void dispatchWindowVisibilityChanged(int visibility) { onWindowVisibilityChanged(visibility); @@ -6228,7 +6357,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @param newConfig The new resource configuration. * - * @see #onConfigurationChanged(android.content.res.Configuration) + * @see #onConfigurationChanged(android.content.res.Configuration) */ public void dispatchConfigurationChanged(Configuration newConfig) { onConfigurationChanged(newConfig); @@ -7096,7 +7225,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal if ((changed & DRAW_MASK) != 0) { if ((mViewFlags & WILL_NOT_DRAW) != 0) { - if (mBGDrawable != null) { + if (mBackground != null) { mPrivateFlags &= ~SKIP_DRAW; mPrivateFlags |= ONLY_DRAWS_BACKGROUND; } else { @@ -7484,39 +7613,39 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * views are drawn) from the camera to this view. The camera's distance * affects 3D transformations, for instance rotations around the X and Y * axis. If the rotationX or rotationY properties are changed and this view is - * large (more than half the size of the screen), it is recommended to always + * large (more than half the size of the screen), it is recommended to always * use a camera distance that's greater than the height (X axis rotation) or * the width (Y axis rotation) of this view.</p> - * + * * <p>The distance of the camera from the view plane can have an affect on the * perspective distortion of the view when it is rotated around the x or y axis. * For example, a large distance will result in a large viewing angle, and there * will not be much perspective distortion of the view as it rotates. A short - * distance may cause much more perspective distortion upon rotation, and can + * distance may cause much more perspective distortion upon rotation, and can * also result in some drawing artifacts if the rotated view ends up partially * behind the camera (which is why the recommendation is to use a distance at * least as far as the size of the view, if the view is to be rotated.)</p> - * + * * <p>The distance is expressed in "depth pixels." The default distance depends * on the screen density. For instance, on a medium density display, the * default distance is 1280. On a high density display, the default distance * is 1920.</p> - * + * * <p>If you want to specify a distance that leads to visually consistent * results across various densities, use the following formula:</p> * <pre> * float scale = context.getResources().getDisplayMetrics().density; * view.setCameraDistance(distance * scale); * </pre> - * + * * <p>The density scale factor of a high density display is 1.5, * and 1920 = 1280 * 1.5.</p> - * + * * @param distance The distance in "depth pixels", if negative the opposite * value is used - * - * @see #setRotationX(float) - * @see #setRotationY(float) + * + * @see #setRotationX(float) + * @see #setRotationY(float) */ public void setCameraDistance(float distance) { invalidateViewProperty(true, false); @@ -7541,10 +7670,10 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal /** * The degrees that the view is rotated around the pivot point. * - * @see #setRotation(float) + * @see #setRotation(float) * @see #getPivotX() * @see #getPivotY() - * + * * @return The degrees of rotation. */ @ViewDebug.ExportedProperty(category = "drawing") @@ -7557,12 +7686,12 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * result in clockwise rotation. * * @param rotation The degrees of rotation. - * - * @see #getRotation() + * + * @see #getRotation() * @see #getPivotX() * @see #getPivotY() - * @see #setRotationX(float) - * @see #setRotationY(float) + * @see #setRotationX(float) + * @see #setRotationY(float) * * @attr ref android.R.styleable#View_rotation */ @@ -7586,8 +7715,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @see #getPivotX() * @see #getPivotY() - * @see #setRotationY(float) - * + * @see #setRotationY(float) + * * @return The degrees of Y rotation. */ @ViewDebug.ExportedProperty(category = "drawing") @@ -7599,18 +7728,18 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Sets the degrees that the view is rotated around the vertical axis through the pivot point. * Increasing values result in counter-clockwise rotation from the viewpoint of looking * down the y axis. - * + * * When rotating large views, it is recommended to adjust the camera distance * accordingly. Refer to {@link #setCameraDistance(float)} for more information. * * @param rotationY The degrees of Y rotation. - * - * @see #getRotationY() + * + * @see #getRotationY() * @see #getPivotX() * @see #getPivotY() * @see #setRotation(float) - * @see #setRotationX(float) - * @see #setCameraDistance(float) + * @see #setRotationX(float) + * @see #setCameraDistance(float) * * @attr ref android.R.styleable#View_rotationY */ @@ -7633,8 +7762,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @see #getPivotX() * @see #getPivotY() - * @see #setRotationX(float) - * + * @see #setRotationX(float) + * * @return The degrees of X rotation. */ @ViewDebug.ExportedProperty(category = "drawing") @@ -7646,18 +7775,18 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Sets the degrees that the view is rotated around the horizontal axis through the pivot point. * Increasing values result in clockwise rotation from the viewpoint of looking down the * x axis. - * + * * When rotating large views, it is recommended to adjust the camera distance * accordingly. Refer to {@link #setCameraDistance(float)} for more information. * * @param rotationX The degrees of X rotation. - * - * @see #getRotationX() + * + * @see #getRotationX() * @see #getPivotX() * @see #getPivotY() * @see #setRotation(float) - * @see #setRotationY(float) - * @see #setCameraDistance(float) + * @see #setRotationY(float) + * @see #setCameraDistance(float) * * @attr ref android.R.styleable#View_rotationX */ @@ -7762,6 +7891,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @see #getScaleY() * @see #getPivotY() * @return The x location of the pivot point. + * + * @attr ref android.R.styleable#View_transformPivotX */ @ViewDebug.ExportedProperty(category = "drawing") public float getPivotX() { @@ -7807,6 +7938,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @see #getScaleY() * @see #getPivotY() * @return The y location of the pivot point. + * + * @attr ref android.R.styleable#View_transformPivotY */ @ViewDebug.ExportedProperty(category = "drawing") public float getPivotY() { @@ -9022,7 +9155,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal // - Background is opaque // - Doesn't have scrollbars or scrollbars are inside overlay - if (mBGDrawable != null && mBGDrawable.getOpacity() == PixelFormat.OPAQUE) { + if (mBackground != null && mBackground.getOpacity() == PixelFormat.OPAQUE) { mPrivateFlags |= OPAQUE_BACKGROUND; } else { mPrivateFlags &= ~OPAQUE_BACKGROUND; @@ -9070,7 +9203,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal /** * <p>Causes the Runnable to be added to the message queue. * The runnable will be run on the user interface thread.</p> - * + * * <p>This method can be invoked from outside of the UI thread * only when this View is attached to a window.</p> * @@ -9094,7 +9227,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * <p>Causes the Runnable to be added to the message queue, to be run * after the specified amount of time elapses. * The runnable will be run on the user interface thread.</p> - * + * * <p>This method can be invoked from outside of the UI thread * only when this View is attached to a window.</p> * @@ -9168,7 +9301,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal /** * <p>Removes the specified Runnable from the message queue.</p> - * + * * <p>This method can be invoked from outside of the UI thread * only when this View is attached to a window.</p> * @@ -9200,7 +9333,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * <p>This method can be invoked from outside of the UI thread * only when this View is attached to a window.</p> - * + * * @see #invalidate() */ public void postInvalidate() { @@ -9210,7 +9343,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal /** * <p>Cause an invalidate of the specified area to happen on a subsequent cycle * through the event loop. Use this to invalidate the View from a non-UI thread.</p> - * + * * <p>This method can be invoked from outside of the UI thread * only when this View is attached to a window.</p> * @@ -9229,7 +9362,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal /** * <p>Cause an invalidate to happen on a subsequent cycle through the event * loop. Waits for the specified amount of time.</p> - * + * * <p>This method can be invoked from outside of the UI thread * only when this View is attached to a window.</p> * @@ -9248,7 +9381,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal /** * <p>Cause an invalidate of the specified area to happen on a subsequent cycle * through the event loop. Waits for the specified amount of time.</p> - * + * * <p>This method can be invoked from outside of the UI thread * only when this View is attached to a window.</p> * @@ -9358,6 +9491,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * otherwise * * @see #setHorizontalFadingEdgeEnabled(boolean) + * * @attr ref android.R.styleable#View_requiresFadingEdge */ public boolean isHorizontalFadingEdgeEnabled() { @@ -9373,6 +9507,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * horizontally * * @see #isHorizontalFadingEdgeEnabled() + * * @attr ref android.R.styleable#View_requiresFadingEdge */ public void setHorizontalFadingEdgeEnabled(boolean horizontalFadingEdgeEnabled) { @@ -9393,6 +9528,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * otherwise * * @see #setVerticalFadingEdgeEnabled(boolean) + * * @attr ref android.R.styleable#View_requiresFadingEdge */ public boolean isVerticalFadingEdgeEnabled() { @@ -9408,6 +9544,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * vertically * * @see #isVerticalFadingEdgeEnabled() + * * @attr ref android.R.styleable#View_requiresFadingEdge */ public void setVerticalFadingEdgeEnabled(boolean verticalFadingEdgeEnabled) { @@ -9550,6 +9687,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @param fadeScrollbars wheter to enable fading * + * @attr ref android.R.styleable#View_fadeScrollbars */ public void setScrollbarFadingEnabled(boolean fadeScrollbars) { initScrollCache(); @@ -9567,12 +9705,86 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Returns true if scrollbars will fade when this view is not scrolling * * @return true if scrollbar fading is enabled + * + * @attr ref android.R.styleable#View_fadeScrollbars */ public boolean isScrollbarFadingEnabled() { return mScrollCache != null && mScrollCache.fadeScrollBars; } /** + * + * Returns the delay before scrollbars fade. + * + * @return the delay before scrollbars fade + * + * @attr ref android.R.styleable#View_scrollbarDefaultDelayBeforeFade + */ + public int getScrollBarDefaultDelayBeforeFade() { + return mScrollCache == null ? ViewConfiguration.getScrollDefaultDelay() : + mScrollCache.scrollBarDefaultDelayBeforeFade; + } + + /** + * Define the delay before scrollbars fade. + * + * @param scrollBarDefaultDelayBeforeFade - the delay before scrollbars fade + * + * @attr ref android.R.styleable#View_scrollbarDefaultDelayBeforeFade + */ + public void setScrollBarDefaultDelayBeforeFade(int scrollBarDefaultDelayBeforeFade) { + getScrollCache().scrollBarDefaultDelayBeforeFade = scrollBarDefaultDelayBeforeFade; + } + + /** + * + * Returns the scrollbar fade duration. + * + * @return the scrollbar fade duration + * + * @attr ref android.R.styleable#View_scrollbarFadeDuration + */ + public int getScrollBarFadeDuration() { + return mScrollCache == null ? ViewConfiguration.getScrollBarFadeDuration() : + mScrollCache.scrollBarFadeDuration; + } + + /** + * Define the scrollbar fade duration. + * + * @param scrollBarFadeDuration - the scrollbar fade duration + * + * @attr ref android.R.styleable#View_scrollbarFadeDuration + */ + public void setScrollBarFadeDuration(int scrollBarFadeDuration) { + getScrollCache().scrollBarFadeDuration = scrollBarFadeDuration; + } + + /** + * + * Returns the scrollbar size. + * + * @return the scrollbar size + * + * @attr ref android.R.styleable#View_scrollbarSize + */ + public int getScrollBarSize() { + return mScrollCache == null ? ViewConfiguration.getScrollBarSize() : + mScrollCache.scrollBarSize; + } + + /** + * Define the scrollbar size. + * + * @param scrollBarSize - the scrollbar size + * + * @attr ref android.R.styleable#View_scrollbarSize + */ + public void setScrollBarSize(int scrollBarSize) { + getScrollCache().scrollBarSize = scrollBarSize; + } + + /** * <p>Specify the style of the scrollbars. The scrollbars can be overlaid or * inset. When inset, they add to the padding of the view. And the scrollbars * can be drawn inside the padding area or on the edge of the view. For example, @@ -9588,6 +9800,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @see #SCROLLBARS_INSIDE_INSET * @see #SCROLLBARS_OUTSIDE_OVERLAY * @see #SCROLLBARS_OUTSIDE_INSET + * + * @attr ref android.R.styleable#View_scrollbarStyle */ public void setScrollBarStyle(int style) { if (style != (mViewFlags & SCROLLBARS_STYLE_MASK)) { @@ -9604,6 +9818,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @see #SCROLLBARS_INSIDE_INSET * @see #SCROLLBARS_OUTSIDE_OVERLAY * @see #SCROLLBARS_OUTSIDE_INSET + * + * @attr ref android.R.styleable#View_scrollbarStyle */ @ViewDebug.ExportedProperty(mapping = { @ViewDebug.IntToString(from = SCROLLBARS_INSIDE_OVERLAY, to = "INSIDE_OVERLAY"), @@ -9989,6 +10205,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal resolveLayoutDirection(); resolvePadding(); resolveTextDirection(); + resolveTextAlignment(); if (isFocused()) { InputMethodManager imm = InputMethodManager.peekInstance(); imm.focusIn(this); @@ -10218,6 +10435,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal mCurrentAnimation = null; resetResolvedLayoutDirection(); + resetResolvedTextAlignment(); } /** @@ -10348,9 +10566,9 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @param container The SparseArray in which to save the view's state. * - * @see #restoreHierarchyState(android.util.SparseArray) - * @see #dispatchSaveInstanceState(android.util.SparseArray) - * @see #onSaveInstanceState() + * @see #restoreHierarchyState(android.util.SparseArray) + * @see #dispatchSaveInstanceState(android.util.SparseArray) + * @see #onSaveInstanceState() */ public void saveHierarchyState(SparseArray<Parcelable> container) { dispatchSaveInstanceState(container); @@ -10363,9 +10581,9 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @param container The SparseArray in which to save the view's state. * - * @see #dispatchRestoreInstanceState(android.util.SparseArray) - * @see #saveHierarchyState(android.util.SparseArray) - * @see #onSaveInstanceState() + * @see #dispatchRestoreInstanceState(android.util.SparseArray) + * @see #saveHierarchyState(android.util.SparseArray) + * @see #onSaveInstanceState() */ protected void dispatchSaveInstanceState(SparseArray<Parcelable> container) { if (mID != NO_ID && (mViewFlags & SAVE_DISABLED_MASK) == 0) { @@ -10399,9 +10617,9 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @return Returns a Parcelable object containing the view's current dynamic * state, or null if there is nothing interesting to save. The * default implementation returns null. - * @see #onRestoreInstanceState(android.os.Parcelable) - * @see #saveHierarchyState(android.util.SparseArray) - * @see #dispatchSaveInstanceState(android.util.SparseArray) + * @see #onRestoreInstanceState(android.os.Parcelable) + * @see #saveHierarchyState(android.util.SparseArray) + * @see #dispatchSaveInstanceState(android.util.SparseArray) * @see #setSaveEnabled(boolean) */ protected Parcelable onSaveInstanceState() { @@ -10414,9 +10632,9 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @param container The SparseArray which holds previously frozen states. * - * @see #saveHierarchyState(android.util.SparseArray) - * @see #dispatchRestoreInstanceState(android.util.SparseArray) - * @see #onRestoreInstanceState(android.os.Parcelable) + * @see #saveHierarchyState(android.util.SparseArray) + * @see #dispatchRestoreInstanceState(android.util.SparseArray) + * @see #onRestoreInstanceState(android.os.Parcelable) */ public void restoreHierarchyState(SparseArray<Parcelable> container) { dispatchRestoreInstanceState(container); @@ -10430,9 +10648,9 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @param container The SparseArray which holds previously saved state. * - * @see #dispatchSaveInstanceState(android.util.SparseArray) - * @see #restoreHierarchyState(android.util.SparseArray) - * @see #onRestoreInstanceState(android.os.Parcelable) + * @see #dispatchSaveInstanceState(android.util.SparseArray) + * @see #restoreHierarchyState(android.util.SparseArray) + * @see #onRestoreInstanceState(android.os.Parcelable) */ protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container) { if (mID != NO_ID) { @@ -10458,9 +10676,9 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @param state The frozen state that had previously been returned by * {@link #onSaveInstanceState}. * - * @see #onSaveInstanceState() - * @see #restoreHierarchyState(android.util.SparseArray) - * @see #dispatchRestoreInstanceState(android.util.SparseArray) + * @see #onSaveInstanceState() + * @see #restoreHierarchyState(android.util.SparseArray) + * @see #dispatchRestoreInstanceState(android.util.SparseArray) */ protected void onRestoreInstanceState(Parcelable state) { mPrivateFlags |= SAVE_STATE_CALLED; @@ -10614,7 +10832,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * {@link #LAYER_TYPE_HARDWARE} * * @see #setLayerType(int, android.graphics.Paint) - * @see #buildLayer() + * @see #buildLayer() * @see #LAYER_TYPE_NONE * @see #LAYER_TYPE_SOFTWARE * @see #LAYER_TYPE_HARDWARE @@ -10627,14 +10845,14 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Forces this view's layer to be created and this view to be rendered * into its layer. If this view's layer type is set to {@link #LAYER_TYPE_NONE}, * invoking this method will have no effect. - * + * * This method can for instance be used to render a view into its layer before * starting an animation. If this view is complex, rendering into the layer * before starting the animation will avoid skipping frames. - * + * * @throws IllegalStateException If this view is not attached to a window - * - * @see #setLayerType(int, android.graphics.Paint) + * + * @see #setLayerType(int, android.graphics.Paint) */ public void buildLayer() { if (mLayerType == LAYER_TYPE_NONE) return; @@ -10656,7 +10874,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal break; } } - + // Make sure the HardwareRenderer.validate() was invoked before calling this method void flushLayer() { if (mLayerType == LAYER_TYPE_HARDWARE && mHardwareLayer != null) { @@ -10675,7 +10893,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal !mAttachInfo.mHardwareRenderer.isEnabled()) { return null; } - + if (!mAttachInfo.mHardwareRenderer.validate()) return null; final int width = mRight - mLeft; @@ -10709,10 +10927,10 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal /** * Destroys this View's hardware layer if possible. - * + * * @return True if the layer was destroyed, false otherwise. - * - * @see #setLayerType(int, android.graphics.Paint) + * + * @see #setLayerType(int, android.graphics.Paint) * @see #LAYER_TYPE_HARDWARE */ boolean destroyLayer(boolean valid) { @@ -10736,11 +10954,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Destroys all hardware rendering resources. This method is invoked * when the system needs to reclaim resources. Upon execution of this * method, you should free any OpenGL resources created by the view. - * + * * Note: you <strong>must</strong> call * <code>super.destroyHardwareResources()</code> when overriding * this method. - * + * * @hide */ protected void destroyHardwareResources() { @@ -11451,17 +11669,17 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal if (offsetRequired) top += getTopPaddingOffset(); return top; } - + /** * @hide * @param offsetRequired */ protected int getFadeHeight(boolean offsetRequired) { int padding = mPaddingTop; - if (offsetRequired) padding += getTopPaddingOffset(); + if (offsetRequired) padding += getTopPaddingOffset(); return mBottom - mTop - mPaddingBottom - padding; } - + /** * <p>Indicates whether this view is attached to a hardware accelerated * window or not.</p> @@ -11962,7 +12180,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal int saveCount; if (!dirtyOpaque) { - final Drawable background = mBGDrawable; + final Drawable background = mBackground; if (background != null) { final int scrollX = mScrollX; final int scrollY = mScrollY; @@ -12036,7 +12254,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } final ScrollabilityCache scrollabilityCache = mScrollCache; - final float fadeHeight = scrollabilityCache.fadingEdgeLength; + final float fadeHeight = scrollabilityCache.fadingEdgeLength; int length = (int) fadeHeight; // clip the fade length if top and bottom fades overlap @@ -12143,8 +12361,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * optimize the drawing of the fading edges. If you do return a non-zero color, the alpha * should be set to 0xFF. * - * @see #setVerticalFadingEdgeEnabled(boolean) - * @see #setHorizontalFadingEdgeEnabled(boolean) + * @see #setVerticalFadingEdgeEnabled(boolean) + * @see #setHorizontalFadingEdgeEnabled(boolean) * * @return The known solid color background for this view, or 0 if the color may vary */ @@ -12493,7 +12711,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @param who the Drawable to query */ public int getResolvedLayoutDirection(Drawable who) { - return (who == mBGDrawable) ? getResolvedLayoutDirection() : LAYOUT_DIRECTION_DEFAULT; + return (who == mBackground) ? getResolvedLayoutDirection() : LAYOUT_DIRECTION_DEFAULT; } /** @@ -12512,11 +12730,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @return boolean If true than the Drawable is being displayed in the * view; else false and it is not allowed to animate. * - * @see #unscheduleDrawable(android.graphics.drawable.Drawable) - * @see #drawableStateChanged() + * @see #unscheduleDrawable(android.graphics.drawable.Drawable) + * @see #drawableStateChanged() */ protected boolean verifyDrawable(Drawable who) { - return who == mBGDrawable; + return who == mBackground; } /** @@ -12526,10 +12744,10 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * <p>Be sure to call through to the superclass when overriding this * function. * - * @see Drawable#setState(int[]) + * @see Drawable#setState(int[]) */ protected void drawableStateChanged() { - Drawable d = mBGDrawable; + Drawable d = mBackground; if (d != null && d.isStateful()) { d.setState(getDrawableState()); } @@ -12559,9 +12777,9 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * * @return The current drawable state * - * @see Drawable#setState(int[]) - * @see #drawableStateChanged() - * @see #onCreateDrawableState(int) + * @see Drawable#setState(int[]) + * @see #drawableStateChanged() + * @see #onCreateDrawableState(int) */ public final int[] getDrawableState() { if ((mDrawableState != null) && ((mPrivateFlags & DRAWABLE_STATE_DIRTY) == 0)) { @@ -12586,7 +12804,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @return Returns an array holding the current {@link Drawable} state of * the view. * - * @see #mergeDrawableStates(int[], int[]) + * @see #mergeDrawableStates(int[], int[]) */ protected int[] onCreateDrawableState(int extraSpace) { if ((mViewFlags & DUPLICATE_PARENT_STATE) == DUPLICATE_PARENT_STATE && @@ -12662,7 +12880,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @return As a convenience, the <var>baseState</var> array you originally * passed into the function is returned. * - * @see #onCreateDrawableState(int) + * @see #onCreateDrawableState(int) */ protected static int[] mergeDrawableStates(int[] baseState, int[] additionalState) { final int N = baseState.length; @@ -12679,8 +12897,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * on all Drawable objects associated with this view. */ public void jumpDrawablesToCurrentState() { - if (mBGDrawable != null) { - mBGDrawable.jumpToCurrentState(); + if (mBackground != null) { + mBackground.jumpToCurrentState(); } } @@ -12690,10 +12908,10 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal */ @RemotableViewMethod public void setBackgroundColor(int color) { - if (mBGDrawable instanceof ColorDrawable) { - ((ColorDrawable) mBGDrawable).setColor(color); + if (mBackground instanceof ColorDrawable) { + ((ColorDrawable) mBackground).setColor(color); } else { - setBackgroundDrawable(new ColorDrawable(color)); + setBackground(new ColorDrawable(color)); } } @@ -12701,6 +12919,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Set the background to a given resource. The resource should refer to * a Drawable object or 0 to remove the background. * @param resid The identifier of the resource. + * * @attr ref android.R.styleable#View_background */ @RemotableViewMethod @@ -12713,7 +12932,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal if (resid != 0) { d = mResources.getDrawable(resid); } - setBackgroundDrawable(d); + setBackground(d); mBackgroundResource = resid; } @@ -12725,11 +12944,19 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * touched. If setting the padding is desired, please use * {@link #setPadding(int, int, int, int)}. * - * @param d The Drawable to use as the background, or null to remove the + * @param background The Drawable to use as the background, or null to remove the * background */ - public void setBackgroundDrawable(Drawable d) { - if (d == mBGDrawable) { + public void setBackground(Drawable background) { + setBackgroundDrawable(background); + } + + /** + * @deprecated use {@link #setBackground(Drawable)} instead + */ + @Deprecated + public void setBackgroundDrawable(Drawable background) { + if (background == mBackground) { return; } @@ -12741,19 +12968,19 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * Regardless of whether we're setting a new background or not, we want * to clear the previous drawable. */ - if (mBGDrawable != null) { - mBGDrawable.setCallback(null); - unscheduleDrawable(mBGDrawable); + if (mBackground != null) { + mBackground.setCallback(null); + unscheduleDrawable(mBackground); } - if (d != null) { + if (background != null) { Rect padding = sThreadLocal.get(); if (padding == null) { padding = new Rect(); sThreadLocal.set(padding); } - if (d.getPadding(padding)) { - switch (d.getResolvedLayoutDirectionSelf()) { + if (background.getPadding(padding)) { + switch (background.getResolvedLayoutDirectionSelf()) { case LAYOUT_DIRECTION_RTL: setPadding(padding.right, padding.top, padding.left, padding.bottom); break; @@ -12765,17 +12992,17 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal // Compare the minimum sizes of the old Drawable and the new. If there isn't an old or // if it has a different minimum size, we should layout again - if (mBGDrawable == null || mBGDrawable.getMinimumHeight() != d.getMinimumHeight() || - mBGDrawable.getMinimumWidth() != d.getMinimumWidth()) { + if (mBackground == null || mBackground.getMinimumHeight() != background.getMinimumHeight() || + mBackground.getMinimumWidth() != background.getMinimumWidth()) { requestLayout = true; } - d.setCallback(this); - if (d.isStateful()) { - d.setState(getDrawableState()); + background.setCallback(this); + if (background.isStateful()) { + background.setState(getDrawableState()); } - d.setVisible(getVisibility() == VISIBLE, false); - mBGDrawable = d; + background.setVisible(getVisibility() == VISIBLE, false); + mBackground = background; if ((mPrivateFlags & SKIP_DRAW) != 0) { mPrivateFlags &= ~SKIP_DRAW; @@ -12784,7 +13011,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } } else { /* Remove the background */ - mBGDrawable = null; + mBackground = null; if ((mPrivateFlags & ONLY_DRAWS_BACKGROUND) != 0) { /* @@ -12820,10 +13047,15 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal /** * Gets the background drawable + * * @return The drawable used as the background for this view, if any. + * + * @see #setBackground(Drawable) + * + * @attr ref android.R.styleable#View_background */ public Drawable getBackground() { - return mBGDrawable; + return mBackground; } /** @@ -13364,8 +13596,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * number. * * @see #NO_ID - * @see #getId() - * @see #findViewById(int) + * @see #getId() + * @see #findViewById(int) * * @param id a number used to identify the view * @@ -13404,8 +13636,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @return a positive integer used to identify the view or {@link #NO_ID} * if the view has no ID * - * @see #setId(int) - * @see #findViewById(int) + * @see #setId(int) + * @see #findViewById(int) * @attr ref android.R.styleable#View_id */ @ViewDebug.CapturedViewProperty @@ -13917,16 +14149,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @return The suggested minimum height of the view. */ protected int getSuggestedMinimumHeight() { - int suggestedMinHeight = mMinHeight; + return (mBackground == null) ? mMinHeight : max(mMinHeight, mBackground.getMinimumHeight()); - if (mBGDrawable != null) { - final int bgMinHeight = mBGDrawable.getMinimumHeight(); - if (suggestedMinHeight < bgMinHeight) { - suggestedMinHeight = bgMinHeight; - } - } - - return suggestedMinHeight; } /** @@ -13941,16 +14165,20 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * @return The suggested minimum width of the view. */ protected int getSuggestedMinimumWidth() { - int suggestedMinWidth = mMinWidth; - - if (mBGDrawable != null) { - final int bgMinWidth = mBGDrawable.getMinimumWidth(); - if (suggestedMinWidth < bgMinWidth) { - suggestedMinWidth = bgMinWidth; - } - } + return (mBackground == null) ? mMinWidth : max(mMinWidth, mBackground.getMinimumWidth()); + } - return suggestedMinWidth; + /** + * Returns the minimum height of the view. + * + * @return the minimum height the view will try to be. + * + * @see #setMinimumHeight(int) + * + * @attr ref android.R.styleable#View_minHeight + */ + public int getMinimumHeight() { + return mMinHeight; } /** @@ -13959,9 +14187,27 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * constrains it with less available height). * * @param minHeight The minimum height the view will try to be. + * + * @see #getMinimumHeight() + * + * @attr ref android.R.styleable#View_minHeight */ public void setMinimumHeight(int minHeight) { mMinHeight = minHeight; + requestLayout(); + } + + /** + * Returns the minimum width of the view. + * + * @return the minimum width the view will try to be. + * + * @see #setMinimumWidth(int) + * + * @attr ref android.R.styleable#View_minWidth + */ + public int getMinimumWidth() { + return mMinWidth; } /** @@ -13970,9 +14216,15 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * constrains it with less available width). * * @param minWidth The minimum width the view will try to be. + * + * @see #getMinimumWidth() + * + * @attr ref android.R.styleable#View_minWidth */ public void setMinimumWidth(int minWidth) { mMinWidth = minWidth; + requestLayout(); + } /** @@ -14091,11 +14343,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal getLocationInWindow(location); region.op(location[0], location[1], location[0] + mRight - mLeft, location[1] + mBottom - mTop, Region.Op.DIFFERENCE); - } else if ((pflags & ONLY_DRAWS_BACKGROUND) != 0 && mBGDrawable != null) { + } else if ((pflags & ONLY_DRAWS_BACKGROUND) != 0 && mBackground != null) { // The ONLY_DRAWS_BACKGROUND flag IS set and the background drawable // exists, so we remove the background drawable's non-transparent // parts from this transparent region. - applyDrawableToTransparentRegion(mBGDrawable, region); + applyDrawableToTransparentRegion(mBackground, region); } } return true; @@ -14162,9 +14414,48 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } /** - * Request that the visibility of the status bar be changed. - * @param visibility Bitwise-or of flags {@link #SYSTEM_UI_FLAG_LOW_PROFILE} or - * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}. + * Request that the visibility of the status bar or other screen/window + * decorations be changed. + * + * <p>This method is used to put the over device UI into temporary modes + * where the user's attention is focused more on the application content, + * by dimming or hiding surrounding system affordances. This is typically + * used in conjunction with {@link Window#FEATURE_ACTION_BAR_OVERLAY + * Window.FEATURE_ACTION_BAR_OVERLAY}, allowing the applications content + * to be placed behind the action bar (and with these flags other system + * affordances) so that smooth transitions between hiding and showing them + * can be done. + * + * <p>Two representative examples of the use of system UI visibility is + * implementing a content browsing application (like a magazine reader) + * and a video playing application. + * + * <p>The first code shows a typical implementation of a View in a content + * browsing application. In this implementation, the application goes + * into a content-oriented mode by hiding the status bar and action bar, + * and putting the navigation elements into lights out mode. The user can + * then interact with content while in this mode. Such an application should + * provide an easy way for the user to toggle out of the mode (such as to + * check information in the status bar or access notifications). In the + * implementation here, this is done simply by tapping on the content. + * + * {@sample development/samples/ApiDemos/src/com/example/android/apis/view/ContentBrowserActivity.java + * content} + * + * <p>This second code sample shows a typical implementation of a View + * in a video playing application. In this situation, while the video is + * playing the application would like to go into a complete full-screen mode, + * to use as much of the display as possible for the video. When in this state + * the user can not interact with the application; the system intercepts + * touching on the screen to pop the UI out of full screen mode. + * + * {@sample development/samples/ApiDemos/src/com/example/android/apis/view/VideoPlayerActivity.java + * content} + * + * @param visibility Bitwise-or of flags {@link #SYSTEM_UI_FLAG_LOW_PROFILE}, + * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}, {@link #SYSTEM_UI_FLAG_FULLSCREEN}, + * {@link #SYSTEM_UI_FLAG_LAYOUT_STABLE}, {@link #SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}, + * and {@link #SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}. */ public void setSystemUiVisibility(int visibility) { if (visibility != mSystemUiVisibility) { @@ -14176,9 +14467,11 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } /** - * Returns the status bar visibility that this view has requested. - * @return Bitwise-or of flags {@link #SYSTEM_UI_FLAG_LOW_PROFILE} or - * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}. + * Returns the last {@link #setSystemUiVisibility(int) that this view has requested. + * @return Bitwise-or of flags {@link #SYSTEM_UI_FLAG_LOW_PROFILE}, + * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}, {@link #SYSTEM_UI_FLAG_FULLSCREEN}, + * {@link #SYSTEM_UI_FLAG_LAYOUT_STABLE}, {@link #SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}, + * and {@link #SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}. */ public int getSystemUiVisibility() { return mSystemUiVisibility; @@ -14766,7 +15059,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * {@link #TEXT_DIRECTION_ANY_RTL}, * {@link #TEXT_DIRECTION_LTR}, * {@link #TEXT_DIRECTION_RTL}, - * {@link #TEXT_DIRECTION_LOCALE}, + * {@link #TEXT_DIRECTION_LOCALE} */ @ViewDebug.ExportedProperty(category = "text", mapping = { @ViewDebug.IntToString(from = TEXT_DIRECTION_INHERIT, to = "INHERIT"), @@ -14790,7 +15083,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * {@link #TEXT_DIRECTION_ANY_RTL}, * {@link #TEXT_DIRECTION_LTR}, * {@link #TEXT_DIRECTION_RTL}, - * {@link #TEXT_DIRECTION_LOCALE}, + * {@link #TEXT_DIRECTION_LOCALE} */ public void setTextDirection(int textDirection) { if (getTextDirection() != textDirection) { @@ -14799,6 +15092,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal resetResolvedTextDirection(); // Set the new text direction mPrivateFlags2 |= ((textDirection << TEXT_DIRECTION_MASK_SHIFT) & TEXT_DIRECTION_MASK); + // Refresh requestLayout(); invalidate(true); } @@ -14818,7 +15112,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * {@link #TEXT_DIRECTION_ANY_RTL}, * {@link #TEXT_DIRECTION_LTR}, * {@link #TEXT_DIRECTION_RTL}, - * {@link #TEXT_DIRECTION_LOCALE}, + * {@link #TEXT_DIRECTION_LOCALE} */ public int getResolvedTextDirection() { // The text direction will be resolved only if needed @@ -14927,6 +15221,199 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal public void onResolvedTextDirectionReset() { } + /** + * Return the value specifying the text alignment or policy that was set with + * {@link #setTextAlignment(int)}. + * + * @return the defined text alignment. It can be one of: + * + * {@link #TEXT_ALIGNMENT_INHERIT}, + * {@link #TEXT_ALIGNMENT_GRAVITY}, + * {@link #TEXT_ALIGNMENT_CENTER}, + * {@link #TEXT_ALIGNMENT_TEXT_START}, + * {@link #TEXT_ALIGNMENT_TEXT_END}, + * {@link #TEXT_ALIGNMENT_VIEW_START}, + * {@link #TEXT_ALIGNMENT_VIEW_END} + */ + @ViewDebug.ExportedProperty(category = "text", mapping = { + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_INHERIT, to = "INHERIT"), + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_GRAVITY, to = "GRAVITY"), + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_TEXT_START, to = "TEXT_START"), + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_TEXT_END, to = "TEXT_END"), + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_CENTER, to = "CENTER"), + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_START, to = "VIEW_START"), + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END") + }) + public int getTextAlignment() { + return (mPrivateFlags2 & TEXT_ALIGNMENT_MASK) >> TEXT_ALIGNMENT_MASK_SHIFT; + } + + /** + * Set the text alignment. + * + * @param textAlignment The text alignment to set. Should be one of + * + * {@link #TEXT_ALIGNMENT_INHERIT}, + * {@link #TEXT_ALIGNMENT_GRAVITY}, + * {@link #TEXT_ALIGNMENT_CENTER}, + * {@link #TEXT_ALIGNMENT_TEXT_START}, + * {@link #TEXT_ALIGNMENT_TEXT_END}, + * {@link #TEXT_ALIGNMENT_VIEW_START}, + * {@link #TEXT_ALIGNMENT_VIEW_END} + * + * @attr ref android.R.styleable#View_textAlignment + */ + public void setTextAlignment(int textAlignment) { + if (textAlignment != getTextAlignment()) { + // Reset the current and resolved text alignment + mPrivateFlags2 &= ~TEXT_ALIGNMENT_MASK; + resetResolvedTextAlignment(); + // Set the new text alignment + mPrivateFlags2 |= ((textAlignment << TEXT_ALIGNMENT_MASK_SHIFT) & TEXT_ALIGNMENT_MASK); + // Refresh + requestLayout(); + invalidate(true); + } + } + + /** + * Return the resolved text alignment. + * + * The resolved text alignment. This needs resolution if the value is + * TEXT_ALIGNMENT_INHERIT. The resolution matches {@link #setTextAlignment(int)} if it is + * not TEXT_ALIGNMENT_INHERIT, otherwise resolution proceeds up the parent chain of the view. + * + * @return the resolved text alignment. Returns one of: + * + * {@link #TEXT_ALIGNMENT_GRAVITY}, + * {@link #TEXT_ALIGNMENT_CENTER}, + * {@link #TEXT_ALIGNMENT_TEXT_START}, + * {@link #TEXT_ALIGNMENT_TEXT_END}, + * {@link #TEXT_ALIGNMENT_VIEW_START}, + * {@link #TEXT_ALIGNMENT_VIEW_END} + */ + @ViewDebug.ExportedProperty(category = "text", mapping = { + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_INHERIT, to = "INHERIT"), + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_GRAVITY, to = "GRAVITY"), + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_TEXT_START, to = "TEXT_START"), + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_TEXT_END, to = "TEXT_END"), + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_CENTER, to = "CENTER"), + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_START, to = "VIEW_START"), + @ViewDebug.IntToString(from = TEXT_ALIGNMENT_VIEW_END, to = "VIEW_END") + }) + public int getResolvedTextAlignment() { + // If text alignment is not resolved, then resolve it + if ((mPrivateFlags2 & TEXT_ALIGNMENT_RESOLVED) != TEXT_ALIGNMENT_RESOLVED) { + resolveTextAlignment(); + } + return (mPrivateFlags2 & TEXT_ALIGNMENT_RESOLVED_MASK) >> TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT; + } + + /** + * Resolve the text alignment. Will call {@link View#onResolvedTextAlignmentChanged} when + * resolution is done. + */ + public void resolveTextAlignment() { + // Reset any previous text alignment resolution + mPrivateFlags2 &= ~(TEXT_ALIGNMENT_RESOLVED | TEXT_ALIGNMENT_RESOLVED_MASK); + + if (hasRtlSupport()) { + // Set resolved text alignment flag depending on text alignment flag + final int textAlignment = getTextAlignment(); + switch (textAlignment) { + case TEXT_ALIGNMENT_INHERIT: + // Check if we can resolve the text alignment + if (canResolveLayoutDirection() && mParent instanceof View) { + View view = (View) mParent; + + final int parentResolvedTextAlignment = view.getResolvedTextAlignment(); + switch (parentResolvedTextAlignment) { + case TEXT_ALIGNMENT_GRAVITY: + case TEXT_ALIGNMENT_TEXT_START: + case TEXT_ALIGNMENT_TEXT_END: + case TEXT_ALIGNMENT_CENTER: + case TEXT_ALIGNMENT_VIEW_START: + case TEXT_ALIGNMENT_VIEW_END: + // Resolved text alignment is the same as the parent resolved + // text alignment + mPrivateFlags2 |= + (parentResolvedTextAlignment << TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT); + break; + default: + // Use default resolved text alignment + mPrivateFlags2 |= TEXT_ALIGNMENT_RESOLVED_DEFAULT; + } + } + else { + // We cannot do the resolution if there is no parent so use the default + mPrivateFlags2 |= TEXT_ALIGNMENT_RESOLVED_DEFAULT; + } + break; + case TEXT_ALIGNMENT_GRAVITY: + case TEXT_ALIGNMENT_TEXT_START: + case TEXT_ALIGNMENT_TEXT_END: + case TEXT_ALIGNMENT_CENTER: + case TEXT_ALIGNMENT_VIEW_START: + case TEXT_ALIGNMENT_VIEW_END: + // Resolved text alignment is the same as text alignment + mPrivateFlags2 |= (textAlignment << TEXT_ALIGNMENT_RESOLVED_MASK_SHIFT); + break; + default: + // Use default resolved text alignment + mPrivateFlags2 |= TEXT_ALIGNMENT_RESOLVED_DEFAULT; + } + } else { + // Use default resolved text alignment + mPrivateFlags2 |= TEXT_ALIGNMENT_RESOLVED_DEFAULT; + } + + // Set the resolved + mPrivateFlags2 |= TEXT_ALIGNMENT_RESOLVED; + onResolvedTextAlignmentChanged(); + } + + /** + * Check if text alignment resolution can be done. + * + * @return true if text alignment resolution can be done otherwise return false. + */ + public boolean canResolveTextAlignment() { + switch (getTextAlignment()) { + case TEXT_DIRECTION_INHERIT: + return (mParent != null); + default: + return true; + } + } + + /** + * Called when text alignment has been resolved. Subclasses that care about text alignment + * resolution should override this method. + * + * The default implementation does nothing. + */ + public void onResolvedTextAlignmentChanged() { + } + + /** + * Reset resolved text alignment. Text alignment can be resolved with a call to + * getResolvedTextAlignment(). Will call {@link View#onResolvedTextAlignmentReset} when + * reset is done. + */ + public void resetResolvedTextAlignment() { + // Reset any previous text alignment resolution + mPrivateFlags2 &= ~(TEXT_ALIGNMENT_RESOLVED | TEXT_ALIGNMENT_RESOLVED_MASK); + onResolvedTextAlignmentReset(); + } + + /** + * Called when text alignment is reset. Subclasses that care about text alignment reset should + * override this method and do a reset of the text alignment of their children. The default + * implementation does nothing. + */ + public void onResolvedTextAlignmentReset() { + } + // // Properties // @@ -15419,7 +15906,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * visibility. This reports <strong>global</strong> changes to the system UI * state, not just what the application is requesting. * - * @see View#setOnSystemUiVisibilityChangeListener(android.view.View.OnSystemUiVisibilityChangeListener) + * @see View#setOnSystemUiVisibilityChangeListener(android.view.View.OnSystemUiVisibilityChangeListener) */ public interface OnSystemUiVisibilityChangeListener { /** diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java index b9924c7..9d06145 100644 --- a/core/java/android/view/ViewConfiguration.java +++ b/core/java/android/view/ViewConfiguration.java @@ -315,7 +315,7 @@ public class ViewConfiguration { if (!sHasPermanentMenuKeySet) { IWindowManager wm = Display.getWindowManager(); try { - sHasPermanentMenuKey = wm.canStatusBarHide() && !wm.hasNavigationBar(); + sHasPermanentMenuKey = !wm.hasSystemNavBar() && !wm.hasNavigationBar(); sHasPermanentMenuKeySet = true; } catch (RemoteException ex) { sHasPermanentMenuKey = false; diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index d5c783f..121b544 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -3375,7 +3375,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager boolean clearChildFocus = false; if (view == mFocused) { - view.clearFocusForRemoval(); + view.unFocus(); clearChildFocus = true; } @@ -3398,6 +3398,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager if (clearChildFocus) { clearChildFocus(view); + ensureInputFocusOnFirstFocusable(); } } @@ -3450,7 +3451,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } if (view == focused) { - view.clearFocusForRemoval(); + view.unFocus(); clearChildFocus = view; } @@ -3474,6 +3475,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager if (clearChildFocus != null) { clearChildFocus(clearChildFocus); + ensureInputFocusOnFirstFocusable(); } } @@ -3519,7 +3521,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } if (view == focused) { - view.clearFocusForRemoval(); + view.unFocus(); clearChildFocus = view; } @@ -3542,6 +3544,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager if (clearChildFocus != null) { clearChildFocus(clearChildFocus); + ensureInputFocusOnFirstFocusable(); } } @@ -5056,6 +5059,18 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } } + @Override + public void onResolvedTextAlignmentReset() { + // Take care of resetting the children resolution too + final int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + if (child.getTextAlignment() == TEXT_ALIGNMENT_INHERIT) { + child.resetResolvedTextAlignment(); + } + } + } + /** * Return true if the pressed state should be delayed for children or descendants of this * ViewGroup. Generally, this should be done for containers that can scroll, such as a List. diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index d72f3b7..899fb32 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -2039,9 +2039,10 @@ public final class ViewRootImpl implements ViewParent, scrollToRectOrFocus(null, false); - if (mAttachInfo.mViewScrollChanged) { - mAttachInfo.mViewScrollChanged = false; - mAttachInfo.mTreeObserver.dispatchOnScrollChanged(); + final AttachInfo attachInfo = mAttachInfo; + if (attachInfo.mViewScrollChanged) { + attachInfo.mViewScrollChanged = false; + attachInfo.mTreeObserver.dispatchOnScrollChanged(); } int yoff; @@ -2056,8 +2057,8 @@ public final class ViewRootImpl implements ViewParent, fullRedrawNeeded = true; } - final float appScale = mAttachInfo.mApplicationScale; - final boolean scalingRequired = mAttachInfo.mScalingRequired; + final float appScale = attachInfo.mApplicationScale; + final boolean scalingRequired = attachInfo.mScalingRequired; int resizeAlpha = 0; if (mResizeBuffer != null) { @@ -2086,7 +2087,7 @@ public final class ViewRootImpl implements ViewParent, } if (fullRedrawNeeded) { - mAttachInfo.mIgnoreDirtyState = true; + attachInfo.mIgnoreDirtyState = true; dirty.set(0, 0, (int) (mWidth * appScale + 0.5f), (int) (mHeight * appScale + 0.5f)); } @@ -2099,8 +2100,10 @@ public final class ViewRootImpl implements ViewParent, appScale + ", width=" + mWidth + ", height=" + mHeight); } + attachInfo.mTreeObserver.dispatchOnDraw(); + if (!dirty.isEmpty() || mIsAnimating) { - if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) { + if (attachInfo.mHardwareRenderer != null && attachInfo.mHardwareRenderer.isEnabled()) { // Draw with hardware renderer. mIsAnimating = false; mHardwareYOffset = yoff; @@ -2111,154 +2114,164 @@ public final class ViewRootImpl implements ViewParent, mPreviousDirty.set(dirty); dirty.setEmpty(); - if (mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this, + if (attachInfo.mHardwareRenderer.draw(mView, attachInfo, this, animating ? null : mCurrentDirty)) { mPreviousDirty.set(0, 0, mWidth, mHeight); } - } else { - // Draw with software renderer. - Canvas canvas; - try { - int left = dirty.left; - int top = dirty.top; - int right = dirty.right; - int bottom = dirty.bottom; - - final long lockCanvasStartTime; - if (ViewDebug.DEBUG_LATENCY) { - lockCanvasStartTime = System.nanoTime(); - } - - canvas = mSurface.lockCanvas(dirty); + } else if (!drawSoftware(surface, attachInfo, yoff, scalingRequired, dirty)) { + return; + } + } - if (ViewDebug.DEBUG_LATENCY) { - long now = System.nanoTime(); - Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- lockCanvas() took " - + ((now - lockCanvasStartTime) * 0.000001f) + "ms"); - } + if (animating) { + mFullRedrawNeeded = true; + scheduleTraversals(); + } + } - if (left != dirty.left || top != dirty.top || right != dirty.right || - bottom != dirty.bottom) { - mAttachInfo.mIgnoreDirtyState = true; - } + /** + * @return true if drawing was succesfull, false if an error occurred + */ + private boolean drawSoftware(Surface surface, AttachInfo attachInfo, int yoff, + boolean scalingRequired, Rect dirty) { - // TODO: Do this in native - canvas.setDensity(mDensity); - } catch (Surface.OutOfResourcesException e) { - Log.e(TAG, "OutOfResourcesException locking surface", e); - try { - if (!sWindowSession.outOfMemory(mWindow)) { - Slog.w(TAG, "No processes killed for memory; killing self"); - Process.killProcess(Process.myPid()); - } - } catch (RemoteException ex) { - } - mLayoutRequested = true; // ask wm for a new surface next time. - return; - } catch (IllegalArgumentException e) { - Log.e(TAG, "IllegalArgumentException locking surface", e); - // Don't assume this is due to out of memory, it could be - // something else, and if it is something else then we could - // kill stuff (or ourself) for no reason. - mLayoutRequested = true; // ask wm for a new surface next time. - return; - } + // Draw with software renderer. + Canvas canvas; + try { + int left = dirty.left; + int top = dirty.top; + int right = dirty.right; + int bottom = dirty.bottom; - try { - if (DEBUG_ORIENTATION || DEBUG_DRAW) { - Log.v(TAG, "Surface " + surface + " drawing to bitmap w=" - + canvas.getWidth() + ", h=" + canvas.getHeight()); - //canvas.drawARGB(255, 255, 0, 0); - } + final long lockCanvasStartTime; + if (ViewDebug.DEBUG_LATENCY) { + lockCanvasStartTime = System.nanoTime(); + } - long startTime = 0L; - if (ViewDebug.DEBUG_PROFILE_DRAWING) { - startTime = SystemClock.elapsedRealtime(); - } + canvas = mSurface.lockCanvas(dirty); - // If this bitmap's format includes an alpha channel, we - // need to clear it before drawing so that the child will - // properly re-composite its drawing on a transparent - // background. This automatically respects the clip/dirty region - // or - // If we are applying an offset, we need to clear the area - // where the offset doesn't appear to avoid having garbage - // left in the blank areas. - if (!canvas.isOpaque() || yoff != 0) { - canvas.drawColor(0, PorterDuff.Mode.CLEAR); - } + if (ViewDebug.DEBUG_LATENCY) { + long now = System.nanoTime(); + Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- lockCanvas() took " + + ((now - lockCanvasStartTime) * 0.000001f) + "ms"); + } - dirty.setEmpty(); - mIsAnimating = false; - mAttachInfo.mDrawingTime = SystemClock.uptimeMillis(); - mView.mPrivateFlags |= View.DRAWN; + if (left != dirty.left || top != dirty.top || right != dirty.right || + bottom != dirty.bottom) { + attachInfo.mIgnoreDirtyState = true; + } - if (DEBUG_DRAW) { - Context cxt = mView.getContext(); - Log.i(TAG, "Drawing: package:" + cxt.getPackageName() + - ", metrics=" + cxt.getResources().getDisplayMetrics() + - ", compatibilityInfo=" + cxt.getResources().getCompatibilityInfo()); - } - try { - canvas.translate(0, -yoff); - if (mTranslator != null) { - mTranslator.translateCanvas(canvas); - } - canvas.setScreenDensity(scalingRequired - ? DisplayMetrics.DENSITY_DEVICE : 0); - mAttachInfo.mSetIgnoreDirtyState = false; + // TODO: Do this in native + canvas.setDensity(mDensity); + } catch (Surface.OutOfResourcesException e) { + Log.e(TAG, "OutOfResourcesException locking surface", e); + try { + if (!sWindowSession.outOfMemory(mWindow)) { + Slog.w(TAG, "No processes killed for memory; killing self"); + Process.killProcess(Process.myPid()); + } + } catch (RemoteException ex) { + } + mLayoutRequested = true; // ask wm for a new surface next time. + return false; + } catch (IllegalArgumentException e) { + Log.e(TAG, "IllegalArgumentException locking surface", e); + // Don't assume this is due to out of memory, it could be + // something else, and if it is something else then we could + // kill stuff (or ourself) for no reason. + mLayoutRequested = true; // ask wm for a new surface next time. + return false; + } - final long drawStartTime; - if (ViewDebug.DEBUG_LATENCY) { - drawStartTime = System.nanoTime(); - } + try { + if (DEBUG_ORIENTATION || DEBUG_DRAW) { + Log.v(TAG, "Surface " + surface + " drawing to bitmap w=" + + canvas.getWidth() + ", h=" + canvas.getHeight()); + //canvas.drawARGB(255, 255, 0, 0); + } - mView.draw(canvas); + long startTime = 0L; + if (ViewDebug.DEBUG_PROFILE_DRAWING) { + startTime = SystemClock.elapsedRealtime(); + } - if (ViewDebug.DEBUG_LATENCY) { - long now = System.nanoTime(); - Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- draw() took " - + ((now - drawStartTime) * 0.000001f) + "ms"); - } - } finally { - if (!mAttachInfo.mSetIgnoreDirtyState) { - // Only clear the flag if it was not set during the mView.draw() call - mAttachInfo.mIgnoreDirtyState = false; - } - } + // If this bitmap's format includes an alpha channel, we + // need to clear it before drawing so that the child will + // properly re-composite its drawing on a transparent + // background. This automatically respects the clip/dirty region + // or + // If we are applying an offset, we need to clear the area + // where the offset doesn't appear to avoid having garbage + // left in the blank areas. + if (!canvas.isOpaque() || yoff != 0) { + canvas.drawColor(0, PorterDuff.Mode.CLEAR); + } - if (false && ViewDebug.consistencyCheckEnabled) { - mView.dispatchConsistencyCheck(ViewDebug.CONSISTENCY_DRAWING); - } + dirty.setEmpty(); + mIsAnimating = false; + attachInfo.mDrawingTime = SystemClock.uptimeMillis(); + mView.mPrivateFlags |= View.DRAWN; - if (ViewDebug.DEBUG_PROFILE_DRAWING) { - EventLog.writeEvent(60000, SystemClock.elapsedRealtime() - startTime); - } - } finally { - final long unlockCanvasAndPostStartTime; - if (ViewDebug.DEBUG_LATENCY) { - unlockCanvasAndPostStartTime = System.nanoTime(); - } + if (DEBUG_DRAW) { + Context cxt = mView.getContext(); + Log.i(TAG, "Drawing: package:" + cxt.getPackageName() + + ", metrics=" + cxt.getResources().getDisplayMetrics() + + ", compatibilityInfo=" + cxt.getResources().getCompatibilityInfo()); + } + try { + canvas.translate(0, -yoff); + if (mTranslator != null) { + mTranslator.translateCanvas(canvas); + } + canvas.setScreenDensity(scalingRequired + ? DisplayMetrics.DENSITY_DEVICE : 0); + attachInfo.mSetIgnoreDirtyState = false; - surface.unlockCanvasAndPost(canvas); + final long drawStartTime; + if (ViewDebug.DEBUG_LATENCY) { + drawStartTime = System.nanoTime(); + } - if (ViewDebug.DEBUG_LATENCY) { - long now = System.nanoTime(); - Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- unlockCanvasAndPost() took " - + ((now - unlockCanvasAndPostStartTime) * 0.000001f) + "ms"); - } + mView.draw(canvas); - if (LOCAL_LOGV) { - Log.v(TAG, "Surface " + surface + " unlockCanvasAndPost"); - } + if (ViewDebug.DEBUG_LATENCY) { + long now = System.nanoTime(); + Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- draw() took " + + ((now - drawStartTime) * 0.000001f) + "ms"); + } + } finally { + if (!attachInfo.mSetIgnoreDirtyState) { + // Only clear the flag if it was not set during the mView.draw() call + attachInfo.mIgnoreDirtyState = false; } } - } - if (animating) { - mFullRedrawNeeded = true; - scheduleTraversals(); + if (false && ViewDebug.consistencyCheckEnabled) { + mView.dispatchConsistencyCheck(ViewDebug.CONSISTENCY_DRAWING); + } + + if (ViewDebug.DEBUG_PROFILE_DRAWING) { + EventLog.writeEvent(60000, SystemClock.elapsedRealtime() - startTime); + } + } finally { + final long unlockCanvasAndPostStartTime; + if (ViewDebug.DEBUG_LATENCY) { + unlockCanvasAndPostStartTime = System.nanoTime(); + } + + surface.unlockCanvasAndPost(canvas); + + if (ViewDebug.DEBUG_LATENCY) { + long now = System.nanoTime(); + Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- unlockCanvasAndPost() took " + + ((now - unlockCanvasAndPostStartTime) * 0.000001f) + "ms"); + } + + if (LOCAL_LOGV) { + Log.v(TAG, "Surface " + surface + " unlockCanvasAndPost"); + } } + return true; } void invalidateDisplayLists() { @@ -3830,30 +3843,33 @@ public final class ViewRootImpl implements ViewParent, if (LOCAL_LOGV) Log.v(TAG, "DIE in " + this + " of " + mSurface); synchronized (this) { if (mAdded) { - mAdded = false; dispatchDetachedFromWindow(); } if (mAdded && !mFirst) { destroyHardwareRenderer(); - int viewVisibility = mView.getVisibility(); - boolean viewVisibilityChanged = mViewVisibility != viewVisibility; - if (mWindowAttributesChanged || viewVisibilityChanged) { - // If layout params have been changed, first give them - // to the window manager to make sure it has the correct - // animation info. - try { - if ((relayoutWindow(mWindowAttributes, viewVisibility, false) - & WindowManagerImpl.RELAYOUT_RES_FIRST_TIME) != 0) { - sWindowSession.finishDrawing(mWindow); + if (mView != null) { + int viewVisibility = mView.getVisibility(); + boolean viewVisibilityChanged = mViewVisibility != viewVisibility; + if (mWindowAttributesChanged || viewVisibilityChanged) { + // If layout params have been changed, first give them + // to the window manager to make sure it has the correct + // animation info. + try { + if ((relayoutWindow(mWindowAttributes, viewVisibility, false) + & WindowManagerImpl.RELAYOUT_RES_FIRST_TIME) != 0) { + sWindowSession.finishDrawing(mWindow); + } + } catch (RemoteException e) { } - } catch (RemoteException e) { } + + mSurface.release(); } - - mSurface.release(); } + + mAdded = false; } } diff --git a/core/java/android/view/ViewTreeObserver.java b/core/java/android/view/ViewTreeObserver.java index 7fd3389..1c5d436 100644 --- a/core/java/android/view/ViewTreeObserver.java +++ b/core/java/android/view/ViewTreeObserver.java @@ -38,6 +38,7 @@ public final class ViewTreeObserver { private CopyOnWriteArrayList<OnComputeInternalInsetsListener> mOnComputeInternalInsetsListeners; private CopyOnWriteArrayList<OnScrollChangedListener> mOnScrollChangedListeners; private ArrayList<OnPreDrawListener> mOnPreDrawListeners; + private ArrayList<OnDrawListener> mOnDrawListeners; private boolean mAlive = true; @@ -90,6 +91,27 @@ public final class ViewTreeObserver { } /** + * Interface definition for a callback to be invoked when the view tree is about to be drawn. + */ + public interface OnDrawListener { + /** + * <p>Callback method to be invoked when the view tree is about to be drawn. At this point, + * views cannot be modified in any way.</p> + * + * <p>Unlike with {@link OnPreDrawListener}, this method cannot be used to cancel the + * current drawing pass.</p> + * + * <p>An {@link OnDrawListener} listener <strong>cannot be added or removed</strong> + * from this method.</p> + * + * @see android.view.View#onMeasure + * @see android.view.View#onLayout + * @see android.view.View#onDraw + */ + public void onDraw(); + } + + /** * Interface definition for a callback to be invoked when the touch mode changes. */ public interface OnTouchModeChangeListener { @@ -171,11 +193,7 @@ public final class ViewTreeObserver { public void setTouchableInsets(int val) { mTouchableInsets = val; } - - public int getTouchableInsets() { - return mTouchableInsets; - } - + int mTouchableInsets; void reset() { @@ -184,29 +202,28 @@ public final class ViewTreeObserver { touchableRegion.setEmpty(); mTouchableInsets = TOUCHABLE_INSETS_FRAME; } - + + @Override + public int hashCode() { + int result = contentInsets != null ? contentInsets.hashCode() : 0; + result = 31 * result + (visibleInsets != null ? visibleInsets.hashCode() : 0); + result = 31 * result + (touchableRegion != null ? touchableRegion.hashCode() : 0); + result = 31 * result + mTouchableInsets; + return result; + } + @Override public boolean equals(Object o) { - try { - if (o == null) { - return false; - } - InternalInsetsInfo other = (InternalInsetsInfo)o; - if (mTouchableInsets != other.mTouchableInsets) { - return false; - } - if (!contentInsets.equals(other.contentInsets)) { - return false; - } - if (!visibleInsets.equals(other.visibleInsets)) { - return false; - } - return touchableRegion.equals(other.touchableRegion); - } catch (ClassCastException e) { - return false; - } + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + InternalInsetsInfo other = (InternalInsetsInfo)o; + return mTouchableInsets == other.mTouchableInsets && + contentInsets.equals(other.contentInsets) && + visibleInsets.equals(other.visibleInsets) && + touchableRegion.equals(other.touchableRegion); } - + void set(InternalInsetsInfo other) { contentInsets.set(other.contentInsets); visibleInsets.set(other.visibleInsets); @@ -420,6 +437,44 @@ public final class ViewTreeObserver { } /** + * <p>Register a callback to be invoked when the view tree is about to be drawn.</p> + * <p><strong>Note:</strong> this method <strong>cannot</strong> be invoked from + * {@link android.view.ViewTreeObserver.OnDrawListener#onDraw()}.</p> + * + * @param listener The callback to add + * + * @throws IllegalStateException If {@link #isAlive()} returns false + */ + public void addOnDrawListener(OnDrawListener listener) { + checkIsAlive(); + + if (mOnDrawListeners == null) { + mOnDrawListeners = new ArrayList<OnDrawListener>(); + } + + mOnDrawListeners.add(listener); + } + + /** + * <p>Remove a previously installed pre-draw callback.</p> + * <p><strong>Note:</strong> this method <strong>cannot</strong> be invoked from + * {@link android.view.ViewTreeObserver.OnDrawListener#onDraw()}.</p> + * + * @param victim The callback to remove + * + * @throws IllegalStateException If {@link #isAlive()} returns false + * + * @see #addOnDrawListener(OnDrawListener) + */ + public void removeOnDrawListener(OnDrawListener victim) { + checkIsAlive(); + if (mOnDrawListeners == null) { + return; + } + mOnDrawListeners.remove(victim); + } + + /** * Register a callback to be invoked when a view has been scrolled. * * @param listener The callback to add @@ -601,6 +656,7 @@ public final class ViewTreeObserver { * * @return True if the current draw should be canceled and resceduled, false otherwise. */ + @SuppressWarnings("unchecked") public final boolean dispatchOnPreDraw() { // NOTE: we *must* clone the listener list to perform the dispatching. // The clone is a safe guard against listeners that @@ -619,6 +675,19 @@ public final class ViewTreeObserver { } /** + * Notifies registered listeners that the drawing pass is about to start. + */ + public final void dispatchOnDraw() { + if (mOnDrawListeners != null) { + final ArrayList<OnDrawListener> listeners = mOnDrawListeners; + int numListeners = listeners.size(); + for (int i = 0; i < numListeners; ++i) { + listeners.get(i).onDraw(); + } + } + } + + /** * Notifies registered listeners that the touch mode has changed. * * @param inTouchMode True if the touch mode is now enabled, false otherwise. diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index 75267bb..491cd67 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -326,6 +326,11 @@ public interface WindowManagerPolicy { * Returns true if {@link #hideLw} was last called for the window. */ public boolean showLw(boolean doAnimation); + + /** + * Check whether the process hosting this window is currently alive. + */ + public boolean isAlive(); } /** @@ -344,6 +349,10 @@ public interface WindowManagerPolicy { * between it and the policy. */ public interface WindowManagerFuncs { + public static final int LID_ABSENT = -1; + public static final int LID_CLOSED = 0; + public static final int LID_OPEN = 1; + /** * Ask the window manager to re-evaluate the system UI flags. */ @@ -357,6 +366,16 @@ public interface WindowManagerPolicy { InputEventReceiver.Factory inputEventReceiverFactory, String name, int windowType, int layoutParamsFlags, boolean canReceiveKeys, boolean hasFocus, boolean touchFullscreen); + + /** + * Returns a code that describes the current state of the lid switch. + */ + public int getLidState(); + + /** + * Creates an input channel that will receive all input from the input dispatcher. + */ + public InputChannel monitorInput(String name); } /** @@ -447,7 +466,7 @@ public interface WindowManagerPolicy { * Called by window manager once it has the initial, default native * display dimensions. */ - public void setInitialDisplaySize(int width, int height); + public void setInitialDisplaySize(Display display, int width, int height); /** * Check permissions when adding a window. @@ -514,10 +533,10 @@ public interface WindowManagerPolicy { public int getMaxWallpaperLayer(); /** - * Return true if the policy allows the status bar to hide. Otherwise, - * it is a tablet-style system bar. + * Return true if the policy desires a full unified system nav bar. Otherwise, + * it is a phone-style status bar with optional nav bar. */ - public boolean canStatusBarHide(); + public boolean hasSystemNavBar(); /** * Return the display width available after excluding any screen @@ -938,10 +957,10 @@ public interface WindowManagerPolicy { public void setRotationLw(int rotation); /** - * Called when the system is mostly done booting to determine whether + * Called when the system is mostly done booting to set whether * the system should go into safe mode. */ - public boolean detectSafeMode(); + public void setSafeMode(boolean safeMode); /** * Called when the system is mostly done booting. diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 17dbde8..067be39 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -405,7 +405,9 @@ public final class InputMethodManager { } // Check focus again in case that "onWindowFocus" is called before // handling this message. - checkFocus(mHasBeenInactive); + if (mServedView != null && mServedView.hasWindowFocus()) { + checkFocus(mHasBeenInactive); + } } } return; @@ -1202,7 +1204,9 @@ public final class InputMethodManager { } if (DEBUG) Log.v(TAG, "checkFocus: view=" + mServedView + " next=" + mNextServedView - + " forceNewFocus=" + forceNewFocus); + + " forceNewFocus=" + forceNewFocus + + " package=" + + (mServedView != null ? mServedView.getContext().getPackageName() : "<none>")); if (mNextServedView == null) { finishInputLocked(); diff --git a/core/java/android/view/textservice/SpellCheckerInfo.java b/core/java/android/view/textservice/SpellCheckerInfo.java index 137743a..d05c1af 100644 --- a/core/java/android/view/textservice/SpellCheckerInfo.java +++ b/core/java/android/view/textservice/SpellCheckerInfo.java @@ -45,6 +45,7 @@ public final class SpellCheckerInfo implements Parcelable { private final ResolveInfo mService; private final String mId; private final int mLabel; + private final boolean mSupportsSentenceSpellCheck; /** * The spell checker setting activity's name, used by the system settings to @@ -97,6 +98,9 @@ public final class SpellCheckerInfo implements Parcelable { label = sa.getResourceId(com.android.internal.R.styleable.SpellChecker_label, 0); settingsActivityComponent = sa.getString( com.android.internal.R.styleable.SpellChecker_settingsActivity); + mSupportsSentenceSpellCheck = sa.getBoolean( + com.android.internal.R.styleable.SpellChecker_supportsSentenceSpellCheck, + false); sa.recycle(); final int depth = parser.getDepth(); @@ -138,6 +142,7 @@ public final class SpellCheckerInfo implements Parcelable { */ public SpellCheckerInfo(Parcel source) { mLabel = source.readInt(); + mSupportsSentenceSpellCheck = source.readInt() != 0; mId = source.readString(); mSettingsActivityName = source.readString(); mService = ResolveInfo.CREATOR.createFromParcel(source); @@ -152,6 +157,12 @@ public final class SpellCheckerInfo implements Parcelable { return mId; } + /** + * @hide + */ + public boolean isSentenceSpellCheckSupported() { + return mSupportsSentenceSpellCheck; + } /** * Return the component of the service that implements. @@ -177,6 +188,7 @@ public final class SpellCheckerInfo implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(mLabel); + dest.writeInt(mSupportsSentenceSpellCheck ? 1 : 0); dest.writeString(mId); dest.writeString(mSettingsActivityName); mService.writeToParcel(dest, flags); diff --git a/core/java/android/view/textservice/SpellCheckerSession.java b/core/java/android/view/textservice/SpellCheckerSession.java index 35940ba..9dc05e4 100644 --- a/core/java/android/view/textservice/SpellCheckerSession.java +++ b/core/java/android/view/textservice/SpellCheckerSession.java @@ -436,15 +436,15 @@ public class SpellCheckerSession { */ public interface SpellCheckerSessionListener { /** - * Callback for {@link SpellCheckerSession#getSuggestions(TextInfo[], int, boolean)} + * Callback for {@link SpellCheckerSession#getSuggestions(TextInfo, int)} + * and {@link SpellCheckerSession#getSuggestions(TextInfo[], int, boolean)} * @param results an array of {@link SuggestionsInfo}s. * These results are suggestions for {@link TextInfo}s queried by - * {@link SpellCheckerSession#getSuggestions(TextInfo[], int, boolean)}. + * {@link SpellCheckerSession#getSuggestions(TextInfo, int)} or + * {@link SpellCheckerSession#getSuggestions(TextInfo[], int, boolean)} */ public void onGetSuggestions(SuggestionsInfo[] results); - // TODO: Remove @hide as soon as the sample spell checker client gets fixed. /** - * @hide * Callback for {@link SpellCheckerSession#getSentenceSuggestions(TextInfo[], int)} * @param results an array of {@link SentenceSuggestionsInfo}s. * These results are suggestions for {@link TextInfo}s @@ -494,7 +494,7 @@ public class SpellCheckerSession { } /** - * @hide + * @return true if the spell checker supports sentence level spell checking APIs */ public boolean isSentenceSpellCheckSupported() { return mSubtype.containsExtraValueKey(SUPPORT_SENTENCE_SPELL_CHECK); diff --git a/core/java/android/webkit/FindActionModeCallback.java b/core/java/android/webkit/FindActionModeCallback.java index 6c331ac..6b7263c 100644 --- a/core/java/android/webkit/FindActionModeCallback.java +++ b/core/java/android/webkit/FindActionModeCallback.java @@ -148,8 +148,8 @@ class FindActionModeCallback implements ActionMode.Callback, TextWatcher, mInput.showSoftInput(mEditText, 0); } - public void updateMatchCount(int matchIndex, int matchCount, boolean isNewFind) { - if (!isNewFind) { + public void updateMatchCount(int matchIndex, int matchCount, boolean isEmptyFind) { + if (!isEmptyFind) { mNumberOfMatches = matchCount; mActiveMatchIndex = matchIndex; updateMatchesString(); diff --git a/core/java/android/webkit/WebSettingsClassic.java b/core/java/android/webkit/WebSettingsClassic.java index 94b46fc..aa3d8d3 100644 --- a/core/java/android/webkit/WebSettingsClassic.java +++ b/core/java/android/webkit/WebSettingsClassic.java @@ -33,7 +33,7 @@ import java.util.Locale; */ public class WebSettingsClassic extends WebSettings { // TODO: Keep this up to date - private static final String PREVIOUS_VERSION = "4.0.3"; + private static final String PREVIOUS_VERSION = "4.0.4"; // WebView associated with this WebSettings. private WebViewClassic mWebView; diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 9492e38..84632c6 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -313,7 +313,6 @@ public class WebView extends AbsoluteLayout /** * Interface to listen for find results. - * @hide */ public interface FindListener { /** @@ -1249,8 +1248,7 @@ public class WebView extends AbsoluteLayout * 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 + * @param listener An implementation of {@link FindListener}. */ public void setFindListener(FindListener listener) { checkThread(); @@ -1258,11 +1256,15 @@ public class WebView extends AbsoluteLayout } /** - * Highlight and scroll to the next occurance of String in findAll. - * Wraps the page infinitely, and scrolls. Must be called after - * calling findAll. + * Highlight and scroll to the next match found by {@link #findAll} or + * {@link #findAllAsync}, wrapping around page boundaries as necessary. + * Notifies any registered {@link FindListener}. If neither + * {@link #findAll} nor {@link #findAllAsync(String)} has been called yet, + * or if {@link #clearMatches} has been called since the last find + * operation, this function does nothing. * * @param forward Direction to search. + * @see #setFindListener */ public void findNext(boolean forward) { checkThread(); @@ -1271,10 +1273,13 @@ public class WebView extends AbsoluteLayout /** * Find all instances of find on the page and highlight them. + * Notifies any registered {@link FindListener}. * * @param find String to find. * @return int The number of occurances of the String "find" * that were found. + * @deprecated {@link #findAllAsync} is preferred. + * @see #setFindListener */ public int findAll(String find) { checkThread(); @@ -1283,10 +1288,12 @@ public class WebView extends AbsoluteLayout /** * Find all instances of find on the page and highlight them, - * asynchronously. + * asynchronously. Notifies any registered {@link FindListener}. + * Successive calls to this or {@link #findAll} will cancel any + * pending searches. * * @param find String to find. - * @hide + * @see #setFindListener */ public void findAllAsync(String find) { checkThread(); @@ -1333,8 +1340,9 @@ public class WebView extends AbsoluteLayout return getFactory().getStatics().findAddress(addr); } - /* - * Clear the highlighting surrounding text matches created by findAll. + /** + * Clear the highlighting surrounding text matches created by + * {@link #findAll} or {@link #findAllAsync}. */ public void clearMatches() { checkThread(); diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java index 4c118ac..586fcb1 100644 --- a/core/java/android/webkit/WebViewClassic.java +++ b/core/java/android/webkit/WebViewClassic.java @@ -3588,7 +3588,9 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc @Override public void findNext(boolean forward) { if (0 == mNativeClass) return; // client isn't initialized - mWebViewCore.sendMessage(EventHub.FIND_NEXT, forward ? 1 : 0); + if (mFindRequest != null) { + mWebViewCore.sendMessage(EventHub.FIND_NEXT, forward ? 1 : 0, mFindRequest); + } } /** @@ -3605,28 +3607,26 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc private int findAllBody(String find, boolean isAsync) { if (0 == mNativeClass) return 0; // client isn't initialized - mLastFind = find; + mFindRequest = null; if (find == null) return 0; mWebViewCore.removeMessages(EventHub.FIND_ALL); - WebViewCore.FindAllRequest request = new - WebViewCore.FindAllRequest(find); + mFindRequest = new WebViewCore.FindAllRequest(find); if (isAsync) { - mWebViewCore.sendMessage(EventHub.FIND_ALL, request); + mWebViewCore.sendMessage(EventHub.FIND_ALL, mFindRequest); return 0; // no need to wait for response } - synchronized(request) { + synchronized(mFindRequest) { try { - mWebViewCore.sendMessageAtFrontOfQueue(EventHub.FIND_ALL, - request); - while (request.mMatchCount == -1) { - request.wait(); + mWebViewCore.sendMessageAtFrontOfQueue(EventHub.FIND_ALL, mFindRequest); + while (mFindRequest.mMatchCount == -1) { + mFindRequest.wait(); } } catch (InterruptedException e) { return 0; } + return mFindRequest.mMatchCount; } - return request.mMatchCount; } /** @@ -3657,7 +3657,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc return true; } if (text == null) { - text = mLastFind; + text = mFindRequest == null ? null : mFindRequest.mSearchText; } if (text != null) { mFindCallback.setText(text); @@ -3683,9 +3683,8 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc // or not we draw the highlights for matches. private boolean mFindIsUp; - // Keep track of the last string sent, so we can search again when find is - // reopened. - private String mLastFind; + // Keep track of the last find request sent. + private WebViewCore.FindAllRequest mFindRequest = null; /** * Return the first substring consisting of the address of a physical @@ -8476,13 +8475,27 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc } case UPDATE_MATCH_COUNT: { - 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); + WebViewCore.FindAllRequest request = (WebViewCore.FindAllRequest)msg.obj; + if (request == null) { + if (mFindCallback != null) { + mFindCallback.updateMatchCount(0, 0, true); + } + } else if (request == mFindRequest) { + int matchCount, matchIndex; + synchronized (mFindRequest) { + matchCount = request.mMatchCount; + matchIndex = request.mMatchIndex; + } + if (mFindCallback != null) { + mFindCallback.updateMatchCount(matchIndex, matchCount, false); + } + if (mFindListener != null) { + mFindListener.onFindResultReceived(matchIndex, matchCount, true); + } + } break; } + case CLEAR_CARET_HANDLE: selectionDone(); break; diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index b4ebc09..5549d89 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -1041,9 +1041,11 @@ public final class WebViewCore { public FindAllRequest(String text) { mSearchText = text; mMatchCount = -1; + mMatchIndex = -1; } - public String mSearchText; + public final String mSearchText; public int mMatchCount; + public int mMatchIndex; } /** @@ -1777,21 +1779,32 @@ public final class WebViewCore { nativeSelectAll(mNativeClass); break; case FIND_ALL: { - FindAllRequest request = (FindAllRequest) msg.obj; - if (request == null) { - nativeFindAll(mNativeClass, null); - } else { - request.mMatchCount = nativeFindAll( - mNativeClass, request.mSearchText); - synchronized(request) { + FindAllRequest request = (FindAllRequest)msg.obj; + if (request != null) { + int matchCount = nativeFindAll(mNativeClass, request.mSearchText); + int matchIndex = nativeFindNext(mNativeClass, true); + synchronized (request) { + request.mMatchCount = matchCount; + request.mMatchIndex = matchIndex; request.notify(); } + } else { + nativeFindAll(mNativeClass, null); } + Message.obtain(mWebViewClassic.mPrivateHandler, + WebViewClassic.UPDATE_MATCH_COUNT, request).sendToTarget(); break; } - case FIND_NEXT: - nativeFindNext(mNativeClass, msg.arg1 != 0); + case FIND_NEXT: { + FindAllRequest request = (FindAllRequest)msg.obj; + int matchIndex = nativeFindNext(mNativeClass, msg.arg1 != 0); + synchronized (request) { + request.mMatchIndex = matchIndex; + } + Message.obtain(mWebViewClassic.mPrivateHandler, + WebViewClassic.UPDATE_MATCH_COUNT, request).sendToTarget(); break; + } } } }; @@ -2825,17 +2838,6 @@ public final class WebViewCore { .sendToTarget(); } - // called by JNI - private void updateMatchCount(int matchIndex, int matchCount, - String findText) { - if (mWebViewClassic == null) { - return; - } - Message.obtain(mWebViewClassic.mPrivateHandler, - WebViewClassic.UPDATE_MATCH_COUNT, matchIndex, matchCount, - findText).sendToTarget(); - } - private native void nativeRevealSelection(int nativeClass); private native String nativeRequestLabel(int nativeClass, int framePtr, int nodePtr); @@ -3086,7 +3088,7 @@ public final class WebViewCore { private native void nativeAutoFillForm(int nativeClass, int queryId); private native void nativeScrollLayer(int nativeClass, int layer, Rect rect); private native int nativeFindAll(int nativeClass, String text); - private native void nativeFindNext(int nativeClass, boolean forward); + private native int nativeFindNext(int nativeClass, boolean forward); /** * Deletes editable text between two points. Note that the selection may diff --git a/core/java/android/widget/Chronometer.java b/core/java/android/widget/Chronometer.java index 0370049..b7a126e 100644 --- a/core/java/android/widget/Chronometer.java +++ b/core/java/android/widget/Chronometer.java @@ -25,6 +25,7 @@ import android.os.SystemClock; import android.text.format.DateUtils; import android.util.AttributeSet; import android.util.Log; +import android.util.Slog; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 880dc34..cbff58c 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -1609,7 +1609,6 @@ public class Editor { private boolean mCancelled; public void run() { - Log.d("GILLES", "blinking !!!"); if (mCancelled) { return; } diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index d2a1755..9867e47 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -5340,24 +5340,63 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener physicalWidth, false); } + @Override + public void onResolvedLayoutDirectionReset() { + if (mLayoutAlignment != null) { + int resolvedTextAlignment = getResolvedTextAlignment(); + if (resolvedTextAlignment == TEXT_ALIGNMENT_VIEW_START || + resolvedTextAlignment == TEXT_ALIGNMENT_VIEW_END) { + mLayoutAlignment = null; + } + } + } + private Layout.Alignment getLayoutAlignment() { if (mLayoutAlignment == null) { - switch (mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) { - case Gravity.START: + int textAlign = getResolvedTextAlignment(); + switch (textAlign) { + case TEXT_ALIGNMENT_GRAVITY: + switch (mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) { + case Gravity.START: + mLayoutAlignment = Layout.Alignment.ALIGN_NORMAL; + break; + case Gravity.END: + mLayoutAlignment = Layout.Alignment.ALIGN_OPPOSITE; + break; + case Gravity.LEFT: + mLayoutAlignment = Layout.Alignment.ALIGN_LEFT; + break; + case Gravity.RIGHT: + mLayoutAlignment = Layout.Alignment.ALIGN_RIGHT; + break; + case Gravity.CENTER_HORIZONTAL: + mLayoutAlignment = Layout.Alignment.ALIGN_CENTER; + break; + default: + mLayoutAlignment = Layout.Alignment.ALIGN_NORMAL; + break; + } + break; + case TEXT_ALIGNMENT_TEXT_START: mLayoutAlignment = Layout.Alignment.ALIGN_NORMAL; break; - case Gravity.END: + case TEXT_ALIGNMENT_TEXT_END: mLayoutAlignment = Layout.Alignment.ALIGN_OPPOSITE; break; - case Gravity.LEFT: - mLayoutAlignment = Layout.Alignment.ALIGN_LEFT; + case TEXT_ALIGNMENT_CENTER: + mLayoutAlignment = Layout.Alignment.ALIGN_CENTER; break; - case Gravity.RIGHT: - mLayoutAlignment = Layout.Alignment.ALIGN_RIGHT; + case TEXT_ALIGNMENT_VIEW_START: + mLayoutAlignment = (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) ? + Layout.Alignment.ALIGN_RIGHT : Layout.Alignment.ALIGN_LEFT; break; - case Gravity.CENTER_HORIZONTAL: - mLayoutAlignment = Layout.Alignment.ALIGN_CENTER; + case TEXT_ALIGNMENT_VIEW_END: + mLayoutAlignment = (getResolvedLayoutDirection() == LAYOUT_DIRECTION_RTL) ? + Layout.Alignment.ALIGN_LEFT : Layout.Alignment.ALIGN_RIGHT; break; + case TEXT_ALIGNMENT_INHERIT: + // This should never happen as we have already resolved the text alignment + // but better safe than sorry so we just fall through default: mLayoutAlignment = Layout.Alignment.ALIGN_NORMAL; break; diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java index 3115eff..f1dffa1 100644 --- a/core/java/com/android/internal/app/ActionBarImpl.java +++ b/core/java/com/android/internal/app/ActionBarImpl.java @@ -85,6 +85,8 @@ public class ActionBarImpl extends ActionBar { private TabImpl mSelectedTab; private int mSavedTabPosition = INVALID_POSITION; + private boolean mDisplayHomeAsUpSet; + ActionModeImpl mActionMode; ActionMode mDeferredDestroyActionMode; ActionMode.Callback mDeferredModeDestroyCallback; @@ -375,11 +377,17 @@ public class ActionBarImpl extends ActionBar { } public void setDisplayOptions(int options) { + if ((options & DISPLAY_HOME_AS_UP) != 0) { + mDisplayHomeAsUpSet = true; + } mActionView.setDisplayOptions(options); } public void setDisplayOptions(int options, int mask) { final int current = mActionView.getDisplayOptions(); + if ((mask & DISPLAY_HOME_AS_UP) != 0) { + mDisplayHomeAsUpSet = true; + } mActionView.setDisplayOptions((options & mask) | (current & ~mask)); } @@ -1072,4 +1080,10 @@ public class ActionBarImpl extends ActionBar { public void setLogo(Drawable logo) { mActionView.setLogo(logo); } + + public void setDefaultDisplayHomeAsUpEnabled(boolean enable) { + if (!mDisplayHomeAsUpSet) { + setDisplayHomeAsUpEnabled(enable); + } + } } diff --git a/core/java/com/android/internal/net/NetworkStatsFactory.java b/core/java/com/android/internal/net/NetworkStatsFactory.java index ccd2763..d59585f 100644 --- a/core/java/com/android/internal/net/NetworkStatsFactory.java +++ b/core/java/com/android/internal/net/NetworkStatsFactory.java @@ -16,7 +16,7 @@ package com.android.internal.net; -import static android.net.NetworkStats.SET_DEFAULT; +import static android.net.NetworkStats.SET_ALL; import static android.net.NetworkStats.TAG_NONE; import static android.net.NetworkStats.UID_ALL; import static com.android.server.NetworkManagementSocketTagger.kernelToTag; @@ -101,7 +101,7 @@ public class NetworkStatsFactory { while (reader.hasMoreData()) { entry.iface = reader.nextString(); entry.uid = UID_ALL; - entry.set = SET_DEFAULT; + entry.set = SET_ALL; entry.tag = TAG_NONE; final boolean active = reader.nextInt() != 0; @@ -165,7 +165,7 @@ public class NetworkStatsFactory { entry.iface = iface; entry.uid = UID_ALL; - entry.set = SET_DEFAULT; + entry.set = SET_ALL; entry.tag = TAG_NONE; entry.rxBytes = readSingleLongFromFile(new File(ifacePath, "rx_bytes")); entry.rxPackets = readSingleLongFromFile(new File(ifacePath, "rx_packets")); @@ -193,7 +193,7 @@ public class NetworkStatsFactory { try { entry.iface = values.get(0); entry.uid = UID_ALL; - entry.set = SET_DEFAULT; + entry.set = SET_ALL; entry.tag = TAG_NONE; entry.rxBytes = Long.parseLong(values.get(1)); entry.rxPackets = Long.parseLong(values.get(2)); diff --git a/core/java/com/android/internal/util/Protocol.java b/core/java/com/android/internal/util/Protocol.java index d462d7f..7c2b1b5 100644 --- a/core/java/com/android/internal/util/Protocol.java +++ b/core/java/com/android/internal/util/Protocol.java @@ -49,7 +49,7 @@ public class Protocol { public static final int BASE_DATA_CONNECTION = 0x00040000; public static final int BASE_DATA_CONNECTION_AC = 0x00041000; public static final int BASE_DATA_CONNECTION_TRACKER = 0x00042000; - public static final int BASE_DNS_PINGER = 0x00050000; + public static final int BASE_NSD_MANAGER = 0x00060000; //TODO: define all used protocols } diff --git a/core/java/com/android/internal/widget/ActionBarOverlayLayout.java b/core/java/com/android/internal/widget/ActionBarOverlayLayout.java index 8521481..d1652df 100644 --- a/core/java/com/android/internal/widget/ActionBarOverlayLayout.java +++ b/core/java/com/android/internal/widget/ActionBarOverlayLayout.java @@ -18,14 +18,11 @@ package com.android.internal.widget; import com.android.internal.app.ActionBarImpl; -import android.animation.LayoutTransition; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Rect; import android.util.AttributeSet; -import android.util.Log; import android.view.View; -import android.view.ViewTreeObserver; import android.widget.FrameLayout; /** diff --git a/core/java/com/android/internal/widget/ILockSettings.aidl b/core/java/com/android/internal/widget/ILockSettings.aidl new file mode 100644 index 0000000..c72c770 --- /dev/null +++ b/core/java/com/android/internal/widget/ILockSettings.aidl @@ -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 com.android.internal.widget; + +/** {@hide} */ +interface ILockSettings { + void setBoolean(in String key, in boolean value, in int userId); + void setLong(in String key, in long value, in int userId); + void setString(in String key, in String value, in int userId); + boolean getBoolean(in String key, in boolean defaultValue, in int userId); + long getLong(in String key, in long defaultValue, in int userId); + String getString(in String key, in String defaultValue, in int userId); + void setLockPattern(in byte[] hash, int userId); + boolean checkPattern(in byte[] hash, int userId); + void setLockPassword(in byte[] hash, int userId); + boolean checkPassword(in byte[] hash, int userId); + boolean havePattern(int userId); + boolean havePassword(int userId); + void removeUser(int userId); +} diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 93f90f6..4d308dd 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -21,15 +21,20 @@ import com.android.internal.telephony.ITelephony; import com.google.android.collect.Lists; import android.app.admin.DevicePolicyManager; +import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; +import android.content.IntentFilter; import android.content.pm.PackageManager; +import android.os.Binder; import android.os.FileObserver; import android.os.IBinder; +import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; +import android.os.UserId; import android.os.storage.IMountService; import android.provider.Settings; import android.security.KeyStore; @@ -59,10 +64,6 @@ public class LockPatternUtils { private static final String TAG = "LockPatternUtils"; - private static final String SYSTEM_DIRECTORY = "/system/"; - private static final String LOCK_PATTERN_FILE = "gesture.key"; - private static final String LOCK_PASSWORD_FILE = "password.key"; - /** * The maximum number of incorrect attempts before the user is prevented * from trying again for {@link #FAILED_ATTEMPT_TIMEOUT_MS}. @@ -111,14 +112,14 @@ public class LockPatternUtils { */ 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"; + protected final static String LOCKOUT_PERMANENT_KEY = "lockscreen.lockedoutpermanently"; + protected final static String LOCKOUT_ATTEMPT_DEADLINE = "lockscreen.lockoutattemptdeadline"; + protected final static String PATTERN_EVER_CHOSEN_KEY = "lockscreen.patterneverchosen"; public final static String PASSWORD_TYPE_KEY = "lockscreen.password_type"; public static final String PASSWORD_TYPE_ALTERNATE_KEY = "lockscreen.password_type_alternate"; - private final static String LOCK_PASSWORD_SALT_KEY = "lockscreen.password_salt"; - private final static String DISABLE_LOCKSCREEN_KEY = "lockscreen.disabled"; - private final static String LOCKSCREEN_OPTIONS = "lockscreen.options"; + protected final static String LOCK_PASSWORD_SALT_KEY = "lockscreen.password_salt"; + protected final static String DISABLE_LOCKSCREEN_KEY = "lockscreen.disabled"; + protected final static String LOCKSCREEN_OPTIONS = "lockscreen.options"; public final static String LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK = "lockscreen.biometric_weak_fallback"; public final static String BIOMETRIC_WEAK_EVER_CHOSEN_KEY @@ -126,35 +127,13 @@ public class LockPatternUtils { public final static String LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS = "lockscreen.power_button_instantly_locks"; - private final static String PASSWORD_HISTORY_KEY = "lockscreen.passwordhistory"; + protected final static String PASSWORD_HISTORY_KEY = "lockscreen.passwordhistory"; private final Context mContext; private final ContentResolver mContentResolver; private DevicePolicyManager mDevicePolicyManager; - private static String sLockPatternFilename; - private static String sLockPasswordFilename; - - private static final AtomicBoolean sHaveNonZeroPatternFile = new AtomicBoolean(false); - private static final AtomicBoolean sHaveNonZeroPasswordFile = new AtomicBoolean(false); - - private static FileObserver sPasswordObserver; - - private static class PasswordFileObserver extends FileObserver { - public PasswordFileObserver(String path, int mask) { - super(path, mask); - } - - @Override - public void onEvent(int event, String path) { - if (LOCK_PATTERN_FILE.equals(path)) { - Log.d(TAG, "lock pattern file changed"); - sHaveNonZeroPatternFile.set(new File(sLockPatternFilename).length() > 0); - } else if (LOCK_PASSWORD_FILE.equals(path)) { - Log.d(TAG, "lock password file changed"); - sHaveNonZeroPasswordFile.set(new File(sLockPasswordFilename).length() > 0); - } - } - } + private ILockSettings mLockSettingsService; + private int mCurrentUserId = 0; public DevicePolicyManager getDevicePolicyManager() { if (mDevicePolicyManager == null) { @@ -167,34 +146,27 @@ public class LockPatternUtils { } return mDevicePolicyManager; } + /** * @param contentResolver Used to look up and save settings. */ public LockPatternUtils(Context context) { mContext = context; mContentResolver = context.getContentResolver(); + } - // Initialize the location of gesture & PIN lock files - if (sLockPatternFilename == null) { - String dataSystemDirectory = - android.os.Environment.getDataDirectory().getAbsolutePath() + - SYSTEM_DIRECTORY; - sLockPatternFilename = dataSystemDirectory + LOCK_PATTERN_FILE; - sLockPasswordFilename = dataSystemDirectory + LOCK_PASSWORD_FILE; - sHaveNonZeroPatternFile.set(new File(sLockPatternFilename).length() > 0); - sHaveNonZeroPasswordFile.set(new File(sLockPasswordFilename).length() > 0); - int fileObserverMask = FileObserver.CLOSE_WRITE | FileObserver.DELETE | - FileObserver.MOVED_TO | FileObserver.CREATE; - sPasswordObserver = new PasswordFileObserver(dataSystemDirectory, fileObserverMask); - sPasswordObserver.startWatching(); + private ILockSettings getLockSettings() { + if (mLockSettingsService == null) { + mLockSettingsService = ILockSettings.Stub.asInterface( + (IBinder) ServiceManager.getService("lock_settings")); } + return mLockSettingsService; } public int getRequestedMinimumPasswordLength() { return getDevicePolicyManager().getPasswordMinimumLength(null); } - /** * Gets the device policy password mode. If the mode is non-specific, returns * MODE_PATTERN which allows the user to choose anything. @@ -243,6 +215,33 @@ public class LockPatternUtils { getDevicePolicyManager().reportSuccessfulPasswordAttempt(); } + public void setCurrentUser(int userId) { + if (Process.myUid() == Process.SYSTEM_UID) { + mCurrentUserId = userId; + } else { + throw new SecurityException("Only the system process can set the current user"); + } + } + + public void removeUser(int userId) { + if (Process.myUid() == Process.SYSTEM_UID) { + try { + getLockSettings().removeUser(userId); + } catch (RemoteException re) { + Log.e(TAG, "Couldn't remove lock settings for user " + userId); + } + } + } + + private int getCurrentOrCallingUserId() { + int callingUid = Binder.getCallingUid(); + if (callingUid == android.os.Process.SYSTEM_UID) { + return mCurrentUserId; + } else { + return UserId.getUserId(callingUid); + } + } + /** * Check to see if a pattern matches the saved pattern. If no pattern exists, * always returns true. @@ -250,20 +249,10 @@ public class LockPatternUtils { * @return Whether the pattern matches the stored one. */ public boolean checkPattern(List<LockPatternView.Cell> pattern) { + int userId = getCurrentOrCallingUserId(); try { - // Read all the bytes from the file - RandomAccessFile raf = new RandomAccessFile(sLockPatternFilename, "r"); - final byte[] stored = new byte[(int) raf.length()]; - int got = raf.read(stored, 0, stored.length); - raf.close(); - if (got <= 0) { - return true; - } - // Compare the hash from the file with the entered pattern's hash - return Arrays.equals(stored, LockPatternUtils.patternToHash(pattern)); - } catch (FileNotFoundException fnfe) { - return true; - } catch (IOException ioe) { + return getLockSettings().checkPattern(patternToHash(pattern), userId); + } catch (RemoteException re) { return true; } } @@ -275,20 +264,10 @@ public class LockPatternUtils { * @return Whether the password matches the stored one. */ public boolean checkPassword(String password) { + int userId = getCurrentOrCallingUserId(); try { - // Read all the bytes from the file - RandomAccessFile raf = new RandomAccessFile(sLockPasswordFilename, "r"); - final byte[] stored = new byte[(int) raf.length()]; - int got = raf.read(stored, 0, stored.length); - raf.close(); - if (got <= 0) { - return true; - } - // Compare the hash from the file with the entered password's hash - return Arrays.equals(stored, passwordToHash(password)); - } catch (FileNotFoundException fnfe) { - return true; - } catch (IOException ioe) { + return getLockSettings().checkPassword(passwordToHash(password), userId); + } catch (RemoteException re) { return true; } } @@ -325,7 +304,11 @@ public class LockPatternUtils { * @return Whether a saved pattern exists. */ public boolean savedPatternExists() { - return sHaveNonZeroPatternFile.get(); + try { + return getLockSettings().havePattern(getCurrentOrCallingUserId()); + } catch (RemoteException re) { + return false; + } } /** @@ -333,7 +316,11 @@ public class LockPatternUtils { * @return Whether a saved pattern exists. */ public boolean savedPasswordExists() { - return sHaveNonZeroPasswordFile.get(); + try { + return getLockSettings().havePassword(getCurrentOrCallingUserId()); + } catch (RemoteException re) { + return false; + } } /** @@ -471,15 +458,7 @@ public class LockPatternUtils { // Compute the hash final byte[] hash = LockPatternUtils.patternToHash(pattern); try { - // Write the hash to file - RandomAccessFile raf = new RandomAccessFile(sLockPatternFilename, "rw"); - // Truncate the file if pattern is null, to clear the lock - if (pattern == null) { - raf.setLength(0); - } else { - raf.write(hash, 0, hash.length); - } - raf.close(); + getLockSettings().setLockPattern(hash, getCurrentOrCallingUserId()); DevicePolicyManager dpm = getDevicePolicyManager(); KeyStore keyStore = KeyStore.getInstance(); if (pattern != null) { @@ -505,13 +484,8 @@ public class LockPatternUtils { dpm.setActivePasswordState(DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, 0, 0, 0, 0, 0, 0, 0); } - } catch (FileNotFoundException fnfe) { - // Cant do much, unless we want to fail over to using the settings - // provider - Log.e(TAG, "Unable to save lock pattern to " + sLockPatternFilename); - } catch (IOException ioe) { - // Cant do much - Log.e(TAG, "Unable to save lock pattern to " + sLockPatternFilename); + } catch (RemoteException re) { + Log.e(TAG, "Couldn't save lock pattern " + re); } } @@ -586,15 +560,7 @@ public class LockPatternUtils { // Compute the hash final byte[] hash = passwordToHash(password); try { - // Write the hash to file - RandomAccessFile raf = new RandomAccessFile(sLockPasswordFilename, "rw"); - // Truncate the file if pattern is null, to clear the lock - if (password == null) { - raf.setLength(0); - } else { - raf.write(hash, 0, hash.length); - } - raf.close(); + getLockSettings().setLockPassword(hash, getCurrentOrCallingUserId()); DevicePolicyManager dpm = getDevicePolicyManager(); KeyStore keyStore = KeyStore.getInstance(); if (password != null) { @@ -676,12 +642,9 @@ public class LockPatternUtils { dpm.setActivePasswordState( DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, 0, 0, 0, 0, 0, 0, 0); } - } catch (FileNotFoundException fnfe) { - // Cant do much, unless we want to fail over to using the settings provider - Log.e(TAG, "Unable to save lock pattern to " + sLockPasswordFilename); - } catch (IOException ioe) { + } catch (RemoteException re) { // Cant do much - Log.e(TAG, "Unable to save lock pattern to " + sLockPasswordFilename); + Log.e(TAG, "Unable to save lock password " + re); } } @@ -1013,30 +976,57 @@ public class LockPatternUtils { } private boolean getBoolean(String secureSettingKey, boolean defaultValue) { - return 1 == - android.provider.Settings.Secure.getInt(mContentResolver, secureSettingKey, - defaultValue ? 1 : 0); + try { + return getLockSettings().getBoolean(secureSettingKey, defaultValue, + getCurrentOrCallingUserId()); + } catch (RemoteException re) { + return defaultValue; + } } private void setBoolean(String secureSettingKey, boolean enabled) { - android.provider.Settings.Secure.putInt(mContentResolver, secureSettingKey, - enabled ? 1 : 0); + try { + getLockSettings().setBoolean(secureSettingKey, enabled, getCurrentOrCallingUserId()); + } catch (RemoteException re) { + // What can we do? + Log.e(TAG, "Couldn't write boolean " + secureSettingKey + re); + } } - private long getLong(String secureSettingKey, long def) { - return android.provider.Settings.Secure.getLong(mContentResolver, secureSettingKey, def); + private long getLong(String secureSettingKey, long defaultValue) { + try { + return getLockSettings().getLong(secureSettingKey, defaultValue, + getCurrentOrCallingUserId()); + } catch (RemoteException re) { + return defaultValue; + } } private void setLong(String secureSettingKey, long value) { - android.provider.Settings.Secure.putLong(mContentResolver, secureSettingKey, value); + try { + getLockSettings().setLong(secureSettingKey, value, getCurrentOrCallingUserId()); + } catch (RemoteException re) { + // What can we do? + Log.e(TAG, "Couldn't write long " + secureSettingKey + re); + } } private String getString(String secureSettingKey) { - return android.provider.Settings.Secure.getString(mContentResolver, secureSettingKey); + try { + return getLockSettings().getString(secureSettingKey, null, + getCurrentOrCallingUserId()); + } catch (RemoteException re) { + return null; + } } private void setString(String secureSettingKey, String value) { - android.provider.Settings.Secure.putString(mContentResolver, secureSettingKey, value); + try { + getLockSettings().setString(secureSettingKey, value, getCurrentOrCallingUserId()); + } catch (RemoteException re) { + // What can we do? + Log.e(TAG, "Couldn't write string " + secureSettingKey + re); + } } public boolean isSecure() { diff --git a/core/java/com/android/internal/widget/LockSettingsService.java b/core/java/com/android/internal/widget/LockSettingsService.java new file mode 100644 index 0000000..24c7161 --- /dev/null +++ b/core/java/com/android/internal/widget/LockSettingsService.java @@ -0,0 +1,388 @@ +/* + * 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.widget; + +import android.content.ContentResolver; +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.os.Binder; +import android.os.RemoteException; +import android.os.UserId; +import android.provider.Settings; +import android.provider.Settings.Secure; +import android.text.TextUtils; +import android.util.Slog; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.Arrays; + +/** + * Keeps the lock pattern/password data and related settings for each user. + * Used by LockPatternUtils. Needs to be a service because Settings app also needs + * to be able to save lockscreen information for secondary users. + * @hide + */ +public class LockSettingsService extends ILockSettings.Stub { + + private final DatabaseHelper mOpenHelper; + private static final String TAG = "LockSettingsService"; + + private static final String TABLE = "locksettings"; + private static final String COLUMN_KEY = "name"; + private static final String COLUMN_USERID = "user"; + private static final String COLUMN_VALUE = "value"; + + private static final String[] COLUMNS_FOR_QUERY = { + COLUMN_VALUE + }; + + private static final String SYSTEM_DIRECTORY = "/system/"; + private static final String LOCK_PATTERN_FILE = "gesture.key"; + private static final String LOCK_PASSWORD_FILE = "password.key"; + + private final Context mContext; + + public LockSettingsService(Context context) { + mContext = context; + // Open the database + mOpenHelper = new DatabaseHelper(mContext); + } + + public void systemReady() { + migrateOldData(); + } + + private void migrateOldData() { + try { + if (getString("migrated", null, 0) != null) { + // Already migrated + return; + } + + final ContentResolver cr = mContext.getContentResolver(); + for (String validSetting : VALID_SETTINGS) { + String value = Settings.Secure.getString(cr, validSetting); + if (value != null) { + setString(validSetting, value, 0); + } + } + // No need to move the password / pattern files. They're already in the right place. + setString("migrated", "true", 0); + Slog.i(TAG, "Migrated lock settings to new location"); + } catch (RemoteException re) { + Slog.e(TAG, "Unable to migrate old data"); + } + } + + private static final void checkWritePermission(int userId) { + final int callingUid = Binder.getCallingUid(); + if (UserId.getAppId(callingUid) != android.os.Process.SYSTEM_UID) { + throw new SecurityException("uid=" + callingUid + + " not authorized to write lock settings"); + } + } + + private static final void checkPasswordReadPermission(int userId) { + final int callingUid = Binder.getCallingUid(); + if (UserId.getAppId(callingUid) != android.os.Process.SYSTEM_UID) { + throw new SecurityException("uid=" + callingUid + + " not authorized to read lock password"); + } + } + + private static final void checkReadPermission(int userId) { + final int callingUid = Binder.getCallingUid(); + if (UserId.getAppId(callingUid) != android.os.Process.SYSTEM_UID + && UserId.getUserId(callingUid) != userId) { + throw new SecurityException("uid=" + callingUid + + " not authorized to read settings of user " + userId); + } + } + + @Override + public void setBoolean(String key, boolean value, int userId) throws RemoteException { + checkWritePermission(userId); + + writeToDb(key, value ? "1" : "0", userId); + } + + @Override + public void setLong(String key, long value, int userId) throws RemoteException { + checkWritePermission(userId); + + writeToDb(key, Long.toString(value), userId); + } + + @Override + public void setString(String key, String value, int userId) throws RemoteException { + checkWritePermission(userId); + + writeToDb(key, value, userId); + } + + @Override + public boolean getBoolean(String key, boolean defaultValue, int userId) throws RemoteException { + //checkReadPermission(userId); + + String value = readFromDb(key, null, userId); + return TextUtils.isEmpty(value) ? + defaultValue : (value.equals("1") || value.equals("true")); + } + + @Override + public long getLong(String key, long defaultValue, int userId) throws RemoteException { + //checkReadPermission(userId); + + String value = readFromDb(key, null, userId); + return TextUtils.isEmpty(value) ? defaultValue : Long.parseLong(value); + } + + @Override + public String getString(String key, String defaultValue, int userId) throws RemoteException { + //checkReadPermission(userId); + + return readFromDb(key, defaultValue, userId); + } + + private String getLockPatternFilename(int userId) { + String dataSystemDirectory = + android.os.Environment.getDataDirectory().getAbsolutePath() + + SYSTEM_DIRECTORY; + if (userId == 0) { + // Leave it in the same place for user 0 + return dataSystemDirectory + LOCK_PATTERN_FILE; + } else { + return dataSystemDirectory + "users/" + userId + "/" + LOCK_PATTERN_FILE; + } + } + + private String getLockPasswordFilename(int userId) { + String dataSystemDirectory = + android.os.Environment.getDataDirectory().getAbsolutePath() + + SYSTEM_DIRECTORY; + if (userId == 0) { + // Leave it in the same place for user 0 + return dataSystemDirectory + LOCK_PASSWORD_FILE; + } else { + return dataSystemDirectory + "users/" + userId + "/" + LOCK_PASSWORD_FILE; + } + } + + @Override + public boolean havePassword(int userId) throws RemoteException { + // Do we need a permissions check here? + + return new File(getLockPasswordFilename(userId)).length() > 0; + } + + @Override + public boolean havePattern(int userId) throws RemoteException { + // Do we need a permissions check here? + + return new File(getLockPatternFilename(userId)).length() > 0; + } + + @Override + public void setLockPattern(byte[] hash, int userId) throws RemoteException { + checkWritePermission(userId); + + writeFile(getLockPatternFilename(userId), hash); + } + + @Override + public boolean checkPattern(byte[] hash, int userId) throws RemoteException { + checkPasswordReadPermission(userId); + try { + // Read all the bytes from the file + RandomAccessFile raf = new RandomAccessFile(getLockPatternFilename(userId), "r"); + final byte[] stored = new byte[(int) raf.length()]; + int got = raf.read(stored, 0, stored.length); + raf.close(); + if (got <= 0) { + return true; + } + // Compare the hash from the file with the entered pattern's hash + return Arrays.equals(stored, hash); + } catch (FileNotFoundException fnfe) { + Slog.e(TAG, "Cannot read file " + fnfe); + return true; + } catch (IOException ioe) { + Slog.e(TAG, "Cannot read file " + ioe); + return true; + } + } + + @Override + public void setLockPassword(byte[] hash, int userId) throws RemoteException { + checkWritePermission(userId); + + writeFile(getLockPasswordFilename(userId), hash); + } + + @Override + public boolean checkPassword(byte[] hash, int userId) throws RemoteException { + checkPasswordReadPermission(userId); + + try { + // Read all the bytes from the file + RandomAccessFile raf = new RandomAccessFile(getLockPasswordFilename(userId), "r"); + final byte[] stored = new byte[(int) raf.length()]; + int got = raf.read(stored, 0, stored.length); + raf.close(); + if (got <= 0) { + return true; + } + // Compare the hash from the file with the entered password's hash + return Arrays.equals(stored, hash); + } catch (FileNotFoundException fnfe) { + Slog.e(TAG, "Cannot read file " + fnfe); + return true; + } catch (IOException ioe) { + Slog.e(TAG, "Cannot read file " + ioe); + return true; + } + } + + @Override + public void removeUser(int userId) { + checkWritePermission(userId); + + SQLiteDatabase db = mOpenHelper.getWritableDatabase(); + try { + File file = new File(getLockPasswordFilename(userId)); + if (file.exists()) { + file.delete(); + } + file = new File(getLockPatternFilename(userId)); + if (file.exists()) { + file.delete(); + } + + db.beginTransaction(); + db.delete(TABLE, COLUMN_USERID + "='" + userId + "'", null); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + } + + private void writeFile(String name, byte[] hash) { + try { + // Write the hash to file + RandomAccessFile raf = new RandomAccessFile(name, "rw"); + // Truncate the file if pattern is null, to clear the lock + if (hash == null || hash.length == 0) { + raf.setLength(0); + } else { + raf.write(hash, 0, hash.length); + } + raf.close(); + } catch (IOException ioe) { + Slog.e(TAG, "Error writing to file " + ioe); + } + } + + private void writeToDb(String key, String value, int userId) { + ContentValues cv = new ContentValues(); + cv.put(COLUMN_KEY, key); + cv.put(COLUMN_USERID, userId); + cv.put(COLUMN_VALUE, value); + + SQLiteDatabase db = mOpenHelper.getWritableDatabase(); + db.beginTransaction(); + try { + db.delete(TABLE, COLUMN_KEY + "=? AND " + COLUMN_USERID + "=?", + new String[] {key, Integer.toString(userId)}); + db.insert(TABLE, null, cv); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + } + + private String readFromDb(String key, String defaultValue, int userId) { + Cursor cursor; + String result = defaultValue; + SQLiteDatabase db = mOpenHelper.getReadableDatabase(); + if ((cursor = db.query(TABLE, COLUMNS_FOR_QUERY, + COLUMN_USERID + "=? AND " + COLUMN_KEY + "=?", + new String[] { Integer.toString(userId), key }, + null, null, null)) != null) { + if (cursor.moveToFirst()) { + result = cursor.getString(0); + } + cursor.close(); + } + return result; + } + + class DatabaseHelper extends SQLiteOpenHelper { + private static final String TAG = "LockSettingsDB"; + private static final String DATABASE_NAME = "locksettings.db"; + + private static final int DATABASE_VERSION = 1; + + public DatabaseHelper(Context context) { + super(context, DATABASE_NAME, null, DATABASE_VERSION); + setWriteAheadLoggingEnabled(true); + } + + private void createTable(SQLiteDatabase db) { + db.execSQL("CREATE TABLE " + TABLE + " (" + + "_id INTEGER PRIMARY KEY AUTOINCREMENT," + + COLUMN_KEY + " TEXT," + + COLUMN_USERID + " INTEGER," + + COLUMN_VALUE + " TEXT" + + ");"); + } + + @Override + public void onCreate(SQLiteDatabase db) { + createTable(db); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int currentVersion) { + // Nothing yet + } + } + + private static final String[] VALID_SETTINGS = new String[] { + LockPatternUtils.LOCKOUT_PERMANENT_KEY, + LockPatternUtils.LOCKOUT_ATTEMPT_DEADLINE, + LockPatternUtils.PATTERN_EVER_CHOSEN_KEY, + LockPatternUtils.PASSWORD_TYPE_KEY, + LockPatternUtils.PASSWORD_TYPE_ALTERNATE_KEY, + LockPatternUtils.LOCK_PASSWORD_SALT_KEY, + LockPatternUtils.DISABLE_LOCKSCREEN_KEY, + LockPatternUtils.LOCKSCREEN_OPTIONS, + LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, + LockPatternUtils.BIOMETRIC_WEAK_EVER_CHOSEN_KEY, + LockPatternUtils.LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, + LockPatternUtils.PASSWORD_HISTORY_KEY, + Secure.LOCK_PATTERN_ENABLED, + Secure.LOCK_BIOMETRIC_WEAK_FLAGS, + Secure.LOCK_PATTERN_VISIBLE, + Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED + }; +} diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp index 5e73a5f..3c27caf 100644 --- a/core/jni/android/graphics/Bitmap.cpp +++ b/core/jni/android/graphics/Bitmap.cpp @@ -236,7 +236,7 @@ static jobject Bitmap_creator(JNIEnv* env, jobject, jintArray jColors, 0, 0, width, height, bitmap);
}
- return GraphicsJNI::createBitmap(env, new SkBitmap(bitmap), buff, isMutable, NULL);
+ return GraphicsJNI::createBitmap(env, new SkBitmap(bitmap), buff, isMutable, NULL, NULL);
}
static jobject Bitmap_copy(JNIEnv* env, jobject, const SkBitmap* src,
@@ -248,7 +248,7 @@ static jobject Bitmap_copy(JNIEnv* env, jobject, const SkBitmap* src, return NULL;
}
- return GraphicsJNI::createBitmap(env, new SkBitmap(result), allocator.getStorageObj(), isMutable, NULL);
+ return GraphicsJNI::createBitmap(env, new SkBitmap(result), allocator.getStorageObj(), isMutable, NULL, NULL);
}
static void Bitmap_destructor(JNIEnv* env, jobject, SkBitmap* bitmap) {
@@ -407,7 +407,7 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) { bitmap->unlockPixels();
blob.release();
- return GraphicsJNI::createBitmap(env, bitmap, buffer, isMutable, NULL, density);
+ return GraphicsJNI::createBitmap(env, bitmap, buffer, isMutable, NULL, NULL, density);
}
static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
@@ -485,7 +485,7 @@ static jobject Bitmap_extractAlpha(JNIEnv* env, jobject clazz, env->ReleaseIntArrayElements(offsetXY, array, 0);
}
- return GraphicsJNI::createBitmap(env, dst, allocator.getStorageObj(), true, NULL);
+ return GraphicsJNI::createBitmap(env, dst, allocator.getStorageObj(), true, NULL, NULL);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp index dcd1d28..dd59444 100644 --- a/core/jni/android/graphics/BitmapFactory.cpp +++ b/core/jni/android/graphics/BitmapFactory.cpp @@ -35,6 +35,7 @@ jfieldID gOptions_mimeFieldID; jfieldID gOptions_mCancelID; jfieldID gOptions_bitmapFieldID; jfieldID gBitmap_nativeBitmapFieldID; +jfieldID gBitmap_layoutBoundsFieldID; #if 0 #define TRACE_BITMAP(code) code @@ -276,7 +277,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, } jbyteArray ninePatchChunk = NULL; - if (peeker.fPatchIsValid) { + if (peeker.fPatch != NULL) { if (willScale) { scaleNinePatchChunk(peeker.fPatch, scale); } @@ -296,6 +297,18 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, env->ReleasePrimitiveArrayCritical(ninePatchChunk, array, 0); } + jintArray layoutBounds = NULL; + if (peeker.fLayoutBounds != NULL) { + layoutBounds = env->NewIntArray(4); + if (layoutBounds == NULL) { + return nullObjectReturn("layoutBounds == null"); + } + + env->SetIntArrayRegion(layoutBounds, 0, 4, (jint*) peeker.fLayoutBounds); + if (javaBitmap != NULL) { + env->SetObjectField(javaBitmap, gBitmap_layoutBoundsFieldID, layoutBounds); + } + } // detach bitmap from its autodeleter, since we want to own it now adb.detach(); @@ -321,7 +334,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, } if (padding) { - if (peeker.fPatchIsValid) { + if (peeker.fPatch != NULL) { GraphicsJNI::set_jrect(env, padding, peeker.fPatch->paddingLeft, peeker.fPatch->paddingTop, peeker.fPatch->paddingRight, peeker.fPatch->paddingBottom); @@ -350,7 +363,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, } // now create the java bitmap return GraphicsJNI::createBitmap(env, bitmap, javaAllocator.getStorageObj(), - isMutable, ninePatchChunk); + isMutable, ninePatchChunk, layoutBounds, -1); } static jobject nativeDecodeStreamScaled(JNIEnv* env, jobject clazz, jobject is, jbyteArray storage, @@ -576,7 +589,7 @@ int register_android_graphics_BitmapFactory(JNIEnv* env) { jclass bitmap_class = env->FindClass("android/graphics/Bitmap"); SkASSERT(bitmap_class); gBitmap_nativeBitmapFieldID = getFieldIDCheck(env, bitmap_class, "mNativeBitmap", "I"); - + gBitmap_layoutBoundsFieldID = getFieldIDCheck(env, bitmap_class, "mLayoutBounds", "[I"); int ret = AndroidRuntime::registerNativeMethods(env, "android/graphics/BitmapFactory$Options", gOptionsMethods, diff --git a/core/jni/android/graphics/BitmapRegionDecoder.cpp b/core/jni/android/graphics/BitmapRegionDecoder.cpp index 682877a..dd8e84f 100644 --- a/core/jni/android/graphics/BitmapRegionDecoder.cpp +++ b/core/jni/android/graphics/BitmapRegionDecoder.cpp @@ -244,7 +244,7 @@ static jobject nativeDecodeRegion(JNIEnv* env, jobject, SkBitmapRegionDecoder *b JavaPixelAllocator* allocator = (JavaPixelAllocator*) decoder->getAllocator(); jbyteArray buff = allocator->getStorageObjAndReset(); - return GraphicsJNI::createBitmap(env, bitmap, buff, false, NULL, -1); + return GraphicsJNI::createBitmap(env, bitmap, buff, false, NULL, NULL, -1); } static int nativeGetHeight(JNIEnv* env, jobject, SkBitmapRegionDecoder *brd) { diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp index a1d41ee..d4c7600 100644 --- a/core/jni/android/graphics/Graphics.cpp +++ b/core/jni/android/graphics/Graphics.cpp @@ -345,14 +345,14 @@ SkRegion* GraphicsJNI::getNativeRegion(JNIEnv* env, jobject region) /////////////////////////////////////////////////////////////////////////////////////////// jobject GraphicsJNI::createBitmap(JNIEnv* env, SkBitmap* bitmap, jbyteArray buffer, - bool isMutable, jbyteArray ninepatch, int density) + bool isMutable, jbyteArray ninepatch, jintArray layoutbounds, + int density) { SkASSERT(bitmap); SkASSERT(bitmap->pixelRef()); - jobject obj = env->NewObject(gBitmap_class, gBitmap_constructorMethodID, static_cast<jint>(reinterpret_cast<uintptr_t>(bitmap)), - buffer, isMutable, ninepatch, density); + buffer, isMutable, ninepatch, layoutbounds, density); hasException(env); // For the side effect of logging. return obj; } @@ -360,7 +360,7 @@ jobject GraphicsJNI::createBitmap(JNIEnv* env, SkBitmap* bitmap, jbyteArray buff jobject GraphicsJNI::createBitmap(JNIEnv* env, SkBitmap* bitmap, bool isMutable, jbyteArray ninepatch, int density) { - return createBitmap(env, bitmap, NULL, isMutable, ninepatch, density); + return createBitmap(env, bitmap, NULL, isMutable, ninepatch, NULL, density); } @@ -587,7 +587,7 @@ int register_android_graphics_Graphics(JNIEnv* env) gBitmap_class = make_globalref(env, "android/graphics/Bitmap"); gBitmap_nativeInstanceID = getFieldIDCheck(env, gBitmap_class, "mNativeBitmap", "I"); gBitmap_constructorMethodID = env->GetMethodID(gBitmap_class, "<init>", - "(I[BZ[BI)V"); + "(I[BZ[B[II)V"); gBitmapRegionDecoder_class = make_globalref(env, "android/graphics/BitmapRegionDecoder"); gBitmapRegionDecoder_constructorMethodID = env->GetMethodID(gBitmapRegionDecoder_class, "<init>", "(I)V"); diff --git a/core/jni/android/graphics/GraphicsJNI.h b/core/jni/android/graphics/GraphicsJNI.h index cc32f44..c5b06f5 100644 --- a/core/jni/android/graphics/GraphicsJNI.h +++ b/core/jni/android/graphics/GraphicsJNI.h @@ -53,7 +53,8 @@ public: storage array (may be null). */ static jobject createBitmap(JNIEnv* env, SkBitmap* bitmap, jbyteArray buffer, - bool isMutable, jbyteArray ninepatch, int density = -1); + bool isMutable, jbyteArray ninepatch, jintArray layoutbounds, + int density = -1); static jobject createBitmap(JNIEnv* env, SkBitmap* bitmap, bool isMutable, jbyteArray ninepatch, int density = -1); diff --git a/core/jni/android/graphics/NinePatchPeeker.cpp b/core/jni/android/graphics/NinePatchPeeker.cpp index 365d985..df996af 100644 --- a/core/jni/android/graphics/NinePatchPeeker.cpp +++ b/core/jni/android/graphics/NinePatchPeeker.cpp @@ -31,14 +31,11 @@ bool NinePatchPeeker::peek(const char tag[], const void* data, size_t length) { // this relies on deserialization being done in place Res_png_9patch::deserialize(patchNew); patchNew->fileToDevice(); - if (fPatchIsValid) { - free(fPatch); - } + free(fPatch); fPatch = patchNew; //printf("9patch: (%d,%d)-(%d,%d)\n", // fPatch.sizeLeft, fPatch.sizeTop, // fPatch.sizeRight, fPatch.sizeBottom); - fPatchIsValid = true; // now update our host to force index or 32bit config // 'cause we don't want 565 predithered, since as a 9patch, we know @@ -52,8 +49,9 @@ bool NinePatchPeeker::peek(const char tag[], const void* data, size_t length) { SkBitmap::kARGB_8888_Config, }; fHost->setPrefConfigTable(gNo565Pref); - } else { - fPatch = NULL; + } else if (strcmp("npLb", tag) == 0 && length == sizeof(int) * 4) { + fLayoutBounds = new int[4]; + memcpy(fLayoutBounds, data, sizeof(int) * 4); } return true; // keep on decoding } diff --git a/core/jni/android/graphics/NinePatchPeeker.h b/core/jni/android/graphics/NinePatchPeeker.h index 207536c..10d268a 100644 --- a/core/jni/android/graphics/NinePatchPeeker.h +++ b/core/jni/android/graphics/NinePatchPeeker.h @@ -28,17 +28,17 @@ public: NinePatchPeeker(SkImageDecoder* host) { // the host lives longer than we do, so a raw ptr is safe fHost = host; - fPatchIsValid = false; + fPatch = NULL; + fLayoutBounds = NULL; } ~NinePatchPeeker() { - if (fPatchIsValid) { - free(fPatch); - } + free(fPatch); + delete fLayoutBounds; } - bool fPatchIsValid; Res_png_9patch* fPatch; + int *fLayoutBounds; virtual bool peek(const char tag[], const void* data, size_t length); }; diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp index 3d350ed..244b166 100644 --- a/core/jni/android/graphics/SurfaceTexture.cpp +++ b/core/jni/android/graphics/SurfaceTexture.cpp @@ -218,6 +218,18 @@ static jint SurfaceTexture_updateTexImage(JNIEnv* env, jobject thiz) return surfaceTexture->updateTexImage(); } +static jint SurfaceTexture_detachFromGLContext(JNIEnv* env, jobject thiz) +{ + sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); + return surfaceTexture->detachFromContext(); +} + +static jint SurfaceTexture_attachToGLContext(JNIEnv* env, jobject thiz, jint tex) +{ + sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz)); + return surfaceTexture->attachToContext((GLuint)tex); +} + static void SurfaceTexture_getTransformMatrix(JNIEnv* env, jobject thiz, jfloatArray jmtx) { @@ -242,14 +254,16 @@ static void SurfaceTexture_release(JNIEnv* env, jobject thiz) // ---------------------------------------------------------------------------- static JNINativeMethod gSurfaceTextureMethods[] = { - {"nativeClassInit", "()V", (void*)SurfaceTexture_classInit }, - {"nativeInit", "(ILjava/lang/Object;Z)V", (void*)SurfaceTexture_init }, - {"nativeFinalize", "()V", (void*)SurfaceTexture_finalize }, + {"nativeClassInit", "()V", (void*)SurfaceTexture_classInit }, + {"nativeInit", "(ILjava/lang/Object;Z)V", (void*)SurfaceTexture_init }, + {"nativeFinalize", "()V", (void*)SurfaceTexture_finalize }, {"nativeSetDefaultBufferSize", "(II)V", (void*)SurfaceTexture_setDefaultBufferSize }, - {"nativeUpdateTexImage", "()I", (void*)SurfaceTexture_updateTexImage }, - {"nativeGetTransformMatrix", "([F)V", (void*)SurfaceTexture_getTransformMatrix }, - {"nativeGetTimestamp", "()J", (void*)SurfaceTexture_getTimestamp }, - {"nativeRelease", "()V", (void*)SurfaceTexture_release }, + {"nativeUpdateTexImage", "()I", (void*)SurfaceTexture_updateTexImage }, + {"nativeDetachFromGLContext", "()I", (void*)SurfaceTexture_detachFromGLContext }, + {"nativeAttachToGLContext", "(I)I", (void*)SurfaceTexture_attachToGLContext }, + {"nativeGetTransformMatrix", "([F)V", (void*)SurfaceTexture_getTransformMatrix }, + {"nativeGetTimestamp", "()J", (void*)SurfaceTexture_getTimestamp }, + {"nativeRelease", "()V", (void*)SurfaceTexture_release }, }; int register_android_graphics_SurfaceTexture(JNIEnv* env) diff --git a/core/jni/android_app_NativeActivity.cpp b/core/jni/android_app_NativeActivity.cpp index 655a834..19bc154 100644 --- a/core/jni/android_app_NativeActivity.cpp +++ b/core/jni/android_app_NativeActivity.cpp @@ -416,8 +416,8 @@ struct NativeCode : public ANativeActivity { if (env != NULL && clazz != NULL) { env->DeleteGlobalRef(clazz); } - if (looper != NULL && mainWorkRead >= 0) { - looper->removeFd(mainWorkRead); + if (messageQueue != NULL && mainWorkRead >= 0) { + messageQueue->getLooper()->removeFd(mainWorkRead); } if (nativeInputQueue != NULL) { nativeInputQueue->mWorkWrite = -1; @@ -481,7 +481,7 @@ struct NativeCode : public ANativeActivity { // These are used to wake up the main thread to process work. int mainWorkRead; int mainWorkWrite; - sp<Looper> looper; + sp<MessageQueue> messageQueue; }; void android_NativeActivity_finish(ANativeActivity* activity) { @@ -515,16 +515,6 @@ void android_NativeActivity_hideSoftInput( // ------------------------------------------------------------------------ -static bool checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) { - if (env->ExceptionCheck()) { - ALOGE("An exception was thrown by callback '%s'.", methodName); - LOGE_EX(env); - env->ExceptionClear(); - return true; - } - return false; -} - /* * Callback for handling native events on the application's main thread. */ @@ -551,7 +541,8 @@ static int mainWorkCallback(int fd, int events, void* data) { if (inputEventObj) { handled = code->env->CallBooleanMethod(code->clazz, gNativeActivityClassInfo.dispatchUnhandledKeyEvent, inputEventObj); - checkAndClearExceptionFromCallback(code->env, "dispatchUnhandledKeyEvent"); + code->messageQueue->raiseAndClearException( + code->env, "dispatchUnhandledKeyEvent"); code->env->DeleteLocalRef(inputEventObj); } else { ALOGE("Failed to obtain key event for dispatchUnhandledKeyEvent."); @@ -566,7 +557,7 @@ static int mainWorkCallback(int fd, int events, void* data) { if (inputEventObj) { code->env->CallVoidMethod(code->clazz, gNativeActivityClassInfo.preDispatchKeyEvent, inputEventObj, seq); - checkAndClearExceptionFromCallback(code->env, "preDispatchKeyEvent"); + code->messageQueue->raiseAndClearException(code->env, "preDispatchKeyEvent"); code->env->DeleteLocalRef(inputEventObj); } else { ALOGE("Failed to obtain key event for preDispatchKeyEvent."); @@ -575,27 +566,27 @@ static int mainWorkCallback(int fd, int events, void* data) { } break; case CMD_FINISH: { code->env->CallVoidMethod(code->clazz, gNativeActivityClassInfo.finish); - checkAndClearExceptionFromCallback(code->env, "finish"); + code->messageQueue->raiseAndClearException(code->env, "finish"); } break; case CMD_SET_WINDOW_FORMAT: { code->env->CallVoidMethod(code->clazz, gNativeActivityClassInfo.setWindowFormat, work.arg1); - checkAndClearExceptionFromCallback(code->env, "setWindowFormat"); + code->messageQueue->raiseAndClearException(code->env, "setWindowFormat"); } break; case CMD_SET_WINDOW_FLAGS: { code->env->CallVoidMethod(code->clazz, gNativeActivityClassInfo.setWindowFlags, work.arg1, work.arg2); - checkAndClearExceptionFromCallback(code->env, "setWindowFlags"); + code->messageQueue->raiseAndClearException(code->env, "setWindowFlags"); } break; case CMD_SHOW_SOFT_INPUT: { code->env->CallVoidMethod(code->clazz, gNativeActivityClassInfo.showIme, work.arg1); - checkAndClearExceptionFromCallback(code->env, "showIme"); + code->messageQueue->raiseAndClearException(code->env, "showIme"); } break; case CMD_HIDE_SOFT_INPUT: { code->env->CallVoidMethod(code->clazz, gNativeActivityClassInfo.hideIme, work.arg1); - checkAndClearExceptionFromCallback(code->env, "hideIme"); + code->messageQueue->raiseAndClearException(code->env, "hideIme"); } break; default: ALOGW("Unknown work command: %d", work.cmd); @@ -634,9 +625,9 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName return 0; } - code->looper = android_os_MessageQueue_getLooper(env, messageQueue); - if (code->looper == NULL) { - ALOGW("Unable to retrieve MessageQueue's Looper"); + code->messageQueue = android_os_MessageQueue_getMessageQueue(env, messageQueue); + if (code->messageQueue == NULL) { + ALOGW("Unable to retrieve native MessageQueue"); delete code; return 0; } @@ -655,7 +646,8 @@ loadNativeCode_native(JNIEnv* env, jobject clazz, jstring path, jstring funcName result = fcntl(code->mainWorkWrite, F_SETFL, O_NONBLOCK); SLOGW_IF(result != 0, "Could not make main work write pipe " "non-blocking: %s", strerror(errno)); - code->looper->addFd(code->mainWorkRead, 0, ALOOPER_EVENT_INPUT, mainWorkCallback, code); + code->messageQueue->getLooper()->addFd( + code->mainWorkRead, 0, ALOOPER_EVENT_INPUT, mainWorkCallback, code); code->ANativeActivity::callbacks = &code->callbacks; if (env->GetJavaVM(&code->vm) < 0) { diff --git a/core/jni/android_os_MessageQueue.cpp b/core/jni/android_os_MessageQueue.cpp index 12a77d5..a4dcac6 100644 --- a/core/jni/android_os_MessageQueue.cpp +++ b/core/jni/android_os_MessageQueue.cpp @@ -17,6 +17,7 @@ #define LOG_TAG "MessageQueue-JNI" #include "JNIHelp.h" +#include <android_runtime/AndroidRuntime.h> #include <utils/Looper.h> #include <utils/Log.h> @@ -24,31 +25,46 @@ namespace android { -// ---------------------------------------------------------------------------- - static struct { jfieldID mPtr; // native object attached to the DVM MessageQueue } gMessageQueueClassInfo; -// ---------------------------------------------------------------------------- -class NativeMessageQueue { +class NativeMessageQueue : public MessageQueue { public: NativeMessageQueue(); - ~NativeMessageQueue(); + virtual ~NativeMessageQueue(); + + virtual void raiseException(JNIEnv* env, const char* msg, jthrowable exceptionObj); - inline sp<Looper> getLooper() { return mLooper; } + void pollOnce(JNIEnv* env, int timeoutMillis); - void pollOnce(int timeoutMillis); void wake(); private: - sp<Looper> mLooper; + bool mInCallback; + jthrowable mExceptionObj; }; -// ---------------------------------------------------------------------------- -NativeMessageQueue::NativeMessageQueue() { +MessageQueue::MessageQueue() { +} + +MessageQueue::~MessageQueue() { +} + +bool MessageQueue::raiseAndClearException(JNIEnv* env, const char* msg) { + jthrowable exceptionObj = env->ExceptionOccurred(); + if (exceptionObj) { + env->ExceptionClear(); + raiseException(env, msg, exceptionObj); + env->DeleteLocalRef(exceptionObj); + return true; + } + return false; +} + +NativeMessageQueue::NativeMessageQueue() : mInCallback(false), mExceptionObj(NULL) { mLooper = Looper::getForThread(); if (mLooper == NULL) { mLooper = new Looper(false); @@ -59,8 +75,32 @@ NativeMessageQueue::NativeMessageQueue() { NativeMessageQueue::~NativeMessageQueue() { } -void NativeMessageQueue::pollOnce(int timeoutMillis) { +void NativeMessageQueue::raiseException(JNIEnv* env, const char* msg, jthrowable exceptionObj) { + if (exceptionObj) { + if (mInCallback) { + if (mExceptionObj) { + env->DeleteLocalRef(mExceptionObj); + } + mExceptionObj = jthrowable(env->NewLocalRef(exceptionObj)); + ALOGE("Exception in MessageQueue callback: %s", msg); + jniLogException(env, ANDROID_LOG_ERROR, LOG_TAG, exceptionObj); + } else { + ALOGE("Exception: %s", msg); + jniLogException(env, ANDROID_LOG_ERROR, LOG_TAG, exceptionObj); + LOG_ALWAYS_FATAL("raiseException() was called when not in a callback, exiting."); + } + } +} + +void NativeMessageQueue::pollOnce(JNIEnv* env, int timeoutMillis) { + mInCallback = true; mLooper->pollOnce(timeoutMillis); + mInCallback = false; + if (mExceptionObj) { + env->Throw(mExceptionObj); + env->DeleteLocalRef(mExceptionObj); + mExceptionObj = NULL; + } } void NativeMessageQueue::wake() { @@ -81,19 +121,20 @@ static void android_os_MessageQueue_setNativeMessageQueue(JNIEnv* env, jobject m reinterpret_cast<jint>(nativeMessageQueue)); } -sp<Looper> android_os_MessageQueue_getLooper(JNIEnv* env, jobject messageQueueObj) { +sp<MessageQueue> android_os_MessageQueue_getMessageQueue(JNIEnv* env, jobject messageQueueObj) { NativeMessageQueue* nativeMessageQueue = android_os_MessageQueue_getNativeMessageQueue(env, messageQueueObj); - return nativeMessageQueue != NULL ? nativeMessageQueue->getLooper() : NULL; + return nativeMessageQueue; } static void android_os_MessageQueue_nativeInit(JNIEnv* env, jobject obj) { NativeMessageQueue* nativeMessageQueue = new NativeMessageQueue(); - if (! nativeMessageQueue) { + if (!nativeMessageQueue) { jniThrowRuntimeException(env, "Unable to allocate native queue"); return; } + nativeMessageQueue->incStrong(env); android_os_MessageQueue_setNativeMessageQueue(env, obj, nativeMessageQueue); } @@ -102,7 +143,7 @@ static void android_os_MessageQueue_nativeDestroy(JNIEnv* env, jobject obj) { android_os_MessageQueue_getNativeMessageQueue(env, obj); if (nativeMessageQueue) { android_os_MessageQueue_setNativeMessageQueue(env, obj, NULL); - delete nativeMessageQueue; + nativeMessageQueue->decStrong(env); } } @@ -113,7 +154,7 @@ static void throwQueueNotInitialized(JNIEnv* env) { static void android_os_MessageQueue_nativePollOnce(JNIEnv* env, jobject obj, jint ptr, jint timeoutMillis) { NativeMessageQueue* nativeMessageQueue = reinterpret_cast<NativeMessageQueue*>(ptr); - nativeMessageQueue->pollOnce(timeoutMillis); + nativeMessageQueue->pollOnce(env, timeoutMillis); } static void android_os_MessageQueue_nativeWake(JNIEnv* env, jobject obj, jint ptr) { diff --git a/core/jni/android_os_MessageQueue.h b/core/jni/android_os_MessageQueue.h index f961d8f..49d2aa0 100644 --- a/core/jni/android_os_MessageQueue.h +++ b/core/jni/android_os_MessageQueue.h @@ -18,12 +18,53 @@ #define _ANDROID_OS_MESSAGEQUEUE_H #include "jni.h" +#include <utils/Looper.h> namespace android { -class Looper; +class MessageQueue : public RefBase { +public: + /* Gets the message queue's looper. */ + inline sp<Looper> getLooper() const { + return mLooper; + } -extern sp<Looper> android_os_MessageQueue_getLooper(JNIEnv* env, jobject messageQueueObj); + /* Checks whether the JNI environment has a pending exception. + * + * If an exception occurred, logs it together with the specified message, + * and calls raiseException() to ensure the exception will be raised when + * the callback returns, clears the pending exception from the environment, + * then returns true. + * + * If no exception occurred, returns false. + */ + bool raiseAndClearException(JNIEnv* env, const char* msg); + + /* Raises an exception from within a callback function. + * The exception will be rethrown when control returns to the message queue which + * will typically cause the application to crash. + * + * This message can only be called from within a callback function. If it is called + * at any other time, the process will simply be killed. + * + * Does nothing if exception is NULL. + * + * (This method does not take ownership of the exception object reference. + * The caller is responsible for releasing its reference when it is done.) + */ + virtual void raiseException(JNIEnv* env, const char* msg, jthrowable exceptionObj) = 0; + +protected: + MessageQueue(); + virtual ~MessageQueue(); + +protected: + sp<Looper> mLooper; +}; + +/* Gets the native object associated with a MessageQueue. */ +extern sp<MessageQueue> android_os_MessageQueue_getMessageQueue( + JNIEnv* env, jobject messageQueueObj); } // namespace android diff --git a/core/jni/android_view_DisplayEventReceiver.cpp b/core/jni/android_view_DisplayEventReceiver.cpp index 72c171c..d80bfb3 100644 --- a/core/jni/android_view_DisplayEventReceiver.cpp +++ b/core/jni/android_view_DisplayEventReceiver.cpp @@ -45,7 +45,7 @@ static struct { class NativeDisplayEventReceiver : public RefBase { public: NativeDisplayEventReceiver(JNIEnv* env, - jobject receiverObj, const sp<Looper>& looper); + jobject receiverObj, const sp<MessageQueue>& messageQueue); status_t initialize(); status_t scheduleVsync(); @@ -55,7 +55,7 @@ protected: private: jobject mReceiverObjGlobal; - sp<Looper> mLooper; + sp<MessageQueue> mMessageQueue; DisplayEventReceiver mReceiver; bool mWaitingForVsync; @@ -65,9 +65,9 @@ private: NativeDisplayEventReceiver::NativeDisplayEventReceiver(JNIEnv* env, - jobject receiverObj, const sp<Looper>& looper) : + jobject receiverObj, const sp<MessageQueue>& messageQueue) : mReceiverObjGlobal(env->NewGlobalRef(receiverObj)), - mLooper(looper), mWaitingForVsync(false) { + mMessageQueue(messageQueue), mWaitingForVsync(false) { ALOGV("receiver %p ~ Initializing input event receiver.", this); } @@ -75,7 +75,7 @@ NativeDisplayEventReceiver::~NativeDisplayEventReceiver() { ALOGV("receiver %p ~ Disposing display event receiver.", this); if (!mReceiver.initCheck()) { - mLooper->removeFd(mReceiver.getFd()); + mMessageQueue->getLooper()->removeFd(mReceiver.getFd()); } JNIEnv* env = AndroidRuntime::getJNIEnv(); @@ -89,7 +89,7 @@ status_t NativeDisplayEventReceiver::initialize() { return result; } - int rc = mLooper->addFd(mReceiver.getFd(), 0, ALOOPER_EVENT_INPUT, + int rc = mMessageQueue->getLooper()->addFd(mReceiver.getFd(), 0, ALOOPER_EVENT_INPUT, handleReceiveCallback, this); if (rc < 0) { return UNKNOWN_ERROR; @@ -151,12 +151,7 @@ int NativeDisplayEventReceiver::handleReceiveCallback(int receiveFd, int events, gDisplayEventReceiverClassInfo.dispatchVsync, vsyncTimestamp, vsyncCount); ALOGV("receiver %p ~ Returned from vsync handler.", data); - if (env->ExceptionCheck()) { - ALOGE("An exception occurred while dispatching a vsync event."); - LOGE_EX(env); - env->ExceptionClear(); - } - + r->mMessageQueue->raiseAndClearException(env, "dispatchVsync"); return 1; // keep the callback } @@ -183,14 +178,14 @@ bool NativeDisplayEventReceiver::readLastVsyncMessage( static jint nativeInit(JNIEnv* env, jclass clazz, jobject receiverObj, jobject messageQueueObj) { - sp<Looper> looper = android_os_MessageQueue_getLooper(env, messageQueueObj); - if (looper == NULL) { + sp<MessageQueue> messageQueue = android_os_MessageQueue_getMessageQueue(env, messageQueueObj); + if (messageQueue == NULL) { jniThrowRuntimeException(env, "MessageQueue is not initialized."); return 0; } sp<NativeDisplayEventReceiver> receiver = new NativeDisplayEventReceiver(env, - receiverObj, looper); + receiverObj, messageQueue); status_t status = receiver->initialize(); if (status) { String8 message; diff --git a/core/jni/android_view_InputEventReceiver.cpp b/core/jni/android_view_InputEventReceiver.cpp index e7d4244..348437d 100644 --- a/core/jni/android_view_InputEventReceiver.cpp +++ b/core/jni/android_view_InputEventReceiver.cpp @@ -48,7 +48,7 @@ class NativeInputEventReceiver : public RefBase { public: NativeInputEventReceiver(JNIEnv* env, jobject receiverObj, const sp<InputChannel>& inputChannel, - const sp<Looper>& looper); + const sp<MessageQueue>& messageQueue); status_t initialize(); status_t finishInputEvent(uint32_t seq, bool handled); @@ -61,7 +61,7 @@ protected: private: jobject mReceiverObjGlobal; InputConsumer mInputConsumer; - sp<Looper> mLooper; + sp<MessageQueue> mMessageQueue; PreallocatedInputEventFactory mInputEventFactory; bool mBatchedInputEventPending; @@ -72,9 +72,10 @@ private: NativeInputEventReceiver::NativeInputEventReceiver(JNIEnv* env, - jobject receiverObj, const sp<InputChannel>& inputChannel, const sp<Looper>& looper) : + jobject receiverObj, const sp<InputChannel>& inputChannel, + const sp<MessageQueue>& messageQueue) : mReceiverObjGlobal(env->NewGlobalRef(receiverObj)), - mInputConsumer(inputChannel), mLooper(looper), + mInputConsumer(inputChannel), mMessageQueue(messageQueue), mBatchedInputEventPending(false) { #if DEBUG_DISPATCH_CYCLE ALOGD("channel '%s' ~ Initializing input event receiver.", getInputChannelName()); @@ -86,7 +87,7 @@ NativeInputEventReceiver::~NativeInputEventReceiver() { ALOGD("channel '%s' ~ Disposing input event receiver.", getInputChannelName()); #endif - mLooper->removeFd(mInputConsumer.getChannel()->getFd()); + mMessageQueue->getLooper()->removeFd(mInputConsumer.getChannel()->getFd()); JNIEnv* env = AndroidRuntime::getJNIEnv(); env->DeleteGlobalRef(mReceiverObjGlobal); @@ -94,7 +95,8 @@ NativeInputEventReceiver::~NativeInputEventReceiver() { status_t NativeInputEventReceiver::initialize() { int receiveFd = mInputConsumer.getChannel()->getFd(); - mLooper->addFd(receiveFd, 0, ALOOPER_EVENT_INPUT, handleReceiveCallback, this); + mMessageQueue->getLooper()->addFd( + receiveFd, 0, ALOOPER_EVENT_INPUT, handleReceiveCallback, this); return OK; } @@ -157,12 +159,8 @@ status_t NativeInputEventReceiver::consumeEvents(bool consumeBatches) { #endif env->CallVoidMethod(mReceiverObjGlobal, gInputEventReceiverClassInfo.dispatchBatchedInputEventPending); - - if (env->ExceptionCheck()) { - ALOGE("channel '%s' ~ An exception occurred while dispatching that " - "batched input events are pending.", getInputChannelName()); - LOGE_EX(env); - env->ExceptionClear(); + if (mMessageQueue->raiseAndClearException( + env, "dispatchBatchedInputEventPending")) { mBatchedInputEventPending = false; // try again later } } @@ -182,6 +180,7 @@ status_t NativeInputEventReceiver::consumeEvents(bool consumeBatches) { #endif inputEventObj = android_view_KeyEvent_fromNative(env, static_cast<KeyEvent*>(inputEvent)); + mMessageQueue->raiseAndClearException(env, "new KeyEvent"); break; case AINPUT_EVENT_TYPE_MOTION: @@ -190,6 +189,7 @@ status_t NativeInputEventReceiver::consumeEvents(bool consumeBatches) { #endif inputEventObj = android_view_MotionEvent_obtainAsCopy(env, static_cast<MotionEvent*>(inputEvent)); + mMessageQueue->raiseAndClearException(env, "new MotionEvent"); break; default: @@ -200,7 +200,7 @@ status_t NativeInputEventReceiver::consumeEvents(bool consumeBatches) { if (!inputEventObj) { ALOGW("channel '%s' ~ Failed to obtain event object.", getInputChannelName()); mInputConsumer.sendFinishedSignal(seq, false); - return NO_MEMORY; + continue; } #if DEBUG_DISPATCH_CYCLE @@ -211,14 +211,8 @@ status_t NativeInputEventReceiver::consumeEvents(bool consumeBatches) { env->DeleteLocalRef(inputEventObj); - if (env->ExceptionCheck()) { - ALOGE("channel '%s' ~ An exception occurred while dispatching an event.", - getInputChannelName()); - LOGE_EX(env); - env->ExceptionClear(); - + if (mMessageQueue->raiseAndClearException(env, "dispatchInputEvent")) { mInputConsumer.sendFinishedSignal(seq, false); - return OK; } } } @@ -233,14 +227,14 @@ static jint nativeInit(JNIEnv* env, jclass clazz, jobject receiverObj, return 0; } - sp<Looper> looper = android_os_MessageQueue_getLooper(env, messageQueueObj); - if (looper == NULL) { + sp<MessageQueue> messageQueue = android_os_MessageQueue_getMessageQueue(env, messageQueueObj); + if (messageQueue == NULL) { jniThrowRuntimeException(env, "MessageQueue is not initialized."); return 0; } sp<NativeInputEventReceiver> receiver = new NativeInputEventReceiver(env, - receiverObj, inputChannel, looper); + receiverObj, inputChannel, messageQueue); status_t status = receiver->initialize(); if (status) { String8 message; diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 5ae12b6..00faa41 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1200,7 +1200,8 @@ android:protectionLevel="signature|system" /> <!-- Allows an application to retrieve the current state of keys and - switches. This is only for use by the system.--> + switches. This is only for use by the system. + @deprecated The API that used this permission has been removed. --> <permission android:name="android.permission.READ_INPUT_STATE" android:label="@string/permlab_readInputState" android:description="@string/permdesc_readInputState" diff --git a/core/res/res/anim/dock_bottom_enter.xml b/core/res/res/anim/dock_bottom_enter.xml new file mode 100644 index 0000000..7a2e94b --- /dev/null +++ b/core/res/res/anim/dock_bottom_enter.xml @@ -0,0 +1,26 @@ +<?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. +*/ +--> + +<!-- Animation for when a dock window at the bottom of the screen is entering. --> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:interpolator/decelerate_quad"> + <translate android:fromYDelta="75%" android:toYDelta="0" + android:duration="@android:integer/config_mediumAnimTime"/> + <alpha android:fromAlpha="0.0" android:toAlpha="1.0" + android:duration="@android:integer/config_mediumAnimTime" /> +</set> diff --git a/core/res/res/anim/dock_bottom_exit.xml b/core/res/res/anim/dock_bottom_exit.xml new file mode 100644 index 0000000..c2fd15c --- /dev/null +++ b/core/res/res/anim/dock_bottom_exit.xml @@ -0,0 +1,26 @@ +<?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. +*/ +--> + +<!-- Animation for when a dock window at the bottom of the screen is exiting. --> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:interpolator/accelerate_quad"> + <translate android:fromYDelta="0" android:toYDelta="75%" + android:startOffset="100" android:duration="@android:integer/config_mediumAnimTime"/> + <alpha android:fromAlpha="1.0" android:toAlpha="0.0" + android:startOffset="100" android:duration="@android:integer/config_mediumAnimTime" /> +</set> diff --git a/core/res/res/anim/dock_left_enter.xml b/core/res/res/anim/dock_left_enter.xml new file mode 100644 index 0000000..b057f67 --- /dev/null +++ b/core/res/res/anim/dock_left_enter.xml @@ -0,0 +1,26 @@ +<?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. +*/ +--> + +<!-- Animation for when a dock window at the left of the screen is entering. --> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:interpolator/decelerate_quad"> + <translate android:fromXDelta="-75%" android:toXDelta="0" + android:duration="@android:integer/config_mediumAnimTime"/> + <alpha android:fromAlpha="0.0" android:toAlpha="1.0" + android:duration="@android:integer/config_mediumAnimTime" /> +</set> diff --git a/core/res/res/anim/dock_left_exit.xml b/core/res/res/anim/dock_left_exit.xml new file mode 100644 index 0000000..576b1aa --- /dev/null +++ b/core/res/res/anim/dock_left_exit.xml @@ -0,0 +1,26 @@ +<?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. +*/ +--> + +<!-- Animation for when a dock window at the right of the screen is exiting. --> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:interpolator/accelerate_quad"> + <translate android:fromXDelta="0" android:toXDelta="-75%" + android:startOffset="100" android:duration="@android:integer/config_mediumAnimTime"/> + <alpha android:fromAlpha="1.0" android:toAlpha="0.0" + android:startOffset="100" android:duration="@android:integer/config_mediumAnimTime" /> +</set> diff --git a/core/res/res/anim/dock_right_enter.xml b/core/res/res/anim/dock_right_enter.xml new file mode 100644 index 0000000..e1bd190 --- /dev/null +++ b/core/res/res/anim/dock_right_enter.xml @@ -0,0 +1,26 @@ +<?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. +*/ +--> + +<!-- Animation for when a dock window at the right of the screen is entering. --> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:interpolator/decelerate_quad"> + <translate android:fromXDelta="75%" android:toXDelta="0" + android:duration="@android:integer/config_mediumAnimTime"/> + <alpha android:fromAlpha="0.0" android:toAlpha="1.0" + android:duration="@android:integer/config_mediumAnimTime" /> +</set> diff --git a/core/res/res/anim/dock_right_exit.xml b/core/res/res/anim/dock_right_exit.xml new file mode 100644 index 0000000..6d778fa --- /dev/null +++ b/core/res/res/anim/dock_right_exit.xml @@ -0,0 +1,26 @@ +<?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. +*/ +--> + +<!-- Animation for when a dock window at the right of the screen is exiting. --> +<set xmlns:android="http://schemas.android.com/apk/res/android" + android:interpolator="@android:interpolator/accelerate_quad"> + <translate android:fromXDelta="0" android:toXDelta="75%" + android:startOffset="100" android:duration="@android:integer/config_mediumAnimTime"/> + <alpha android:fromAlpha="1.0" android:toAlpha="0.0" + android:startOffset="100" android:duration="@android:integer/config_mediumAnimTime" /> +</set> diff --git a/packages/SystemUI/res/anim/status_bar_enter.xml b/core/res/res/anim/dock_top_enter.xml index f1c1301..f2e4cae 100644 --- a/packages/SystemUI/res/anim/status_bar_enter.xml +++ b/core/res/res/anim/dock_top_enter.xml @@ -1,8 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_enter.xml -** -** Copyright 2007, The Android Open Source Project +/* Copyright 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. @@ -18,10 +16,11 @@ */ --> +<!-- Animation for when a dock window at the top of the screen is entering. --> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:interpolator/decelerate_quad"> - <translate android:fromYDelta="-75%" android:toYDelta="0" + <translate android:fromYDelta="-75%" android:toYDelta="0" android:duration="@android:integer/config_mediumAnimTime"/> - <alpha android:fromAlpha="0.0" android:toAlpha="1.0" + <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="@android:integer/config_mediumAnimTime" /> </set> diff --git a/packages/SystemUI/res/anim/status_bar_exit.xml b/core/res/res/anim/dock_top_exit.xml index 46462e2..7373695 100644 --- a/packages/SystemUI/res/anim/status_bar_exit.xml +++ b/core/res/res/anim/dock_top_exit.xml @@ -1,8 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- -/* //device/apps/common/res/anim/options_panel_exit.xml -** -** Copyright 2007, The Android Open Source Project +/* Copyright 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. @@ -18,10 +16,11 @@ */ --> +<!-- Animation for when a dock window at the top of the screen is exiting. --> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:interpolator/accelerate_quad"> - <translate android:fromYDelta="0" android:toYDelta="-75%" + <translate android:fromYDelta="0" android:toYDelta="-75%" android:startOffset="100" android:duration="@android:integer/config_mediumAnimTime"/> - <alpha android:fromAlpha="1.0" android:toAlpha="0.0" + <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:startOffset="100" android:duration="@android:integer/config_mediumAnimTime" /> </set> diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_search_activated.png b/core/res/res/drawable-hdpi/ic_lockscreen_search_activated.png Binary files differnew file mode 100644 index 0000000..0d2e2ef --- /dev/null +++ b/core/res/res/drawable-hdpi/ic_lockscreen_search_activated.png diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_search_normal.png b/core/res/res/drawable-hdpi/ic_lockscreen_search_normal.png Binary files differnew file mode 100644 index 0000000..66d14ae --- /dev/null +++ b/core/res/res/drawable-hdpi/ic_lockscreen_search_normal.png diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_search_activated.png b/core/res/res/drawable-mdpi/ic_lockscreen_search_activated.png Binary files differnew file mode 100644 index 0000000..73c6be6 --- /dev/null +++ b/core/res/res/drawable-mdpi/ic_lockscreen_search_activated.png diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_search_normal.png b/core/res/res/drawable-mdpi/ic_lockscreen_search_normal.png Binary files differnew file mode 100644 index 0000000..73c6be6 --- /dev/null +++ b/core/res/res/drawable-mdpi/ic_lockscreen_search_normal.png diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_search_activated.png b/core/res/res/drawable-xhdpi/ic_lockscreen_search_activated.png Binary files differnew file mode 100644 index 0000000..c625a36 --- /dev/null +++ b/core/res/res/drawable-xhdpi/ic_lockscreen_search_activated.png diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_search_normal.png b/core/res/res/drawable-xhdpi/ic_lockscreen_search_normal.png Binary files differnew file mode 100644 index 0000000..c625a36 --- /dev/null +++ b/core/res/res/drawable-xhdpi/ic_lockscreen_search_normal.png diff --git a/core/res/res/drawable/ic_lockscreen_search.xml b/core/res/res/drawable/ic_lockscreen_search.xml new file mode 100644 index 0000000..b103922 --- /dev/null +++ b/core/res/res/drawable/ic_lockscreen_search.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + + <item + android:state_enabled="true" + android:state_active="false" + android:state_focused="false" + android:drawable="@drawable/ic_lockscreen_search_normal" /> + + <item + android:state_enabled="true" + android:state_active="true" + android:state_focused="false" + android:drawable="@drawable/ic_lockscreen_search_activated" /> + +</selector> diff --git a/core/res/res/layout/action_mode_close_item.xml b/core/res/res/layout/action_mode_close_item.xml index ac5af70..8cd0cdd 100644 --- a/core/res/res/layout/action_mode_close_item.xml +++ b/core/res/res/layout/action_mode_close_item.xml @@ -19,6 +19,7 @@ android:focusable="true" android:clickable="true" android:paddingLeft="8dip" + android:contentDescription="@string/action_mode_done" style="?android:attr/actionModeCloseButtonStyle" android:layout_width="wrap_content" android:layout_height="match_parent" diff --git a/core/res/res/layout/keyguard_screen_unlock_portrait.xml b/core/res/res/layout/keyguard_screen_unlock_portrait.xml index 9a2e024..35b8665 100644 --- a/core/res/res/layout/keyguard_screen_unlock_portrait.xml +++ b/core/res/res/layout/keyguard_screen_unlock_portrait.xml @@ -173,13 +173,13 @@ <RelativeLayout android:id="@+id/faceLockAreaView" android:visibility="invisible" - android:layout_row="4" + android:layout_row="3" android:layout_column="0" - android:layout_rowSpan="1" + android:layout_rowSpan="2" android:layout_columnSpan="1" android:layout_gravity="fill" - android:layout_marginTop="8dip" - android:layout_marginBottom="8dip" + android:layout_marginTop="4dip" + android:layout_marginBottom="4dip" android:layout_width="0dip" android:layout_height="0dip" android:background="@drawable/intro_bg"> diff --git a/core/res/res/layout/notification_action.xml b/core/res/res/layout/notification_action.xml index 54fde70..785da7c 100644 --- a/core/res/res/layout/notification_action.xml +++ b/core/res/res/layout/notification_action.xml @@ -19,5 +19,5 @@ android:layout_width="match_parent" android:layout_height="wrap_content" style="@android:style/Widget.Holo.Button.Small" - android:gravity="left" + android:gravity="left|center_vertical" />
\ No newline at end of file diff --git a/core/res/res/layout/notification_template_base.xml b/core/res/res/layout/notification_template_base.xml index 5b06460..b9710d6 100644 --- a/core/res/res/layout/notification_template_base.xml +++ b/core/res/res/layout/notification_template_base.xml @@ -28,7 +28,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" + android:layout_gravity="fill_vertical" android:layout_marginLeft="@dimen/notification_large_icon_width" android:minHeight="@dimen/notification_large_icon_height" android:orientation="vertical" @@ -36,6 +36,7 @@ android:paddingRight="12dp" android:paddingTop="4dp" android:paddingBottom="4dp" + android:gravity="center_vertical" > <LinearLayout android:id="@+id/line1" @@ -52,15 +53,21 @@ android:fadingEdge="horizontal" android:layout_weight="1" /> - <DateTimeView android:id="@+id/time" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Time" + <ViewStub android:id="@+id/time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_weight="0" - android:singleLine="true" - android:gravity="center" - android:paddingLeft="8dp" + android:visibility="gone" + android:layout="@layout/notification_template_part_time" + /> + <ViewStub android:id="@+id/chronometer" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_weight="0" + android:visibility="gone" + android:layout="@layout/notification_template_part_chronometer" /> </LinearLayout> <TextView android:id="@+id/text2" diff --git a/packages/SystemUI/res/anim/status_bar_out.xml b/core/res/res/layout/notification_template_part_chronometer.xml index 80863cf..382b0e4 100644 --- a/packages/SystemUI/res/anim/status_bar_out.xml +++ b/core/res/res/layout/notification_template_part_chronometer.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 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,13 @@ limitations under the License. --> -<set xmlns:android="http://schemas.android.com/apk/res/android" - > - <translate android:toYDelta="100%p" android:fromYDelta="0" - android:duration="@android:integer/config_longAnimTime" - android:interpolator="@anim/hydraulic_brake_interpolator" - /> - <alpha android:toAlpha="0.5" android:fromAlpha="1.0" - android:duration="@android:integer/config_longAnimTime" - /> -</set> +<Chronometer android:id="@+id/chronometer" xmlns:android="http://schemas.android.com/apk/res/android" + android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Time" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_weight="0" + android:singleLine="true" + android:gravity="center" + android:paddingLeft="8dp" + /> diff --git a/packages/SystemUI/res/anim/status_bar_in.xml b/core/res/res/layout/notification_template_part_time.xml index 79fe5f1..410fcaf 100644 --- a/packages/SystemUI/res/anim/status_bar_in.xml +++ b/core/res/res/layout/notification_template_part_time.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 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,13 @@ limitations under the License. --> -<set xmlns:android="http://schemas.android.com/apk/res/android" - > - <translate android:fromYDelta="100%p" android:toYDelta="0" - android:duration="@android:integer/config_longAnimTime" - android:interpolator="@anim/hydraulic_brake_interpolator" - /> - <alpha android:fromAlpha="0.5" android:toAlpha="1.0" - android:duration="@android:integer/config_longAnimTime" - /> -</set> +<DateTimeView android:id="@+id/time" xmlns:android="http://schemas.android.com/apk/res/android" + android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Time" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_weight="0" + android:singleLine="true" + android:gravity="center" + android:paddingLeft="8dp" + /> diff --git a/core/res/res/values-af/strings.xml b/core/res/res/values-af/strings.xml index 203c335..f23c7e2 100644 --- a/core/res/res/values-af/strings.xml +++ b/core/res/res/values-af/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Voer \'n PUK van 8 syfers of langer in."</string> <string name="needPuk" msgid="919668385956251611">"Jou SIM-kaart is PUK-gesluit. Voer die PUK-kode in om dit te ontsluit."</string> <string name="needPuk2" msgid="4526033371987193070">"Sleutel PUK2 in om SIM-kaart oop te sluit."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Inkomender beller-ID"</string> <string name="ClirMmi" msgid="7784673673446833091">"Uitgaande beller-ID"</string> <string name="CfMmi" msgid="5123218989141573515">"Oproepaanstuur"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Stel tyd"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Stel datum"</string> <string name="date_time_set" msgid="5777075614321087758">"Stel"</string> + <string name="date_time_done" msgid="2507683751759308828">"Klaar"</string> <string name="default_permission_group" msgid="2690160991405646128">"Verstek"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NUUT: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Geen toestemmings benodig nie"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Voeg \'n rekening by"</string> <string name="choose_account_text" msgid="6303348737197849675">"Watter rekening wil jy gebruik?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Voeg rekening by"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Verhoging"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Verminder"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Vermeerder"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Verminder"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> raak en hou."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Skuif op om by te tel en af om af te trek."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Tel \'n minuut by"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Trek \'n minuut af"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Tel \'n uur by."</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Trek \'n uur af"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Gly op om te vermeeder en af om te verminder."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Vermeerder minuut"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Verminder minute"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Vermeerder uur"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Verminder uur"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Stel NM."</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Stel VM."</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Tel \'n maand by"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Trek \'n maand af"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Tel \'n dag by"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Trek \'n dag af."</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Tel \'n jaar by"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Trek \'n jaar af"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Vermeerder maand"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Verminder maand"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Vermeerder dag"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Verminder dag"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Vermeerder jaar"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Verminder jaar"</string> <string name="checkbox_checked" msgid="7222044992652711167">"gekontroleer"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"nie gekontroleer nie"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"gekies"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Deel met"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Deel met <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Skyfievatsel. Raak en hou."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Op na <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Af vir <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Links vir <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Regs vir <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Gly op vir <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Gly af vir <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Gly links vir <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Gly regs vir <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Ontsluit"</string> <string name="description_target_camera" msgid="969071997552486814">"Kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Stil"</string> <string name="description_target_soundon" msgid="30052466675500172">"Klank aan"</string> + <string name="description_target_search" msgid="3091587249776033139">"Soek"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Sleep om te ontsluit."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Prop \'n kopfoon in om te hoor hoe wagwoordsleutels hardop gesê word."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Punt."</string> diff --git a/core/res/res/values-am/strings.xml b/core/res/res/values-am/strings.xml index ab937c5..b0218dd 100644 --- a/core/res/res/values-am/strings.xml +++ b/core/res/res/values-am/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"8 ወይም ከዛ በላይ የሆኑ ቁጥሮችንPUK ተይብ።"</string> <string name="needPuk" msgid="919668385956251611">"SIM ካርድዎ PUK-የተቆለፈ ነው።የPUK ኮዱን በመተየብ ይክፈቱት።"</string> <string name="needPuk2" msgid="4526033371987193070">" SIM ለመክፈት PUK2 ተይብ።"</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"የገቢ ደዋይID"</string> <string name="ClirMmi" msgid="7784673673446833091">"የወጪ ጥሪID"</string> <string name="CfMmi" msgid="5123218989141573515">"ጥሪ ማስተላለፍ"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"ጊዜ አዘጋጅ"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"ውሂብ አዘጋጅ"</string> <string name="date_time_set" msgid="5777075614321087758">"አዘጋጅ"</string> + <string name="date_time_done" msgid="2507683751759308828">"ተጠናቋል"</string> <string name="default_permission_group" msgid="2690160991405646128">"ነባሪ"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"አዲስ፦ "</font></string> <string name="no_permissions" msgid="7283357728219338112">"ምንም ፍቃዶች አይጠየቁም"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"መለያ አክል"</string> <string name="choose_account_text" msgid="6303348737197849675">"የትኛውን መለያ መጠቀም ትፈልጋለህ?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"መለያ አክል"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"ጨምር"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"ቀንስ"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"ጨምር"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"ቀንስ"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> ንካ እና ያዝ።"</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"ለመጨመር ወደላይ ለመቀነስ ወደታች አንሸራት"</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"ደቂቃዎች ጨምር"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"ደቂቃ ቀንስ"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"ሰዓት ጨምር።"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"ሰዓት ቀንስ"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"ለመጨመር ወደ ላይ አንሸራትት እና ለመቀነስ ወደ ታች አንሸራትት።"</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"ደቂቃ ጨምር"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"ደቂቃ ቀንስ"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"ሰዓት ጨምር"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"ሰዓት ቀንስ"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"PM አዘጋጅ"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"AM አዘጋጅ"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"ወር ጨምር"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"ወር ቀንስ"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"ቀን ጨምር"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"ቀን ቀንስ"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"አመት ጨምር"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"አመት ቀንስ"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"ወር ጨምር"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"ወር ቀንስ"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"ቀን ጨምር"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"ቀን ቀንስ"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"ዓመት ጨምር"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"ዓመት ቀንስ"</string> <string name="checkbox_checked" msgid="7222044992652711167">"ታይቷል"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"አልተፈተሸም"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"የተመረጠ"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ወደላይ።"</string> - <string name="description_direction_down" msgid="4294993639091088240">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ወደታች።"</string> - <string name="description_direction_left" msgid="6814008463839915747">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ወደግራ።"</string> - <string name="description_direction_right" msgid="4296057241963012862">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ወደቀኝ።"</string> + <string name="description_direction_up" msgid="7169032478259485180">"ለ<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ወደ ላይ አንሸራትት።"</string> + <string name="description_direction_down" msgid="5087739728639014595">"ለ<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ወደ ታች አንሸራትት።"</string> + <string name="description_direction_left" msgid="7207478719805562165">"ለ<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ወደ ግራ አንሸራትት።"</string> + <string name="description_direction_right" msgid="8034433242579600980">"ለ<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ወደ ቀኝ አንሸራትት።"</string> <string name="description_target_unlock" msgid="2228524900439801453">"ክፈት"</string> <string name="description_target_camera" msgid="969071997552486814">"ካሜራ"</string> <string name="description_target_silent" msgid="893551287746522182">"ፀጥታ"</string> <string name="description_target_soundon" msgid="30052466675500172">"ድምፅ አብራ"</string> + <string name="description_target_search" msgid="3091587249776033139">"ፈልግ"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"ላለመቆለፍ አንሸራት፡፡"</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"የይለፍ ቃል ቁልፎች ሲነገሩ ለመስማት የጆሮ ማዳመጫ ሰካ።"</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"ነጥብ."</string> diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml index aca8f47..9c3d658 100644 --- a/core/res/res/values-ar/strings.xml +++ b/core/res/res/values-ar/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"اكتب رمز PUK مكونًا من 8 أرقام أو أكثر."</string> <string name="needPuk" msgid="919668385956251611">"بطاقة SIM مؤمّنة بكود PUK. اكتب كود PUK لإلغاء تأمينها."</string> <string name="needPuk2" msgid="4526033371987193070">"اكتب PUK2 لإلغاء تأمين بطاقة SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"معرف المتصل الوارد"</string> <string name="ClirMmi" msgid="7784673673446833091">"معرف المتصل الصادر"</string> <string name="CfMmi" msgid="5123218989141573515">"إعادة توجيه الاتصال"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"تعيين الوقت"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"تعيين التاريخ"</string> <string name="date_time_set" msgid="5777075614321087758">"تعيين"</string> + <string name="date_time_done" msgid="2507683751759308828">"تم"</string> <string name="default_permission_group" msgid="2690160991405646128">"افتراضي"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"جديد: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"لا أذونات مطلوبة"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"إضافة حساب"</string> <string name="choose_account_text" msgid="6303348737197849675">"ما الحساب الذي تريد استخدامه؟"</string> <string name="add_account_button_label" msgid="3611982894853435874">"إضافة حساب"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"زيادة"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"تناقص"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"زيادة"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"تقليل"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> المس مع الاستمرار."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"مرر لأعلى للزيادة ولأسفل للإنقاص."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"زيادة دقيقة"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"إنقاص دقيقة"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"زيادة ساعة"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"إنقاص ساعة"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"مرر لأعلى للزيادة ولأسفل للتقليل."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"زيادة الدقائق"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"تقليل الدقائق"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"زيادة الساعات"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"تقليل الساعات"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"تعيين المساء"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"تعيين الصباح"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"زيادة شهر"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"إنقاص شهر"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"زيادة يوم"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"إنقاص يوم"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"زيادة عام"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"إنقاص عام"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"زيادة الشهور"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"تقليل الشهور"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"زيادة الأيام"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"تقليل الأيام"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"زيادة الأعوام"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"تقليل الأعوام"</string> <string name="checkbox_checked" msgid="7222044992652711167">"تم التحديد"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"لم يتم التحديد"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"محدد"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"أعلى إلى <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"أسفل إلى <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"يسارًا إلى <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"يمينًا إلى <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"تمرير لأعلى لـ <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"تمرير لأسفل لـ <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"تمرير لليسار لـ <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"تمرير لليمين لـ <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"إلغاء تأمين"</string> <string name="description_target_camera" msgid="969071997552486814">"الكاميرا"</string> <string name="description_target_silent" msgid="893551287746522182">"صامت"</string> <string name="description_target_soundon" msgid="30052466675500172">"تشغيل الصوت"</string> + <string name="description_target_search" msgid="3091587249776033139">"بحث"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"مرر بسرعة لإلغاء التأمين."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"يمكنك توصيل سماعة رأس لسماع مفاتيح كلمة المرور عندما يتم نطقها."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"نقطة"</string> diff --git a/core/res/res/values-be/strings.xml b/core/res/res/values-be/strings.xml index 4d304f1..9aab752 100644 --- a/core/res/res/values-be/strings.xml +++ b/core/res/res/values-be/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Увядзіце PUK з 8 лічбаў ці больш."</string> <string name="needPuk" msgid="919668385956251611">"Ваша SIM-карта заблакавана PUK-кодам. Увядзіце PUK, каб разблакаваць карту."</string> <string name="needPuk2" msgid="4526033371987193070">"Увядзіце PUK2 для разблакавання SIM-карты."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Ідэнтыфікатар АВН"</string> <string name="ClirMmi" msgid="7784673673446833091">"Ідэнтыфікатар АВН"</string> <string name="CfMmi" msgid="5123218989141573515">"Пераадрасацыя выкліку"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Усталяваць час"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Усталяваць дату"</string> <string name="date_time_set" msgid="5777075614321087758">"Задаць"</string> + <string name="date_time_done" msgid="2507683751759308828">"Гатова"</string> <string name="default_permission_group" msgid="2690160991405646128">"Па змаўчанні"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"НОВАЕ: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Дазволу не патрабуецца"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Дадаць уліковы запіс"</string> <string name="choose_account_text" msgid="6303348737197849675">"Які ўліковы запіс вы жадаеце выкарыстоўваць?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Дадаць уліковы запіс"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Інкрэмент"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Дэкрэмент"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Павялічыць"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Паменшыць"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Націсніце і ўтрымлівайце <xliff:g id="VALUE">%s</xliff:g>."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Перасуньце палец уверх, каб павялiчыць адрэзак, або ўніз, каб паменшыць."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"На хвiлiну больш"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"На хвiлiну менш"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"На гадзiну больш"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"На гадзiну менш"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Правядзіце пальцам уверх, каб павялічыць, або ўніз, каб паменшыць."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Павялічыць лічбу хвілін."</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Паменшыць лічбу хвілін."</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Павялічыць лічбу гадзін."</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Паменшыць лічбу гадзін."</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Усталяваць час пасля паўдня"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Усталяваць час да паўдня"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"На месяц больш"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"На месяц менш"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"На дзень больш"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"На дзень менш."</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"На год больш"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"На год менш"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Павялічыць лічбу месяца"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Паменшыць лічбу месяца"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Павялічыць лічбу дня"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Паменшыць лічбу дня"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Павялічыць лічбу года"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Паменшыць лічбу года"</string> <string name="checkbox_checked" msgid="7222044992652711167">"пастаўлены"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"не пастаўлены"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"абрана"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Апублікаваць з дапамогай"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Адправiць з дапамогай прыкладання <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Ручка для перасоўвання. Націсніце і ўтрымлівайце."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Уверх да <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Уніз да <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Улева да <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Управа да <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Правядзіце пальцам уверх, каб атрымаць <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Правядзіце пальцам уніз, каб атрымаць <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Правядзіце пальцам улева, каб атрымаць <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Правядзіце пальцам управа, каб атрымаць <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Разблакаваць"</string> <string name="description_target_camera" msgid="969071997552486814">"Камера"</string> <string name="description_target_silent" msgid="893551287746522182">"Ціхі рэжым"</string> <string name="description_target_soundon" msgid="30052466675500172">"Гук уключаны"</string> + <string name="description_target_search" msgid="3091587249776033139">"Пошук"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Прагартайце, каб разблакаваць."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Каб праслухаць паролi, падключыце гарнiтуру."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Кропка."</string> diff --git a/core/res/res/values-bg/strings.xml b/core/res/res/values-bg/strings.xml index b057cef..81a75bd 100644 --- a/core/res/res/values-bg/strings.xml +++ b/core/res/res/values-bg/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Въведете PUK код с поне осем цифри."</string> <string name="needPuk" msgid="919668385956251611">"SIM картата ви е заключена с PUK. Въведете PUK кода, за да я отключите."</string> <string name="needPuk2" msgid="4526033371987193070">"Въведете PUK2, за да отблокирате SIM картата."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Идентификация на вх. обаждания"</string> <string name="ClirMmi" msgid="7784673673446833091">"Идентификация на изходящите повиквания"</string> <string name="CfMmi" msgid="5123218989141573515">"Пренасочване на повиквания"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Задаване на часа"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Задаване на дата"</string> <string name="date_time_set" msgid="5777075614321087758">"Задаване"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"По подразбиране"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"НОВО: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Не се изискват разрешения"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Добавяне на профил"</string> <string name="choose_account_text" msgid="6303348737197849675">"Кой профил искате да използвате?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Добавяне на профил"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Увеличаване"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Намаляване"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Докоснете <xliff:g id="VALUE">%s</xliff:g> път/и и задръжте."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Плъзнете нагоре за увеличаване и надолу за намаляване."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Увеличаване на минутите"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Намаляване на минутите"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Увеличаване на часа"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Намаляване на часа"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Задаване на PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Задаване на AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Увеличаване на месеца"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Намаляване на месеца"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Увеличаване на деня"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Намаляване на деня"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Увеличаване на годината"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Намаляване на годината"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"отметнато"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"не е отметнато"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"избрано"</string> @@ -1205,14 +1218,20 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"Нагоре за <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Надолу за <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Наляво за <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Надясно за <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Отключване"</string> <string name="description_target_camera" msgid="969071997552486814">"Камера"</string> <string name="description_target_silent" msgid="893551287746522182">"Тих режим"</string> <string name="description_target_soundon" msgid="30052466675500172">"Включване на звука"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Прокарайте пръст, за да отключите."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Включете слушалки, за да чуете изговарянето на клавишите за паролата."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Точка."</string> diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml index 61c3cf0..6c6030c 100644 --- a/core/res/res/values-ca/strings.xml +++ b/core/res/res/values-ca/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Introdueix un PUK compost com a mínim de 8 nombres."</string> <string name="needPuk" msgid="919668385956251611">"La targeta SIM està bloquejada pel PUK. Escriviu el codi PUK per desbloquejar-la."</string> <string name="needPuk2" msgid="4526033371987193070">"Escriviu el PUK2 per desbloquejar la targeta SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Identificació de trucada entrant"</string> <string name="ClirMmi" msgid="7784673673446833091">"Identificació de trucada de sortida"</string> <string name="CfMmi" msgid="5123218989141573515">"Desviació de trucades"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Estableix l\'hora"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Establiment de data"</string> <string name="date_time_set" msgid="5777075614321087758">"Defineix"</string> + <string name="date_time_done" msgid="2507683751759308828">"Fet"</string> <string name="default_permission_group" msgid="2690160991405646128">"Predeterminat"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NOU: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"No cal cap permís"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Addició d\'un compte"</string> <string name="choose_account_text" msgid="6303348737197849675">"Quin compte vols utilitzar?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Afegeix un compte"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Incrementa"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Disminueix"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Incrementa"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Redueix"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Mantén premut <xliff:g id="VALUE">%s</xliff:g>."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Fes lliscar el dit cap amunt per incrementar i cap avall per disminuir."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Incrementa els minuts"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Disminueix els minuts"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Incrementa les hores"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Disminueix les hores"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Fes lliscar el dit cap amunt per incrementar i cap avall per disminuir."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Fes augmentar el minut"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Fes disminuir el minut"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Fes augmentar l\'hora"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Fes disminuir l\'hora"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Estableix com a p. m."</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Estableix com a a. m."</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Incrementa el mes"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Disminueix el mes"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Incrementa els dies"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Disminueix els dies"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Incrementa l\'any"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Disminueix l\'any"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Fes augmentar el mes"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Fes disminuir el mes"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Fes augmentar el dia"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Fes disminuir el dia"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Fes augmentar l\'any"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Fes disminuir l\'any"</string> <string name="checkbox_checked" msgid="7222044992652711167">"marcat"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"no marcat"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"seleccionat"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Comparteix amb"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Comparteix amb <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Llisca el dit. Mantén premut."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Cap amunt per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Cap avall per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Cap a l\'esquerra per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Cap a la dreta per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Fes lliscar el dit cap amunt per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Fes lliscar el dit cap avall per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Fes lliscar el dit cap a l\'esquerra per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Fes lliscar el dit cap a la dreta per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Desbloqueja"</string> <string name="description_target_camera" msgid="969071997552486814">"Càmera"</string> <string name="description_target_silent" msgid="893551287746522182">"Silenci"</string> <string name="description_target_soundon" msgid="30052466675500172">"Activa el so"</string> + <string name="description_target_search" msgid="3091587249776033139">"Cerca"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Llisca el dit per desbloquejar."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Connecta un auricular per escoltar les claus de la contrasenya en veu alta."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Punt."</string> diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml index ec640f7..d95feaa 100644 --- a/core/res/res/values-cs/strings.xml +++ b/core/res/res/values-cs/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Zadejte osmimístný nebo delší kód PUK."</string> <string name="needPuk" msgid="919668385956251611">"Karta SIM je blokována pomocí kódu PUK. Odblokujete ji zadáním kódu PUK."</string> <string name="needPuk2" msgid="4526033371987193070">"Chcete-li odblokovat kartu SIM, zadejte kód PUK2."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Příchozí identifikace volajícího"</string> <string name="ClirMmi" msgid="7784673673446833091">"Odchozí identifikace volajícího"</string> <string name="CfMmi" msgid="5123218989141573515">"Přesměrování hovorů"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Nastavení času"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Nastavení data"</string> <string name="date_time_set" msgid="5777075614321087758">"Nastavit"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Výchozí"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NOVÉ: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Nejsou vyžadována žádná oprávnění"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Přidat účet"</string> <string name="choose_account_text" msgid="6303348737197849675">"Který účet chcete použít?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Přidat účet"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Zvýšení"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Snížení"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> dotkněte se a podržte."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Chcete-li přičítat, přejeďte prstem nahoru, chcete-li odečítat, přejeďte prstem dolů."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Přičíst minutu"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Odečíst minutu"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Přičíst hodinu"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Odečíst hodinu"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Nastavit odp."</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Nastavit dop."</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Přičíst měsíc"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Odečíst měsíc"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Přičíst den"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Odečíst den"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Přičíst rok"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Odečíst rok"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"zaškrtnuto"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"nezaškrtnuto"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"Vybráno"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Sdílet s"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Sdílet s aplikací <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Posuvník. Dotkněte se a podržte."</string> - <string name="description_direction_up" msgid="1983114130441878529">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> – nahoru."</string> - <string name="description_direction_down" msgid="4294993639091088240">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> – dolů."</string> - <string name="description_direction_left" msgid="6814008463839915747">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> – vlevo."</string> - <string name="description_direction_right" msgid="4296057241963012862">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> – vpravo."</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Odemknout"</string> <string name="description_target_camera" msgid="969071997552486814">"Fotoaparát"</string> <string name="description_target_silent" msgid="893551287746522182">"Tichý"</string> <string name="description_target_soundon" msgid="30052466675500172">"Zapnout zvuk"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Odemknete posunutím prstu."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Chcete-li slyšet, které klávesy jste při zadávání hesla stiskli, připojte sluchátka."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Tečka."</string> diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml index d72364b..2c7f130 100644 --- a/core/res/res/values-da/strings.xml +++ b/core/res/res/values-da/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Angiv en PUK-kode på 8 eller flere cifre."</string> <string name="needPuk" msgid="919668385956251611">"Dit SIM-kort er låst med PUK-koden. Indtast PUK-koden for at låse den op."</string> <string name="needPuk2" msgid="4526033371987193070">"Indtast PUK2-koden for at låse op for SIM-kortet."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI-nummer"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Indgående opkalds-id"</string> <string name="ClirMmi" msgid="7784673673446833091">"Udgående opkalds-id"</string> <string name="CfMmi" msgid="5123218989141573515">"Viderestilling af opkald"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Angiv tidspunkt"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Angiv dato"</string> <string name="date_time_set" msgid="5777075614321087758">"Angiv"</string> + <string name="date_time_done" msgid="2507683751759308828">"Udført"</string> <string name="default_permission_group" msgid="2690160991405646128">"Standard"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NYHED! "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Der kræves ingen tilladelser"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Tilføj en konto"</string> <string name="choose_account_text" msgid="6303348737197849675">"Hvilken konto vil du bruge?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Tilføj konto"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Optælling"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Nedtælling"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Højere"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Lavere"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Tryk <xliff:g id="VALUE">%s</xliff:g> gange, og hold inde."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Glid op for at tilføje, og glid ned for at fjerne."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Tilføj minut"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Fjern minut"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Tilføj time"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Fjern time"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Glid op for at øge og ned for at mindske."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Forøg minuttal"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Sænk minuttal"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Forøg timetal"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Sænk timetal"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Indstil PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Indstil AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Tilføj måned"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Fjern måned"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Tilføj dag"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Fjern dag"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Tilføj år"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Fjern år"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Senere måned"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Tidligere måned"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Senere dag"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Tidligere dag"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Senere år"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Tidligere år"</string> <string name="checkbox_checked" msgid="7222044992652711167">"markeret"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"ikke markeret"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"udvalgt"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Del med"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Del med <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Glidende håndtag. Tryk og hold nede."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Op for at <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Ned for at <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Til venstre for at <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Til højre for at <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Glid op for at <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Glid ned for at <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Glid til venstre for at <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Glid til højre for at <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Lås op"</string> <string name="description_target_camera" msgid="969071997552486814">"Kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Lydløs"</string> <string name="description_target_soundon" msgid="30052466675500172">"Lyd slået til"</string> + <string name="description_target_search" msgid="3091587249776033139">"Søgning"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Glid hurtigt henover for at låse op."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Tilslut et headset for at høre tasterne blive læst højt ved angivelse af adgangskode."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Punktum."</string> diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml index defd850..aa44b87 100644 --- a/core/res/res/values-de/strings.xml +++ b/core/res/res/values-de/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Geben Sie eine mindestens achtstellige PUK ein."</string> <string name="needPuk" msgid="919668385956251611">"Ihre SIM-Karte ist mit einem PUK gesperrt. Geben Sie zum Entsperren den PUK-Code ein."</string> <string name="needPuk2" msgid="4526033371987193070">"Geben Sie zum Entsperren der SIM-Karte den PUK2 ein."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Anrufer-ID für eingehenden Anruf"</string> <string name="ClirMmi" msgid="7784673673446833091">"Anrufer-ID für ausgehenden Anruf"</string> <string name="CfMmi" msgid="5123218989141573515">"Rufweiterleitung"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Uhrzeit festlegen"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Datum festlegen"</string> <string name="date_time_set" msgid="5777075614321087758">"Speichern"</string> + <string name="date_time_done" msgid="2507683751759308828">"Fertig"</string> <string name="default_permission_group" msgid="2690160991405646128">"Standard"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"Neu: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Keine Berechtigungen erforderlich"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Konto hinzufügen"</string> <string name="choose_account_text" msgid="6303348737197849675">"Welches Konto möchten Sie verwenden?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Konto hinzufügen"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Erhöhen"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Verringern"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Erhöhen"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Verringern"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> berühren und gedrückt halten"</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Zum Vorstellen nach oben und zum Zurückstellen nach unten ziehen"</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Minute vorstellen"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Minute zurückstellen"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Stunde vorstellen"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Stunde zurückstellen"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Zum Erhöhen nach oben und zum Verringern nach unten schieben"</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Minuten verlängern"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Minuten verringern"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Stunden verlängern"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Stunden verringern"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Zeit festlegen"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Zeit festlegen"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Monat vorstellen"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Monat zurückstellen"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Tag vorstellen"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Tag zurückstellen"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Jahr vorstellen"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Jahr zurückstellen"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Monat verlängern"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Monat verringern"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Tag verlängern"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Tag verringern"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Jahr verlängern"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Jahr verringern"</string> <string name="checkbox_checked" msgid="7222044992652711167">"Aktiviert"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"Nicht aktiviert"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"Ausgewählt"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Teilen mit"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Mit <xliff:g id="APPLICATION_NAME">%s</xliff:g> teilen"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Schieberegler: Berühren und halten"</string> - <string name="description_direction_up" msgid="1983114130441878529">"Für <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> nach oben"</string> - <string name="description_direction_down" msgid="4294993639091088240">"Für <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> nach unten"</string> - <string name="description_direction_left" msgid="6814008463839915747">"Für <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> nach links"</string> - <string name="description_direction_right" msgid="4296057241963012862">"Für <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> nach rechts"</string> + <string name="description_direction_up" msgid="7169032478259485180">"Zum <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> nach oben schieben"</string> + <string name="description_direction_down" msgid="5087739728639014595">"Zum <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> nach unten schieben"</string> + <string name="description_direction_left" msgid="7207478719805562165">"Zum <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> nach links schieben"</string> + <string name="description_direction_right" msgid="8034433242579600980">"Zum <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> nach rechts schieben"</string> <string name="description_target_unlock" msgid="2228524900439801453">"Entsperren"</string> <string name="description_target_camera" msgid="969071997552486814">"Kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Lautlos"</string> <string name="description_target_soundon" msgid="30052466675500172">"Ton ein"</string> + <string name="description_target_search" msgid="3091587249776033139">"Suche"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Zum Entsperren den Finger über den Bildschirm ziehen"</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Schließen Sie ein Headset an, um das Passwort gesprochen zu hören."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Punkt."</string> diff --git a/core/res/res/values-el/strings.xml b/core/res/res/values-el/strings.xml index 71547ce..d85d639 100644 --- a/core/res/res/values-el/strings.xml +++ b/core/res/res/values-el/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Πληκτρολογήστε έναν κωδικό PUK με 8 αριθμούς ή περισσότερους."</string> <string name="needPuk" msgid="919668385956251611">"Η κάρτα SIM έχει κλειδωθεί με κωδικό PUK. Πληκτρολογήστε τον κωδικό PUK για να την ξεκλειδώσετε."</string> <string name="needPuk2" msgid="4526033371987193070">"Πληκτρολογήστε τον κωδικό PUK2 για την κατάργηση αποκλεισμού της κάρτας SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Εισερχόμενη αναγνώριση κλήσης"</string> <string name="ClirMmi" msgid="7784673673446833091">"Εξερχόμενη αναγνώριση κλήσης"</string> <string name="CfMmi" msgid="5123218989141573515">"Προώθηση κλήσεων"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Ρύθμιση ώρας"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Ορισμός ημερομηνίας"</string> <string name="date_time_set" msgid="5777075614321087758">"Ορισμός"</string> + <string name="date_time_done" msgid="2507683751759308828">"Τέλος"</string> <string name="default_permission_group" msgid="2690160991405646128">"Προεπιλεγμένο"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"ΝΕΟ: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Δεν απαιτούνται άδειες"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Προσθήκη λογαριασμού"</string> <string name="choose_account_text" msgid="6303348737197849675">"Ποιον λογαριασμό θέλετε να χρησιμοποιήσετε;"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Προσθήκη λογαριασμού"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Αύξηση"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Μείωση"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Αύξηση"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Μείωση"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Πατήστε παρατεταμένα το <xliff:g id="VALUE">%s</xliff:g>."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Πραγματοποιήστε κύλιση προς τα πάνω για αύξηση και προς τα κάτω για μείωση."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Αύξηση λεπτού"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Μείωση λεπτού"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Αύξηση ώρας"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Μείωση ώρας"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Πραγματοποιήστε κύλιση προς τα πάνω για αύξηση και προς τα κάτω για μείωση."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Αύξηση λεπτού"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Μείωση λεπτού"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Αύξηση ώρας"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Μείωση ώρας"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Ορισμός ΜΜ"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Ορισμός ΠΜ"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Επόμενος μήνας"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Προηγούμενος μήνας"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Επόμενη ημέρα"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Προηγούμενη μέρα"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Αύξηση έτους"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Προηγούμενο έτος"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Αύξηση μήνα"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Μείωση μήνα"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Αύξηση ημέρας"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Μείωση ημέρας"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Αύξηση έτους"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Μείωση έτους"</string> <string name="checkbox_checked" msgid="7222044992652711167">"ελέγχθηκε"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"δεν επιλέχθηκε"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"επιλεγμένο"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"Κύλιση πάνω <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Κύλιση κάτω για <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Κύλιση αριστερά για <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Κύλιση δεξιά <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Κύλιση προς τα επάνω για <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Κύλιση προς τα κάτω για <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Κύλιση προς τα αριστερά για <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Κύλιση προς τα δεξιά για <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Ξεκλείδωμα"</string> <string name="description_target_camera" msgid="969071997552486814">"Φωτογραφική μηχανή"</string> <string name="description_target_silent" msgid="893551287746522182">"Αθόρυβο"</string> <string name="description_target_soundon" msgid="30052466675500172">"Ενεργοποίηση ήχου"</string> + <string name="description_target_search" msgid="3091587249776033139">"Αναζήτηση"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Σύρετε για ξεκλείδωμα."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Συνδέστε ακουστικά για να ακούσετε τα πλήκτρα του κωδικού πρόσβασης να εκφωνούνται."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Τελεία."</string> diff --git a/core/res/res/values-en-rGB/strings.xml b/core/res/res/values-en-rGB/strings.xml index b070e02..fa767ff 100644 --- a/core/res/res/values-en-rGB/strings.xml +++ b/core/res/res/values-en-rGB/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Type a PUK that is 8 numbers or longer."</string> <string name="needPuk" msgid="919668385956251611">"Your SIM card is PUK-locked. Type the PUK code to unlock it."</string> <string name="needPuk2" msgid="4526033371987193070">"Type PUK2 to unblock SIM card."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Incoming Caller ID"</string> <string name="ClirMmi" msgid="7784673673446833091">"Outgoing Caller ID"</string> <string name="CfMmi" msgid="5123218989141573515">"Call forwarding"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Set time"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Set date"</string> <string name="date_time_set" msgid="5777075614321087758">"Set"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Default"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NEW: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"No permission required"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Add an account"</string> <string name="choose_account_text" msgid="6303348737197849675">"Which account do you want to use?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Add account"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Increment"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Decrement"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> touch and hold."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Slide up to increment and down to decrease."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Increment minute"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Decrement minute"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Increment hour"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Decrement hour"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Set p.m."</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Set a.m."</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Increment month"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Decrement month"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Increment day"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Decrement day"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Increment year"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Decrement year"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"ticked"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"not ticked"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"selected"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Share with"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Share with <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Sliding handle. Touch & hold."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Up for <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Down for <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Left for <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Right for <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Unlock"</string> <string name="description_target_camera" msgid="969071997552486814">"Camera"</string> <string name="description_target_silent" msgid="893551287746522182">"Silent"</string> <string name="description_target_soundon" msgid="30052466675500172">"Sound on"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Swipe to unlock."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Plug in a headset to hear password keys spoken."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Dot"</string> diff --git a/core/res/res/values-es-rUS/strings.xml b/core/res/res/values-es-rUS/strings.xml index 8de6b8c..5c7b782 100644 --- a/core/res/res/values-es-rUS/strings.xml +++ b/core/res/res/values-es-rUS/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Ingresa un código PUK de ocho números o más."</string> <string name="needPuk" msgid="919668385956251611">"Tu tarjeta SIM está bloqueada con PUK. Escribe el código PUK para desbloquearla."</string> <string name="needPuk2" msgid="4526033371987193070">"Escribir PUK2 para desbloquear la tarjeta SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Identificador de llamadas entrantes"</string> <string name="ClirMmi" msgid="7784673673446833091">"Identificador de llamadas salientes"</string> <string name="CfMmi" msgid="5123218989141573515">"Desvío de llamadas"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Configurar hora"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Configurar fecha"</string> <string name="date_time_set" msgid="5777075614321087758">"Establecer"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Predeterminado"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NUEVO: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"No se requieren permisos"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Agregar una cuenta"</string> <string name="choose_account_text" msgid="6303348737197849675">"¿Qué cuenta quieres usar?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Agregar una cuenta"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Incremento"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Decremento"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Mantén presionado <xliff:g id="VALUE">%s</xliff:g>."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Deslízate hacia arriba para aumentar y hacia abajo para disminuir."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Aumentar minutos"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Disminuir minutos"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Aumentar horas"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Disminuir horas"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Establecer p.m."</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Establecer a.m."</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Aumentar mes"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Disminuir mes"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Aumentar día"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Disminuir día"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Aumentar año"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Disminuir año"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"marcado"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"no marcado"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"seleccionado"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Compartir con"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Compartir con <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Mantén presionado el controlador deslizante."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Hacia arriba para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_down" msgid="4294993639091088240">"Hacia abajo para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_left" msgid="6814008463839915747">"Hacia la izquierda para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_right" msgid="4296057241963012862">"Hacia la derecha para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Desbloquear"</string> <string name="description_target_camera" msgid="969071997552486814">"Cámara"</string> <string name="description_target_silent" msgid="893551287746522182">"Silencioso"</string> <string name="description_target_soundon" msgid="30052466675500172">"Sonido activado"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Desliza el dedo para desbloquear."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Conecta un auricular para escuchar las contraseñas."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Punto"</string> diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml index b76053f..8ade0e0 100644 --- a/core/res/res/values-es/strings.xml +++ b/core/res/res/values-es/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Escribe un código PUK de ocho caracteres o más."</string> <string name="needPuk" msgid="919668385956251611">"La tarjeta SIM está bloqueada con el código PUK. Introduce el código PUK para desbloquearla."</string> <string name="needPuk2" msgid="4526033371987193070">"Introduce el código PUK2 para desbloquear la tarjeta SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"ID de emisor de llamada entrante"</string> <string name="ClirMmi" msgid="7784673673446833091">"ID de emisor de llamada saliente"</string> <string name="CfMmi" msgid="5123218989141573515">"Desvío de llamada"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Establecer hora"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Establecer fecha"</string> <string name="date_time_set" msgid="5777075614321087758">"Establecer"</string> + <string name="date_time_done" msgid="2507683751759308828">"Listo"</string> <string name="default_permission_group" msgid="2690160991405646128">"Predeterminado"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NUEVO:"</font></string> <string name="no_permissions" msgid="7283357728219338112">"No es necesario ningún permiso"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Añadir una cuenta"</string> <string name="choose_account_text" msgid="6303348737197849675">"¿Qué cuenta quieres usar?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Añadir cuenta"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Aumentar"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Disminuir"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Aumentar"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Reducir"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Mantén pulsado <xliff:g id="VALUE">%s</xliff:g>."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Desliza el dedo hacia arriba para aumentar y hacia abajo para disminuir."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Aumentar minuto"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Disminuir minuto"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Aumentar hora"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Disminuir hora"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Desliza el dedo hacia arriba para aumentar y hacia abajo para disminuir."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Aumentar minutos"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Reducir minutos"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Aumentar horas"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Reducir horas"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Establecer p.m."</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Establecer a.m."</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Aumentar mes"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Disminuir mes"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Aumentar día"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Disminuir día"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Aumentar año"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Disminuir año"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Aumentar mes"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Reducir mes"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Aumentar días"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Reducir días"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Aumentar año"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Reducir año"</string> <string name="checkbox_checked" msgid="7222044992652711167">"seleccionado"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"no seleccionado"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"seleccionado"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Compartir con"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Compartir con <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Mantén pulsado el icono de desbloqueo y deslízalo."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Hacia arriba para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_down" msgid="4294993639091088240">"Hacia abajo para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_left" msgid="6814008463839915747">"Hacia la izquierda para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_right" msgid="4296057241963012862">"Hacia la derecha para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> + <string name="description_direction_up" msgid="7169032478259485180">"Desliza el dedo hacia arriba para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Desliza el dedo hacia abajo para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Desliza el dedo hacia la izquierda para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Desliza el dedo hacia la derecha para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Desbloquear"</string> <string name="description_target_camera" msgid="969071997552486814">"Cámara"</string> <string name="description_target_silent" msgid="893551287746522182">"Silencio"</string> <string name="description_target_soundon" msgid="30052466675500172">"Sonido activado"</string> + <string name="description_target_search" msgid="3091587249776033139">"Buscar"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Desliza el dedo para desbloquear."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Conecta un auricular para escuchar las contraseñas."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Punto"</string> diff --git a/core/res/res/values-et/strings.xml b/core/res/res/values-et/strings.xml index 38c9251..0a8faed 100644 --- a/core/res/res/values-et/strings.xml +++ b/core/res/res/values-et/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Sisestage 8- või enamanumbriline PUK-kood."</string> <string name="needPuk" msgid="919668385956251611">"SIM-kaart on PUK-lukustatud. Avamiseks sisestage PUK-kood."</string> <string name="needPuk2" msgid="4526033371987193070">"Sisestage SIM-kaardi blokeeringu tühistamiseks PUK2-kood."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Sissetuleva kõne helistaja ID"</string> <string name="ClirMmi" msgid="7784673673446833091">"Väljuva kõne helistaja ID"</string> <string name="CfMmi" msgid="5123218989141573515">"Kõnede suunamine"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Kellaaja määramine"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Kuupäeva määramine"</string> <string name="date_time_set" msgid="5777075614321087758">"Määra"</string> + <string name="date_time_done" msgid="2507683751759308828">"Valmis"</string> <string name="default_permission_group" msgid="2690160991405646128">"Vaikimisi"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"UUS: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Lube pole vaja"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Konto lisamine"</string> <string name="choose_account_text" msgid="6303348737197849675">"Millist kontot soovite kasutada?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Lisa konto"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Suurenda"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Vähenda"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Suurendamine"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Vähendamine"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> puudutage ja hoidke."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Suurendamiseks lohistage üles, vähendamiseks alla."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Minutite arvu suurendamine"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Minutite arvu vähendamine"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Tundide arvu suurendamine"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Tundide arvu vähendamine"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Suurendamiseks lohistage üles, vähendamiseks alla."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Minutite suurendamine"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Minutite vähendamine"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Tundide suurendamine"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Tundide vähendamine"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"PM-i seadmine"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"AM-i seadmine"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Järgmine kuu"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Eelmine kuu"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Järgmine päev"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Eelmine päev"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Aastaarvu suurendamine"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Aastaarvu vähendamine"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Kuu suurendamine"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Kuu vähendamine"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Päeva suurendamine"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Päeva vähendamine"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Aasta suurendamine"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Aasta vähendamine"</string> <string name="checkbox_checked" msgid="7222044992652711167">"märgitud"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"pole märgitud"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"valitud"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Jaga:"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Jaga rakendusega <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Libistamispide. Puudutage ja hoidke all."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Üles – <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Alla – <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Vasakule – <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Paremale – <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Lohistage üles: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Lohistage alla: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Lohistage vasakule: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Lohistage paremale: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Luku avamine"</string> <string name="description_target_camera" msgid="969071997552486814">"Kaamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Hääletu"</string> <string name="description_target_soundon" msgid="30052466675500172">"Heli on sees"</string> + <string name="description_target_search" msgid="3091587249776033139">"Otsing"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Avamiseks tõmmake sõrmega."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Paroolide kuulamiseks ühendage peakomplekt."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Punkt."</string> diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml index 5a50a8f..c9329bb 100644 --- a/core/res/res/values-fa/strings.xml +++ b/core/res/res/values-fa/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"یک PUK با 8 رقم یا بیشتر تایپ کنید."</string> <string name="needPuk" msgid="919668385956251611">"سیم کارت شما با PUK قفل شده است. کد PUK را برای بازگشایی آن بنویسید."</string> <string name="needPuk2" msgid="4526033371987193070">"PUK2 را برای بازگشایی قفل سیم کارت بنویسید."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"شناسه تماس گیرنده ورودی"</string> <string name="ClirMmi" msgid="7784673673446833091">"شناسه تماس گیرنده خروجی"</string> <string name="CfMmi" msgid="5123218989141573515">"هدایت تماس"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"تنظیم زمان"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"تاریخ تنظیم"</string> <string name="date_time_set" msgid="5777075614321087758">"تنظیم"</string> + <string name="date_time_done" msgid="2507683751759308828">"انجام شد"</string> <string name="default_permission_group" msgid="2690160991405646128">"پیش فرض"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"جدید: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"مجوزی لازم نیست"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"افزودن یک حساب"</string> <string name="choose_account_text" msgid="6303348737197849675">"کدام حساب را میخواهید استفاده کنید؟"</string> <string name="add_account_button_label" msgid="3611982894853435874">"افزودن حساب"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"افزایش"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"کاهش"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"افزایش"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"کاهش"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> لمس کرده و نگه دارید."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"برای افزایش به بالا و برای کاهش به پایین بلغزانید."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">" افزایش دقیقه"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"کاهش دقیقه"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"افزایش ساعت"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"کاهش ساعت"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"برای افزایش به بالا بلغزانید و برای کاهش به پایین بلغزانید."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"افزایش دقیقه"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"کاهش دقیقه"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"افزایش ساعت"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"کاهش ساعت"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"تنظیم ب.ظ"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"تنظیم ق.ظ"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"ماه افزایشی"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"کاهش ماه"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"افزایش روز"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"کاهش روز"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"افزایش سال"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"کاهش سال"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"افزایش ماه"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"کاهش ماه"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"افزایش روز"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"کاهش روز"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"افزایش سال"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"کاهش سال"</string> <string name="checkbox_checked" msgid="7222044992652711167">"علامت زده"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"بدون علامت"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"انتخاب شد"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"بالا برای <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"پایین برای <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"چپ برای <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"راست برای <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"لغزاندن به بالا برای <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"لغزاندن به پایین برای <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"لغزاندن به چپ برای <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"لغزاندن به راست برای <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"بازکردن قفل"</string> <string name="description_target_camera" msgid="969071997552486814">"دوربین"</string> <string name="description_target_silent" msgid="893551287746522182">"ساکت"</string> <string name="description_target_soundon" msgid="30052466675500172">"صدا روشن"</string> + <string name="description_target_search" msgid="3091587249776033139">"جستجو"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"برای بازگشایی قفل، بلغزانید."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"برای شنیدن کلیدهای گذرواژه که با صدای بلند خوانده میشوند، هدست را وصل کنید."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"نقطه."</string> diff --git a/core/res/res/values-fi/strings.xml b/core/res/res/values-fi/strings.xml index 6d849dd..8a1079b 100644 --- a/core/res/res/values-fi/strings.xml +++ b/core/res/res/values-fi/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Kirjoita vähintään 8 numeron pituinen PUK-koodi."</string> <string name="needPuk" msgid="919668385956251611">"SIM-korttisi on PUK-lukittu. Poista lukitus antamalla PUK-koodi."</string> <string name="needPuk2" msgid="4526033371987193070">"Pura SIM-kortin esto antamalla PUK2-koodi."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI-koodi"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Soittajan tunnus"</string> <string name="ClirMmi" msgid="7784673673446833091">"Soittajan tunnus"</string> <string name="CfMmi" msgid="5123218989141573515">"Soitonsiirto"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Aseta aika"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Aseta päivämäärä"</string> <string name="date_time_set" msgid="5777075614321087758">"Aseta"</string> + <string name="date_time_done" msgid="2507683751759308828">"Valmis"</string> <string name="default_permission_group" msgid="2690160991405646128">"Oletus"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"UUTTA: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Lupia ei tarvita"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Lisää tili"</string> <string name="choose_account_text" msgid="6303348737197849675">"Mitä tiliä haluat käyttää?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Lisää tili"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Lisää"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Vähennä"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Lisää"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Vähennä"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> kosketa pitkään."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Kasvata tai pienennä arvoa liu\'uttamalla ylös tai alas."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Kasvata minuuttia"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Pienennä minuuttia"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Kasvata tuntia"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Pienennä tuntia"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Lisää tai vähennä arvoa liu\'uttamalla ylös tai alas."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Lisää minuuttien määrää."</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Vähennä minuuttien määrää."</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Lisää tuntien määrää."</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Vähennä tuntien määrää."</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Aseta ip"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Aseta ap"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Kasvata kuukautta"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Vähennä kuukautta"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Kasvata päivää"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Pienennä päivää"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Kasvata vuotta"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Pienennä vuotta"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Lisää kuukausien määrää."</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Vähennä kuukausien määrää."</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Lisää päivien määrää."</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Vähennä päivien määrää."</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Lisää vuosien määrää."</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Vähennä vuosien määrää."</string> <string name="checkbox_checked" msgid="7222044992652711167">"valittu"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"ei valittu"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"valittu"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Jaa seuraavien kanssa:"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Jaa sovelluksessa <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Liukuva valitsin. Kosketa pitkään."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Ylös: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Alas: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Vasemmalle: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Oikealle: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Liu\'uta ylös ja <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Liu\'uta alas ja <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Liu\'uta vasemmalle ja <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Liu\'uta oikealle ja <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Poista lukitus"</string> <string name="description_target_camera" msgid="969071997552486814">"Kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Äänetön"</string> <string name="description_target_soundon" msgid="30052466675500172">"Ääni käytössä"</string> + <string name="description_target_search" msgid="3091587249776033139">"Haku"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Poista lukitus liu\'uttamalla."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Liitä kuulokkeet kuullaksesi, mitä näppäimiä painat kirjoittaessasi salasanaa."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Piste."</string> diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml index 548d66b..f05e564 100644 --- a/core/res/res/values-fr/strings.xml +++ b/core/res/res/values-fr/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Saisissez un code PUK comportant au moins huit chiffres."</string> <string name="needPuk" msgid="919668385956251611">"Votre carte SIM est verrouillée par clé PUK. Saisissez la clé PUK pour la déverrouiller."</string> <string name="needPuk2" msgid="4526033371987193070">"Saisissez la clé PUK2 pour débloquer la carte SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"Code IMEI"</string> + <string name="meid" msgid="4841221237681254195">"Code MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Numéro de l\'appelant (entrant)"</string> <string name="ClirMmi" msgid="7784673673446833091">"Numéro de l\'appelant (sortant)"</string> <string name="CfMmi" msgid="5123218989141573515">"Transfert d\'appel"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Définir l\'heure"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Définir la date"</string> <string name="date_time_set" msgid="5777075614321087758">"Définir"</string> + <string name="date_time_done" msgid="2507683751759308828">"OK"</string> <string name="default_permission_group" msgid="2690160991405646128">"Par défaut"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NOUVEAU"</font>" :"</string> <string name="no_permissions" msgid="7283357728219338112">"Aucune autorisation requise"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Ajouter un compte"</string> <string name="choose_account_text" msgid="6303348737197849675">"Quel compte souhaitez-vous utiliser ?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Ajouter un compte"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Augmenter"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Diminuer"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Augmenter"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Diminuer"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> appuyez de manière prolongée."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Faire glisser vers le haut pour augmenter et vers le bas pour diminuer"</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Minute suivante"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Minute précédente"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Heure suivante"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Heure précédente"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Faites glisser vers le haut pour augmenter et vers le bas pour diminuer."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Minute suivante"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Minute précédente"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Heure suivante"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Heure précédente"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Définir la valeur PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Définir la valeur AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Mois suivant"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Mois précédent"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Jour suivant"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Jour précédent"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Année suivante"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Année précédente"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Mois suivant"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Mois précédent"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Jour suivant"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Jour précédent"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Année suivante"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Année précédente"</string> <string name="checkbox_checked" msgid="7222044992652711167">"coché"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"non coché"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"sélectionné"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Partager avec"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Partager avec <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Poignée coulissante. Appuyez de manière prolongée."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Vers le haut pour <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_down" msgid="4294993639091088240">"Vers le bas pour <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_left" msgid="6814008463839915747">"Vers la gauche pour <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_right" msgid="4296057241963012862">"Vers la droite pour <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> + <string name="description_direction_up" msgid="7169032478259485180">"Faites glisser vers le haut pour <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Faites glisser vers le bas pour <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Faites glisser vers la gauche pour <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Faites glisser vers la droite pour <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Déverrouiller"</string> <string name="description_target_camera" msgid="969071997552486814">"Appareil photo"</string> <string name="description_target_silent" msgid="893551287746522182">"Mode silencieux"</string> <string name="description_target_soundon" msgid="30052466675500172">"Son activé"</string> + <string name="description_target_search" msgid="3091587249776033139">"Rechercher"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Faites glisser votre doigt pour déverrouiller l\'appareil."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Branchez des écouteurs pour entendre l\'énoncé des touches lors de la saisie du mot de passe."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Point."</string> diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml index be85378..9a742c4 100644 --- a/core/res/res/values-hi/strings.xml +++ b/core/res/res/values-hi/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"ऐसा PUK लिखें जो 8 अंकों या अधिक का हो."</string> <string name="needPuk" msgid="919668385956251611">"आपका सिम कार्ड PUK लॉक किया गया है. इसे अनलॉक करने के लिए PUK कोड लिखें."</string> <string name="needPuk2" msgid="4526033371987193070">"सिम कार्ड अनब्लॉक करने के लिए PUK2 लिखें."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"इनकमिंग कॉलर ID"</string> <string name="ClirMmi" msgid="7784673673446833091">"आउटगोइंग कॉलर ID"</string> <string name="CfMmi" msgid="5123218989141573515">"कॉल अग्रेषण"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"समय सेट करें"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"दिनांक सेट करें"</string> <string name="date_time_set" msgid="5777075614321087758">"सेट करें"</string> + <string name="date_time_done" msgid="2507683751759308828">"पूर्ण"</string> <string name="default_permission_group" msgid="2690160991405646128">"डिफ़ॉल्ट"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"नया: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"किसी अनुमति की आवश्यकता नहीं है"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"कोई खाता जोड़ें"</string> <string name="choose_account_text" msgid="6303348737197849675">"आप कौन-सा खाता उपयोग करना चाहते हैं?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"खाता जोड़ें"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"वृद्धि"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"कमी"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"बढ़ाएं"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"कम करें"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> को स्पर्श करके रखें."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"बढ़ते क्रम के लिए ऊपर और घटते क्रम के लिए नीचे की ओर स्लाइड करें."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"बढ़ते क्रम में मिनट"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"घटते क्रम में मिनट"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"बढ़ते क्रम में घंटा"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"घटते क्रम में घंटा"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"बढ़ाने के लिए ऊपर और कम करने के लिए नीचे स्लाइड करें."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"मिनट बढ़ाएं"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"मिनट कम करें"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"घंटे बढ़ाएं"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"घंटे कम करें"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"सायं सेट करें"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"प्रात: सेट करें"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"बढ़ते क्रम में माह"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"घटते क्रम में माह"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"बढ़ते क्रम में दिन"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"घटते क्रम में दिन"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"बढ़ते क्रम में वर्ष"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"घटते क्रम में वर्ष"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"माह बढ़ाएं"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"माह कम करें"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"दिन बढ़ाएं"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"दिन कम करें"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"वर्ष बढ़ाएं"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"वर्ष कम करें"</string> <string name="checkbox_checked" msgid="7222044992652711167">"चेक किया गया"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"चेक नहीं किया गया"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"चयनित"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> के लिए ऊपर."</string> - <string name="description_direction_down" msgid="4294993639091088240">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> के लिए नीचे."</string> - <string name="description_direction_left" msgid="6814008463839915747">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> के लिए बाएं."</string> - <string name="description_direction_right" msgid="4296057241963012862">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> के लिए दाएं."</string> + <string name="description_direction_up" msgid="7169032478259485180">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> के लिए ऊपर स्लाइड करें."</string> + <string name="description_direction_down" msgid="5087739728639014595">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> के लिए नीचे स्लाइड करें."</string> + <string name="description_direction_left" msgid="7207478719805562165">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> के लिए बाएं स्लाइड करें."</string> + <string name="description_direction_right" msgid="8034433242579600980">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> के लिए दाएं स्लाइड करें."</string> <string name="description_target_unlock" msgid="2228524900439801453">"अनलॉक करें"</string> <string name="description_target_camera" msgid="969071997552486814">"कैमरा"</string> <string name="description_target_silent" msgid="893551287746522182">"मौन"</string> <string name="description_target_soundon" msgid="30052466675500172">"ध्वनि चालू करें"</string> + <string name="description_target_search" msgid="3091587249776033139">"खोजें"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"अनलॉक करने के लिए स्वाइप करें."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"बोली गईं पासवर्ड कुंजियां सुनने के लिए हेडसेट प्लग इन करें."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"बिंदु."</string> diff --git a/core/res/res/values-hr/strings.xml b/core/res/res/values-hr/strings.xml index a30a5e0..ba0fb7a 100644 --- a/core/res/res/values-hr/strings.xml +++ b/core/res/res/values-hr/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Upišite PUK koji se sastoji od barem 8 brojeva."</string> <string name="needPuk" msgid="919668385956251611">"Vaša je SIM kartica zaključana PUK-om. Unesite PUK kôd da biste je otključali."</string> <string name="needPuk2" msgid="4526033371987193070">"Unesite PUK2 da biste odblokirali SIM karticu."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"ID dolaznog pozivatelja"</string> <string name="ClirMmi" msgid="7784673673446833091">"ID izlaznog pozivatelja"</string> <string name="CfMmi" msgid="5123218989141573515">"Preusmjeravanje poziva"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Postavljanje vremena"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Postavi datum"</string> <string name="date_time_set" msgid="5777075614321087758">"Postavi"</string> + <string name="date_time_done" msgid="2507683751759308828">"Gotovo"</string> <string name="default_permission_group" msgid="2690160991405646128">"Zadano"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NOVO: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Nije potrebno dopuštenje"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Dodajte račun"</string> <string name="choose_account_text" msgid="6303348737197849675">"Koji račun želite upotrijebiti?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Dodaj račun"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Povećaj"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Smanji"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Povećavanje"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Smanjivanje"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> pritisnite i držite."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Klizite prema gore za pomak unaprijed, a prema dolje za pomak unatrag."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Pomak unaprijed za jednu minutu"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Pomak unatrag za jednu minutu"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Pomak unaprijed za jedan sat"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Pomak unatrag za jedan sat"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Kliznite prema gore za povećavanje i prema dolje za smanjivanje."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Povećanje minuta"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Smanjenje minuta"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Povećanje sati"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Smanjenje sati"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Postavi PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Postavi AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Pomak unaprijed za jedan mjesec"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Pomak unatrag za jedan mjesec"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Pomak unaprijed za jedan dan"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Pomak unatrag za jedan dan"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Pomak unaprijed za jednu godinu"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Pomak unatrag za jednu godinu"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Povećanje mjeseca"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Smanjenje mjeseca"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Povećanje dana"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Smanjenje dana"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Povećanje godine"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Smanjenje godine"</string> <string name="checkbox_checked" msgid="7222044992652711167">"označeno"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"nije označeno"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"odabran"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Dijeljenje sa"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Dijeli s aplikacijom <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Klizna ručka. Dodirnite i držite."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Gore za <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Dolje za <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Lijevo za <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Desno za <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Kliznite prema gore za <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Kliznite prema dolje za <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Kliznite lijevo za <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Kliznite desno za <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Otključaj"</string> <string name="description_target_camera" msgid="969071997552486814">"Fotoaparat"</string> <string name="description_target_silent" msgid="893551287746522182">"Bešumno"</string> <string name="description_target_soundon" msgid="30052466675500172">"Zvuk je uključen"</string> + <string name="description_target_search" msgid="3091587249776033139">"Pretraživanje"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Prijeđite prstima da biste otključali."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Priključite slušalice kako biste čuli izgovaranje tipki zaporke."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Točka."</string> diff --git a/core/res/res/values-hu/strings.xml b/core/res/res/values-hu/strings.xml index f6fd651..25a8d2a 100644 --- a/core/res/res/values-hu/strings.xml +++ b/core/res/res/values-hu/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"8 számjegyű vagy hosszabb PUK kódot írjon be."</string> <string name="needPuk" msgid="919668385956251611">"A SIM-kártya le van zárva a PUK-kóddal. A feloldáshoz adja meg a PUK-kódot."</string> <string name="needPuk2" msgid="4526033371987193070">"A SIM-kártya feloldásához adja meg a PUK2-kódot."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Beérkező hívóazonosító"</string> <string name="ClirMmi" msgid="7784673673446833091">"Kimenő hívóazonosító"</string> <string name="CfMmi" msgid="5123218989141573515">"Hívásátirányítás"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Idő beállítása"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Dátum beállítása"</string> <string name="date_time_set" msgid="5777075614321087758">"Beállítás"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Alapértelmezett"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"ÚJ: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Nincs szükség engedélyre"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Fiók hozzáadása"</string> <string name="choose_account_text" msgid="6303348737197849675">"Melyik fiókot szeretné használni?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Fiók hozzáadása"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Növelés"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Csökkentés"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> érintse meg és tartsa lenyomva."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Csúsztassa fel a növeléshez és le a csökkentéshez."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Percek növelése"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Percek csökkentése"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Órák növelése"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Órák csökkentése"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Állítsa du. értékre"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Állítsa de. értékre"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Hónapok növelése"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Hónapok csökkentése"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Napok növelése"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Napok csökkentése"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Évek növelése"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Évek csökkentése"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"bejelölve"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"nincs bejelölve"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"bejelölve"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Megosztás a következővel:"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Ossza meg a következő alkalmazással: <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Csúsztatható fogantyú. Érintse meg és tartsa."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Fel: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_down" msgid="4294993639091088240">"Le: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_left" msgid="6814008463839915747">"Balra: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_right" msgid="4296057241963012862">"Jobbra: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Feloldás"</string> <string name="description_target_camera" msgid="969071997552486814">"Kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Némítás"</string> <string name="description_target_soundon" msgid="30052466675500172">"Hang bekapcsolása"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"A feloldásához húzza végig az ujját."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Csatlakoztasson egy fülhallgatót, ha hallani szeretné a jelszó betűit felolvasva."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Pont."</string> diff --git a/core/res/res/values-in/strings.xml b/core/res/res/values-in/strings.xml index 4a14208..944f429 100644 --- a/core/res/res/values-in/strings.xml +++ b/core/res/res/values-in/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Ketik PUK yang terdiri dari 8 angka atau lebih."</string> <string name="needPuk" msgid="919668385956251611">"Kartu SIM Anda dikunci PUK. Ketikkan kode PUK untuk membukanya."</string> <string name="needPuk2" msgid="4526033371987193070">"Ketikkan PUK2 untuk membuka kartu SIM"</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Nomor Penelepon Masuk"</string> <string name="ClirMmi" msgid="7784673673446833091">"Nomor Penelepon Keluar"</string> <string name="CfMmi" msgid="5123218989141573515">"Penerusan panggilan"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Setel waktu"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Setel tanggal"</string> <string name="date_time_set" msgid="5777075614321087758">"Setel"</string> + <string name="date_time_done" msgid="2507683751759308828">"Selesai"</string> <string name="default_permission_group" msgid="2690160991405646128">"Default"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"BARU: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Tidak perlu izin"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Tambahkan akun"</string> <string name="choose_account_text" msgid="6303348737197849675">"Akun mana yang ingin Anda gunakan?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Tambahkan akun"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Penambahan"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Pengurangan"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Menambah"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Mengurangi"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> sentuh dan tahan."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Geser ke atas untuk menambah dan ke bawah untuk mengurangi."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Menit penambahan"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Menit pengurangan"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Jam penambahan"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Jam pengurangan"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Geser ke atas untuk menambah dan ke bawah untuk mengurangi."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Menambah menit"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Mengurangi menit"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Menambah jam"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Mengurangi jam"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Menyetel PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Setel AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Bulan penambahan"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Bulan pengurangan"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Hari penambahan"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Hari pengurangan"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Tahun penambahan"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Tahun pengurangan"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Menambah bulan"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Mengurangi bulan"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Menambah hari"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Mengurangi hari"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Menambah tahun"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Mengurangi tahun"</string> <string name="checkbox_checked" msgid="7222044992652711167">"dicentang"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"tidak diperiksa"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"dipilih"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Berbagi dengan"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Berbagi dengan <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Gagang geser. Sentuh & tahan."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Ke atas untuk <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Ke bawah untuk <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Ke kiri untuk <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Ke kanan untuk <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Geser ke atas untuk <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Geser ke bawah untuk <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Geser ke kiri untuk <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Geser ke kanan untuk <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Membuka gembok"</string> <string name="description_target_camera" msgid="969071997552486814">"Kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Senyap"</string> <string name="description_target_soundon" msgid="30052466675500172">"Suara hidup"</string> + <string name="description_target_search" msgid="3091587249776033139">"Penelusuran"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Gesek untuk membuka kunci."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Pasang headset untuk mendengar tombol sandi yang diucapkan."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Titik."</string> diff --git a/core/res/res/values-it/strings.xml b/core/res/res/values-it/strings.xml index c682a85..03cf404 100644 --- a/core/res/res/values-it/strings.xml +++ b/core/res/res/values-it/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Digita un PUK formato da almeno 8 numeri."</string> <string name="needPuk" msgid="919668385956251611">"La SIM è bloccata tramite PUK. Digita il codice PUK per sbloccarla."</string> <string name="needPuk2" msgid="4526033371987193070">"Digita il PUK2 per sbloccare la SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"ID chiamante in entrata"</string> <string name="ClirMmi" msgid="7784673673446833091">"ID chiamante in uscita"</string> <string name="CfMmi" msgid="5123218989141573515">"Deviazione chiamate"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Imposta ora"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Imposta data"</string> <string name="date_time_set" msgid="5777075614321087758">"Imposta"</string> + <string name="date_time_done" msgid="2507683751759308828">"Fine"</string> <string name="default_permission_group" msgid="2690160991405646128">"Predefinito"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NUOVA: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Nessuna autorizzazione richiesta"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Aggiungi un account"</string> <string name="choose_account_text" msgid="6303348737197849675">"Quale account vuoi usare?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Aggiungi account"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Aumenta"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Diminuisci"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Aumenta"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Riduci"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Tocca e tieni premuto il numero <xliff:g id="VALUE">%s</xliff:g>."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Scorri verso l\'alto per aumentare il valore e verso il basso per diminuirlo."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Aumenta minuto"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Diminuisci minuto"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Aumenta ora"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Diminuisci ora"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Scorri verso l\'alto per aumentare il valore e verso il basso per diminuirlo."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Aumenta minuti"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Riduci minuti"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Aumenta ore"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Riduci ore"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Imposta PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Imposta AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Aumenta mese"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Diminuisci mese"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Aumenta giorno"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Diminuisci giorno"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Aumenta anno"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Diminuisci anno"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Aumenta mese"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Riduci mese"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Aumenta giorno"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Riduci giorno"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Aumenta anno"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Riduci anno"</string> <string name="checkbox_checked" msgid="7222044992652711167">"selezionata"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"non selezionato"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"selezionato"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Condividi con"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Condividi con <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Maniglia scorrevole. Tocca e tieni premuto."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Su per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Giù per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"A sinistra per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"A destra per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Su per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Giù per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"A sinistra per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"A destra per <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Sblocca"</string> <string name="description_target_camera" msgid="969071997552486814">"Fotocamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Silenzioso"</string> <string name="description_target_soundon" msgid="30052466675500172">"Audio attivato"</string> + <string name="description_target_search" msgid="3091587249776033139">"Ricerca"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Fai scorrere per sbloccare."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Collega gli auricolari per ascoltare la pronuncia dei tasti premuti per la password."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Punto."</string> diff --git a/core/res/res/values-iw/strings.xml b/core/res/res/values-iw/strings.xml index 9ebc58d..3c6e0c2 100644 --- a/core/res/res/values-iw/strings.xml +++ b/core/res/res/values-iw/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"הקלד PUK באורך 8 מספרים או יותר."</string> <string name="needPuk" msgid="919668385956251611">"כרטיס ה-SIM נעול באמצעות PUK. הקלד את קוד PUK כדי לבטל את נעילתו."</string> <string name="needPuk2" msgid="4526033371987193070">"הקלד PUK2 כדי לבטל את חסימת כרטיס ה-SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"זיהוי מתקשר של שיחה נכנסת"</string> <string name="ClirMmi" msgid="7784673673446833091">"זיהוי מתקשר בשיחה יוצאת"</string> <string name="CfMmi" msgid="5123218989141573515">"העברת שיחות"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"הגדרת שעה"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"הגדר תאריך"</string> <string name="date_time_set" msgid="5777075614321087758">"הגדר"</string> + <string name="date_time_done" msgid="2507683751759308828">"בוצע"</string> <string name="default_permission_group" msgid="2690160991405646128">"ברירת מחדל"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"חדש: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"לא דרושים אישורים"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"הוסף חשבון"</string> <string name="choose_account_text" msgid="6303348737197849675">"באיזה חשבון ברצונך להשתמש?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"הוסף חשבון"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"הגדל"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"הפחת"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"הוסף"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"הפחת"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> גע והחזק."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"הסט מעלה כדי להוסיף ומטה כדי להפחית."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"הוסף דקה"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"הפחת דקה"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"הוסף שעה"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"הפחת שעה"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"הסט למעלה כדי להוסיף ולמטה כדי להפחית."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"הוסף דקה"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"הפחת דקה"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"הוסף שעה"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"הפחת שעה"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"הגדר PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"הגדר AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"הוסף חודש"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"הפחת חודש"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"הוסף יום"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"הפחת יום."</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"הוסף שנה"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"הפחת שנה"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"הוסף חודש"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"הפחת חודש"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"הוסף יום"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"הפחת יום"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"הוסף שנה"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"הפחת שנה"</string> <string name="checkbox_checked" msgid="7222044992652711167">"מסומן"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"לא מסומן"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"נבחר"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"\'למעלה\' עבור <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"\'למטה\' עבור <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"\'שמאל\' עבור <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"\'ימין\' עבור <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"הסט למעלה כדי להציג <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"הסט למטה כדי להציג <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"הסט שמאלה כדי להציג <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"הסט ימינה כדי להציג <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"בטל נעילה"</string> <string name="description_target_camera" msgid="969071997552486814">"מצלמה"</string> <string name="description_target_silent" msgid="893551287746522182">"שקט"</string> <string name="description_target_soundon" msgid="30052466675500172">"הקול פועל"</string> + <string name="description_target_search" msgid="3091587249776033139">"חיפוש"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"החלק לביטול נעילה."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"חבר אוזניות כדי לשמוע הקראה של מפתחות סיסמה."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"נקודה."</string> diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml index 9f70bb3..9e21085 100644 --- a/core/res/res/values-ja/strings.xml +++ b/core/res/res/values-ja/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"PUKは8桁以上で入力してください。"</string> <string name="needPuk" msgid="919668385956251611">"SIMカードはPUKでロックされています。ロックを解除するにはPUKコードを入力してください。"</string> <string name="needPuk2" msgid="4526033371987193070">"SIMカードのロック解除のためPUK2を入力します。"</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"着信時の発信者番号"</string> <string name="ClirMmi" msgid="7784673673446833091">"発信者番号"</string> <string name="CfMmi" msgid="5123218989141573515">"着信転送"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"時刻設定"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"日付設定"</string> <string name="date_time_set" msgid="5777075614321087758">"設定"</string> + <string name="date_time_done" msgid="2507683751759308828">"完了"</string> <string name="default_permission_group" msgid="2690160991405646128">"端末既定"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NEW: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"権限の許可は必要ありません"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"アカウントを追加"</string> <string name="choose_account_text" msgid="6303348737197849675">"どのアカウントを使用しますか?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"アカウントを追加"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"増やす"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"減らす"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"進めます"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"戻します"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g>回タップして押し続けます。"</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"上にスライドで大きく、下にスライドで小さくなります。"</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"1分進める"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"1分戻す"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"1時間進める"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"1時間戻す"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"上にスライドで進み、下にスライドで戻ります。"</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"1分進めます"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"1分戻します"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"1時間進めます"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"1時間戻します"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"午後に設定"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"午前に設定"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"1か月進める"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"1か月戻す"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"1日進める"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"1日戻す"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"1年進める"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"1年戻す"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"1か月進めます"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"1か月戻します"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"1日進めます"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"1日戻します"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"1年進めます"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"1年戻します"</string> <string name="checkbox_checked" msgid="7222044992652711167">"ON"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"OFF"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"ON"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"上は<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>です。"</string> - <string name="description_direction_down" msgid="4294993639091088240">"下は<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>です。"</string> - <string name="description_direction_left" msgid="6814008463839915747">"左は<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>です。"</string> - <string name="description_direction_right" msgid="4296057241963012862">"右は<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>です。"</string> + <string name="description_direction_up" msgid="7169032478259485180">"上にスライドして<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>を行います。"</string> + <string name="description_direction_down" msgid="5087739728639014595">"下にスライドして<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>を行います。"</string> + <string name="description_direction_left" msgid="7207478719805562165">"左にスライドして<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>を行います。"</string> + <string name="description_direction_right" msgid="8034433242579600980">"右にスライドして<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>を行います。"</string> <string name="description_target_unlock" msgid="2228524900439801453">"ロックを解除"</string> <string name="description_target_camera" msgid="969071997552486814">"カメラ"</string> <string name="description_target_silent" msgid="893551287746522182">"マナーモード"</string> <string name="description_target_soundon" msgid="30052466675500172">"サウンドON"</string> + <string name="description_target_search" msgid="3091587249776033139">"検索します"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"ロック解除するにはスワイプします。"</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"パスワードのキーが音声出力されるのでヘッドセットを接続してください。"</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"ドット。"</string> diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml index 0057a5b..8dc3fa6 100644 --- a/core/res/res/values-ko/strings.xml +++ b/core/res/res/values-ko/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"8자리 이상의 숫자 PUK를 입력합니다."</string> <string name="needPuk" msgid="919668385956251611">"SIM 카드의 PUK가 잠겨 있습니다. 잠금해제하려면 PUK 코드를 입력하세요."</string> <string name="needPuk2" msgid="4526033371987193070">"SIM 카드 잠금을 해제하려면 PUK2를 입력하세요."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"발신자 번호"</string> <string name="ClirMmi" msgid="7784673673446833091">"내 발신 번호"</string> <string name="CfMmi" msgid="5123218989141573515">"착신전환"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"시간 설정"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"날짜 설정"</string> <string name="date_time_set" msgid="5777075614321087758">"설정"</string> + <string name="date_time_done" msgid="2507683751759308828">"완료"</string> <string name="default_permission_group" msgid="2690160991405646128">"기본값"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"신규: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"권한 필요 없음"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"계정 추가"</string> <string name="choose_account_text" msgid="6303348737197849675">"사용할 계정을 선택하세요."</string> <string name="add_account_button_label" msgid="3611982894853435874">"계정 추가"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"올리기"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"줄이기"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"늘리기"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"줄이기"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> 길게 터치하세요."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"올리려면 위로 슬라이드하고 줄이려면 아래로 슬라이드합니다."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"\'분\'을 올립니다."</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"\'분\'을 줄입니다."</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"\'시\'를 올립니다."</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"\'시\'를 줄입니다."</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"늘리려면 위로 슬라이드하고 줄이려면 아래로 슬라이드합니다."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"\'분\'을 늘립니다."</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"\'분\'을 줄입니다."</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"\'시간\'을 늘립니다."</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"\'시간\'을 줄입니다."</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"PM 설정"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"AM 설정"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"\'월\'을 올립니다."</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"\'월\'을 줄입니다."</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"\'날짜\'를 올립니다."</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"\'날짜\'를 줄입니다."</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"\'연도\'를 올립니다."</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"\'연도\'를 줄입니다."</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"\'월\'을 늘립니다."</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"\'월\'을 줄입니다."</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"\'일\'을 늘립니다."</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"\'일\'을 줄입니다."</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"\'연도\'를 늘립니다."</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"\'연도\'를 줄입니다."</string> <string name="checkbox_checked" msgid="7222044992652711167">"확인"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"선택 안함"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"선택됨"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>하려면 위로 슬라이드"</string> - <string name="description_direction_down" msgid="4294993639091088240">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>하려면 아래로 슬라이드"</string> - <string name="description_direction_left" msgid="6814008463839915747">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>하려면 왼쪽으로 슬라이드"</string> - <string name="description_direction_right" msgid="4296057241963012862">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>하려면 오른쪽으로 슬라이드"</string> + <string name="description_direction_up" msgid="7169032478259485180">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>하려면 위로 슬라이드"</string> + <string name="description_direction_down" msgid="5087739728639014595">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>하려면 아래로 슬라이드"</string> + <string name="description_direction_left" msgid="7207478719805562165">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>하려면 왼쪽으로 슬라이드"</string> + <string name="description_direction_right" msgid="8034433242579600980">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>하려면 오른쪽으로 슬라이드"</string> <string name="description_target_unlock" msgid="2228524900439801453">"잠금 해제"</string> <string name="description_target_camera" msgid="969071997552486814">"카메라"</string> <string name="description_target_silent" msgid="893551287746522182">"무음"</string> <string name="description_target_soundon" msgid="30052466675500172">"사운드 켜기"</string> + <string name="description_target_search" msgid="3091587249776033139">"검색"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"스와이프하여 잠급니다."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"비밀번호 키를 음성으로 들으려면 헤드셋을 연결하세요."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"점"</string> diff --git a/core/res/res/values-land/arrays.xml b/core/res/res/values-land/arrays.xml index 68e5cfd..537d27c 100644 --- a/core/res/res/values-land/arrays.xml +++ b/core/res/res/values-land/arrays.xml @@ -23,49 +23,49 @@ <array name="lockscreen_targets_when_silent"> <item>@null</item>" <item>@drawable/ic_lockscreen_unlock</item> - <item>@null</item> + <item>@drawable/ic_lockscreen_search</item> <item>@drawable/ic_lockscreen_soundon</item> </array> <array name="lockscreen_target_descriptions_when_silent"> <item>@null</item> <item>@string/description_target_unlock</item> - <item>@null</item> + <item>@string/description_target_search</item> <item>@string/description_target_soundon</item> </array> <array name="lockscreen_direction_descriptions"> <item>@null</item> <item>@string/description_direction_up</item> - <item>@null</item> + <item>@string/description_direction_left</item> <item>@string/description_direction_down</item> </array> <array name="lockscreen_targets_when_soundon"> <item>@null</item> <item>@drawable/ic_lockscreen_unlock</item> - <item>@null</item> + <item>@drawable/ic_lockscreen_search</item> <item>@drawable/ic_lockscreen_silent</item> </array> <array name="lockscreen_target_descriptions_when_soundon"> <item>@null</item> <item>@string/description_target_unlock</item> - <item>@null</item> + <item>@string/description_target_search</item> <item>@string/description_target_silent</item> </array> <array name="lockscreen_targets_with_camera"> <item>@null</item> <item>@drawable/ic_lockscreen_unlock</item> - <item>@null</item> + <item>@drawable/ic_lockscreen_search</item> <item>@drawable/ic_lockscreen_camera</item> </array> <array name="lockscreen_target_descriptions_with_camera"> <item>@null</item> <item>@string/description_target_unlock</item> - <item>@null</item> + <item>@string/description_target_search</item> <item>@string/description_target_camera</item> </array> diff --git a/core/res/res/values-lt/strings.xml b/core/res/res/values-lt/strings.xml index 8aeb170..fa13981 100644 --- a/core/res/res/values-lt/strings.xml +++ b/core/res/res/values-lt/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Įveskite 8 skaitmenų ar ilgesnį PUK kodą."</string> <string name="needPuk" msgid="919668385956251611">"Jūsų SIM kortelė yra užrakinta PUK kodu. Jei norite ją atrakinti, įveskite PUK kodą."</string> <string name="needPuk2" msgid="4526033371987193070">"Įveskite PUK2 kodą, kad panaikintumėte SIM kortelės blokavimą."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Įeinančio skambintojo ID"</string> <string name="ClirMmi" msgid="7784673673446833091">"Išeinančio skambintojo ID"</string> <string name="CfMmi" msgid="5123218989141573515">"Skambučio peradresavimas"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Nustatyti laiką"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Nustatyti datą"</string> <string name="date_time_set" msgid="5777075614321087758">"Nustatyti"</string> + <string name="date_time_done" msgid="2507683751759308828">"Baigta"</string> <string name="default_permission_group" msgid="2690160991405646128">"Numatytasis"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NAUJAS: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Nereikia leidimų"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Pridėti paskyrą"</string> <string name="choose_account_text" msgid="6303348737197849675">"Kurią paskyrą norite naudoti?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Pridėti paskyrą"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Padidinti"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Sumažinti"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Padidinti"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Sumažinti"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Palieskite <xliff:g id="VALUE">%s</xliff:g> ir laikykite."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Slinkite aukštyn, kad būtų parodytas padidėjimas, ir žemyn, kad būtų parodytas sumažėjimas."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Padidėjimo minutė"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Sumažėjimo minutė"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Padidėjimo valanda"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Sumažėjimo valanda"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Slinkite aukštyn, kad padidintumėte, ir žemyn, kad sumažintumėte."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Padidinti minučių skaičių"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Sumažinti minučių skaičių"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Padidinti valandų skaičių"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Sumažinti valandų skaičių"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Nustatyti po pusiaudienio"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Nustatyti prieš pusiaudienį"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Padidėjimo mėnuo"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Sumažėjimo mėnuo"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Padidėjimo diena"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Sumažėjimo diena"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Padidėjimo metai"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Sumažėjimo metai"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Padidinti mėnesių skaičių"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Sumažinti mėnesių skaičių"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Padidinti dienų skaičių"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Sumažinti dienų skaičių"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Padidinti metų skaičių"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Sumažinti metų skaičių"</string> <string name="checkbox_checked" msgid="7222044992652711167">"pažymėtas"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"nepatikrinta"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"pasirinkta"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Bendrinti su"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Bendrinti su „<xliff:g id="APPLICATION_NAME">%s</xliff:g>“"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Slydimo valdymas. Palieskite ir laikykite."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Aukštyn į <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Žemyn į <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Kairėn į <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Dešinėn į <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Slyskite aukštyn link <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Slyskite žemyn link <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Slyskite į kairę link <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Slyskite į dešinę link <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Atrakinti"</string> <string name="description_target_camera" msgid="969071997552486814">"Vaizdo kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Begarsis"</string> <string name="description_target_soundon" msgid="30052466675500172">"Garsas įjungtas"</string> + <string name="description_target_search" msgid="3091587249776033139">"Paieška"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Perbraukite pirštu, kad atrakintumėte."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Prijunkite ausines, kad išgirstumėte sakomus slaptažodžio klavišus."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Taškas."</string> diff --git a/core/res/res/values-lv/strings.xml b/core/res/res/values-lv/strings.xml index f434e09..1fe5316 100644 --- a/core/res/res/values-lv/strings.xml +++ b/core/res/res/values-lv/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Ierakstiet PUK kodu, kas sastāv no 8 vai vairāk cipariem."</string> <string name="needPuk" msgid="919668385956251611">"SIM karte ir bloķēta ar PUK kodu. Ierakstiet PUK kodu, lai to atbloķētu."</string> <string name="needPuk2" msgid="4526033371987193070">"Ierakstiet PUK2 kodu, lai atbloķētu SIM karti."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Ienākošā zvana zvanītāja ID"</string> <string name="ClirMmi" msgid="7784673673446833091">"Izejošā zvana zvanītāja ID"</string> <string name="CfMmi" msgid="5123218989141573515">"Zvanu pāradresācija"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Laika iestatīšana"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Datuma iestatīšana"</string> <string name="date_time_set" msgid="5777075614321087758">"Iestatīt"</string> + <string name="date_time_done" msgid="2507683751759308828">"Gatavs"</string> <string name="default_permission_group" msgid="2690160991405646128">"Noklusējums"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"JAUNA: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Atļaujas nav nepieciešamas."</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Pievienot kontu"</string> <string name="choose_account_text" msgid="6303348737197849675">"Kuru kontu vēlaties izmantot?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Pievienot kontu"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Palielināt"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Samazināt"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Palielināt"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Samazināt"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g>: pieskarieties un turiet nospiestu."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Bīdiet uz augšu, lai palielinātu vērtību, un uz leju, lai to samazinātu."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Palielināt minūtes vērtību"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Samazināt minūtes vērtību"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Palielināt stundas vērtību"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Samazināt stundas vērtību"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Velciet uz augšu, lai palielinātu vērtību, un uz leju, lai to samazinātu."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Norādīt vēlākas minūtes"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Norādīt agrākas minūtes"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Norādīt vēlāku stundu"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Norādīt agrāku stundu"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Iestatīt pēcpusdienas laiku"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Iestatīt priekšpusdienas laiku"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Palielināt mēneša vērtību"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Samazināt mēneša vērtību"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Palielināt datuma vērtību"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Samazināt datuma vērtību"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Palielināt gada vērtību"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Samazināt gada vērtību"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Norādīt vēlāku mēnesi"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Norādīt agrāku mēnesi"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Norādīt vēlāku dienu"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Norādīt agrāku dienu"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Norādīt vēlāku gadu"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Norādīt agrāku gadu"</string> <string name="checkbox_checked" msgid="7222044992652711167">"atzīmēta"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"nav atzīmēta"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"atlasīta"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Kopīgot ar:"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Kopīgot ar lietojumprogrammu <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Bīdāms turis. Pieskarieties tam un turiet to nospiestu."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Bīdiet uz augšu, lai veiktu šādu darbību: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Bīdiet uz leju, lai veiktu šādu darbību: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Bīdiet pa kreisi, lai veiktu šādu darbību: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Bīdiet pa labi, lai veiktu šādu darbību: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Velciet uz augšu, lai veiktu šādu darbību: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Velciet uz leju, lai veiktu šādu darbību: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Velciet pa kreisi, lai veiktu šādu darbību: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Velciet pa labi, lai veiktu šādu darbību: <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Atbloķēt"</string> <string name="description_target_camera" msgid="969071997552486814">"Kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Klusums"</string> <string name="description_target_soundon" msgid="30052466675500172">"Skaņa ieslēgta"</string> + <string name="description_target_search" msgid="3091587249776033139">"Meklēt"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Velciet ar pirkstu, lai atbloķētu."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Pievienojiet austiņas, lai dzirdētu paroles taustiņu nosaukumus."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Punkts."</string> diff --git a/core/res/res/values-ms/strings.xml b/core/res/res/values-ms/strings.xml index a2dd90c..da9ca41 100644 --- a/core/res/res/values-ms/strings.xml +++ b/core/res/res/values-ms/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Taipkan PUK yang mempunyai 8 nombor atau lebih panjang."</string> <string name="needPuk" msgid="919668385956251611">"Kad SIM anda dikunci PUK. Taipkan kod PUK untuk membuka kuncinya."</string> <string name="needPuk2" msgid="4526033371987193070">"Taipkan PUK2 untuk menyahsekat kad SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"ID Pemanggil Masuk"</string> <string name="ClirMmi" msgid="7784673673446833091">"ID Pemanggil Keluar"</string> <string name="CfMmi" msgid="5123218989141573515">"Pemajuan panggilan"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Tetapkan masa"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Tetapkan tarikh"</string> <string name="date_time_set" msgid="5777075614321087758">"Tetapkan"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Lalai"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"BAHARU: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Tiada kebenaran diperlukan"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Tambah akaun"</string> <string name="choose_account_text" msgid="6303348737197849675">"Akaun mana yang mahu anda gunakan?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Tambah akaun"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Kenaikan"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Penyusutan"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> sentuh terus."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Luncurkan ke atas untuk kenaikan dan ke bawah untuk penyusutan."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Minit kenaikan"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Minit penyusutan"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Jam kenaikan"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Jam penyusutan"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Tetapkan PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Tetapkan AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Bulan kenaikan"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Bulan penyusutan"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Hari kenaikan"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Hari penyusutan"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Tahun kenaikan"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Tahun penyusutan"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"ditandakan"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"tidak ditandakan"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"dipilih"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Kongsi dengan"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Kongsi dengan <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Pemegang gelongsor. Sentuh & tahan."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Atas untuk <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Bawah untuk <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Kiri untuk <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Kanan untuk <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Buka kunci"</string> <string name="description_target_camera" msgid="969071997552486814">"Kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Senyap"</string> <string name="description_target_soundon" msgid="30052466675500172">"Bunyi dihidupkan"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Leret untuk membuka kunci."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Pasangkan set kepala untuk mendengar kekunci kata laluan disebutkan."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Titik."</string> diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml index b3ea39f..ec580ad 100644 --- a/core/res/res/values-nb/strings.xml +++ b/core/res/res/values-nb/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Skriv inn en PUK-kode på åtte tall eller mer."</string> <string name="needPuk" msgid="919668385956251611">"SIM-kortet ditt er PUK-låst. Skriv inn PUK-koden for å låse det opp."</string> <string name="needPuk2" msgid="4526033371987193070">"Skriv inn PUK2 for å låse opp SIM-kortet."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Inngående nummervisning"</string> <string name="ClirMmi" msgid="7784673673446833091">"Utgående nummervisning"</string> <string name="CfMmi" msgid="5123218989141573515">"Viderekobling"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Stille klokken"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Angi dato"</string> <string name="date_time_set" msgid="5777075614321087758">"Lagre"</string> + <string name="date_time_done" msgid="2507683751759308828">"Ferdig"</string> <string name="default_permission_group" msgid="2690160991405646128">"Standard"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NYTT: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Trenger ingen rettigheter"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Legg til en konto"</string> <string name="choose_account_text" msgid="6303348737197849675">"Hvilken konto vil du bruke?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Legg til konto"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Øke"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Senke"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Øk"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Reduser"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> – trykk og hold inne."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Skyv opp for å øke og ned for å redusere."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Endre minutter (fremover)"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Endre minutter (bakover)"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Endre timer (fremover)"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Endre time (bakover)"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Dra opp for å øke og ned for å redusere."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Øk minutter"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Reduser minutter"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Øk timer"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Reduser timer"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Angi p.m."</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Angi a.m."</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Endre måned (fremover)"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Endre måned (bakover)"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Endre dag (fremover)"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Endre dag (bakover)"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Endre år (fremover)"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Endre år (bakover)"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Øk måneder"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Reduser måneder"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Øk dager"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Reduser dager"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Øk år"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Reduser år"</string> <string name="checkbox_checked" msgid="7222044992652711167">"valgt"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"ikke valgt"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"valgt"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Del med"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Del med <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Glidebryter. Trykk og hold inne."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Opp for <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Ned for <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Venstre for <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Høyre for <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Dra opp for å <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Dra ned for å <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Dra til venstre for å <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Dra til høyre for å <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Lås opp"</string> <string name="description_target_camera" msgid="969071997552486814">"Kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Stille"</string> <string name="description_target_soundon" msgid="30052466675500172">"Lyd på"</string> + <string name="description_target_search" msgid="3091587249776033139">"Søk"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Sveip for å låse opp."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Koble til hodetelefoner for å høre opplesing av bokstavene i passordet."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Punktum."</string> diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml index 5698f03..94d9712 100644 --- a/core/res/res/values-nl/strings.xml +++ b/core/res/res/values-nl/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Typ een PUK-code die 8 cijfers of langer is."</string> <string name="needPuk" msgid="919668385956251611">"Uw SIM-kaart is vergrendeld met de PUK-code. Typ de PUK-code om te ontgrendelen."</string> <string name="needPuk2" msgid="4526033371987193070">"Voer de PUK2-code in om de SIM-kaart te ontgrendelen."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Inkomende beller-id"</string> <string name="ClirMmi" msgid="7784673673446833091">"Uitgaande beller-id"</string> <string name="CfMmi" msgid="5123218989141573515">"Oproep doorschakelen"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Tijd instellen"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Datum instellen"</string> <string name="date_time_set" msgid="5777075614321087758">"Instellen"</string> + <string name="date_time_done" msgid="2507683751759308828">"Gereed"</string> <string name="default_permission_group" msgid="2690160991405646128">"Standaard"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NIEUW: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Geen machtigingen vereist"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Een account toevoegen"</string> <string name="choose_account_text" msgid="6303348737197849675">"Welk account wilt u gebruiken?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Account toevoegen"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Hoger"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Lager"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Verhogen"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Verlagen"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> blijven aanraken."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Schuif omhoog om te verhogen en omlaag om te verlagen."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Minuten verhogen"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Minuten verlagen"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Uren verhogen"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Uren verlagen"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Veeg omhoog om te verhogen en omlaag om te verlagen."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Hogere waarde voor minuten"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Lagere waarde voor minuten"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Hogere waarde voor uren"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Lagere waarde voor uren"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"PM instellen"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"AM instellen"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Maand verhogen"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Maand verlagen"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Dag verhogen"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Dag verlagen"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Jaar verhogen"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Jaar verlagen"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Hogere waarde voor maand"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Lagere waarde voor maand"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Hogere waarde voor dag"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Lagere waarde voor dag"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Hogere waarde voor jaar"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Lagere waarde voor jaar"</string> <string name="checkbox_checked" msgid="7222044992652711167">"aangevinkt"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"niet aangevinkt"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"geselecteerd"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Delen met"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Delen met <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Schuifgreep. Tikken en blijven aanraken."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Omhoog voor <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Omlaag voor <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Links voor <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Rechts voor <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Veeg omhoog voor <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Veeg omlaag voor <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Veeg naar links voor <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Veeg naar rechts voor <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Ontgrendelen"</string> <string name="description_target_camera" msgid="969071997552486814">"Camera"</string> <string name="description_target_silent" msgid="893551287746522182">"Stil"</string> <string name="description_target_soundon" msgid="30052466675500172">"Geluid aan"</string> + <string name="description_target_search" msgid="3091587249776033139">"Zoeken"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Vegen om te ontgrendelen"</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Sluit een headset aan om wachtwoordtoetsen te laten voorlezen."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Stip."</string> diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml index da2f78d..ee10502 100644 --- a/core/res/res/values-pl/strings.xml +++ b/core/res/res/values-pl/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Wpisz kod PUK składający się z co najmniej 8 cyfr."</string> <string name="needPuk" msgid="919668385956251611">"Karta SIM jest zablokowana kodem PUK. Wprowadź kod PUK, aby odblokować kartę."</string> <string name="needPuk2" msgid="4526033371987193070">"Wprowadź kod PUK2, aby odblokować kartę SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Identyfikator rozmówcy przy połączeniach przychodzących"</string> <string name="ClirMmi" msgid="7784673673446833091">"Identyfikator rozmówcy przy połączeniach wychodzących"</string> <string name="CfMmi" msgid="5123218989141573515">"Przekazywanie połączeń"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Ustaw godzinę"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Ustaw datę"</string> <string name="date_time_set" msgid="5777075614321087758">"Ustaw"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Domyślne"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NOWE: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Nie są wymagane żadne uprawnienia"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Dodaj konto"</string> <string name="choose_account_text" msgid="6303348737197849675">"Którego konta chcesz użyć?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Dodaj konto"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Zwiększ"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Zmniejsz"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> dotknij i przytrzymaj."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Przesuń w górę, aby zwiększyć wartość, lub w dół, aby ją zmniejszyć."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Następna minuta"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Poprzednia minuta"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Następna godzina"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Poprzednia godzina"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Ustaw PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Ustaw AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Następny miesiąc"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Poprzedni miesiąc"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Następny dzień"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Poprzedni dzień"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Następny rok"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Poprzedni rok"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"zaznaczono"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"nie zaznaczono"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"wybrano"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Udostępnij przez"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Udostępnij przez <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Uchwyt przesuwny. Dotknij i przytrzymaj."</string> - <string name="description_direction_up" msgid="1983114130441878529">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>: w górę"</string> - <string name="description_direction_down" msgid="4294993639091088240">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>: w dół"</string> - <string name="description_direction_left" msgid="6814008463839915747">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>: w lewo"</string> - <string name="description_direction_right" msgid="4296057241963012862">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>: w prawo"</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Odblokuj"</string> <string name="description_target_camera" msgid="969071997552486814">"Aparat"</string> <string name="description_target_silent" msgid="893551287746522182">"Wyciszenie"</string> <string name="description_target_soundon" msgid="30052466675500172">"Włącz dźwięk"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Przesuń, aby odblokować."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Podłącz zestaw słuchawkowy, aby wysłuchać znaków hasła wypowiadanych na głos."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Kropka"</string> diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml index ec43491..290ae19 100644 --- a/core/res/res/values-pt-rPT/strings.xml +++ b/core/res/res/values-pt-rPT/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Introduza um PUK que tenha 8 ou mais algarismos."</string> <string name="needPuk" msgid="919668385956251611">"O seu cartão SIM está bloqueado com PUK. Introduza o código PUK para desbloqueá-lo."</string> <string name="needPuk2" msgid="4526033371987193070">"Introduza o PUK2 para desbloquear o cartão SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"ID do Autor da Chamada"</string> <string name="ClirMmi" msgid="7784673673446833091">"ID do autor da chamada efetuada"</string> <string name="CfMmi" msgid="5123218989141573515">"Encaminhamento de chamadas"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Definir hora"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Definir data"</string> <string name="date_time_set" msgid="5777075614321087758">"Definir"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Predefinido"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NOVA: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Não são necessárias permissões"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Adicionar uma conta"</string> <string name="choose_account_text" msgid="6303348737197849675">"Que conta pretende utilizar?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Adicionar conta"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Aumentar"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Diminuir"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Toque sem soltar em <xliff:g id="VALUE">%s</xliff:g>."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Deslize lentamente para cima para aumentar e para baixo para diminuir."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Aumentar minuto"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Diminuir minuto"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Aumentar hora"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Diminuir hora"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Definir PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Definir AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Aumentar mês"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Diminuir mês"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Aumentar dia"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Diminuir dia"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Aumentar ano"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Diminuir ano"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"marcado"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"desmarcado"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"selecionado"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Partilhar com:"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Compartilhar com <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Barra deslizante. Toque & não solte."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Para cima para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Para baixo para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Para a esquerda para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Para a direita para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Desbloquear"</string> <string name="description_target_camera" msgid="969071997552486814">"Câmara"</string> <string name="description_target_silent" msgid="893551287746522182">"Silencioso"</string> <string name="description_target_soundon" msgid="30052466675500172">"Som ativado"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Deslizar rapidamente para desbloquear."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Ligue os auscultadores com microfone integrado para ouvir as teclas da palavra-passe."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Ponto."</string> diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml index 53e2a96..09fe685 100644 --- a/core/res/res/values-pt/strings.xml +++ b/core/res/res/values-pt/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Digite um PUK com oito números ou mais."</string> <string name="needPuk" msgid="919668385956251611">"O seu cartão SIM está bloqueado por um PUK. Digite o código PUK para desbloqueá-lo."</string> <string name="needPuk2" msgid="4526033371987193070">"Digite o PUK2 para desbloquear o cartão SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"ID do chamador de entrada"</string> <string name="ClirMmi" msgid="7784673673446833091">"ID do chamador de saída"</string> <string name="CfMmi" msgid="5123218989141573515">"Encaminhamento de chamada"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Definir hora"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Definir data"</string> <string name="date_time_set" msgid="5777075614321087758">"Definir"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Padrão"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NOVO: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Nenhuma permissão necessária"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Adicionar uma conta"</string> <string name="choose_account_text" msgid="6303348737197849675">"Qual conta você deseja usar?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Adicionar conta"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Incremento"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Redução"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> toque e mantenha pressionado."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Deslize para cima para aumentar e para baixo para diminuir."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Aumentar minuto"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Diminuir minuto"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Aumentar hora"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Diminuir hora"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Configurar valor PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Configurar valor AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Aumentar mês"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Diminuir mês"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Aumentar dia"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Reduzir dia"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Aumentar ano"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Diminuir ano"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"verificado"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"não selecionado"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"selecionado"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Compartilhar com"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Compartilhar com <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Recurso deslizante. Toque e segure."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Deslize para cima para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Deslize para baixo para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Deslize para a esquerda para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Deslize para a direita para <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Desbloquear"</string> <string name="description_target_camera" msgid="969071997552486814">"Câmera"</string> <string name="description_target_silent" msgid="893551287746522182">"Silencioso"</string> <string name="description_target_soundon" msgid="30052466675500172">"Som ativado"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Deslize para desbloquear."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Conecte um fone de ouvido para ouvir as teclas da senha."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Ponto final."</string> diff --git a/core/res/res/values-rm/strings.xml b/core/res/res/values-rm/strings.xml index 5f0561b..f4bc105 100644 --- a/core/res/res/values-rm/strings.xml +++ b/core/res/res/values-rm/strings.xml @@ -1509,6 +1509,8 @@ <!-- no translation found for date_picker_dialog_title (5879450659453782278) --> <skip /> <string name="date_time_set" msgid="5777075614321087758">"Definir"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Standard"</string> <!-- no translation found for perms_new_perm_prefix (8257740710754301407) --> <skip /> @@ -1746,37 +1748,37 @@ <skip /> <!-- no translation found for add_account_button_label (3611982894853435874) --> <skip /> - <!-- no translation found for number_picker_increment_button (4830170763103463443) --> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> <skip /> - <!-- no translation found for number_picker_decrement_button (2576606679160067262) --> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> <skip /> <!-- no translation found for number_picker_increment_scroll_mode (3073101067441638428) --> <skip /> - <!-- no translation found for number_picker_increment_scroll_action (4628981789985093179) --> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> <skip /> - <!-- no translation found for time_picker_increment_minute_button (2843066823236250329) --> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> <skip /> - <!-- no translation found for time_picker_decrement_minute_button (4357907223628449595) --> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> <skip /> - <!-- no translation found for time_picker_increment_hour_button (2484204991937119057) --> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> <skip /> - <!-- no translation found for time_picker_decrement_hour_button (4659353501775842780) --> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> <skip /> <!-- no translation found for time_picker_increment_set_pm_button (4147590696151230863) --> <skip /> <!-- no translation found for time_picker_decrement_set_am_button (8302140353539486752) --> <skip /> - <!-- no translation found for date_picker_increment_month_button (6324978841467899081) --> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> <skip /> - <!-- no translation found for date_picker_decrement_month_button (7304349355000398077) --> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> <skip /> - <!-- no translation found for date_picker_increment_day_button (4397040141921413183) --> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> <skip /> - <!-- no translation found for date_picker_decrement_day_button (2427816793443629131) --> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> <skip /> - <!-- no translation found for date_picker_increment_year_button (3058553394722295105) --> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> <skip /> - <!-- no translation found for date_picker_decrement_year_button (5193062846559743823) --> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> <skip /> <!-- no translation found for checkbox_checked (7222044992652711167) --> <skip /> @@ -1816,13 +1818,13 @@ <skip /> <!-- no translation found for content_description_sliding_handle (415975056159262248) --> <skip /> - <!-- no translation found for description_direction_up (1983114130441878529) --> + <!-- no translation found for description_direction_up (7169032478259485180) --> <skip /> - <!-- no translation found for description_direction_down (4294993639091088240) --> + <!-- no translation found for description_direction_down (5087739728639014595) --> <skip /> - <!-- no translation found for description_direction_left (6814008463839915747) --> + <!-- no translation found for description_direction_left (7207478719805562165) --> <skip /> - <!-- no translation found for description_direction_right (4296057241963012862) --> + <!-- no translation found for description_direction_right (8034433242579600980) --> <skip /> <!-- no translation found for description_target_unlock (2228524900439801453) --> <skip /> @@ -1832,6 +1834,8 @@ <skip /> <!-- no translation found for description_target_soundon (30052466675500172) --> <skip /> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <!-- no translation found for description_target_unlock_tablet (3833195335629795055) --> <skip /> <!-- no translation found for keyboard_headset_required_to_hear_password (7011927352267668657) --> diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml index 11199b0..9dee72d 100644 --- a/core/res/res/values-ro/strings.xml +++ b/core/res/res/values-ro/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Introduceţi un cod PUK care să aibă 8 cifre sau mai mult."</string> <string name="needPuk" msgid="919668385956251611">"Cardul SIM este blocat cu codul PUK. Introduceţi codul PUK pentru a-l debloca."</string> <string name="needPuk2" msgid="4526033371987193070">"Introduceţi codul PUK2 pentru a debloca cardul SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"ID apelant de primire"</string> <string name="ClirMmi" msgid="7784673673446833091">"ID apelant"</string> <string name="CfMmi" msgid="5123218989141573515">"Redirecţionarea apelurilor"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Setaţi ora"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Setaţi data"</string> <string name="date_time_set" msgid="5777075614321087758">"Setaţi"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Prestabilit"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NOU: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Nu se solicită nicio permisiune"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Adăugaţi un cont"</string> <string name="choose_account_text" msgid="6303348737197849675">"Ce cont doriţi să utilizaţi?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Adăugaţi un cont"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Incrementaţi"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Decrementaţi"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Atingeţi şi ţineţi apăsat <xliff:g id="VALUE">%s</xliff:g>."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Glisaţi în sus pentru incrementare şi în jos pentru decrementare."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Incrementaţi valoarea pentru minut"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Decrementaţi valoarea pentru minut"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Incrementaţi valoarea pentru oră"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Decrementaţi valoarea pentru oră"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Setaţi valoarea PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Setaţi valoarea AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Incrementaţi valoarea pentru lună"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Decrementaţi valoarea pentru lună"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Incrementaţi valoarea pentru zi"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Decrementaţi valoarea pentru zi"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Incrementaţi valoarea pentru an"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Decrementaţi valoarea pentru an"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"bifată"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"nebifată"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"selectat"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Permiteţi accesul pentru"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Permiteţi accesul pentru <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Mâner glisant. Atingeţi şi ţineţi apăsat."</string> - <string name="description_direction_up" msgid="1983114130441878529">"În sus pentru <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"În jos pentru <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"La stânga pentru <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"La dreapta pentru <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Deblocaţi"</string> <string name="description_target_camera" msgid="969071997552486814">"Cameră foto"</string> <string name="description_target_silent" msgid="893551287746522182">"Silenţios"</string> <string name="description_target_soundon" msgid="30052466675500172">"Sunet activat"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Glisaţi pentru a debloca."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Conectaţi un set căşti-microfon pentru a auzi tastele apăsate când introduceţi parola."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Punct."</string> diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml index d4adfb4..041133cd 100644 --- a/core/res/res/values-ru/strings.xml +++ b/core/res/res/values-ru/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Введите PUK-код из 8 или более цифр."</string> <string name="needPuk" msgid="919668385956251611">"SIM-карта заблокирована с помощью кода PUK. Для разблокировки введите код PUK."</string> <string name="needPuk2" msgid="4526033371987193070">"Для разблокировки SIM-карты введите PUK2."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Идентификация вызывающего абонента"</string> <string name="ClirMmi" msgid="7784673673446833091">"Идентификация звонящего абонента"</string> <string name="CfMmi" msgid="5123218989141573515">"Переадресация вызова"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Настройка времени"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Настройка даты"</string> <string name="date_time_set" msgid="5777075614321087758">"Установить"</string> + <string name="date_time_done" msgid="2507683751759308828">"Готово"</string> <string name="default_permission_group" msgid="2690160991405646128">"По умолчанию"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"НОВОЕ: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Не требуется разрешений"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Добавить аккаунт"</string> <string name="choose_account_text" msgid="6303348737197849675">"Выберите аккаунт"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Добавить аккаунт"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Увеличить"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Уменьшить"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Увеличить"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Уменьшить"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Нажмите и удерживайте <xliff:g id="VALUE">%s</xliff:g>."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Проведите вверх, чтобы увеличить значение, и вниз, чтобы уменьшить его."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"На минуту вперед"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"На минуту назад"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"На час вперед"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"На час назад"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Проведите вверх, чтобы увеличить значение, и вниз, чтобы уменьшить его."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"На минуту вперед"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"На минуту назад"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"На час вперед"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"На час назад"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Установить время после полудня"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Установить время до полудня"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"На месяц вперед"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"На месяц назад"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"На день вперед"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"На день назад"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"На год вперед"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"На год назад"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"На месяц вперед"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"На месяц назад"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"На день вперед"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"На день назад"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"На год вперед"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"На год назад"</string> <string name="checkbox_checked" msgid="7222044992652711167">"установлено"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"не установлено"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"выбрано"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"Проведите вверх, чтобы <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Проведите вниз, чтобы <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Проведите влево, чтобы <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Проведите вправо, чтобы <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Проведите вверх, чтобы <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Проведите вниз, чтобы <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Проведите влево, чтобы <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Проведите вправо, чтобы <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Разблокировать"</string> <string name="description_target_camera" msgid="969071997552486814">"Камера"</string> <string name="description_target_silent" msgid="893551287746522182">"Без звука"</string> <string name="description_target_soundon" msgid="30052466675500172">"Включить звук"</string> + <string name="description_target_search" msgid="3091587249776033139">"Поиск"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Проведите по экрану, чтобы разблокировать устройство."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Подключите гарнитуру, чтобы услышать пароль."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Точка"</string> diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml index bad739f9..c7c7b4f 100644 --- a/core/res/res/values-sk/strings.xml +++ b/core/res/res/values-sk/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Zadajte kód PUK, ktorý má 8 alebo viac čísel."</string> <string name="needPuk" msgid="919668385956251611">"Karta SIM je uzamknutá pomocou kódu PUK. Odomknite ju zadaním kódu PUK."</string> <string name="needPuk2" msgid="4526033371987193070">"Ak chcete odblokovať kartu SIM, zadajte kód PUK2."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Prichádzajúca identifikácia volajúceho"</string> <string name="ClirMmi" msgid="7784673673446833091">"Odchádzajúca identifikácia volajúceho"</string> <string name="CfMmi" msgid="5123218989141573515">"Presmerovanie hovorov"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Nastaviť čas"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Nastaviť dátum"</string> <string name="date_time_set" msgid="5777075614321087758">"Nastaviť"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Predvolené"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NOVINKA: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Nevyžadujú sa žiadne oprávnenia."</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Pridať účet"</string> <string name="choose_account_text" msgid="6303348737197849675">"Ktorý účet chcete použiť?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Pridať účet"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Zvýšenie"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Zníženie"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Dotknite sa a podržte <xliff:g id="VALUE">%s</xliff:g>."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Ak chcete pripočítať, potiahnite prst nahor. Ak chcete odpočítať, potiahnite prst nadol."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Pripočítať minútu"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Odpočítať minútu"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Pripočítať hodinu"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Odpočítať hodinu"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Nastaviť čas popoludní"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Nastaviť čas dopoludnia"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Pripočítať mesiac"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Odpočítať mesiac"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Pripočítať deň"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Odpočítať deň"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Pripočítať rok"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Odpočítať rok"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"začiarknuté"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"nezačiarknuté"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"vybratý"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Zdieľať s"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Zdieľať s aplikáciou <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Posuvné tlačidlo. Dotknite sa a podržte."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Nahor na <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Nadol na <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Doľava na <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Doprava na <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Odomknúť"</string> <string name="description_target_camera" msgid="969071997552486814">"Fotoaparát"</string> <string name="description_target_silent" msgid="893551287746522182">"Tichý"</string> <string name="description_target_soundon" msgid="30052466675500172">"Zapnúť zvuk"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Posunom odomknúť."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Ak si chcete vypočuť vyslovené klávesy hesla, pripojte náhlavnú súpravu."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Bodka."</string> diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml index 767305c..4dc425b 100644 --- a/core/res/res/values-sl/strings.xml +++ b/core/res/res/values-sl/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Vnesite 8- ali več mestni PUK."</string> <string name="needPuk" msgid="919668385956251611">"Kartica SIM je zaklenjena s kodo PUK. Če jo želite odkleniti, vnesite kodo PUK."</string> <string name="needPuk2" msgid="4526033371987193070">"Če želite odstraniti blokiranje kartice SIM, vnesite PUK2."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"ID dohodnega klicatelja"</string> <string name="ClirMmi" msgid="7784673673446833091">"ID odhodnega klicatelja"</string> <string name="CfMmi" msgid="5123218989141573515">"Preusmerjanje klicev"</string> @@ -430,7 +428,7 @@ <string name="permlab_readPhoneState" msgid="2326172951448691631">"branje stanja in identitete telefona"</string> <string name="permdesc_readPhoneState" msgid="5127767618743602782">"Programu omogoča dostop do funkcij telefona v napravi. Program lahko s tem dovoljenjem določi telefonsko številko in serijsko številko tega telefona, določi lahko tudi, ali je klic aktiven, številko, s katero je klic povezan, in podobno."</string> <string name="permlab_wakeLock" product="tablet" msgid="1531731435011495015">"preprečitev prehoda tabličnega računalnika v stanje pripravljenosti"</string> - <string name="permlab_wakeLock" product="default" msgid="573480187941496130">"preprečevanje prehod v stanje pripravljenosti telefona"</string> + <string name="permlab_wakeLock" product="default" msgid="573480187941496130">"preprečevanje prehoda v stanje pripravljenosti telefona"</string> <string name="permdesc_wakeLock" product="tablet" msgid="7311319824400447868">"Omogoča, da program prepreči prehod tabličnega računalnika v stanje pripravljenosti."</string> <string name="permdesc_wakeLock" product="default" msgid="8559100677372928754">"Programu omogoča, da v telefonu prepreči prehod v stanje pripravljenosti."</string> <string name="permlab_devicePower" product="tablet" msgid="2787034722616350417">"vklop ali izklop tabličnega računalnika"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Nastavi uro"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Nastavi datum"</string> <string name="date_time_set" msgid="5777075614321087758">"Nastavi"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Privzeto"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NOVO: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Ni zahtevanih dovoljenj"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Dodajanje računa"</string> <string name="choose_account_text" msgid="6303348737197849675">"Kateri račun želite uporabiti?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Dodaj račun"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Povečaj"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Zmanjšaj"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Dotaknite se vrednosti <xliff:g id="VALUE">%s</xliff:g> in jo pridržite."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Povlecite gor za povečanje in dol za zmanjšanje."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Povečaj minute"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Zmanjšaj minute"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Povečaj uro"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Zmanjšaj uro"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Nastavi PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Nastavi AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Naslednji mesec"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Prejšnji mesec"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Naslednji dan"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Prejšnji dan"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Naslednje leto"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Prejšnje leto"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"potrjeno"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"ni odkljukano"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"izbrano"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Delite z"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Delite s programom <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Drsna ročica. Dotaknite se in pridržite."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Gor za <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Dol za <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Levo za <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Desno za <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Odkleni"</string> <string name="description_target_camera" msgid="969071997552486814">"Fotoaparat"</string> <string name="description_target_silent" msgid="893551287746522182">"Tiho"</string> <string name="description_target_soundon" msgid="30052466675500172">"Vklopljen zvok"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Povlecite, če želite odkleniti."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Priključite slušalke, če želite slišati izgovorjene tipke gesla."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Pika."</string> diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml index d03abd7..94024b8 100644 --- a/core/res/res/values-sr/strings.xml +++ b/core/res/res/values-sr/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Унесите PUK који се састоји од 8 цифара или више."</string> <string name="needPuk" msgid="919668385956251611">"SIM картица је закључана PUK кодом. Унесите PUK кôд да бисте је откључали."</string> <string name="needPuk2" msgid="4526033371987193070">"Унесите PUK2 да бисте деблокирали SIM картицу."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Долазни ИД позиваоца"</string> <string name="ClirMmi" msgid="7784673673446833091">"Одлазни ИД позиваоца"</string> <string name="CfMmi" msgid="5123218989141573515">"Преусмеравање позива"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Подешавање времена"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Подешавање датума"</string> <string name="date_time_set" msgid="5777075614321087758">"Подеси"</string> + <string name="date_time_done" msgid="2507683751759308828">"Готово"</string> <string name="default_permission_group" msgid="2690160991405646128">"Подразумевано"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"НОВО: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Није потребна ниједна дозвола"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Додај налог"</string> <string name="choose_account_text" msgid="6303348737197849675">"Који налог желите да користите?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Додај налог"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Повећање"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Смањење"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Повећавање"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Смањивање"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> додирните и задржите."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Превуците нагоре за повећање, а надоле за смањење."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Повећај минуте"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Смањи минуте"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Повећај сате"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Смањи сате"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Превуците нагоре да бисте повећали, а надоле да бисте смањили."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Повећавање минута"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Смањивање минута"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Повећавање сати"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Смањивање сати"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Подеси по подне"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Подеси пре подне"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Повећај месеце"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Смањи месеце"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Повећај дане"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Смањи дане"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Повећај године"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Смањи године"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Повећавање месеца"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Смањивање месеца"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Повећавање дана"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Смањивање дана"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Повећавање године"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Смањивање године"</string> <string name="checkbox_checked" msgid="7222044992652711167">"изабрано"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"није потврђено"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"изабрано"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"Нагоре за <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Надоле за <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Улево за <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Удесно за <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Превуците нагоре за <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Превуците надоле за <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Превуците улево за <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Превуците удесно за <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Откључај"</string> <string name="description_target_camera" msgid="969071997552486814">"Камера"</string> <string name="description_target_silent" msgid="893551287746522182">"Нечујно"</string> <string name="description_target_soundon" msgid="30052466675500172">"Укључи звук"</string> + <string name="description_target_search" msgid="3091587249776033139">"Претрага"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Превуците да бисте откључали."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Прикључите слушалице да бисте чули изговорене тастере за лозинку."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Тачка."</string> diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml index ddaa30a..ec77eb1 100644 --- a/core/res/res/values-sv/strings.xml +++ b/core/res/res/values-sv/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Ange en PUK-kod med minst 8 siffror."</string> <string name="needPuk" msgid="919668385956251611">"Ditt SIM-kort är PUK-låst. Ange PUK-koden om du vill låsa upp det."</string> <string name="needPuk2" msgid="4526033371987193070">"Ange PUK2-koden för att häva spärren av SIM-kortet."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI-kod"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Nummerpresentatör för inkommande samtal"</string> <string name="ClirMmi" msgid="7784673673446833091">"Nummerpresentatör för utgående samtal"</string> <string name="CfMmi" msgid="5123218989141573515">"Vidarebefordra samtal"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Ange tid"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Ange datum"</string> <string name="date_time_set" msgid="5777075614321087758">"Ställ in"</string> + <string name="date_time_done" msgid="2507683751759308828">"Klar"</string> <string name="default_permission_group" msgid="2690160991405646128">"Standardinställning"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"NY: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Inga behörigheter krävs"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Lägg till ett konto"</string> <string name="choose_account_text" msgid="6303348737197849675">"Vilket konto vill du använda?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Lägg till konto"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Öka"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Minska"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Öka"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Minska"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> tryck länge."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Skjut uppåt för att öka och nedåt för att minska."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Öka minuter"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Minska minuter"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Öka timmar"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Minska timmar"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Dra uppåt för att öka och nedåt för att minska."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Öka minuter"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Minska minuter"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Öka timmar"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Minska timmar"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Ange em"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Ange fm"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Öka månad"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Minska månad"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Öka dagar"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Minska dag"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Öka år"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Minska år"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Öka månader"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Minska månader"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Öka dagar"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Minska dagar"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Öka år"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Minska år"</string> <string name="checkbox_checked" msgid="7222044992652711167">"markerat"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"inte markerat"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"markerade"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Dela med"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Dela med <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Skärmlåsfunktion. Tryck och dra."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Upp för <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Ned för <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Vänster för <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Höger för <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Dra uppåt för <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Dra nedåt för <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Dra åt vänster för <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Dra åt höger för <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Lås upp"</string> <string name="description_target_camera" msgid="969071997552486814">"Kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Tyst"</string> <string name="description_target_soundon" msgid="30052466675500172">"Ljud på"</string> + <string name="description_target_search" msgid="3091587249776033139">"Sök"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Lås upp genom att dra."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Anslut mikrofonlurar om du vill att lösenordet ska läsas upp."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Punkt."</string> diff --git a/core/res/res/values-sw/strings.xml b/core/res/res/values-sw/strings.xml index 0424964..6b64163 100644 --- a/core/res/res/values-sw/strings.xml +++ b/core/res/res/values-sw/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Andika PUK ambayo ina urefu wa nambari 8 au zaidi."</string> <string name="needPuk" msgid="919668385956251611">"Kadi yako ya SIM imefungwa na PUK. Anika msimbo wa PUK ili kuifungua."</string> <string name="needPuk2" msgid="4526033371987193070">"Chapisha PUK2 ili kufungua SIM kadi."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Kitambulisho cha Mpigaji wa Simu Inayoingia"</string> <string name="ClirMmi" msgid="7784673673446833091">"ID ya Mpigaji simu Inayotoka nje"</string> <string name="CfMmi" msgid="5123218989141573515">"Kusambaza simu"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Weka muda"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Weka tarehe"</string> <string name="date_time_set" msgid="5777075614321087758">"Weka"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Chaguo-msingi"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">" MPYA: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Hakuna vibali vinavyohitajika"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Ongeza akaunti"</string> <string name="choose_account_text" msgid="6303348737197849675">"Je, ni akaunti gani unataka kutumia?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Ongeza akaunti"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Ongezeko"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Punguza"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> gusa na ushikilie."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Nyiririsha juu kuongeza na chini kupunguza."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Dakika ya nyongeza"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Dakika pungufu"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Saa ya nyongeza"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Saa pungufu."</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Seti PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Seti AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Mwezi wa nyongeza"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Mwezi pungufu"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Siku ya nyongeza"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Siku pungufu"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Mwaka wa nyongeza"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Mwaka pungufu"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"imeangaliwa"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"haijakaguliwa"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"Iliyochaguliwa"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Gawa na"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Gawa na <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Utambo unaosonga. Gusa & shika"</string> - <string name="description_direction_up" msgid="1983114130441878529">"Juu ajili ya<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Chini kwa ajili ya<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Kushoto kwa <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Kulia kwa ajili ya <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> ."</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Fungua"</string> <string name="description_target_camera" msgid="969071997552486814">"Kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Kimya"</string> <string name="description_target_soundon" msgid="30052466675500172">"Sauti imewashwa"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Pitisha ili kufungua."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Chomeka kifaa cha sauti ili kusikiliza vibonye vya nenosiri vikizungumzwa."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Nukta."</string> diff --git a/core/res/res/values-th/strings.xml b/core/res/res/values-th/strings.xml index 7197f90..a9313b7 100644 --- a/core/res/res/values-th/strings.xml +++ b/core/res/res/values-th/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"พิมพ์รหัส PUK ซึ่งต้องเป็นตัวเลขอย่างน้อย 8 หลัก"</string> <string name="needPuk" msgid="919668385956251611">"ซิมการ์ดของคุณถูกล็อกด้วย PUK พิมพ์รหัส PUK เพื่อปลดล็อก"</string> <string name="needPuk2" msgid="4526033371987193070">"พิมพ์ PUK2 เพื่อยกเลิกการปิดกั้นซิมการ์ด"</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"หมายเลขผู้โทรเข้า"</string> <string name="ClirMmi" msgid="7784673673446833091">"หมายเลขผู้โทรออก"</string> <string name="CfMmi" msgid="5123218989141573515">"การโอนสาย"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"ตั้งเวลา"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"ตั้งวันที่"</string> <string name="date_time_set" msgid="5777075614321087758">"ตั้งค่า"</string> + <string name="date_time_done" msgid="2507683751759308828">"เสร็จสิ้น"</string> <string name="default_permission_group" msgid="2690160991405646128">"เริ่มต้น"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"ใหม่: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"ไม่ต้องการการอนุญาต"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"เพิ่มบัญชี"</string> <string name="choose_account_text" msgid="6303348737197849675">"คุณต้องการใช้บัญชีใด"</string> <string name="add_account_button_label" msgid="3611982894853435874">"เพิ่มบัญชี"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"การเพิ่ม"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"การลด"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"เพิ่ม"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"ลด"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"แตะ <xliff:g id="VALUE">%s</xliff:g> ค้างไว้"</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"เลื่อนขึ้นเพื่อเพิ่มและเลื่อนลงเพื่อลด"</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"เพิ่มนาที"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"ลดนาที"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"เพิ่มชั่วโมง"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"ลดชั่วโมง"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"เลื่อนขึ้นเพื่อเพิ่มและเลื่อนลงเพื่อลด"</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"เพิ่มนาที"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"ลดนาที"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"เพิ่มชั่วโมง"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"ลดชั่วโมง"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"ตั้งค่า PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"ตั้งค่า AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"เพิ่มเดือน"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"ลดเดือน"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"เพิ่มวัน"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"ลดวัน"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"เพิ่มปี"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"ลดปี"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"เพิ่มเดือน"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"ลดเดือน"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"เพิ่มวัน"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"ลดวัน"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"เพิ่มปี"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"ลดปี"</string> <string name="checkbox_checked" msgid="7222044992652711167">"เลือกไว้"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"ไม่ได้ตรวจสอบ"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"เลือกแล้ว"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"เลื่อนขึ้นเพื่อ <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_down" msgid="4294993639091088240">"เลื่อนลงเพื่อ <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_left" msgid="6814008463839915747">"เลื่อนไปทางซ้ายเพื่อ <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> - <string name="description_direction_right" msgid="4296057241963012862">"เลื่อนไปทางขวาเพื่อ <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> + <string name="description_direction_up" msgid="7169032478259485180">"เลื่อนขึ้นเพื่อ <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> + <string name="description_direction_down" msgid="5087739728639014595">"เลื่อนลงเพื่อ <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> + <string name="description_direction_left" msgid="7207478719805562165">"เลื่อนไปทางซ้ายเพื่อ <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> + <string name="description_direction_right" msgid="8034433242579600980">"เลื่อนไปทางขวาเพื่อ <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>"</string> <string name="description_target_unlock" msgid="2228524900439801453">"ปลดล็อก"</string> <string name="description_target_camera" msgid="969071997552486814">"กล้องถ่ายรูป"</string> <string name="description_target_silent" msgid="893551287746522182">"ปิดเสียง"</string> <string name="description_target_soundon" msgid="30052466675500172">"เปิดเสียง"</string> + <string name="description_target_search" msgid="3091587249776033139">"ค้นหา"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"กวาดเพื่อปลดล็อก"</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"เสียบชุดหูฟังเพื่อฟังเสียงเมื่อพิมพ์รหัสผ่าน"</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"เครื่องหมายจุด"</string> diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml index ff2e7ea..2addf86 100644 --- a/core/res/res/values-tl/strings.xml +++ b/core/res/res/values-tl/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Mag-type ng PUK na may 8 numbero o mas mahaba."</string> <string name="needPuk" msgid="919668385956251611">"Na-PUK-lock ang iyong SIM card. I-type ang PUK code upang i-unlock ito."</string> <string name="needPuk2" msgid="4526033371987193070">"I-type ang PUK2 upang i-unblock ang SIM card."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Papasok na Caller ID"</string> <string name="ClirMmi" msgid="7784673673446833091">"Papalabas na Caller ID"</string> <string name="CfMmi" msgid="5123218989141573515">"Pagpapasa ng tawag"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Magtakda ng oras"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Itakda ang petsa"</string> <string name="date_time_set" msgid="5777075614321087758">"Itakda"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Default"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"BAGO: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Walang mga kinakailangang pahintulot"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Magdagdag ng account"</string> <string name="choose_account_text" msgid="6303348737197849675">"Aling account ang nais mong gamitin?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Magdagdag ng account"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Taasan"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Babaan"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> pindutin nang matagal."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"I-slide pataas upang magdagdag at pababa upang magbawas."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Minuto ng pagdaragdag"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Minuto ng pagbawas"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Oras ng pagdaragdag"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Oras ng pagbawas"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Itakda ang PM"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Itakda ang AM"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Buwan ng pagdagdag"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Buwan ng pagbawas"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Araw ng pagdaragdag"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Araw ng pagbawas"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Taon ng pagdaragdag"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Taon ng pagbawas"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"nilagyan ng check"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"hindi nilagyan ng check"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"pinili"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Ibahagi sa"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Ibahagi sa <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Hawakan sa pag-slide. Pindutin nang matagal."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Nakataas para sa <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Nakababa para sa <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Pakaliwa para sa <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Pakanan para sa <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"I-unlock"</string> <string name="description_target_camera" msgid="969071997552486814">"Camera"</string> <string name="description_target_silent" msgid="893551287746522182">"Tahimik"</string> <string name="description_target_soundon" msgid="30052466675500172">"I-on ang tunog"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Mag-swipe upang i-unlock."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Mag-plug in ng isang headset upang marinig ang mga password key na binabanggit."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Dot."</string> diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml index c450761..29cde7d 100644 --- a/core/res/res/values-tr/strings.xml +++ b/core/res/res/values-tr/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"8 veya daha uzun basamaklı bir PUK kodu yazın."</string> <string name="needPuk" msgid="919668385956251611">"SIM kartınızın PUK kilidi devrede. Kilidi açmak için PUK kodunu yazın."</string> <string name="needPuk2" msgid="4526033371987193070">"Engellenen SIM kartı açmak için PUK2 kodunu yazın."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Gelen Çağrı Kimliği"</string> <string name="ClirMmi" msgid="7784673673446833091">"Giden Çağrı Kimliği"</string> <string name="CfMmi" msgid="5123218989141573515">"Çağrı yönlendirme"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Saati ayarla"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Tarihi ayarla"</string> <string name="date_time_set" msgid="5777075614321087758">"Ayarla"</string> + <string name="date_time_done" msgid="2507683751759308828">"Tamamlandı"</string> <string name="default_permission_group" msgid="2690160991405646128">"Varsayılan"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"YENİ: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"İzin gerektirmez"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Hesap ekleyin"</string> <string name="choose_account_text" msgid="6303348737197849675">"Hangi hesabı kullanmak istiyorsunuz?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Hesap ekle"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Artır"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Azalt"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Artır"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Azalt"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> rakamına dokunun ve basılı tutun."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Artırmak için yukarı, azaltmak için aşağı kaydırın."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Dakika değerini artır"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Dakika değerini azalt"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Saat değerini artır"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Saat değerini azalt"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Artırmak için yukarı, azaltmak için aşağı kaydırın."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Dakikayı artır"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Dakikayı azalt"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Saati artır"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Saati azalt"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"ÖS değerini ayarla"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"ÖÖ değerini ayarla"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Ay değerini artır"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Ay değerini azalt"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Gün değerini artır"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Gün değerini azalt"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Yıl değerini artır"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Yıl değerini azalt"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Ayı artır"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Ayı azalt"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Günü artır"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Günü azalt"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Yılı artır"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Yılı azalt"</string> <string name="checkbox_checked" msgid="7222044992652711167">"işaretli"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"işaretlenmedi"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"seçili"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Şununla paylaş:"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"<xliff:g id="APPLICATION_NAME">%s</xliff:g> ile paylaş"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Kayan tutma yeri. Dokunun ve basılı tutun."</string> - <string name="description_direction_up" msgid="1983114130441878529">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> için yukarı."</string> - <string name="description_direction_down" msgid="4294993639091088240">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> için aşağı."</string> - <string name="description_direction_left" msgid="6814008463839915747">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> için sola."</string> - <string name="description_direction_right" msgid="4296057241963012862">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> için sağa."</string> + <string name="description_direction_up" msgid="7169032478259485180">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> için yukarı kaydırın."</string> + <string name="description_direction_down" msgid="5087739728639014595">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> için aşağı kaydırın."</string> + <string name="description_direction_left" msgid="7207478719805562165">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> için sola kaydırın."</string> + <string name="description_direction_right" msgid="8034433242579600980">"<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g> için sağa kaydırın."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Kilidi aç"</string> <string name="description_target_camera" msgid="969071997552486814">"Kamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Sessiz"</string> <string name="description_target_soundon" msgid="30052466675500172">"Ses açık"</string> + <string name="description_target_search" msgid="3091587249776033139">"Ara"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Kilidi açmak için kaydırın."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Şifre tuşlarının sesli okunmasını dinlemek için mikrofonlu kulaklık takın."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Nokta."</string> diff --git a/core/res/res/values-uk/strings.xml b/core/res/res/values-uk/strings.xml index 2afb95f..f2ef429 100644 --- a/core/res/res/values-uk/strings.xml +++ b/core/res/res/values-uk/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Введіть PUK-код із 8 або більше цифр."</string> <string name="needPuk" msgid="919668385956251611">"SIM-карта заблок. PUK-кодом. Введіть PUK-код, щоб її розблок."</string> <string name="needPuk2" msgid="4526033371987193070">"Введ. PUK2, щоб розбл. SIM-карту."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Вхідн. ід. абонента"</string> <string name="ClirMmi" msgid="7784673673446833091">"Вихід. ід. абонента"</string> <string name="CfMmi" msgid="5123218989141573515">"Переадрес. виклику"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Установити час"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Установити дату"</string> <string name="date_time_set" msgid="5777075614321087758">"Застосувати"</string> + <string name="date_time_done" msgid="2507683751759308828">"Готово"</string> <string name="default_permission_group" msgid="2690160991405646128">"За умовч."</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"НОВИЙ: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Дозвіл не потрібний"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Додати обліковий запис"</string> <string name="choose_account_text" msgid="6303348737197849675">"Який обліковий запис використовувати?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Додати облік. запис"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Додати"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Відняти"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Збільшити"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Зменшити"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> – торкніться й утримуйте."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Перемістіть угору, щоб додати, і вниз, щоб відняти."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Додати хвилину"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Відняти хвилину"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Додати годину"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Відняти годину"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Проведіть пальцем угору, щоб збільшити, і вниз, щоб зменшити."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Вибрати хвилину в майбутньому"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Вибрати хвилину в минулому"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Вибрати годину в майбутньому"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Вибрати годину в минулому"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Установити час \"пп\""</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Установити час \"дп\""</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Додати місяць"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Відняти місяць"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Додати день"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Відняти день"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Додати рік"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Відняти рік"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Вибрати місяць у майбутньому"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Вибрати місяць у минулому"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Вибрати день у майбутньому"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Вибрати день у минулому"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Вибрати рік у майбутньому"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Вибрати рік у минулому"</string> <string name="checkbox_checked" msgid="7222044992652711167">"перевірено"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"не перевірено"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"вибрано"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"Угору, щоб <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Униз, щоб <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Ліворуч, щоб <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Праворуч, щоб <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Проведіть пальцем угору, щоб <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Проведіть пальцем униз, щоб <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Проведіть пальцем ліворуч, щоб <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Проведіть пальцем праворуч, щоб <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Розблокувати"</string> <string name="description_target_camera" msgid="969071997552486814">"Камера"</string> <string name="description_target_silent" msgid="893551287746522182">"Без звуку"</string> <string name="description_target_soundon" msgid="30052466675500172">"Увімкнути звук"</string> + <string name="description_target_search" msgid="3091587249776033139">"Пошук"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Гортайте, щоб розблокувати."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Підключіть гарнітуру, щоб прослухати відтворені вголос символи пароля."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Крапка."</string> diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml index 329917e..94ce574 100644 --- a/core/res/res/values-vi/strings.xml +++ b/core/res/res/values-vi/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Nhập PUK có từ 8 số trở lên."</string> <string name="needPuk" msgid="919668385956251611">"Thẻ SIM của bạn đã bị khóa PUK. Nhập mã PUK để mở khóa thẻ SIM đó."</string> <string name="needPuk2" msgid="4526033371987193070">"Nhập mã PUK2 để bỏ chặn thẻ SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"Số gọi đến"</string> <string name="ClirMmi" msgid="7784673673446833091">"Số gọi đi"</string> <string name="CfMmi" msgid="5123218989141573515">"Chuyển tiếp cuộc gọi"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Đặt giờ"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Đặt ngày"</string> <string name="date_time_set" msgid="5777075614321087758">"Đặt"</string> + <string name="date_time_done" msgid="2507683751759308828">"Xong"</string> <string name="default_permission_group" msgid="2690160991405646128">"Mặc định"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"MỚI: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Không yêu cầu quyền"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"Thêm tài khoản"</string> <string name="choose_account_text" msgid="6303348737197849675">"Bạn muốn sử dụng tài khoản nào?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Thêm tài khoản"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Tăng dần"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Giảm dần"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"Tăng"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"Giảm"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"Chạm và giữ <xliff:g id="VALUE">%s</xliff:g>."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Trượt lên để tăng và trượt xuống để giảm."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Phút tăng dần"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Phút giảm dần"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Giờ tăng dần"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Giờ giảm dần."</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"Trượt lên để tăng và trượt xuống để giảm."</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"Tăng phút"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"Giảm phút"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"Tăng giờ"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"Giảm giờ"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Đặt CH"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Đặt SA"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Tháng tăng dần"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Tháng giảm dần"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Ngày tăng dần"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Ngày giảm dần"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Năm tăng dần"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Năm giảm dần."</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"Tăng tháng"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"Giảm tháng"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"Tăng ngày"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"Giảm ngày"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"Tăng năm"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"Giảm năm"</string> <string name="checkbox_checked" msgid="7222044992652711167">"đã kiểm tra"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"chưa chọn"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"đã chọn"</string> @@ -1205,14 +1204,15 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Chia sẻ với"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Chia sẻ với <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Tay trượt. Chạm & giữ."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Lên để <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Xuống để <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Sang trái để <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Sang phải để <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_up" msgid="7169032478259485180">"Trượt lên để <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_down" msgid="5087739728639014595">"Trượt xuống để <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_left" msgid="7207478719805562165">"Trượt sang trái để <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <string name="description_direction_right" msgid="8034433242579600980">"Trượt sang phải để <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> <string name="description_target_unlock" msgid="2228524900439801453">"Mở khóa"</string> <string name="description_target_camera" msgid="969071997552486814">"Máy ảnh"</string> <string name="description_target_silent" msgid="893551287746522182">"Im lặng"</string> <string name="description_target_soundon" msgid="30052466675500172">"Bật âm thanh"</string> + <string name="description_target_search" msgid="3091587249776033139">"Tìm kiếm"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Trượt để mở khóa."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Cắm tai nghe để nghe các khóa mật khẩu được đọc."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Dấu chấm."</string> diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml index d6ed9a9..fd69a3e 100644 --- a/core/res/res/values-zh-rCN/strings.xml +++ b/core/res/res/values-zh-rCN/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"请键入至少 8 位数字的 PUK 码。"</string> <string name="needPuk" msgid="919668385956251611">"已对 SIM 卡进行 PUK 码锁定。键入 PUK 码将其解锁。"</string> <string name="needPuk2" msgid="4526033371987193070">"输入 PUK2 码以解锁 SIM 卡。"</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"来电显示"</string> <string name="ClirMmi" msgid="7784673673446833091">"本机号码"</string> <string name="CfMmi" msgid="5123218989141573515">"来电转接"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"设置时间"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"设置日期"</string> <string name="date_time_set" msgid="5777075614321087758">"设置"</string> + <string name="date_time_done" msgid="2507683751759308828">"完成"</string> <string name="default_permission_group" msgid="2690160991405646128">"默认"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"新增:"</font></string> <string name="no_permissions" msgid="7283357728219338112">"不需要任何权限"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"添加帐户"</string> <string name="choose_account_text" msgid="6303348737197849675">"您要使用哪个帐户?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"添加帐户"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"增加"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"减少"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"增大"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"减小"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"触摸 <xliff:g id="VALUE">%s</xliff:g> 次并按住。"</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"向上滑动可增加值,向下滑动可减少值。"</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"增加分钟数"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"减少分钟数"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"增加小时数"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"减少小时数"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"向上滑动可增大值,向下滑动可减小值。"</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"增大分钟值"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"减小分钟值"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"增大小时值"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"减小小时值"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"设置下午时间"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"设置上午时间"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"增加月份值"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"减少月份值"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"增加天数"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"减少天数"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"增加年数"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"减少年份值"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"增大月份值"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"减小月份值"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"增大日的值"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"减小日的值"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"增大年份值"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"减小年份值"</string> <string name="checkbox_checked" msgid="7222044992652711167">"已选中"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"未选中"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"已选择"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"向上滑动<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> - <string name="description_direction_down" msgid="4294993639091088240">"向下滑动<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> - <string name="description_direction_left" msgid="6814008463839915747">"向左滑动<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> - <string name="description_direction_right" msgid="4296057241963012862">"向右滑动<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> + <string name="description_direction_up" msgid="7169032478259485180">"向上滑动以<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> + <string name="description_direction_down" msgid="5087739728639014595">"向下滑动以<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> + <string name="description_direction_left" msgid="7207478719805562165">"向左滑动以<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> + <string name="description_direction_right" msgid="8034433242579600980">"向右滑动以<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> <string name="description_target_unlock" msgid="2228524900439801453">"解锁"</string> <string name="description_target_camera" msgid="969071997552486814">"相机"</string> <string name="description_target_silent" msgid="893551287746522182">"静音"</string> <string name="description_target_soundon" msgid="30052466675500172">"打开声音"</string> + <string name="description_target_search" msgid="3091587249776033139">"搜索"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"滑动解锁。"</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"需要插入耳机才能听到密码的按键声。"</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"点。"</string> diff --git a/core/res/res/values-zh-rTW/strings.xml b/core/res/res/values-zh-rTW/strings.xml index bc9337b..9283fa9 100644 --- a/core/res/res/values-zh-rTW/strings.xml +++ b/core/res/res/values-zh-rTW/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"輸入 8 位數以上的 PUK。"</string> <string name="needPuk" msgid="919668385956251611">"SIM 卡的 PUK 已鎖定。請輸入 PUK 碼解除鎖定。"</string> <string name="needPuk2" msgid="4526033371987193070">"請輸入 PUK2 以解鎖 SIM 卡。"</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"來電顯示"</string> <string name="ClirMmi" msgid="7784673673446833091">"本機號碼"</string> <string name="CfMmi" msgid="5123218989141573515">"來電轉接"</string> @@ -1021,6 +1019,7 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"設定時間"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"日期設定"</string> <string name="date_time_set" msgid="5777075614321087758">"設定"</string> + <string name="date_time_done" msgid="2507683751759308828">"完成"</string> <string name="default_permission_group" msgid="2690160991405646128">"預設值"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"新增:"</font></string> <string name="no_permissions" msgid="7283357728219338112">"無須許可"</string> @@ -1170,22 +1169,22 @@ <string name="add_account_label" msgid="2935267344849993553">"新增帳戶"</string> <string name="choose_account_text" msgid="6303348737197849675">"您要使用哪個帳戶?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"新增帳戶"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"增加"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"減少"</string> + <string name="number_picker_increment_button" msgid="2412072272832284313">"增加"</string> + <string name="number_picker_decrement_button" msgid="476050778386779067">"減少"</string> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> 輕觸並按住。"</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"向上滑動即可增加,向下滑動即可減少。"</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"增加分鐘數"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"減少分鐘數"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"增加時數"</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"減少時數"</string> + <string name="number_picker_increment_scroll_action" msgid="9101473045891835490">"向上滑動即可增加,向下滑動即可減少。"</string> + <string name="time_picker_increment_minute_button" msgid="8865885114028614321">"增加分鐘數"</string> + <string name="time_picker_decrement_minute_button" msgid="6246834937080684791">"減少分鐘數"</string> + <string name="time_picker_increment_hour_button" msgid="3652056055810223139">"增加小時數"</string> + <string name="time_picker_decrement_hour_button" msgid="1377479863429214792">"減少小時數"</string> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"設定 PM 值"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"設定 AM 值"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"增加月份"</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"減少月份"</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"增加天數"</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"減少天數"</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"增加年份"</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"減少年份"</string> + <string name="date_picker_increment_month_button" msgid="5369998479067934110">"增加月數"</string> + <string name="date_picker_decrement_month_button" msgid="1832698995541726019">"減少月數"</string> + <string name="date_picker_increment_day_button" msgid="7130465412308173903">"增加日數"</string> + <string name="date_picker_decrement_day_button" msgid="4131881521818750031">"減少日數"</string> + <string name="date_picker_increment_year_button" msgid="6318697384310808899">"增加年數"</string> + <string name="date_picker_decrement_year_button" msgid="4482021813491121717">"減少年數"</string> <string name="checkbox_checked" msgid="7222044992652711167">"已勾選"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"尚未勾選"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"已選取"</string> @@ -1205,14 +1204,15 @@ <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> - <string name="description_direction_up" msgid="1983114130441878529">"向上滑動即可<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> - <string name="description_direction_down" msgid="4294993639091088240">"向下滑動即可<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> - <string name="description_direction_left" msgid="6814008463839915747">"向左滑動即可<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> - <string name="description_direction_right" msgid="4296057241963012862">"向右滑動即可<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> + <string name="description_direction_up" msgid="7169032478259485180">"向上滑動即可<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> + <string name="description_direction_down" msgid="5087739728639014595">"向下滑動即可<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> + <string name="description_direction_left" msgid="7207478719805562165">"向左滑動即可<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> + <string name="description_direction_right" msgid="8034433242579600980">"向右滑動即可<xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>。"</string> <string name="description_target_unlock" msgid="2228524900439801453">"解除鎖定"</string> <string name="description_target_camera" msgid="969071997552486814">"相機"</string> <string name="description_target_silent" msgid="893551287746522182">"靜音"</string> <string name="description_target_soundon" msgid="30052466675500172">"開啟音效"</string> + <string name="description_target_search" msgid="3091587249776033139">"搜尋"</string> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"滑動即可解鎖。"</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"連接耳機即可聽取系統朗讀密碼按鍵。"</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"點。"</string> diff --git a/core/res/res/values-zu/strings.xml b/core/res/res/values-zu/strings.xml index 6471965..6fe919d 100644 --- a/core/res/res/values-zu/strings.xml +++ b/core/res/res/values-zu/strings.xml @@ -50,10 +50,8 @@ <string name="invalidPuk" msgid="8761456210898036513">"Thayipha i-PUK enezinombolo ezingu-8 noma ngaphezu."</string> <string name="needPuk" msgid="919668385956251611">"Ikhadi lakho le-SIM livalwe nge-PUK. Thayipha ikhodi ye-PUK ukulivula."</string> <string name="needPuk2" msgid="4526033371987193070">"Thayipha i-PUK2 ukuze uvule ikhadi le-SIM."</string> - <!-- no translation found for imei (2625429890869005782) --> - <skip /> - <!-- no translation found for meid (4841221237681254195) --> - <skip /> + <string name="imei" msgid="2625429890869005782">"IMEI"</string> + <string name="meid" msgid="4841221237681254195">"MEID"</string> <string name="ClipMmi" msgid="6952821216480289285">"I-ID Yocingo Olungenayo"</string> <string name="ClirMmi" msgid="7784673673446833091">"I-ID Yomshayeli Ephumayo"</string> <string name="CfMmi" msgid="5123218989141573515">"Ukudlulisa ikholi"</string> @@ -1021,6 +1019,8 @@ <string name="time_picker_dialog_title" msgid="8349362623068819295">"Hlela isikhathi"</string> <string name="date_picker_dialog_title" msgid="5879450659453782278">"Setha idethi"</string> <string name="date_time_set" msgid="5777075614321087758">"Hlela"</string> + <!-- no translation found for date_time_done (2507683751759308828) --> + <skip /> <string name="default_permission_group" msgid="2690160991405646128">"Okuzenzakalelayo"</string> <string name="perms_new_perm_prefix" msgid="8257740710754301407"><font size="12" fgcolor="#ffffa3a3">"OKUSHA: "</font></string> <string name="no_permissions" msgid="7283357728219338112">"Ayikho imvume edingekayo"</string> @@ -1170,22 +1170,35 @@ <string name="add_account_label" msgid="2935267344849993553">"Yengeza i-akhawunti"</string> <string name="choose_account_text" msgid="6303348737197849675">"Ingabe iyiphi i-akhawunti ofuna ukuyisebenzisa?"</string> <string name="add_account_button_label" msgid="3611982894853435874">"Engeza i-akhawunti"</string> - <string name="number_picker_increment_button" msgid="4830170763103463443">"Nciphisa"</string> - <string name="number_picker_decrement_button" msgid="2576606679160067262">"Decrement"</string> + <!-- no translation found for number_picker_increment_button (2412072272832284313) --> + <skip /> + <!-- no translation found for number_picker_decrement_button (476050778386779067) --> + <skip /> <string name="number_picker_increment_scroll_mode" msgid="3073101067441638428">"<xliff:g id="VALUE">%s</xliff:g> thinta bese ucindezela."</string> - <string name="number_picker_increment_scroll_action" msgid="4628981789985093179">"Shishilizisa kwenyuke kuye ekwenyusweni kwehle kuye ekwehlisweni."</string> - <string name="time_picker_increment_minute_button" msgid="2843066823236250329">"Iminithi wokwenyusa"</string> - <string name="time_picker_decrement_minute_button" msgid="4357907223628449595">"Iminithi yokwehlisa"</string> - <string name="time_picker_increment_hour_button" msgid="2484204991937119057">"Ihora lokwenyusa."</string> - <string name="time_picker_decrement_hour_button" msgid="4659353501775842780">"Ihora lokwehlisa"</string> + <!-- no translation found for number_picker_increment_scroll_action (9101473045891835490) --> + <skip /> + <!-- no translation found for time_picker_increment_minute_button (8865885114028614321) --> + <skip /> + <!-- no translation found for time_picker_decrement_minute_button (6246834937080684791) --> + <skip /> + <!-- no translation found for time_picker_increment_hour_button (3652056055810223139) --> + <skip /> + <!-- no translation found for time_picker_decrement_hour_button (1377479863429214792) --> + <skip /> <string name="time_picker_increment_set_pm_button" msgid="4147590696151230863">"Setha Ntambama"</string> <string name="time_picker_decrement_set_am_button" msgid="8302140353539486752">"Setha Ekuseni"</string> - <string name="date_picker_increment_month_button" msgid="6324978841467899081">"Inyanga yokwenyusa."</string> - <string name="date_picker_decrement_month_button" msgid="7304349355000398077">"Inyanga yokwehlisa."</string> - <string name="date_picker_increment_day_button" msgid="4397040141921413183">"Usuku lokwenyusa."</string> - <string name="date_picker_decrement_day_button" msgid="2427816793443629131">"Usuku lokwehlisa."</string> - <string name="date_picker_increment_year_button" msgid="3058553394722295105">"Unyaka wokwenyusa."</string> - <string name="date_picker_decrement_year_button" msgid="5193062846559743823">"Unyaka wokwehlisa"</string> + <!-- no translation found for date_picker_increment_month_button (5369998479067934110) --> + <skip /> + <!-- no translation found for date_picker_decrement_month_button (1832698995541726019) --> + <skip /> + <!-- no translation found for date_picker_increment_day_button (7130465412308173903) --> + <skip /> + <!-- no translation found for date_picker_decrement_day_button (4131881521818750031) --> + <skip /> + <!-- no translation found for date_picker_increment_year_button (6318697384310808899) --> + <skip /> + <!-- no translation found for date_picker_decrement_year_button (4482021813491121717) --> + <skip /> <string name="checkbox_checked" msgid="7222044992652711167">"kuhloliwe"</string> <string name="checkbox_not_checked" msgid="5174639551134444056">"akuhloliwe"</string> <string name="radiobutton_selected" msgid="8603599808486581511">"Okukhethiwe"</string> @@ -1205,14 +1218,20 @@ <string name="shareactionprovider_share_with" msgid="806688056141131819">"Yabelana no"</string> <string name="shareactionprovider_share_with_application" msgid="5627411384638389738">"Yabelana no <xliff:g id="APPLICATION_NAME">%s</xliff:g>"</string> <string name="content_description_sliding_handle" msgid="415975056159262248">"Ihaambis isibambo. Thinta & ubambe."</string> - <string name="description_direction_up" msgid="1983114130441878529">"Phezulu kwe <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_down" msgid="4294993639091088240">"Ngaphansi kwe <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_left" msgid="6814008463839915747">"Kwesokunxeleee kwe <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> - <string name="description_direction_right" msgid="4296057241963012862">"Ngakwesokudla kwe for <xliff:g id="TARGET_DESCRIPTION">%s</xliff:g>."</string> + <!-- no translation found for description_direction_up (7169032478259485180) --> + <skip /> + <!-- no translation found for description_direction_down (5087739728639014595) --> + <skip /> + <!-- no translation found for description_direction_left (7207478719805562165) --> + <skip /> + <!-- no translation found for description_direction_right (8034433242579600980) --> + <skip /> <string name="description_target_unlock" msgid="2228524900439801453">"Vula"</string> <string name="description_target_camera" msgid="969071997552486814">"Ikhamera"</string> <string name="description_target_silent" msgid="893551287746522182">"Thulile"</string> <string name="description_target_soundon" msgid="30052466675500172">"Umsindo uvuliwe"</string> + <!-- no translation found for description_target_search (3091587249776033139) --> + <skip /> <string name="description_target_unlock_tablet" msgid="3833195335629795055">"Swayipha ukuze uvule."</string> <string name="keyboard_headset_required_to_hear_password" msgid="7011927352267668657">"Plaka ku-headset ukuze uzwe okhiye bephasiwedi ezindlebeni zakho bezwakala kakhulu."</string> <string name="keyboard_password_character_no_headset" msgid="2859873770886153678">"Icashazi."</string> diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml index 90ddc4b..d05a31c 100644 --- a/core/res/res/values/arrays.xml +++ b/core/res/res/values/arrays.xml @@ -353,49 +353,49 @@ <!-- Resources for MultiWaveView in LockScreen --> <array name="lockscreen_targets_when_silent"> <item>@drawable/ic_lockscreen_unlock</item> - <item>@null</item> + <item>@drawable/ic_lockscreen_search</item> <item>@drawable/ic_lockscreen_soundon</item> <item>@null</item> </array> <array name="lockscreen_target_descriptions_when_silent"> <item>@string/description_target_unlock</item> - <item>@null</item> + <item>@string/description_target_search</item> <item>@string/description_target_soundon</item> <item>@null</item> </array> <array name="lockscreen_direction_descriptions"> <item>@string/description_direction_right</item> - <item>@null</item> + <item>@string/description_direction_up</item> <item>@string/description_direction_left</item> <item>@null</item> </array> <array name="lockscreen_targets_when_soundon"> <item>@drawable/ic_lockscreen_unlock</item> - <item>@null</item> + <item>@drawable/ic_lockscreen_search</item> <item>@drawable/ic_lockscreen_silent</item> <item>@null</item> </array> <array name="lockscreen_target_descriptions_when_soundon"> <item>@string/description_target_unlock</item> - <item>@null</item> + <item>@string/description_target_search</item> <item>@string/description_target_silent</item> <item>@null</item> </array> <array name="lockscreen_targets_with_camera"> <item>@drawable/ic_lockscreen_unlock</item> - <item>@null</item> + <item>@drawable/ic_lockscreen_search</item> <item>@drawable/ic_lockscreen_camera</item> <item>@null</item> </array> <array name="lockscreen_target_descriptions_with_camera"> <item>@string/description_target_unlock</item> - <item>@null</item> + <item>@string/description_target_search</item> <item>@string/description_target_camera</item> <item>@null</item> </array> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 438c141..aabe407 100755 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -2079,6 +2079,7 @@ <!-- Locale --> <enum name="locale" value="3" /> </attr> + <!-- Direction of the text. A heuristic is used to determine the resolved text direction of paragraphs. --> <attr name="textDirection" format="integer"> @@ -2099,6 +2100,29 @@ <!-- The paragraph direction is coming from the system Locale. --> <enum name="locale" value="5" /> </attr> + + <!-- Alignment of the text. A heuristic is used to determine the resolved + text alignment. --> + <attr name="textAlignment" format="integer"> + <!-- Default --> + <enum name="inherit" value="0" /> + <!-- Default for the root view. The gravity determines the alignment, ALIGN_NORMAL, + ALIGN_CENTER, or ALIGN_OPPOSITE, which are relative to each paragraph’s + text direction --> + <enum name="gravity" value="1" /> + <!-- Align to the start of the paragraph, e.g. ALIGN_NORMAL. --> + <enum name="textStart" value="2" /> + <!-- Align to the end of the paragraph, e.g. ALIGN_OPPOSITE. --> + <enum name="textEnd" value="3" /> + <!-- Center the paragraph, e.g. ALIGN_CENTER. --> + <enum name="center" value="4" /> + <!-- Align to the start of the view, which is ALIGN_LEFT if the view’s resolved + layoutDirection is LTR, and ALIGN_RIGHT otherwise. --> + <enum name="viewStart" value="5" /> + <!-- Align to the end of the view, which is ALIGN_RIGHT if the view’s resolved + layoutDirection is LTR, and ALIGN_LEFT otherwise --> + <enum name="viewEnd" value="6" /> + </attr> </declare-styleable> <!-- Attributes that can be used with a {@link android.view.ViewGroup} or any @@ -2325,6 +2349,8 @@ <!-- Component name of an activity that allows the user to modify the settings for this service. --> <attr name="settingsActivity"/> + <!-- Set true when the spell checker supports sentence level spell checking. --> + <attr name="supportsSentenceSpellCheck" format="boolean" /> </declare-styleable> <!-- This is the subtype of the spell checker. Subtype can describe locales (e.g. en_US, fr_FR...) --> @@ -5528,4 +5554,21 @@ <attr name="settingsActivity" /> </declare-styleable> + <!-- Use <code>keyboard-layouts</code> as the root tag of the XML resource that + describes a collection of keyboard layouts provided by an application. + Each keyboard layout is declared by a <code>keyboard-layout</code> tag + with these attributes. + + The XML resource that contains the keyboard layouts must be referenced from its + {@link android.hardware.input.InputManager#META_DATA_KEYBOARD_LAYOUTS} + meta-data entry used with broadcast receivers for + {@link android.hardware.input.InputManager#ACTION_QUERY_KEYBOARD_LAYOUTS}. --> + <declare-styleable name="KeyboardLayout"> + <!-- The name of the keyboard layout, must be unique in the receiver. --> + <attr name="name" /> + <!-- The display label of the keyboard layout. --> + <attr name="label" /> + <!-- The key character map file resource. --> + <attr name="kcm" format="reference" /> + </declare-styleable> </resources> diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 1649c48..d414c7f 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -740,6 +740,9 @@ <flag name="splitActionBarWhenNarrow" value="1" /> </attr> + <!-- The name of the logical parent of the activity as it appears in the manifest. --> + <attr name="parentActivityName" format="string" /> + <!-- The <code>manifest</code> tag is the root of an <code>AndroidManifest.xml</code> file, describing the contents of an Android package (.apk) file. One @@ -1348,6 +1351,7 @@ <attr name="immersive" /> <attr name="hardwareAccelerated" /> <attr name="uiOptions" /> + <attr name="parentActivityName" /> </declare-styleable> <!-- The <code>activity-alias</code> tag declares a new @@ -1384,6 +1388,7 @@ component specific values). --> <attr name="enabled" /> <attr name="exported" /> + <attr name="parentActivityName" /> </declare-styleable> <!-- The <code>meta-data</code> tag is used to attach additional diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 6d6b86b..0442be8 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -32,11 +32,9 @@ <dimen name="toast_y_offset">64dip</dimen> <!-- Height of the status bar --> <dimen name="status_bar_height">25dip</dimen> - <!-- Height of the system bar (combined status + navigation, used on large screens) --> - <dimen name="system_bar_height">48dip</dimen> - <!-- Height of the horizontal navigation bar on devices that require it --> + <!-- Height of the bottom navigation / system bar. --> <dimen name="navigation_bar_height">48dp</dimen> - <!-- Width of the vertical navigation bar on devices that require it --> + <!-- Width of the navigation bar when it is placed vertically on the screen --> <dimen name="navigation_bar_width">42dp</dimen> <!-- Height of notification icons in the status bar --> <dimen name="status_bar_icon_size">24dip</dimen> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index e5f049d..ca0e913 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -202,6 +202,7 @@ <java-symbol type="id" name="action2" /> <java-symbol type="id" name="big_picture" /> <java-symbol type="id" name="big_text" /> + <java-symbol type="id" name="chronometer" /> <java-symbol type="attr" name="actionModeShareDrawable" /> <java-symbol type="attr" name="alertDialogCenterButtons" /> @@ -991,6 +992,7 @@ <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="drawable" name="ic_lockscreen_search" /> <java-symbol type="layout" name="action_bar_home" /> <java-symbol type="layout" name="action_bar_title_item" /> @@ -1079,6 +1081,8 @@ <java-symbol type="layout" name="notification_intruder_content" /> <java-symbol type="layout" name="notification_template_base" /> <java-symbol type="layout" name="notification_template_big_picture" /> + <java-symbol type="layout" name="notification_template_part_time" /> + <java-symbol type="layout" name="notification_template_part_chronometer" /> <java-symbol type="anim" name="slide_in_child_bottom" /> <java-symbol type="anim" name="slide_in_right" /> @@ -1125,6 +1129,14 @@ <!-- From android.policy --> <java-symbol type="anim" name="app_starting_exit" /> <java-symbol type="anim" name="lock_screen_behind_enter" /> + <java-symbol type="anim" name="dock_top_enter" /> + <java-symbol type="anim" name="dock_top_exit" /> + <java-symbol type="anim" name="dock_bottom_enter" /> + <java-symbol type="anim" name="dock_bottom_exit" /> + <java-symbol type="anim" name="dock_left_enter" /> + <java-symbol type="anim" name="dock_left_exit" /> + <java-symbol type="anim" name="dock_right_enter" /> + <java-symbol type="anim" name="dock_right_exit" /> <java-symbol type="array" name="config_keyboardTapVibePattern" /> <java-symbol type="array" name="config_longPressVibePattern" /> <java-symbol type="array" name="config_safeModeDisabledVibePattern" /> @@ -1150,7 +1162,6 @@ <java-symbol type="dimen" name="navigation_bar_height" /> <java-symbol type="dimen" name="navigation_bar_width" /> <java-symbol type="dimen" name="status_bar_height" /> - <java-symbol type="dimen" name="system_bar_height" /> <java-symbol type="drawable" name="ic_jog_dial_sound_off" /> <java-symbol type="drawable" name="ic_jog_dial_sound_on" /> <java-symbol type="drawable" name="ic_jog_dial_unlock" /> @@ -3554,6 +3565,7 @@ <public type="attr" name="supportsRtl" id="0x010103a8" /> <public type="attr" name="textDirection"/> + <public type="attr" name="textAlignment"/> <public type="attr" name="layoutDirection" /> @@ -3562,5 +3574,9 @@ <public type="attr" name="layout_marginStart"/> <public type="attr" name="layout_marginEnd"/> + <public type="attr" name="kcm"/> + <public type="attr" name="parentActivityName" /> + + <public type="attr" name="supportsSentenceSpellCheck" /> </resources> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 718de0a..44f2ade 100755 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3303,6 +3303,8 @@ <string name="description_target_silent">Silent</string> <!-- Description of the sound on target in the Slide unlock screen. [CHAR LIMIT=NONE] --> <string name="description_target_soundon">Sound on</string> + <!-- Description of the unlock target in the Slide unlock screen. [CHAR LIMIT=NONE] --> + <string name="description_target_search">Search</string> <!-- Description of the unlock handle in the Slide unlock screen for tablets. [CHAR LIMIT=NONE] --> <string name="description_target_unlock_tablet">Swipe to unlock.</string> diff --git a/core/tests/coretests/src/com/android/internal/net/NetworkStatsFactoryTest.java b/core/tests/coretests/src/com/android/internal/net/NetworkStatsFactoryTest.java index ea94fa9..58269a8 100644 --- a/core/tests/coretests/src/com/android/internal/net/NetworkStatsFactoryTest.java +++ b/core/tests/coretests/src/com/android/internal/net/NetworkStatsFactoryTest.java @@ -16,6 +16,7 @@ package com.android.internal.net; +import static android.net.NetworkStats.SET_ALL; import static android.net.NetworkStats.SET_DEFAULT; import static android.net.NetworkStats.SET_FOREGROUND; import static android.net.NetworkStats.TAG_NONE; @@ -84,12 +85,12 @@ public class NetworkStatsFactoryTest extends AndroidTestCase { final NetworkStats stats = mFactory.readNetworkStatsSummary(); assertEquals(6, stats.size()); - assertStatsEntry(stats, "lo", UID_ALL, SET_DEFAULT, TAG_NONE, 8308L, 8308L); - assertStatsEntry(stats, "rmnet0", UID_ALL, SET_DEFAULT, TAG_NONE, 1507570L, 489339L); - assertStatsEntry(stats, "ifb0", UID_ALL, SET_DEFAULT, TAG_NONE, 52454L, 0L); - assertStatsEntry(stats, "ifb1", UID_ALL, SET_DEFAULT, TAG_NONE, 52454L, 0L); - assertStatsEntry(stats, "sit0", UID_ALL, SET_DEFAULT, TAG_NONE, 0L, 0L); - assertStatsEntry(stats, "ip6tnl0", UID_ALL, SET_DEFAULT, TAG_NONE, 0L, 0L); + assertStatsEntry(stats, "lo", UID_ALL, SET_ALL, TAG_NONE, 8308L, 8308L); + assertStatsEntry(stats, "rmnet0", UID_ALL, SET_ALL, TAG_NONE, 1507570L, 489339L); + assertStatsEntry(stats, "ifb0", UID_ALL, SET_ALL, TAG_NONE, 52454L, 0L); + assertStatsEntry(stats, "ifb1", UID_ALL, SET_ALL, TAG_NONE, 52454L, 0L); + assertStatsEntry(stats, "sit0", UID_ALL, SET_ALL, TAG_NONE, 0L, 0L); + assertStatsEntry(stats, "ip6tnl0", UID_ALL, SET_ALL, TAG_NONE, 0L, 0L); } public void testNetworkStatsSummaryDown() throws Exception { @@ -102,8 +103,8 @@ public class NetworkStatsFactoryTest extends AndroidTestCase { final NetworkStats stats = mFactory.readNetworkStatsSummary(); assertEquals(7, stats.size()); - assertStatsEntry(stats, "rmnet0", UID_ALL, SET_DEFAULT, TAG_NONE, 1507570L, 489339L); - assertStatsEntry(stats, "wlan0", UID_ALL, SET_DEFAULT, TAG_NONE, 1024L, 2048L); + assertStatsEntry(stats, "rmnet0", UID_ALL, SET_ALL, TAG_NONE, 1507570L, 489339L); + assertStatsEntry(stats, "wlan0", UID_ALL, SET_ALL, TAG_NONE, 1024L, 2048L); } public void testNetworkStatsCombined() throws Exception { @@ -115,7 +116,7 @@ public class NetworkStatsFactoryTest extends AndroidTestCase { stageLong(40L, new File(mTestProc, "net/xt_qtaguid/iface_stat/rmnet0/tx_packets")); final NetworkStats stats = mFactory.readNetworkStatsSummary(); - assertStatsEntry(stats, "rmnet0", UID_ALL, SET_DEFAULT, TAG_NONE, 1507570L + 10L, + assertStatsEntry(stats, "rmnet0", UID_ALL, SET_ALL, TAG_NONE, 1507570L + 10L, 2205L + 20L, 489339L + 30L, 2237L + 40L); } @@ -128,7 +129,7 @@ public class NetworkStatsFactoryTest extends AndroidTestCase { stageLong(40L, new File(mTestProc, "net/xt_qtaguid/iface_stat/rmnet0/tx_packets")); final NetworkStats stats = mFactory.readNetworkStatsSummary(); - assertStatsEntry(stats, "rmnet0", UID_ALL, SET_DEFAULT, TAG_NONE, 10L, 20L, 30L, 40L); + assertStatsEntry(stats, "rmnet0", UID_ALL, SET_ALL, TAG_NONE, 10L, 20L, 30L, 40L); } public void testKernelTags() throws Exception { @@ -153,9 +154,9 @@ public class NetworkStatsFactoryTest extends AndroidTestCase { final NetworkStats stats = mFactory.readNetworkStatsSummary(); assertEquals(6, stats.size()); - assertStatsEntry(stats, "rmnet0", UID_ALL, SET_DEFAULT, TAG_NONE, 2112L, 24L, 700L, 10L); - assertStatsEntry(stats, "test1", UID_ALL, SET_DEFAULT, TAG_NONE, 6L, 8L, 10L, 12L); - assertStatsEntry(stats, "test2", UID_ALL, SET_DEFAULT, TAG_NONE, 1L, 2L, 3L, 4L); + assertStatsEntry(stats, "rmnet0", UID_ALL, SET_ALL, TAG_NONE, 2112L, 24L, 700L, 10L); + assertStatsEntry(stats, "test1", UID_ALL, SET_ALL, TAG_NONE, 6L, 8L, 10L, 12L); + assertStatsEntry(stats, "test2", UID_ALL, SET_ALL, TAG_NONE, 1L, 2L, 3L, 4L); } /** diff --git a/docs/html/design/building-blocks/progress.jd b/docs/html/design/building-blocks/progress.jd index dc3ded1..b188538 100644 --- a/docs/html/design/building-blocks/progress.jd +++ b/docs/html/design/building-blocks/progress.jd @@ -42,9 +42,9 @@ available space.</p> <li class="value-1"><h4>Activity bar (shown with the Holo Dark theme)</h4> <p> -An indeterminate activity bar is used at the start of an application download because Google Play hasn't -been able to contact the server yet, and it's not possible to determine how long it will take for -the download to begin. +An indeterminate activity bar is used at the start of an application download because the Play Store +app hasn't been able to contact the server yet, and it's not possible to determine how long it will +take for the download to begin. </p> </li> diff --git a/docs/html/design/building-blocks/tabs.jd b/docs/html/design/building-blocks/tabs.jd index 2c854d3..19ed1c3 100644 --- a/docs/html/design/building-blocks/tabs.jd +++ b/docs/html/design/building-blocks/tabs.jd @@ -25,7 +25,7 @@ to the next/previous view, swipe left or right.</p> <source src="{@docRoot}design/media/tabs_scrolly.ogv" type="video/ogg"> </video> <div class="figure-caption"> - Scrolling tabs in Google Play. + Scrolling tabs in the Play Store app. <div class="video-instructions"> </div> </div> diff --git a/docs/html/design/design_toc.cs b/docs/html/design/design_toc.cs index 19b58d9..6dd8d61 100644 --- a/docs/html/design/design_toc.cs +++ b/docs/html/design/design_toc.cs @@ -35,6 +35,7 @@ <li><a href="<?cs var:toroot ?>design/patterns/swipe-views.html">Swipe Views</a></li> <li><a href="<?cs var:toroot ?>design/patterns/selection.html">Selection</a></li> <li><a href="<?cs var:toroot ?>design/patterns/notifications.html">Notifications</a></li> + <li><a href="<?cs var:toroot ?>design/patterns/settings.html">Settings</a></li> <li><a href="<?cs var:toroot ?>design/patterns/compatibility.html">Compatibility</a></li> <li><a href="<?cs var:toroot ?>design/patterns/pure-android.html">Pure Android</a></li> </ul> diff --git a/docs/html/design/downloads/index.jd b/docs/html/design/downloads/index.jd index 618c44b..67dfd79 100644 --- a/docs/html/design/downloads/index.jd +++ b/docs/html/design/downloads/index.jd @@ -39,7 +39,7 @@ available.</p> <p> <a class="download-button" href="https://dl-ssl.google.com/android/design/Android_Design_Fireworks_Stencil_20120229.png">Adobe® Fireworks® PNG Stencil</a> <a class="download-button" href="https://dl-ssl.google.com/android/design/Android_Design_OmniGraffle_Stencil_20120229.graffle">Omni® OmniGraffle® Stencil</a> - <a class="download-button" href="https://dl-ssl.google.com/android/design/Android_Design_Holo_Widgets_20120229.zip">Adobe® Photoshop® Sources</a> + <a class="download-button" href="https://dl-ssl.google.com/android/design/Android_Design_Holo_Widgets_20120302.zip">Adobe® Photoshop® Sources</a> </p> </div> diff --git a/docs/html/design/get-started/principles.jd b/docs/html/design/get-started/principles.jd index 8f5b446..0b7147b 100644 --- a/docs/html/design/get-started/principles.jd +++ b/docs/html/design/get-started/principles.jd @@ -10,7 +10,7 @@ with purpose.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Delight me in surprising ways</h4> +<h4 id="delight-me">Delight me in surprising ways</h4> <p>A beautiful surface, a carefully-placed animation, or a well-timed sound effect is a joy to experience. Subtle effects contribute to a feeling of effortlessness and a sense that a powerful force is at hand.</p> @@ -28,7 +28,7 @@ force is at hand.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Real objects are more fun than buttons and menus</h4> +<h4 id="real-objects-more-fun">Real objects are more fun than buttons and menus</h4> <p>Allow people to directly touch and manipulate objects in your app. It reduces the cognitive effort needed to perform a task while making it more emotionally satisfying.</p> @@ -45,7 +45,7 @@ needed to perform a task while making it more emotionally satisfying.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Let me make it mine</h4> +<h4 id="make-it-mine">Let me make it mine</h4> <p>People love to add personal touches because it helps them feel at home and in control. Provide sensible, beautiful defaults, but also consider fun, optional customizations that don't hinder primary tasks.</p> @@ -63,7 +63,7 @@ primary tasks.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Get to know me</h4> +<h4 id="get-to-know-me">Get to know me</h4> <p>Learn peoples' preferences over time. Rather than asking them to make the same choices over and over, place previous choices within easy reach.</p> @@ -80,7 +80,7 @@ over, place previous choices within easy reach.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Keep it brief</h4> +<h4 id="keep-it-brief">Keep it brief</h4> <p>Use short phrases with simple words. People are likely to skip sentences if they're long.</p> </div> @@ -96,7 +96,7 @@ over, place previous choices within easy reach.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Pictures are faster than words</h4> +<h4 id="pictures-faster-than-words">Pictures are faster than words</h4> <p>Consider using pictures to explain ideas. They get people's attention and can be much more efficient than words.</p> @@ -113,7 +113,7 @@ than words.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Decide for me but let me have the final say</h4> +<h4 id="decide-for-me">Decide for me but let me have the final say</h4> <p>Take your best guess and act rather than asking first. Too many choices and decisions make people unhappy. Just in case you get it wrong, allow for 'undo'.</p> @@ -130,7 +130,7 @@ unhappy. Just in case you get it wrong, allow for 'undo'.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Only show what I need when I need it</h4> +<h4 id="only-show-when-i-need-it">Only show what I need when I need it</h4> <p>People get overwhelmed when they see too much at once. Break tasks and information into small, digestible chunks. Hide options that aren't essential at the moment, and teach people as they go.</p> @@ -147,7 +147,7 @@ digestible chunks. Hide options that aren't essential at the moment, and teach p <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>I should always know where I am</h4> +<h4 id="always-know-where-i-am">I should always know where I am</h4> <p>Give people confidence that they know their way around. Make places in your app look distinct and use transitions to show relationships among screens. Provide feedback on tasks in progress.</p> @@ -164,7 +164,7 @@ use transitions to show relationships among screens. Provide feedback on tasks i <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Never lose my stuff</h4> +<h4 id="never-lose-my-stuff">Never lose my stuff</h4> <p>Save what people took time to create and let them access it from anywhere. Remember settings, personal touches, and creations across phones, tablets, and computers. It makes upgrading the easiest thing in the world.</p> @@ -182,7 +182,7 @@ easiest thing in the world.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>If it looks the same, it should act the same</h4> +<h4 id="looks-same-should-act-same">If it looks the same, it should act the same</h4> <p>Help people discern functional differences by making them visually distinct rather than subtle. Avoid modes, which are places that look similar but act differently on the same input.</p> @@ -199,7 +199,7 @@ Avoid modes, which are places that look similar but act differently on the same <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Only interrupt me if it's important</h4> +<h4 id="interrupt-only-if-important">Only interrupt me if it's important</h4> <p>Like a good personal assistant, shield people from unimportant minutiae. People want to stay focused, and unless it's critical and time-sensitive, an interruption can be taxing and frustrating.</p> @@ -216,7 +216,7 @@ focused, and unless it's critical and time-sensitive, an interruption can be tax <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Give me tricks that work everywhere</h4> +<h4 id="give-me-tricks">Give me tricks that work everywhere</h4> <p>People feel great when they figure things out for themselves. Make your app easier to learn by leveraging visual patterns and muscle memory from other Android apps. For example, the swipe gesture may be a good navigational shortcut.</p> @@ -234,7 +234,7 @@ may be a good navigational shortcut.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>It's not my fault</h4> +<h4 id="its-not-my-fault">It's not my fault</h4> <p>Be gentle in how you prompt people to make corrections. They want to feel smart when they use your app. If something goes wrong, give clear recovery instructions but spare them the technical details. If you can fix it behind the scenes, even better.</p> @@ -252,7 +252,7 @@ If you can fix it behind the scenes, even better.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Sprinkle encouragement</h4> +<h4 id="sprinkle-encouragement">Sprinkle encouragement</h4> <p>Break complex tasks into smaller steps that can be easily accomplished. Give feedback on actions, even if it's just a subtle glow.</p> @@ -269,7 +269,7 @@ even if it's just a subtle glow.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Do the heavy lifting for me</h4> +<h4 id="do-heavy-lifting-for-me">Do the heavy lifting for me</h4> <p>Make novices feel like experts by enabling them to do things they never thought they could. For example, shortcuts that combine multiple photo effects can make amateur photographs look amazing in only a few steps.</p> @@ -287,7 +287,7 @@ only a few steps.</p> <div class="layout-content-row"> <div class="layout-content-col span-7"> -<h4>Make important things fast</h4> +<h4 id="make-important-things-fast">Make important things fast</h4> <p>Not all actions are equal. Decide what's most important in your app and make it easy to find and fast to use, like the shutter button in a camera, or the pause button in a music player.</p> diff --git a/docs/html/design/media/app_structure_market.png b/docs/html/design/media/app_structure_market.png Binary files differindex 3b0b786..5aa595e 100644 --- a/docs/html/design/media/app_structure_market.png +++ b/docs/html/design/media/app_structure_market.png diff --git a/docs/html/design/media/app_structure_music_lndscp.png b/docs/html/design/media/app_structure_music_lndscp.png Binary files differindex 0dd400c..67354de 100644 --- a/docs/html/design/media/app_structure_music_lndscp.png +++ b/docs/html/design/media/app_structure_music_lndscp.png diff --git a/docs/html/design/media/app_structure_scrolltabs.png b/docs/html/design/media/app_structure_scrolltabs.png Binary files differindex ef4fca4..ea742c2 100644 --- a/docs/html/design/media/app_structure_scrolltabs.png +++ b/docs/html/design/media/app_structure_scrolltabs.png diff --git a/docs/html/design/media/app_structure_shortcut_on_item.png b/docs/html/design/media/app_structure_shortcut_on_item.png Binary files differindex 3874e1d4..1341f1f 100644 --- a/docs/html/design/media/app_structure_shortcut_on_item.png +++ b/docs/html/design/media/app_structure_shortcut_on_item.png diff --git a/docs/html/design/media/iconography_launcher_example.png b/docs/html/design/media/iconography_launcher_example.png Binary files differindex a5db53e..0cce7ef 100644 --- a/docs/html/design/media/iconography_launcher_example.png +++ b/docs/html/design/media/iconography_launcher_example.png diff --git a/docs/html/design/media/iconography_overview.png b/docs/html/design/media/iconography_overview.png Binary files differindex 688c1b5..56cd409 100644 --- a/docs/html/design/media/iconography_overview.png +++ b/docs/html/design/media/iconography_overview.png diff --git a/docs/html/design/media/migrating_intents.png b/docs/html/design/media/migrating_intents.png Binary files differnew file mode 100644 index 0000000..65fc1a5 --- /dev/null +++ b/docs/html/design/media/migrating_intents.png diff --git a/docs/html/design/media/misc_full_galaxynexus_blank_land_span13.png b/docs/html/design/media/misc_full_galaxynexus_blank_land_span13.png Binary files differdeleted file mode 100644 index bab6aca..0000000 --- a/docs/html/design/media/misc_full_galaxynexus_blank_land_span13.png +++ /dev/null diff --git a/docs/html/design/media/misc_full_galaxynexus_blank_port_span5.png b/docs/html/design/media/misc_full_galaxynexus_blank_port_span5.png Binary files differdeleted file mode 100644 index bdccc2f..0000000 --- a/docs/html/design/media/misc_full_galaxynexus_blank_port_span5.png +++ /dev/null diff --git a/docs/html/design/media/misc_full_galaxynexus_blank_port_span9.png b/docs/html/design/media/misc_full_galaxynexus_blank_port_span9.png Binary files differdeleted file mode 100644 index 5e0135b..0000000 --- a/docs/html/design/media/misc_full_galaxynexus_blank_port_span9.png +++ /dev/null diff --git a/docs/html/design/media/navigation_between_apps_back.png b/docs/html/design/media/navigation_between_apps_back.png Binary files differnew file mode 100755 index 0000000..ded5d0a --- /dev/null +++ b/docs/html/design/media/navigation_between_apps_back.png diff --git a/docs/html/design/media/navigation_between_apps_inward.png b/docs/html/design/media/navigation_between_apps_inward.png Binary files differnew file mode 100755 index 0000000..1f5e401 --- /dev/null +++ b/docs/html/design/media/navigation_between_apps_inward.png diff --git a/docs/html/design/media/navigation_between_apps_up.png b/docs/html/design/media/navigation_between_apps_up.png Binary files differnew file mode 100755 index 0000000..f192c88 --- /dev/null +++ b/docs/html/design/media/navigation_between_apps_up.png diff --git a/docs/html/design/media/navigation_between_siblings_market1.png b/docs/html/design/media/navigation_between_siblings_market1.png Binary files differindex c3148f8..8f2b3dc 100644..100755 --- a/docs/html/design/media/navigation_between_siblings_market1.png +++ b/docs/html/design/media/navigation_between_siblings_market1.png diff --git a/docs/html/design/media/navigation_between_siblings_market2.png b/docs/html/design/media/navigation_between_siblings_market2.png Binary files differindex 208be47..33b654c 100644..100755 --- a/docs/html/design/media/navigation_between_siblings_market2.png +++ b/docs/html/design/media/navigation_between_siblings_market2.png diff --git a/docs/html/design/media/navigation_from_outside_up.png b/docs/html/design/media/navigation_from_outside_up.png Binary files differdeleted file mode 100644 index eaa3cdb..0000000 --- a/docs/html/design/media/navigation_from_outside_up.png +++ /dev/null diff --git a/docs/html/design/media/navigation_indirect_notification.png b/docs/html/design/media/navigation_indirect_notification.png Binary files differnew file mode 100644 index 0000000..6f99267 --- /dev/null +++ b/docs/html/design/media/navigation_indirect_notification.png diff --git a/docs/html/design/media/navigation_popup_notification.png b/docs/html/design/media/navigation_popup_notification.png Binary files differnew file mode 100644 index 0000000..a0a3ee7 --- /dev/null +++ b/docs/html/design/media/navigation_popup_notification.png diff --git a/docs/html/design/media/navigation_up_vs_back_gmail.png b/docs/html/design/media/navigation_up_vs_back_gmail.png Binary files differindex 71e6484..ff7adfe 100644 --- a/docs/html/design/media/navigation_up_vs_back_gmail.png +++ b/docs/html/design/media/navigation_up_vs_back_gmail.png diff --git a/docs/html/design/media/navigation_with_back_and_up.png b/docs/html/design/media/navigation_with_back_and_up.png Binary files differindex 4fb6dce..5440220 100644 --- a/docs/html/design/media/navigation_with_back_and_up.png +++ b/docs/html/design/media/navigation_with_back_and_up.png diff --git a/docs/html/design/media/progress_activity.png b/docs/html/design/media/progress_activity.png Binary files differindex 51210b4..32cf1f5 100644 --- a/docs/html/design/media/progress_activity.png +++ b/docs/html/design/media/progress_activity.png diff --git a/docs/html/design/media/progress_download.png b/docs/html/design/media/progress_download.png Binary files differindex f567f74..ab6bf58 100644 --- a/docs/html/design/media/progress_download.png +++ b/docs/html/design/media/progress_download.png diff --git a/docs/html/design/media/settings_checkbox.png b/docs/html/design/media/settings_checkbox.png Binary files differnew file mode 100644 index 0000000..6615bfb --- /dev/null +++ b/docs/html/design/media/settings_checkbox.png diff --git a/docs/html/design/media/settings_date_time.png b/docs/html/design/media/settings_date_time.png Binary files differnew file mode 100644 index 0000000..8df92d4 --- /dev/null +++ b/docs/html/design/media/settings_date_time.png diff --git a/docs/html/design/media/settings_dependency.png b/docs/html/design/media/settings_dependency.png Binary files differnew file mode 100644 index 0000000..4821c61 --- /dev/null +++ b/docs/html/design/media/settings_dependency.png diff --git a/docs/html/design/media/settings_flowchart.png b/docs/html/design/media/settings_flowchart.png Binary files differnew file mode 100644 index 0000000..7e8623c --- /dev/null +++ b/docs/html/design/media/settings_flowchart.png diff --git a/docs/html/design/media/settings_grouping.png b/docs/html/design/media/settings_grouping.png Binary files differnew file mode 100644 index 0000000..d271ea8 --- /dev/null +++ b/docs/html/design/media/settings_grouping.png diff --git a/docs/html/design/media/settings_individual_on_off.png b/docs/html/design/media/settings_individual_on_off.png Binary files differnew file mode 100644 index 0000000..03bea0b --- /dev/null +++ b/docs/html/design/media/settings_individual_on_off.png diff --git a/docs/html/design/media/settings_list_subscreen.png b/docs/html/design/media/settings_list_subscreen.png Binary files differnew file mode 100644 index 0000000..385aa6a --- /dev/null +++ b/docs/html/design/media/settings_list_subscreen.png diff --git a/docs/html/design/media/settings_main.png b/docs/html/design/media/settings_main.png Binary files differnew file mode 100644 index 0000000..f42a358 --- /dev/null +++ b/docs/html/design/media/settings_main.png diff --git a/docs/html/design/media/settings_master_on_off.png b/docs/html/design/media/settings_master_on_off.png Binary files differnew file mode 100644 index 0000000..e46bb97 --- /dev/null +++ b/docs/html/design/media/settings_master_on_off.png diff --git a/docs/html/design/media/settings_master_on_off_2.png b/docs/html/design/media/settings_master_on_off_2.png Binary files differnew file mode 100644 index 0000000..ab4e992 --- /dev/null +++ b/docs/html/design/media/settings_master_on_off_2.png diff --git a/docs/html/design/media/settings_multiple_choice.png b/docs/html/design/media/settings_multiple_choice.png Binary files differnew file mode 100644 index 0000000..9b28566 --- /dev/null +++ b/docs/html/design/media/settings_multiple_choice.png diff --git a/docs/html/design/media/settings_overflow.png b/docs/html/design/media/settings_overflow.png Binary files differnew file mode 100644 index 0000000..9000bec --- /dev/null +++ b/docs/html/design/media/settings_overflow.png diff --git a/docs/html/design/media/settings_slider.png b/docs/html/design/media/settings_slider.png Binary files differnew file mode 100644 index 0000000..51545c8 --- /dev/null +++ b/docs/html/design/media/settings_slider.png diff --git a/docs/html/design/media/settings_subscreen_navigation.png b/docs/html/design/media/settings_subscreen_navigation.png Binary files differnew file mode 100644 index 0000000..2ab0b96 --- /dev/null +++ b/docs/html/design/media/settings_subscreen_navigation.png diff --git a/docs/html/design/media/tabs_scrolly.mp4 b/docs/html/design/media/tabs_scrolly.mp4 Binary files differindex 4329243..dc9e9c6 100644 --- a/docs/html/design/media/tabs_scrolly.mp4 +++ b/docs/html/design/media/tabs_scrolly.mp4 diff --git a/docs/html/design/media/tabs_scrolly.ogv b/docs/html/design/media/tabs_scrolly.ogv Binary files differindex 345e57a..3e484f9 100644 --- a/docs/html/design/media/tabs_scrolly.ogv +++ b/docs/html/design/media/tabs_scrolly.ogv diff --git a/docs/html/design/media/tabs_scrolly.webm b/docs/html/design/media/tabs_scrolly.webm Binary files differindex 17e368e..e9d371d 100644 --- a/docs/html/design/media/tabs_scrolly.webm +++ b/docs/html/design/media/tabs_scrolly.webm diff --git a/docs/html/design/media/ui_overview_all_apps.png b/docs/html/design/media/ui_overview_all_apps.png Binary files differindex 467f5ad..17e7ece 100644 --- a/docs/html/design/media/ui_overview_all_apps.png +++ b/docs/html/design/media/ui_overview_all_apps.png diff --git a/docs/html/design/patterns/actionbar.jd b/docs/html/design/patterns/actionbar.jd index 9e3f48c..2226fec 100644 --- a/docs/html/design/patterns/actionbar.jd +++ b/docs/html/design/patterns/actionbar.jd @@ -176,7 +176,7 @@ themselves.</p> <source src="{@docRoot}design/media/tabs_scrolly.ogv" type="video/ogg"> </video> <div class="figure-caption"> - Scrolling tabs in Google Play. + Scrolling tabs in the Play Store app. <div class="video-instructions"> </div> </div> diff --git a/docs/html/design/patterns/app-structure.jd b/docs/html/design/patterns/app-structure.jd index b54b12f..e2398ed 100644 --- a/docs/html/design/patterns/app-structure.jd +++ b/docs/html/design/patterns/app-structure.jd @@ -7,7 +7,7 @@ page.title=Application Structure single screen</li> <li>Apps such as Phone whose main purpose is to switch between different activities without deeper navigation</li> -<li>Apps such as Gmail or Google Play that combine a broad set of data views with deep navigation</li> +<li>Apps such as Gmail or the Play Store that combine a broad set of data views with deep navigation</li> </ul> <p>Your app's structure depends largely on the content and tasks you want to surface for your users.</p> <h2 id="general-structure">General Structure</h2> @@ -60,7 +60,7 @@ layouts that are visually engaging and appropriate for the data type and screen <img src="{@docRoot}design/media/app_structure_market.png"> <div class="figure-caption"> - The Google Play app's start screen primarily allows navigation into the stores for Apps, Music, Books, + The Play Store app's start screen primarily allows navigation into the stores for Apps, Music, Books, Movies and Games. It is also enriched with tailored recommendations and promotions that surface content of interest to the user. Search is readily available from the action bar. </div> @@ -145,8 +145,8 @@ minimize navigational effort. Rule of thumb: no more than 5–7 tabs.</p> <img src="{@docRoot}design/media/app_structure_scrolltabs.png"> <div class="figure-caption"> - Google Play uses tabs to simultaneously show category choice and content. To navigate between - categories, users can swipe left/right on the content. + The Play Store app uses tabs to simultaneously show category choice and content. To navigate + between categories, users can swipe left/right on the content. </div> </div> diff --git a/docs/html/design/patterns/navigation.jd b/docs/html/design/patterns/navigation.jd index d35cd82..7e288ae 100644 --- a/docs/html/design/patterns/navigation.jd +++ b/docs/html/design/patterns/navigation.jd @@ -13,32 +13,36 @@ the <em>Up</em> button, consisting of the app icon and a left-point caret.</p> <h2 id="up-vs-back">Up vs. Back</h2> -<p>The Up button is used to navigate within an application based on the hierarchical relationships +<p>The Up button is used to navigate within an app based on the hierarchical relationships between screens. For instance, if screen A displays a list of items, and selecting an item leads to screen B (which presents that item in more detail), then screen B should offer an Up button that returns to screen A.</p> -<p>If a screen is the topmost one in an app (i.e. the home of the app), it should not present an Up +<p>If a screen is the topmost one in an app (that is, the app's home), it should not present an Up button.</p> -<p>The system Back key is used to navigate based on the history of screens the user has recently seen, -in reverse chronological order—in effect, the temporal relationships between screens.</p> + +<p>The system Back button is used to navigate, in reverse chronological order, through the history +of screens the user has recently worked with. It is generally based on the temporal relationships +between screens, rather than the app's hierarchy.</p> + <p>When the previously viewed screen is also the hierarchical parent of the current screen, pressing -the Back key will have the same result as pressing an Up button -- this is a common occurrence. -However, unlike the Up button, which ensures the user remains within your app, the Back key can -return the user to the Home screen, or even to a different application.</p> +the Back button has the same result as pressing an Up button—this is a common +occurrence. However, unlike the Up button, which ensures the user remains within your app, the Back +button can return the user to the Home screen, or even to a different app.</p> <img src="{@docRoot}design/media/navigation_up_vs_back_gmail.png"> -<p>The Back key also supports a few behaviors not directly tied to screen-to-screen navigation:</p> +<p>The Back button also supports a few behaviors not directly tied to screen-to-screen navigation: +</p> <ul> -<li>Back dismisses floating windows (dialogs, popups)</li> -<li>Back dismisses contextual action bars, and removes the highlight from the selected items</li> -<li>Back hides the onscreen keyboard (IME)</li> +<li>Dismisses floating windows (dialogs, popups)</li> +<li>Dismisses contextual action bars, and removes the highlight from the selected items</li> +<li>Hides the onscreen keyboard (IME)</li> </ul> <h2 id="within-app">Navigation Within Your App</h2> <h4>Navigating to screens with multiple entry points</h4> <p>Sometimes a screen doesn't have a strict position within the app's hierarchy, and can be reached -from multiple entry points—e.g., a settings screen which can be navigated to from any screen +from multiple entry points—such as a settings screen that can be reached from any other screen in your app. In this case, the Up button should choose to return to the referring screen, behaving identically to Back.</p> <h4>Changing view within a screen</h4> @@ -50,7 +54,7 @@ in the same place within the app's hierarchy, and no new navigation history is c <li>Switching views using a dropdown (aka collapsed tabs)</li> <li>Filtering a list</li> <li>Sorting a list</li> -<li>Changing display characteristics (e.g. zooming)</li> +<li>Changing display characteristics (such as zooming)</li> </ul> <h4>Navigating between sibling screens</h4> <p>When your app supports navigation from a list of items to a detail view of one of those items, it's @@ -61,56 +65,140 @@ navigation does not change the behavior of Up or Back.</p> <img src="{@docRoot}design/media/navigation_between_siblings_gmail.png"> -<p>However, a notable exception to this occurs when browsing between "related" detail views not tied -together by the referring list—for example, when browsing on Google Play between apps from +<p>However, a notable exception to this occurs when browsing between related detail views not tied +together by the referring list—for example, when browsing in the Play Store between apps from the same developer, or albums by the same artist. In these cases, following each link does create -history, causing the Back button to step through each screen of related content which has been -viewed. Up should continue to bypass these related screens and navigate to the most recently viewed -container screen.</p> +history, causing the Back button to step through each previously viewed screen. Up should continue +to bypass these related screens and navigate to the most recently viewed container screen.</p> <img src="{@docRoot}design/media/navigation_between_siblings_market1.png"> <p>You have the ability to make the Up behavior even smarter based on your knowledge of detail -view. If we extend our Google Play sample from above, imagine the user has navigated from the last Book -viewed to the details for the Movie adaptation. In that case, Up can return to a container (Movies) -which the user had not previously navigated through.</p> +view. Extending the Play Store example from above, imagine the user has navigated from the last +Book viewed to the details for the Movie adaptation. In that case, Up can return to a container +(Movies) which the user hasn't previously navigated through.</p> <img src="{@docRoot}design/media/navigation_between_siblings_market2.png"> -<h2 id="from-outside">Navigation From Outside Your App</h2> +<h2 id="into-your-app">Navigation into Your App via Home Screen Widgets and Notifications</h2> + +<p>You can use Home screen widgets or notifications to help your users navigate directly to screens +deep within your app's hierarchy. For example, Gmail's Inbox widget and new message notification can +both bypass the Inbox screen, taking the user directly to a conversation view.</p> + +<p>For both of these cases, handle the Up button as follows:</p> -<p>There are two categories of navigation from outside your app to screens deep within the app's -hierarchy:</p> <ul> -<li>App-to-app navigation, such as via intent completion.</li> -<li>System-to-app navigation, such as via notifications and home screen widgets.</li> +<li><em>If the destination screen is typically reached from one particular screen within your +app</em>, Up should navigate to that screen.</li> +<li><em>Otherwise</em>, Up should navigate to the topmost ("Home") screen of your app.</li> </ul> -<p>Gmail provides examples of each of these. For app-to-app navigation, a "Share" intent goes directly -to the compose screen. For system-to-app navigation, both a new message notification and a home -screen widget can bypass the Inbox screen, taking the user directly to a conversation view.</p> -<h4>App-to-app navigation</h4> -<p>When navigating deep into your app's hierarchy directly from another app via an intent, Back will -return to the referring app.</p> -<p>The Up button is handled as follows: -- If the destination screen is typically reached from one particular screen within your app, Up - should navigate to that screen. -- Otherwise, Up should navigate to the topmost ("Home") screen of your app.</p> -<p>For example, after choosing to share a book being viewed on Google Play, the user navigates directly to -Gmail's compose screen. From there, Up returns to the Inbox (which happens to be both the -typical referrer to compose, as well as the topmost screen of the app), while Back returns to -Google Play.</p> - -<img src="{@docRoot}design/media/navigation_from_outside_up.png"> - -<h4>System-to-app navigation</h4> -<p>If your app was reached via the system mechanisms of notifications or home screen widgets, Up -behaves as described for app-to-app navigation, above.</p> -<p>For the Back key, you should make navigation more predictably by inserting into the task's back -stack the complete upward navigation path to the app's topmost screen. This way, a user who has -forgotten how they entered your app can safely navigate to the app's topmost screen before exiting -it.</p> -<p>For example, Gmail's Home screen widget has a button for diving directly to its compose screen. -After following that path, the Back key first returns to the Inbox, and from there continues to -Home.</p> + +<p>In the case of the Back button, you should make navigation more predictable by inserting into the +task's back stack the complete upward navigation path to the app's topmost screen. This allows users +who've forgotten how they entered your app to navigate to the app's topmost screen before +exiting.</p> + +<p>As an example, Gmail's Home screen widget has a button for diving directly to its compose +screen. Up or Back from the compose screen would take the user to the Inbox, and from there the +Back button continues to Home.</p> <img src="{@docRoot}design/media/navigation_from_outside_back.png"> + +<h4>Indirect notifications</h4> + +<p>When your app needs to present information about multiple events simultaneously, it can use a +single notification that directs the user to an interstitial screen. This screen summarizes these +events, and provides paths for the user to dive deeply into the app. Notifications of this style are +called <em>indirect notifications</em>.</p> + +<p>Unlike standard (direct) notifications, pressing Back from an indirect notification's +interstitial screen returns the user to the point the notification was triggered from—no +additional screens are inserted into the back stack. Once the user proceeds into the app from its +interstitial screen, Up and Back behave as for standard notifications, as described above: +navigating within the app rather than returning to the interstitial.</p> + +<p>For example, suppose a user in Gmail receives an indirect notification from Calendar. Touching +this notification opens the interstitial screen, which displays reminders for several different +events. Touching Back from the interstitial returns the user to Gmail. Touching on a particular +event takes the user away from the interstitial and into the full Calendar app to display details of +the event. From the event details, Up and Back navigate to the top-level view of Calendar.</p> + +<img src="{@docRoot}design/media/navigation_indirect_notification.png"> + +<h4>Pop-up notifications</h4> + +<p><em>Pop-up notifications</em> bypass the notification drawer, instead appearing directly in +front of the user. They are rarely used, and <strong>should be reserved for occasions where a timely +response is required and the interruption of the user's context is necessary</strong>. For example, +Talk uses this style to alert the user of an invitation from a friend to join a video chat, as this +invitation will automatically expire after a few seconds.</p> + +<p>In terms of navigation behavior, pop-up notifications closely follow the behavior of an indirect +notification's interstitial screen. Back dismisses the pop-up notification. If the user navigates +from the pop-up into the notifying app, Up and Back follow the rules for standard notifications, +navigating within the app.</p> + +<img src="{@docRoot}design/media/navigation_popup_notification.png"> + +<h2 id="between-apps">Navigation Between Apps</h2> + +<p>One of the fundamental strengths of the Android system is the ability for apps to activate each +other, giving the user the ability to navigate directly from one app into another. For example, an +app that needs to capture a photo can activate the Camera app, which will return the photo +to the referring app. This is a tremendous benefit to both the developer, who can easily leverage +code from other apps, and the user, who enjoys a consistent experience for commonly performed +actions.</p> + +<p>To understand app-to-app navigation, it's important to understand the Android framework behavior +discussed below.</p> + +<h4>Activities, tasks, and intents</h4> + +<p>In Android, an <strong>activity</strong> is an application component that defines a screen of +information and all of the associated actions the user can perform. Your app is a collection of +activities, consisting of both the activities you create and those you re-use from other apps.</p> + +<p>A <strong>task</strong> is the sequence of activities a user follows to accomplish a goal. A +single task can make use of activities from just one app, or may draw on activities from a number +of different apps.</p> + +<p>An <strong>intent</strong> is a mechanism for one app to signal it would like another +app's assistance in performing an action. An app's activities can indicate which intents +they can respond to. For common intents such as "Share", the user may have many apps installed +that can fulfill that request.</p> + +<h4>Example: navigating between apps to support sharing</h4> + +<p>To understand how activities, tasks, and intents work together, consider how one app allows users +to share content by using another app. For example, launching the Play Store app from Home begins +new Task A (see figure below). After navigating through the Play Store and touching a promoted book +to see its details, the user remains in the same task, extending it by adding activities. Triggering +the Share action prompts the user with a dialog listing each of the activities (from different apps) +which have registered to handle the Share intent.</p> + +<img src="{@docRoot}design/media/navigation_between_apps_inward.png"> + +<p>When the user elects to share via Gmail, Gmail's compose activity is added as a continuation of +Task A—no new task is created. If Gmail had its own task running in the background, it would +be unaffected.</p> + +<p>From the compose activity, sending the message or touching the Back button returns the user to +the book details activity. Subsequent touches of Back continue to navigate back through the Play +Store, ultimately arriving at Home.</p> + +<img src="{@docRoot}design/media/navigation_between_apps_back.png"> + +<p>However, by touching Up from the compose activity, the user indicates a desire to remain within +Gmail. Gmail's conversation list activity appears, and a new Task B is created for it. New tasks are +always rooted to Home, so touching Back from the conversation list returns there.</p> + +<img src="{@docRoot}design/media/navigation_between_apps_up.png"> + +<p>Task A persists in the background, and the user may return to it later (for example, via the +Recents screen). If Gmail already had its own task running in the background, it would be replaced +with Task B—the prior context is abandoned in favor of the user's new goal.</p> + +<p>When your app registers to handle intents with an activity deep within the app's hierarchy, +refer to <a href="#into-your-app">Navigation into Your App via Home Screen Widgets and +Notifications</a> for guidance on how to specify Up navigation.</p> diff --git a/docs/html/design/patterns/pure-android.jd b/docs/html/design/patterns/pure-android.jd index 8ed1347..77813c0 100644 --- a/docs/html/design/patterns/pure-android.jd +++ b/docs/html/design/patterns/pure-android.jd @@ -48,7 +48,8 @@ conventions of a different platform.</p> document or deleting.</p> <p>As you are migrating your app to Android, please swap out platform-specific icons with their Android counterparts.</p> -<p>You can find a wide variety of icons for use in your app in the Android SDK.</p> +<p>You can find a wide variety of icons for use in your app on the +<a href="{@docRoot}design/downloads/index.html">Downloads</a> page.</p> </div> <div class="layout-content-col span-8"> @@ -89,6 +90,33 @@ platform and to avoid confusion between actions and view switching on Android.</ <div class="layout-content-row"> <div class="layout-content-col span-5"> +<h4>Don't hardcode links to other apps</h4> +<p>In some cases you might want your app to take advantage of another app's feature set. For +example, you may want to share the content that your app created via a social network or messaging +app, or view the content of a weblink in a browser. Don't use hard-coded, explicit links to +particular apps to achieve this. Instead, use Android's intent API to launch an activity chooser +which lists all applications that are set up to handle the particular request. This lets the user +complete the task with their preferred app. For sharing in particular, consider using the <em>Share +Action Provider</em> in your action bar to provide faster access to the user's most recently used +sharing target.</p> + + </div> + <div class="layout-content-col span-8"> + + <img src="{@docRoot}design/media/migrating_intents.png"> + <div class="figure-caption"> + Link to other apps with the activity chooser or use the <em>Share Action Provider</em> in the + action bar. + </div> + + </div> +</div> + +<div class="vspace size-2"> </div> + +<div class="layout-content-row"> + <div class="layout-content-col span-5"> + <h4>Don't use labeled back buttons on action bars</h4> <p>Other platforms use an explicit back button with label to allow the user to navigate up the application's hierarchy. Instead, Android uses the main action bar's app icon for hierarchical diff --git a/docs/html/design/patterns/settings.jd b/docs/html/design/patterns/settings.jd new file mode 100644 index 0000000..3b28b84 --- /dev/null +++ b/docs/html/design/patterns/settings.jd @@ -0,0 +1,689 @@ +page.title=Settings +@jd:body + +<p>Settings is a place in your app where users indicate their preferences for how your app should +behave. This benefits users because:</p> + +<ul> +<li>You don't need to interrupt them with the same questions over and over when certain situations +arise. The settings predetermine what will always happen in those situations (see design +principle: <a href="{@docRoot}design/get-started/principles.html#decide-for-me">Decide for me but +let me have the final say</a>).</li> +<li>You help them feel at home and in control (see design principle: +<a href="{@docRoot}design/get-started/principles.html#make-it-mine">Let me make it mine</a>).</li> +</ul> + +<h2 id="flow-structure">Flow and Structure</h2> + +<h4 id="settings-access">Provide access to Settings in the action overflow</h4> + +<p>Settings is given low prominence in the UI because it's not frequently needed. Even if there's +room in the <a href="{@docRoot}design/patterns/actionbar.html">action bar</a>, never make Settings +an action button. Always keep it in the action overflow and label it "Settings". Place it below +all other items except "Help".</p> + +<img src="{@docRoot}design/media/settings_overflow.png"> + +<div class="vspace size-2"> </div> + +<h4 id="what-to-make-a-setting">Avoid the temptation to make everything a setting</h4> + +<p>Because Settings is a few navigational steps away, no matter how many items you have, they'll +never clutter up the core part of your UI. This may seem like good news, but it also poses a +challenge.</p> + +<p>Settings can be a tempting place to keep a lot of stuff—like a hall closet where things +get stashed when you tidy up before company comes over. It's not a place where you spend lots of +time, so it's easy to rationalize and ignore its cluttered condition. But when users visit +Settings—however infrequently—they'll have the same expectations for the experience as +they do everywhere else in your app. More settings means more choices to make, and too many are +overwhelming.</p> + +<p>So don't punt on the difficult product decisions and debates that can bring on the urge to +"just make it a setting". For each control you're considering adding to Settings, make sure it +meets the bar:</p> + +<img src="{@docRoot}design/media/settings_flowchart.png"> + +<div class="vspace size-3"> </div> + +<div class="layout-content-row"> + <div class="layout-content-col span-5 with-callouts"> + +<h4 id="group-settings">If you still have lots of settings, group related settings together</h4> + +<p>The number of items an average human can hold in short-term memory is 7±2. If you +present a list of 10 or more settings (even after applying the criteria above), users will have +more difficulty scanning, comprehending, and processing them.</p> + +<p>You can remedy this by dividing some or all of the settings into groups, effectively turning +one long list into multiple shorter lists. A group of related settings can be presented in one of +two ways:</p> + +<ol> +<li><h4>Under a section divider</h4></li> +<li><h4>In a separate subscreen</h4></li> +</ol> + +<p>You can use one or both these grouping techniques to organize your app's settings.</p> + +<p>For example, in the main screen of the Android Settings app, each item in the list navigates +to a subscreen of related settings. In addition, the items themselves are grouped under section +dividers.</p> + + </div> + <div class="layout-content-col span-8"> + + <img src="{@docRoot}design/media/settings_grouping.png"> + + </div> +</div> + +<p>Grouping settings is not an exact science, but here's some advice for how to approach it, based +on the total number of settings in your app.</p> + +<div class="vspace size-1"> </div> + +<div class="layout-content-row"> + <div class="layout-content-col span-2"> + +<h4>7 or fewer</h4> + + </div> + <div class="layout-content-col span-11"> + +<p>Don't group them at all. It won't benefit users and will seem like overkill.</p> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-2"> + +<h4>8 to 10</h4> + + </div> + <div class="layout-content-col span-11"> + +<p>Try grouping related settings under 1 or 2 section dividers. If you have any "singletons" +(settings that don't relate to any other settings and can't be grouped under your section +dividers), treat them as follows:</p> + +<ul> +<li>If they include some of your most important settings, list them at the top without a section +divider.</li> +<li>Otherwise, list them at the bottom with a section divider called "OTHER", in order of +importance.</li> +</ul> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-2"> + +<h4>11 to 15</h4> + + </div> + <div class="layout-content-col span-11"> + +<p>Same advice as above, but try 2 to 4 section dividers.</p> + +<p>Also, try the following to reduce the list:</p> + +<ul> +<li>If 2 or more of the settings are mainly for power users, move them out of your main Settings +screen and into an "Advanced" subscreen. Place an item in the action overflow called "Advanced" to +navigate to it.</li> +<li>Look for "doubles": two settings that relate to one another, but not to any other settings. +Try to combine them into one setting, using the design patterns described later in this section. +For example, you might be able to redesign two related checkbox settings into one multiple choice +setting.</li> +</ul> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-2"> + +<h4>16 or more</h4> + + </div> + <div class="layout-content-col span-11"> + +<p>If you have any instances of 4 or more related settings, group them under a subscreen. Then use +the advice suggested above for the reduced list size.</p> + + </div> +</div> + + +<h2 id="patterns">Design Patterns</h2> + +<div class="layout-content-row"> + <div class="layout-content-col span-3"> + +<h4>Checkbox</h4> +<p>Use this pattern for a setting that is either selected or not selected.</p> + + </div> + <div class="layout-content-col span-10"> + +<img src="{@docRoot}design/media/settings_checkbox.png"> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-3"> + +<h4>Multiple choice</h4> +<p>Use this pattern for a setting that needs to present a discrete set of options, from which the +user can choose only one.</p> + + </div> + <div class="layout-content-col span-10"> + +<img src="{@docRoot}design/media/settings_multiple_choice.png"> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-3"> + +<h4>Slider</h4> +<p>Use this pattern for a setting where the range of values are not discrete and fall along a +continuum.</p> + + </div> + <div class="layout-content-col span-10"> + +<img src="{@docRoot}design/media/settings_slider.png"> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-3"> + +<h4>Date/time</h4> +<p>Use this pattern for a setting that needs to collect a date and/or time from the user.</p> + + </div> + <div class="layout-content-col span-10"> + +<img src="{@docRoot}design/media/settings_date_time.png"> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-3"> + +<h4>Subscreen navigation</h4> +<p>Use this pattern for navigating to a subscreen or sequence of subscreens that guide the user +through a more complex setup process.</p> +<ul> +<li>If navigating to a single subscreen, use the same title in both the subscreen and the label +navigating to it.</li> +<li>If navigating to a sequence of subscreens (as in this example), use a title that describes the +first step in the sequence.</li> +</ul> + + </div> + <div class="layout-content-col span-10"> + +<img src="{@docRoot}design/media/settings_subscreen_navigation.png"> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-3"> + +<h4>List subscreen</h4> +<p>Use this pattern for a setting or category of settings that contains a list of equivalent items. +</p> +<p>The label provides the name of the item, and secondary text may be used for status. (In this +example, status is reinforced with an icon to the right of the label.) Any actions associated with +the list appear in the action bar rather than the list itself.</p> + + </div> + <div class="layout-content-col span-10"> + +<img src="{@docRoot}design/media/settings_list_subscreen.png"> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-3"> + +<h4>Master on/off switch</h4> +<p>Use this pattern for a category of settings that need a mechanism for turning on or off as a +whole.</p> +<p>An on/off switch is placed as the first item in the action bar of a subscreen. When the switch +is turned off, the items in the list disappear, replaced by text that describes why the list is +empty. If any actions require the switch to be on, they become disabled.</p> + + </div> + <div class="layout-content-col span-10"> + +<img src="{@docRoot}design/media/settings_master_on_off.png"> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-3"> + +<div class="vspace size-2"> </div> + +<p>You can also echo the master on/off switch in the menu item that leads to the subscreen. +However, you should only do this in cases where users rarely need to access the subscreen once +it's initially set up and more often just want to toggle the switch.</p> + + </div> + <div class="layout-content-col span-10"> + +<img src="{@docRoot}design/media/settings_master_on_off_2.png"> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-3"> + +<h4>Individual on/off switch</h4> +<p>Use this pattern for an individual setting that requires a more elaborate description than can +be provided in checkbox form.</p> +<p>The on/off switch only appears in the subscreen so that users aren't able to toggle it without +also being exposed to the descriptive text. Secondary text appears below the setting label to +reflect the current selection.</p> +<p>In this example, Android Beam is on by default. Since users might not know what this setting +does, we made the status more descriptive than just "On".</p> + + </div> + <div class="layout-content-col span-10"> + +<img src="{@docRoot}design/media/settings_individual_on_off.png"> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-3"> + +<h4>Dependency</h4> +<p>Use this pattern for a setting that changes availability based on the value of another setting. +</p> +<p>The disabled setting appears below its dependency, without any indentation. If the setting +includes a status line, it says "Unavailable", and if the reason isn't obvious, a brief +explanation is included in the status.</p> +<p>If a given setting is a dependency to 3 or more settings, consider using a subscreen with a +master on/off switch so that your main settings screen isn't cluttered by lots of disabled items. +</p> + + </div> + <div class="layout-content-col span-10"> + +<img src="{@docRoot}design/media/settings_dependency.png"> + + </div> +</div> + +<h2 id="defaults">Defaults</h2> + +<p>Take great care in choosing default values for each of your settings. Because settings +determine app behavior, your choices will contribute to users' first impressions of your app. Even +though users can change settings, they'll expect the initial states to be sensible. The following +questions (when applicable) may help inform your decisions:</p> + +<ul> +<li>Which choice would most users be likely to choose on their own if there were no default?</li> +<li>Which choice is the most neutral or middle-of-the-road?</li> +<li>Which choice is the least risky, controversial, or over-the-top?</li> +<li>Which choice uses the least amount of battery or mobile data?</li> +<li>Which choice best supports the design principle +<a href="{@docRoot}design/get-started/principles.html#never-lose-my-stuff">Never lose my stuff</a>?</li> +<li>Which choice best supports the design principle +<a href="{@docRoot}design/get-started/principles.html#interrupt-only-if-important">Only interrupt +me if it's important</a>? +</li> +</ul> + +<h2 id="writing">Writing Guidelines</h2> + +<h4>Label clearly and concisely</h4> + +<p>Writing a good label for a setting can be challenging because space is very limited. You only +get one line, and it's incredibly short on the smallest of devices. Follow these guidelines to +make your labels brief, meaningful, and scannable:</p> + +<ul> +<li>Write each label in sentence case (i.e. only the first word and proper nouns are capitalized). +</li> +<li>Don't start a label with an instructional verb like "Set", "Change", "Edit", "Modify", +"Manage", "Use", "Select", or "Choose". Users already understand that they can do these things to +settings.</li> +<li>Likewise, don't end a label with a word like "setting" or "settings". It's already implied. +</li> +<li>If the setting is part of a grouping, don't repeat the word(s) used in the section divider or +subscreen title.</li> +<li>Avoid starting a label with a negative word like "Don't" or "Never". For example, "Don't +allow" could be rephrased to "Block".</li> +<li>Steer clear of technical jargon as much as possible, unless it's a term widely understood by +your target users. Use common verbs and nouns to convey the setting's purpose rather than its +underlying technology.</li> +<li>Don't refer to the user. For example, for a setting allowing the user to turn notifications on +or off, label it "Notifications" instead of "Notify me".</li> +</ul> + +<p>Once you've decided on labels for your settings, be sure to preview them on an +<a href="{@docRoot}design/style/metrics-grids.html">LDPI handset</a> in portrait to make sure +they'll fit everywhere.</p> + +<h4>Secondary text below is for status, not description…</h4> + +<p>Before Ice Cream Sandwich, we often displayed secondary text below a label to further describe +it or provide instructions. Starting in Ice Cream Sandwich, we're using secondary text for status. +</p> + +<div class="layout-content-row"> + <div class="layout-content-col span-4"> + + <div class="do-dont-label bad emulate-content-left-padding">Before</div> + + <table class="ui-table bad emulate-content-left-padding"> + <thead> + <tr> + <th class="label"> + Screen timeout + </th> + </tr> + </thead> + <tbody> + <tr> + <td class="secondary-text"> + Adjust the delay before the screen automatically turns off + </td> + </tr> + </tbody> + </table> + + </div> + <div class="layout-content-col span-4"> + + <div class="do-dont-label good">After</div> + + <table class="ui-table good"> + <thead> + <tr> + <th class="label"> + Sleep + </th> + </tr> + </thead> + <tbody> + <tr> + <td class="secondary-text"> + After 10 minutes of activity + </td> + </tr> + </tbody> + </table> + + </div> +</div> + +<p>Status in secondary text has the following benefits:</p> +<ul> +<li>Users can see at a glance what the current value of a setting is without having to navigate +any further.</li> +<li>It applies the design principle +<a href="{@docRoot}design/get-started/principles.html#keep-it-brief">Keep it brief</a>, which +users greatly appreciate.</li> +</ul> + +<h4>…unless it's a checkbox setting</h4> +<p>There's one important exception to the using secondary text for status: checkbox settings. +Here, use secondary text for description, not status. Status below a checkbox is unnecessary +because the checkbox already indicates it. The reason why it's appropriate to have a description +below a checkbox setting is because—unlike other controls—it doesn't display a dialog +or navigate to another screen where additional information can be provided.</p> + +<p>That said, if a checkbox setting's label is clear enough on its own, there's no need to also +provide a description. Only include one if necessary.</p> + +<p>Follow these guidelines to write checkbox setting descriptions:</p> +<ul> +<li>Keep it to one sentence and don't use ending punctuation.</li> +<li>Convey what happens when the setting is checked, phrased in the form of a command. Example: +"Allow data exchange", not "Allows data exchange".</li> +<li>Avoid repetition by choosing words that don't already appear in the label.</li> +<li>Don't refer to the user unless it's necessary for understanding the setting.</li> +<li>If you must refer to the user, do so in the second person ("you") rather than the first person +("I"). Android speaks to users, not on behalf of them.</li> +</ul> + +<h4>Writing examples</h4> + +<p>The following are examples of changes we made to labels and secondary text in the Settings app +in Ice Cream Sandwich.</p> + +<div class="layout-content-row"> + <div class="layout-content-col span-4"> + + <div class="do-dont-label bad emulate-content-left-padding">Before</div> + + <table class="ui-table bad emulate-content-left-padding"> + <thead> + <tr> + <th class="label"> + Use tactile feedback + </th> + </tr> + </thead> + </table> + + </div> + <div class="layout-content-col span-4"> + + <div class="do-dont-label good">After</div> + + <table class="ui-table good"> + <thead> + <tr> + <th class="label"> + Vibrate on touch + </th> + </tr> + </thead> + </table> + + </div> + <div class="layout-content-col span-5"> + +<p>In this checkbox setting, we eliminated the throwaway word "Use" and rephrased the label to be +more direct and understandable.</p> + + </div> + +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-4"> + + <div class="do-dont-label bad emulate-content-left-padding">Before</div> + + <table class="ui-table bad emulate-content-left-padding"> + <thead> + <tr> + <th class="label"> + Screen timeout + </th> + </tr> + </thead> + <tbody> + <tr> + <td class="secondary-text"> + Adjust the delay before the screen automatically turns off + </td> + </tr> + </tbody> + </table> + + </div> + <div class="layout-content-col span-4"> + + <div class="do-dont-label good">After</div> + + <table class="ui-table good"> + <thead> + <tr> + <th class="label"> + Sleep + </th> + </tr> + </thead> + <tbody> + <tr> + <td class="secondary-text"> + After 10 minutes of activity + </td> + </tr> + </tbody> + </table> + + </div> + <div class="layout-content-col span-5"> + +<p>In this multiple choice setting, we changed the label to a friendlier term and also replaced +the description with status. We put some descriptive words around the selected value, "10 +minutes", because on its own, the meaning could be misinterpreted as "sleep for 10 minutes".</p> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-4"> + + <div class="do-dont-label bad emulate-content-left-padding">Before</div> + + <table class="ui-table bad emulate-content-left-padding"> + <thead> + <tr> + <th class="label"> + Change screen lock + </th> + </tr> + </thead> + <tbody> + <tr> + <td class="secondary-text"> + Change or disable pattern, PIN, or password security + </td> + </tr> + </tbody> + </table> + + </div> + <div class="layout-content-col span-4"> + + <div class="do-dont-label good">After</div> + + <table class="ui-table good"> + <thead> + <tr> + <th class="label"> + Screen lock + </th> + </tr> + </thead> + <tbody> + <tr> + <td class="secondary-text"> + Pattern + </td> + </tr> + </tbody> + </table> + + </div> + <div class="layout-content-col span-5"> + +<p>This setting navigates to a a sequence of subscreens that allow users to choose a type of +screen lock and then set it up. We eliminated the throwaway word "Change" in the label, and +replaced the description with the current type of screen lock set up by the user. If the user +hasn't set up a screen lock, the secondary text says "None".</p> + + </div> +</div> + +<div class="layout-content-row"> + <div class="layout-content-col span-4"> + + <div class="do-dont-label bad emulate-content-left-padding">Before</div> + + <table class="ui-table bad emulate-content-left-padding"> + <thead> + <tr> + <th class="label"> + NFC + </th> + </tr> + </thead> + <tbody> + <tr> + <td class="secondary-text"> + Use Near Field Communication to read and exchange tags + </td> + </tr> + </tbody> + </table> + + </div> + <div class="layout-content-col span-4"> + + <div class="do-dont-label good">After</div> + + <table class="ui-table good"> + <thead> + <tr> + <th class="label"> + NFC + </th> + </tr> + </thead> + <tbody> + <tr> + <td class="secondary-text"> + Allow data exchange when the phone touches another device + </td> + </tr> + </tbody> + </table> + + </div> + <div class="layout-content-col span-5"> + +<p>In this checkbox setting—although it's technical jargon—we kept the "NFC" label +because: (1) we couldn't find a clear, concise alternative, and (2) user familiarity with the +acronym is expected to increase dramatically in the next couple of years.</p> +<p>We did, however, rewrite the description. It's far less technical than before and does a better +job of conveying how and why you'd use NFC. We didn't include what the acronym stands for because +it doesn't mean anything to most users and would have taken up a lot of space.</p> + + </div> +</div> + +<h2 id="checklist">Checklist</h2> +<ul> +<li><p>Make sure each item in Settings meets the criteria for belonging there.</p></li> +<li><p>If you have more than 7 items, explore ways to group related settings.</p></li> +<li><p>Use design patterns wherever applicable so users don't face a learning curve.</p></li> +<li><p>Choose defaults that are safe, neutral, and fit the majority of users.</p></li> +<li><p>Give each setting a clear, concise label and use secondary text appropriately.</p></li> +</ul>
\ No newline at end of file diff --git a/docs/html/design/style/writing.jd b/docs/html/design/style/writing.jd index 80fd03e..919ea7a 100644 --- a/docs/html/design/style/writing.jd +++ b/docs/html/design/style/writing.jd @@ -1,58 +1,6 @@ page.title=Writing Style @jd:body -<style> - -/* UI tables */ - -.ui_table { - width: 100%; - background: #282828; - color: #fff; - border-radius: 2px; - box-shadow: 0 2px 4px rgba(0,0,0,0.25); - border-collapse: separate; -} - -.ui_table th, -.ui_table td { - padding: 5px 10px; -} - -.ui_table thead th { - font-weight: 600; -} - -.ui_table tfoot td { - border-top: 1px solid #494949; - border-right: 1px solid #494949; - text-align: center; -} - -.ui_table tfoot td:last-child { - border-right: 0; -} - -.list_item_margins { - margin-left: 30px !important; -} - -.example_label { - margin-bottom: 10px; - padding-left: 20px; - background: transparent none no-repeat scroll 0px 3px; -} - -.example_label.bad { - background-image: url({@docRoot}assets/design/ico_wrong.png); -} - -.example_label.good { - background-image: url({@docRoot}assets/design/ico_good.png); -} - -</style> - <p>When choosing words for your app:</p> <ol> <li> @@ -90,20 +38,20 @@ page.title=Writing Style <ol><li class="value-1"><strong>Keep it brief.</strong> From the setup wizard:</ol> <div class="layout-content-row"> - <div class="layout-content-col span-6 list_item_margins"> + <div class="layout-content-col span-6 layout-with-list-item-margins"> - <div class="example_label bad">Too formal</div> + <div class="do-dont-label bad">Too formal</div> - <table class="ui_table good"><tbody><tr><td> + <table class="ui-table good"><tbody><tr><td> Consult the documentation that came with your phone for further instructions. </td></tr></tbody></table> </div> <div class="layout-content-col span-6"> - <div class="example_label good">Better</div> + <div class="do-dont-label good">Better</div> - <table class="ui_table good"><tbody><tr><td> + <table class="ui-table good"><tbody><tr><td> Read the instructions that came with your phone. </td></tr></tbody></table> @@ -115,11 +63,11 @@ page.title=Writing Style <ol><li class="value-2"><strong>Keep it simple.</strong> From the Location settings screen:</ol> <div class="layout-content-row"> - <div class="layout-content-col span-6 list_item_margins"> + <div class="layout-content-col span-6 layout-with-list-item-margins"> - <div class="example_label bad">Confusing</div> + <div class="do-dont-label bad">Confusing</div> - <table class="ui_table bad"> + <table class="ui-table bad"> <thead> <tr> <th> @@ -139,9 +87,9 @@ page.title=Writing Style </div> <div class="layout-content-col span-6"> - <div class="example_label good">Better</div> + <div class="do-dont-label good">Better</div> - <table class="ui_table good"> + <table class="ui-table good"> <thead> <tr> <th> @@ -167,12 +115,12 @@ page.title=Writing Style crashes:</ol> <div class="layout-content-row"> - <div class="layout-content-col span-6 list_item_margins"> + <div class="layout-content-col span-6 layout-with-list-item-margins"> - <div class="example_label bad">Confusing and annoying—"Sorry" just rubs salt in the + <div class="do-dont-label bad">Confusing and annoying—"Sorry" just rubs salt in the wound.</div> - <table class="ui_table bad"> + <table class="ui-table bad"> <thead> <tr> <th colspan="3"> @@ -200,9 +148,9 @@ crashes:</ol> </div> <div class="layout-content-col span-6"> - <div class="example_label good">Shorter, more direct, no faux-apologetic title:<br><br></div> + <div class="do-dont-label good">Shorter, more direct, no faux-apologetic title:<br><br></div> - <table class="ui_table good"> + <table class="ui-table good"> <thead> <tr> <th colspan="3"> @@ -234,20 +182,20 @@ crashes:</ol> <ol><li class="value-4"><strong>Put the most important thing first.</strong></ol> <div class="layout-content-row"> - <div class="layout-content-col span-6 list_item_margins"> + <div class="layout-content-col span-6 layout-with-list-item-margins"> - <div class="example_label bad">Top news last</div> + <div class="do-dont-label bad">Top news last</div> - <table class="ui_table bad"><tbody><tr><td> + <table class="ui-table bad"><tbody><tr><td> 77 other people +1'd this, including Larry Page. </td></tr></tbody></table> </div> <div class="layout-content-col span-6"> - <div class="example_label good">Top news first</div> + <div class="do-dont-label good">Top news first</div> - <table class="ui_table good"><tbody><tr><td> + <table class="ui-table good"><tbody><tr><td> Larry Page and 77 others +1'd this. </td></tr></tbody></table> @@ -255,20 +203,20 @@ crashes:</ol> </div> <div class="layout-content-row"> - <div class="layout-content-col span-6 list_item_margins"> + <div class="layout-content-col span-6 layout-with-list-item-margins"> - <div class="example_label bad">Task last</div> + <div class="do-dont-label bad">Task last</div> - <table class="ui_table bad"><tbody><tr><td> + <table class="ui-table bad"><tbody><tr><td> Touch Next to complete setup using a Wi-Fi connection. </td></tr></tbody></table> </div> <div class="layout-content-col span-6"> - <div class="example_label good">Task first</div> + <div class="do-dont-label good">Task first</div> - <table class="ui_table good"><tbody><tr><td> + <table class="ui-table good"><tbody><tr><td> To finish setup using Wi-Fi, touch Next. </td></tr></tbody></table> @@ -280,11 +228,11 @@ crashes:</ol> <ol><li class="value-5"><strong>Describe only what's necessary, and no more.</strong></ol> <div class="layout-content-row"> - <div class="layout-content-col span-6 list_item_margins"> + <div class="layout-content-col span-6 layout-with-list-item-margins"> - <div class="example_label bad">From a Setup Wizard screen</div> + <div class="do-dont-label bad">From a Setup Wizard screen</div> - <table class="ui_table bad"> + <table class="ui-table bad"> <thead> <tr> <th> @@ -306,9 +254,9 @@ crashes:</ol> </div> <div class="layout-content-col span-6"> - <div class="example_label good">From a Setup Wizard screen</div> + <div class="do-dont-label good">From a Setup Wizard screen</div> - <table class="ui_table good"> + <table class="ui-table good"> <thead> <tr> <th> diff --git a/docs/html/guide/developing/testing/testing_otheride.jd b/docs/html/guide/developing/testing/testing_otheride.jd index 93af979..7745ae7 100644 --- a/docs/html/guide/developing/testing/testing_otheride.jd +++ b/docs/html/guide/developing/testing/testing_otheride.jd @@ -209,7 +209,7 @@ $ android create test-project -m ../HelloAndroid -n HelloAndroidTest -p HelloAnd <p> To update a test project with the <code>android</code> tool, enter: </p> -<pre>android update-test-project -m <main_path> -p <test_path></pre> +<pre>android update test-project -m <main_path> -p <test_path></pre> <table> <tr> diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs index ba8dc5e..62d18ae 100644 --- a/docs/html/guide/guide_toc.cs +++ b/docs/html/guide/guide_toc.cs @@ -834,12 +834,6 @@ applications</span> <li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/widget_design.html"> <span class="en">App Widget Design</span> </a></li> - <li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/activity_task_design.html"> - <span class="en">Activity and Task Design</span> - </a></li> - <li><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/menu_design.html"> - <span class="en">Menu Design</span> - </a></li> </ul> </li> </ul> diff --git a/docs/html/guide/practices/ui_guidelines/activity_task_design.jd b/docs/html/guide/practices/ui_guidelines/activity_task_design.jd index f8ca3f8..8e4528e 100644 --- a/docs/html/guide/practices/ui_guidelines/activity_task_design.jd +++ b/docs/html/guide/practices/ui_guidelines/activity_task_design.jd @@ -3,6 +3,43 @@ parent.title=UI Guidelines parent.link=index.html @jd:body + + + +<div id="deprecatedSticker"> + <a href="#" + onclick="$('#naMessage').show();$('#deprecatedSticker').hide();return false"> + <strong>This doc is deprecated</strong></a> +</div> + + +<div id="naMessage" style="display:block"> +<div><p><strong>This document has been deprecated.</strong></p> + <p>For information about designing an activity structure and navigation, read the design guidelines +for <a href="{@docRoot}design/patterns/app-structure.html">App Structure</a> and +<a href="{@docRoot}design/patterns/navigation.html">Navigation</a>, or the developer guide +about <a +href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back Stack</a>.</p> + + <input style="margin-top:1em;padding:5px" type="button" + value="That's nice, but I still want to read this document" +onclick="$('#naMessage').hide();$('#deprecatedSticker').show()" /> +</div> +</div> + + + + + + + + + + + + + + <div id="qv-wrapper"> <div id="qv"> diff --git a/docs/html/guide/practices/ui_guidelines/index.jd b/docs/html/guide/practices/ui_guidelines/index.jd index 3255275..24fb855 100644 --- a/docs/html/guide/practices/ui_guidelines/index.jd +++ b/docs/html/guide/practices/ui_guidelines/index.jd @@ -39,26 +39,6 @@ at a glance, on a user's Home screen. These design guidelines describe how to design widgets that fit with others on the Home screen. They include links to graphics files and templates that will make your designer's life easier.</dd> </dl> - <dl> - <dt><a href="{@docRoot}guide/practices/ui_guidelines/activity_task_design.html">Activity and Task Design Guidelines</a> </dt> - <dd>Activities are the basic, independent building blocks of applications. - As you design your application's UI and feature set, you are free to - re-use activities from other applications as if they were yours, - to enrich and extend your application. These guidelines - describe how activities work, illustrates them with examples, and - describes important underlying principles and mechanisms, such as - multitasking, activity reuse, intents, the activity stack, and - tasks. It covers this all from a high-level design perspective. -</dd> - <dt><a href="{@docRoot}guide/practices/ui_guidelines/menu_design.html">Menu Design Guidelines</a> </dt> - <dd>Android applications make use of Option menus and Context menus - that enable users to perform operations and navigate to other parts - of your application or to other applications. These guidelines describe - the difference between Options anontext menus, how to arrange - menu items, when to put commands on-screen, and other details about - menu design. -</dd> -</dl> diff --git a/docs/html/guide/practices/ui_guidelines/menu_design.jd b/docs/html/guide/practices/ui_guidelines/menu_design.jd index 7576b6c..b4e2ea7 100644 --- a/docs/html/guide/practices/ui_guidelines/menu_design.jd +++ b/docs/html/guide/practices/ui_guidelines/menu_design.jd @@ -2,7 +2,38 @@ page.title=Menu Design Guidelines parent.title=UI Guidelines parent.link=index.html @jd:body + + + + +<div id="deprecatedSticker"> + <a href="#" + onclick="$('#naMessage').show();$('#deprecatedSticker').hide();return false"> + <strong>This doc is deprecated</strong></a> +</div> + + +<div id="naMessage" style="display:block"> +<div><p><strong>This document has been deprecated.</strong></p> + <p>For design guidelines about adding user actions and other options, read the design guidelines +for <a href="{@docRoot}design/patterns/actionbar.html">Action Bar</a> or the developer guide about +<a href="{@docRoot}guide/topics/ui/menus.html">Menus</a>.</p> + + <input style="margin-top:1em;padding:5px" type="button" + value="That's nice, but I still want to read this document" +onclick="$('#naMessage').hide();$('#deprecatedSticker').show()" /> +</div> +</div> + + + + + + + + + <div id="qv-wrapper"> <div id="qv"> diff --git a/docs/html/guide/topics/ui/accessibility/apps.jd b/docs/html/guide/topics/ui/accessibility/apps.jd index ff34be6..dc91638 100644 --- a/docs/html/guide/topics/ui/accessibility/apps.jd +++ b/docs/html/guide/topics/ui/accessibility/apps.jd @@ -111,7 +111,7 @@ English language interface:</p> <p>By including the description, speech-based accessibility services can announce "Add note" when a user moves focus to this button or hovers over it.</p> -<p class="note">Note: For {@link android.widget.EditText} fields, provide an +<p class="note"><strong>Note:</strong> For {@link android.widget.EditText} fields, provide an <a href="{@docRoot}reference/android/widget/TextView.html#attr_android:hint">android:hint</a> attribute to help users understand what content is expected.</p> @@ -119,8 +119,10 @@ attribute to help users understand what content is expected.</p> <p>Focus navigation allows users with disabilities to step through user interface controls using a directional controller. Directional controllers can be physical, such as a clickable trackball, -directional pad (D-Pad) or arrow keys, tab key navigation with an attached keyboard or a software -application that provides an on-screen directional control.</p> +directional pad (D-pad) or arrow keys, tab key navigation with an attached keyboard or a software +application, such as the +<a href="https://play.google.com/store/apps/details?id=com.googlecode.eyesfree.inputmethod.latin"> +Eyes-Free Keyboard</a>, that provides an on-screen directional control.</p> <p>A directional controller is a primary means of navigation for many users. Verify that all user interface (UI) controls in your application are accessible @@ -566,5 +568,7 @@ option is not available.</p> <p>As part of your accessibility testing, you can test navigation of your application using focus, even if your test devices does not have a directional controller. The <a href="{@docRoot}guide/developing/tools/emulator.html">Android Emulator</a> provides a -simulated directional controller that you can easily use to test navigation. You can also use the -arrow keys and Enter key on your keyboard with the Emulator to simulate use of a D-pad.</p> +simulated directional controller that you can easily use to test navigation. You can also use a +software-based directional controller, such as the one provided by the +<a href="https://play.google.com/store/apps/details?id=com.googlecode.eyesfree.inputmethod.latin"> +Eyes-Free Keyboard</a> to simulate use of a D-pad.</p> diff --git a/docs/html/guide/topics/ui/declaring-layout.jd b/docs/html/guide/topics/ui/declaring-layout.jd index 4dc915f..8af4a1c 100644 --- a/docs/html/guide/topics/ui/declaring-layout.jd +++ b/docs/html/guide/topics/ui/declaring-layout.jd @@ -194,7 +194,7 @@ contains property types that define the size and position for each child view, a appropriate for the view group. As you can see in figure 1, the parent view group defines layout parameters for each child view (including the child view group).</p> -<img src="{@docRoot}images/layoutparams.png" alt="" height="300" align="center"/> +<img src="{@docRoot}images/layoutparams.png" alt="" /> <p class="img-caption"><strong>Figure 1.</strong> Visualization of a view hierarchy with layout parameters associated with each view.</p> diff --git a/docs/html/guide/topics/ui/index.jd b/docs/html/guide/topics/ui/index.jd index 83c8150..45c9ac9 100644 --- a/docs/html/guide/topics/ui/index.jd +++ b/docs/html/guide/topics/ui/index.jd @@ -51,7 +51,7 @@ as shown in the diagram below. This hierarchy tree can be as simple or complex a can build it up using Android's set of predefined widgets and layouts, or with custom Views that you create yourself.</p> -<img src="{@docRoot}images/viewgroup.png" alt="" width="312" height="211" align="center"/> +<img src="{@docRoot}images/viewgroup.png" alt="" /> <p> In order to attach the view hierarchy tree to the screen for rendering, your Activity must call the diff --git a/docs/html/images/layoutparams.png b/docs/html/images/layoutparams.png Binary files differindex 7473dcc..d99625e 100644 --- a/docs/html/images/layoutparams.png +++ b/docs/html/images/layoutparams.png diff --git a/docs/html/images/training/cool-places.png b/docs/html/images/training/cool-places.png Binary files differnew file mode 100755 index 0000000..769b5b7 --- /dev/null +++ b/docs/html/images/training/cool-places.png diff --git a/docs/html/images/training/firstapp/adt-firstapp-setup.png b/docs/html/images/training/firstapp/adt-firstapp-setup.png Binary files differnew file mode 100644 index 0000000..c092562 --- /dev/null +++ b/docs/html/images/training/firstapp/adt-firstapp-setup.png diff --git a/docs/html/images/training/firstapp/edittext_gravity.png b/docs/html/images/training/firstapp/edittext_gravity.png Binary files differnew file mode 100644 index 0000000..f78e676 --- /dev/null +++ b/docs/html/images/training/firstapp/edittext_gravity.png diff --git a/docs/html/images/training/firstapp/edittext_wrap.png b/docs/html/images/training/firstapp/edittext_wrap.png Binary files differnew file mode 100644 index 0000000..156776d --- /dev/null +++ b/docs/html/images/training/firstapp/edittext_wrap.png diff --git a/docs/html/images/training/firstapp/firstapp.png b/docs/html/images/training/firstapp/firstapp.png Binary files differnew file mode 100644 index 0000000..d69cd20 --- /dev/null +++ b/docs/html/images/training/firstapp/firstapp.png diff --git a/docs/html/images/training/panoramio-grid.png b/docs/html/images/training/panoramio-grid.png Binary files differnew file mode 100755 index 0000000..45c0eb5 --- /dev/null +++ b/docs/html/images/training/panoramio-grid.png diff --git a/docs/html/images/viewgroup.png b/docs/html/images/viewgroup.png Binary files differindex a4c2518..2c86ddb 100644 --- a/docs/html/images/viewgroup.png +++ b/docs/html/images/viewgroup.png diff --git a/docs/html/resources/resources_toc.cs b/docs/html/resources/resources_toc.cs index e4ab16f..5297c23 100644 --- a/docs/html/resources/resources_toc.cs +++ b/docs/html/resources/resources_toc.cs @@ -278,6 +278,51 @@ class="new"> new!</span></span> </a> </li> </ul> + </li> + <li class="toggle-list"> + <div><a href="<?cs var:toroot ?>training/tv/index.html"> + <span class="en">Designing for TV<span class="new"> new!</span></span> + </a> + </div> + <ul> + <li><a href="<?cs var:toroot ?>training/tv/optimizing-layouts-tv.html"> + <span class="en">Optimizing Layouts for TV</span> + </a> + </li> + <li><a href="<?cs var:toroot ?>training/tv/optimizing-navigation-tv.html"> + <span class="en">Optimizing Navigation for TV</span> + </a> + </li> + <li><a href="<?cs var:toroot ?>training/tv/unsupported-features-tv.html"> + <span class="en">Handling Features Not Supported on TV</span> + </a> + </li> + </ul> + </li> + + <li class="toggle-list"> + <div><a href="<?cs var:toroot ?>training/displaying-bitmaps/index.html"> + <span class="en">Displaying Bitmaps Efficiently<span class="new"> new!</span></span> + </a> + </div> + <ul> + <li><a href="<?cs var:toroot ?>training/displaying-bitmaps/load-bitmap.html"> + <span class="en">Loading Large Bitmaps Efficiently</span> + </a> + </li> + <li><a href="<?cs var:toroot ?>training/displaying-bitmaps/process-bitmap.html"> + <span class="en">Processing Bitmaps Off the UI Thread</span> + </a> + </li> + <li><a href="<?cs var:toroot ?>training/displaying-bitmaps/cache-bitmap.html"> + <span class="en">Caching Bitmaps</span> + </a> + </li> + <li><a href="<?cs var:toroot ?>training/displaying-bitmaps/display-bitmap.html"> + <span class="en">Displaying Bitmaps in Your UI</span> + </a> + </li> + </ul> </li> <li class="toggle-list"> diff --git a/docs/html/shareables/training/BitmapFun.zip b/docs/html/shareables/training/BitmapFun.zip Binary files differnew file mode 100644 index 0000000..e7e71f9 --- /dev/null +++ b/docs/html/shareables/training/BitmapFun.zip diff --git a/docs/html/shareables/training/LocationAware.zip b/docs/html/shareables/training/LocationAware.zip Binary files differindex e1926fa..46970cd 100644 --- a/docs/html/shareables/training/LocationAware.zip +++ b/docs/html/shareables/training/LocationAware.zip diff --git a/docs/html/sitemap.txt b/docs/html/sitemap.txt index 958fe56..3f26dd0 100644 --- a/docs/html/sitemap.txt +++ b/docs/html/sitemap.txt @@ -160,8 +160,6 @@ http://developer.android.com/guide/practices/ui_guidelines/icon_design_tab.html http://developer.android.com/guide/practices/ui_guidelines/icon_design_dialog.html http://developer.android.com/guide/practices/ui_guidelines/icon_design_list.html http://developer.android.com/guide/practices/ui_guidelines/widget_design.html -http://developer.android.com/guide/practices/ui_guidelines/activity_task_design.html -http://developer.android.com/guide/practices/ui_guidelines/menu_design.html http://developer.android.com/guide/practices/design/performance.html http://developer.android.com/guide/practices/design/responsiveness.html http://developer.android.com/guide/practices/design/seamlessness.html diff --git a/docs/html/training/accessibility/index.jd b/docs/html/training/accessibility/index.jd index d5178a9..333f9f2 100644 --- a/docs/html/training/accessibility/index.jd +++ b/docs/html/training/accessibility/index.jd @@ -13,7 +13,6 @@ next.link=accessible-app.html <h2>Dependencies and prerequisites</h2> <ul> <li>Android 2.0 (API Level 5) or higher</li> -Playback</a></li> </ul> <h2>You should also read</h2> diff --git a/docs/html/training/basics/firstapp/building-ui.jd b/docs/html/training/basics/firstapp/building-ui.jd new file mode 100644 index 0000000..847163a --- /dev/null +++ b/docs/html/training/basics/firstapp/building-ui.jd @@ -0,0 +1,363 @@ +page.title=Building a Simple User Interface +parent.title=Building Your First App +parent.link=index.html + +trainingnavtop=true +previous.title=Running Your App +previous.link=running-app.html +next.title=Starting Another Activity +next.link=starting-activity.html + +@jd:body + + +<!-- This is the training bar --> +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> + +<ol> + <li><a href="#LinearLayout">Use a Linear Layout</a></li> + <li><a href="#TextInput">Add a Text Input Box</a></li> + <li><a href="#Strings">Add String Resources</a></li> + <li><a href="#Button">Add a Button</a></li> + <li><a href="#Weight">Make the Input Box Fill in the Screen Width</a></li> +</ol> + + +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}guide/topics/ui/declaring-layout.html">XML Layouts</a></li> +</ul> + + +</div> +</div> + + + +<p>The graphical user interface for an Android app is built using a hierarchy of {@link +android.view.View} and {@link android.view.ViewGroup} objects. {@link android.view.View} objects are +usually UI widgets such as a button or text field and {@link android.view.ViewGroup} objects are +invisible view containers that define how the child views are laid out, such as in a +grid or a vertical list.</p> + +<p>Android provides an XML vocabulary that corresponds to the subclasses of {@link +android.view.View} and {@link android.view.ViewGroup} so you can define your UI in XML with a +hierarchy of view elements.</p> + + +<div class="sidebox-wrapper"> +<div class="sidebox"> + <h2>Alternative Layouts</h2> + <p>Separating the UI layout into XML files is important for several reasons, +but it's especially important on Android because it allows you to define alternative layouts for +different screen sizes. For example, you can create two versions of a layout and tell +the system to use one on "small" screens and the other on "large" screens. For more information, +see the class about <a +href="{@docRoot}training/supporting-hardware/index.html">Supporting Various Hardware</a>.</p> +</div> +</div> + +<img src="{@docRoot}images/viewgroup.png" alt="" /> +<p class="img-caption"><strong>Figure 1.</strong> Illustration of how {@link +android.view.ViewGroup} objects form branches in the layout and contain {@link +android.view.View} objects.</p> + +<p>In this lesson, you'll create a layout in XML that includes a text input field and a +button. In the following lesson, you'll respond when the button is pressed by sending the +content of the text field to another activity.</p> + + + +<h2 id="LinearLayout">Use a Linear Layout</h2> + +<p>Open the <code>main.xml</code> file from the <code>res/layout/</code> +directory (every new Android project includes this file by default).</p> + +<p class="note"><strong>Note:</strong> In Eclipse, when you open a layout file, you’re first shown +the ADT Layout Editor. This is an editor that helps you build layouts using WYSIWYG tools. For this +lesson, you’re going to work directly with the XML, so click the <em>main.xml</em> tab at +the bottom of the screen to open the XML editor.</p> + +<p>By default, the <code>main.xml</code> file includes a layout with a {@link +android.widget.LinearLayout} root view group and a {@link android.widget.TextView} child view. +You’re going to re-use the {@link android.widget.LinearLayout} in this lesson, but change its +contents and layout orientation.</p> + +<p>First, delete the {@link android.widget.TextView} element and change the value +<a href="{@docRoot}reference/android/widget/LinearLayout.html#attr_android:orientation">{@code +android:orientation}</a> to be <code>"horizontal"</code>. The result looks like this:</p> + +<pre> +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="horizontal" > +</LinearLayout> +</pre> + +<p>{@link android.widget.LinearLayout} is a view group (a subclass of {@link +android.view.ViewGroup}) that lays out child views in either a vertical or horizontal orientation, +as specified by the <a +href="{@docRoot}reference/android/widget/LinearLayout.html#attr_android:orientation">{@code +android:orientation}</a> attribute. Each child of a {@link android.widget.LinearLayout} appears on +the screen in the order in which it appears in the XML.</p> + +<p>The other two attributes, <a +href="{@docRoot}reference/android/view/View.html#attr_android:layout_width">{@code +android:layout_width}</a> and <a +href="{@docRoot}reference/android/view/View.html#attr_android:layout_height">{@code +android:layout_height}</a>, are required for all views in order to specify their size.</p> + +<p>Because the {@link android.widget.LinearLayout} is the root view in the layout, it should fill +the entire screen area that's +available to the app by setting the width and height to +<code>"fill_parent"</code>.</p> + +<p class="note"><strong>Note:</strong> Beginning with Android 2.2 (API level 8), +<code>"fill_parent"</code> has been renamed <code>"match_parent"</code> to better reflect the +behavior. The reason is that if you set a view to <code>"fill_parent"</code> it does not expand to +fill the remaining space after sibling views are considered, but instead expands to +<em>match</em> the size of the parent view no matter what—it will overlap any sibling +views.</p> + +<p>For more information about layout properties, see the <a +href="{@docRoot}guide/topics/ui/declaring-layout.html">XML Layout</a> guide.</p> + + + +<h2 id="TextInput">Add a Text Input Box</h2> + +<p>To create a user-editable text box, add an {@link android.widget.EditText +<EditText>} element inside the {@link android.widget.LinearLayout <LinearLayout>}. The {@link +android.widget.EditText} class is a subclass of {@link android.view.View} that displays an editable +text box.</p> + +<p>Like every {@link android.view.View} object, you must define certain XML attributes to specify +the {@link android.widget.EditText} object's properties. Here’s how you should declare it +inside the {@link android.widget.LinearLayout <LinearLayout>} element:</p> + +<pre> + <EditText android:id="@+id/edit_message" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:hint="@string/edit_message" /> +</pre> + + +<div class="sidebox-wrapper"> +<div class="sidebox"> + <h3>About resource objects</h3> + <p>A resource object is simply a unique integer name that's associated with an app resource, +such as a bitmap, layout file, or string.</p> + <p>Every resource has a +corresponding resource object defined in your project's {@code gen/R.java} file. You can use the +object names in the {@code R} class to refer to your resources, such as when you need to specify a +string value for the <a +href="{@docRoot}reference/android/widget/TextView.html#attr_android:hint">{@code android:hint}</a> +attribute. You can also create arbitrary resource IDs that you associate with a view using the <a +href="{@docRoot}reference/android/view/View.html#attr_android:id">{@code android:id}</a> attribute, +which allows you to reference that view from other code.</p> + <p>The SDK tools generate the {@code R.java} each time you compile your app. You should never +modify this file by hand.</p> +</div> +</div> + +<p>About these attributes:</p> + +<dl> +<dt><a href="{@docRoot}reference/android/view/View.html#attr_android:id">{@code android:id}</a></dt> +<dd>This provides a unique identifier for the view, which you can use to reference the object +from your app code, such as to read and manipulate the object (you'll see this in the next +lesson). + +<p>The at-symbol (<code>@</code>) is required when you want to refer to a resource object from +XML, followed by the resource type ({@code id} in this case), then the resource name ({@code +edit_message}). (Other resources can use the same name as long as they are not the same +resource type—for example, the string resource uses the same name.)</p> + +<p>The plus-symbol (<code>+</code>) is needed only when you're defining a resource ID for the +first time. It tells the SDK tools that the resource ID needs to be created. Thus, when the app is +compiled, the SDK tools use the ID value, <code>edit_message</code>, to create a new identifier in +your project's {@code gen/R.java} file that is now assiciated with the {@link +android.widget.EditText} element. Once the resource ID is created, other references to the ID do not +need the plus symbol. See the sidebox for more information about resource objects.</p></dd> + +<dt><a +href="{@docRoot}reference/android/view/View.html#attr_android:layout_width">{@code +android:layout_width}</a> and <a +href="{@docRoot}reference/android/view/View.html#attr_android:layout_height">{@code +android:layout_height}</a></dt> +<dd>Instead of using specific sizes for the width and height, the <code>"wrap_content"</code> value +specifies that the view should be only as big as needed to fit the contents of the view. If you +were to instead use <code>"fill_parent"</code>, then the {@link android.widget.EditText} +element would fill the screen, because it'd match the size of the parent {@link +android.widget.LinearLayout}. For more information, see the <a +href="{@docRoot}guide/topics/ui/declaring-layout.html">XML Layouts</a> guide.</dd> + +<dt><a +href="{@docRoot}reference/android/widget/TextView.html#attr_android:hint">{@code +android:hint}</a></dt> +<dd>This is a default string to display when the text box is empty. Instead of using a hard-coded +string as the value, the value given in this example refers to a string resource. When you add the +{@code +"@string/edit_message"} value, you’ll see a compiler error because there’s no matching string +resource by that name. You'll fix this in the next section by defining the string +resource.</dd> +</dl> + + + +<h2 id="Strings">Add String Resources</h2> + +<p>When you need to add text in the user interface, you should always specify each string of text in +a resource file. String resources allow you to maintain a single location for all string +values, which makes it easier to find and update text. Externalizing the strings also allows you to +localize your app to different languages by providing alternative definitions for each +string.</p> + +<p>By default, your Android project includes a string resource file at +<code>res/values/strings.xml</code>. Open this file, delete the existing <code>"hello"</code> +string, and add one for the +<code>"edit_message"</code> string used by the {@link android.widget.EditText <EditText>} +element.</p> + +<p>While you’re in this file, also add a string for the button you’ll soon add, called +<code>"button_send"</code>.</p> + +<p>The result for <code>strings.xml</code> looks like this:</p> + +<pre> +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">My First App</string> + <string name="edit_message">Enter a message</string> + <string name="button_send">Send</string> +</resources> +</pre> + +<p>For more information about using string resources to localize your app for several languages, +see the <a +href="{@docRoot}training/basics/supporting-devices/index.html">Supporting Various Devices</a> +class.</p> + + + + +<h2 id="Button">Add a Button</h2> + +<p>Now add a {@link android.widget.Button <Button>} to the layout, immediately following the +{@link android.widget.EditText <EditText>} element:</p> + +<pre> + <Button + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button_send" /> +</pre> + +<p>The height and width are set to <code>"wrap_content"</code> so the button is only as big as +necessary to fit the button's text.</p> + + + +<h2 id="Weight">Make the Input Box Fill in the Screen Width</h2> + +<p>The layout is currently designed so that both the {@link android.widget.EditText} and {@link +android.widget.Button} widgets are only as big as necessary to fit their content, as shown in +figure 2.</p> + +<img src="{@docRoot}images/training/firstapp/edittext_wrap.png" /> +<p class="img-caption"><strong>Figure 2.</strong> The {@link android.widget.EditText} and {@link +android.widget.Button} widgets have their widths set to +<code>"wrap_content"</code>.</p> + +<p>This works fine for the button, but not as well for the text box, because the user might type +something longer and there's extra space left on the screen. So, it'd be nice to fill that width +using the text box. +{@link android.widget.LinearLayout} enables such a design with the <em>weight</em> property, which +you can specify using the <a +href="{@docRoot}reference/android/widget/LinearLayout.LayoutParams.html#weight">{@code +android:layout_weight}</a> attribute.</p> + +<p>The weight value allows you to specify the amount of remaining space each view should consume, +relative to the amount consumed by sibling views, just like the ingredients in a drink recipe: "2 +parts vodka, 1 part coffee liquer" means two-thirds of the drink is vodka. For example, if you give +one view a weight of 2 and another one a weight of 1, the sum is 3, so the first view gets 2/3 of +the remaining space and the second view gets the rest. If you give a third view a weight of 1, +then the first view now gets 1/2 the remaining space, while the remaining two each get 1/4.</p> + +<p>The default weight for all views is 0, so if you specify any weight value +greater than 0 to only one view, then that view fills whatever space remains after each view is +given the space it requires. So, to fill the remaining space with the {@link +android.widget.EditText} element, give it a weight of 1 and leave the button with no weight.</p> + +<pre> + <EditText + android:layout_weight="1" + ... /> +</pre> + +<p>In order to improve the layout efficiency when you specify the weight, you should change the +width of the {@link android.widget.EditText} to be +zero (0dp). Setting the width to zero improves layout performance because using +<code>"wrap_content"</code> as the width requires the system to calculate a width that is +ultimately irrelevant because the weight value requires another width calculation to fill the +remaining space.</p> +<pre> + <EditText + android:layout_weight="1" + android:layout_width="0dp" + ... /> +</pre> + +<p>Figure 3 +shows the result when you assign all weight to the {@link android.widget.EditText} element.</p> + +<img src="{@docRoot}images/training/firstapp/edittext_gravity.png" /> +<p class="img-caption"><strong>Figure 3.</strong> The {@link android.widget.EditText} widget is +given all the layout weight, so fills the remaining space in the {@link +android.widget.LinearLayout}.</p> + +<p>Here’s how your complete layout file should now look:</p> + +<pre> +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="horizontal"> + <EditText android:id="@+id/edit_message" + android:layout_weight="1" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:hint="@string/edit_message" /> + <Button android:id="@+id/button_send" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button_send" /> +</LinearLayout> +</pre> + +<p>This layout is applied by the default {@link android.app.Activity} class +that the SDK tools generated when you created the project, so you can now run the app to see the +results:</p> + +<ul> + <li>In Eclipse, click <strong>Run</strong> from the toolbar.</li> + <li>Or from a command line, change directories to the root of your Android project and +execute: +<pre> +ant debug +adb install bin/MyFirstApp-debug.apk +</pre></li> +</ul> + +<p>Continue to the next lesson to learn how you can respond to button presses, read content +from the text field, start another activity, and more.</p> + + + diff --git a/docs/html/training/basics/firstapp/creating-project.jd b/docs/html/training/basics/firstapp/creating-project.jd new file mode 100644 index 0000000..5a89f2e --- /dev/null +++ b/docs/html/training/basics/firstapp/creating-project.jd @@ -0,0 +1,142 @@ +page.title=Creating an Android Project +parent.title=Building Your First App +parent.link=index.html + +trainingnavtop=true +next.title=Running Your App +next.link=running-app.html + +@jd:body + + +<!-- This is the training bar --> +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> + +<ol> + <li><a href="#Eclipse">Create a Project with Eclipse</a></li> + <li><a href="#CommandLine">Create a Project with Command Line Tools</a></li> +</ol> + +<h2>You should also read</h2> + +<ul> + <li><a href="{@docRoot}sdk/installing.html">Installing the +SDK</a></li> + <li><a href="{@docRoot}guide/developing/projects/index.html">Managing Projects</a></li> +</ul> + + +</div> +</div> + +<p>An Android project contains all the files that comprise the source code for your Android +app. The Android SDK tools make it easy to start a new Android project with a set of +default project directories and files.</p> + +<p>This lesson +shows how to create a new project either using Eclipse (with the ADT plugin) or using the +SDK tools from a command line.</p> + +<p class="note"><strong>Note:</strong> You should already have the Android SDK installed, and if +you're using Eclipse, you should have installed the <a +href="{@docRoot}sdk/eclipse-adt.html">ADT plugin</a> as well. If you have not installed +these, see <a href="{@docRoot}sdk/installing.html">Installing the Android SDK</a> and return here +when you've completed the installation.</p> + + +<h2 id="Eclipse">Create a Project with Eclipse</h2> + +<div class="figure" style="width:416px"> +<img src="{@docRoot}images/training/firstapp/adt-firstapp-setup.png" alt="" /> +<p class="img-caption"><strong>Figure 1.</strong> The new project wizard in Eclipse.</p> +</div> + +<ol> + <li>In Eclipse, select <strong>File > New > Project</strong>. +The resulting dialog should have a folder labeled <em>Android</em>. (If you don’t see the +<em>Android</em> folder, +then you have not installed the ADT plugin—see <a +href="{@docRoot}sdk/eclipse-adt.html#installing">Installing the ADT Plugin</a>).</li> + <li>Open the <em>Android</em> folder, select <em>Android Project</em> and click +<strong>Next</strong>.</li> + <li>Enter a project name (such as "MyFirstApp") and click <strong>Next</strong>.</li> + <li>Select a build target. This is the platform version against which you will compile your app. +<p>We recommend that you select the latest version possible. You can still build your app to +support older versions, but setting the build target to the latest version allows you to +easily optimize your app for a great user experience on the latest Android-powered devices.</p> +<p>If you don't see any built targets listed, you need to install some using the Android SDK +Manager tool. See <a href="{@docRoot}sdk/installing.html#AddingComponents">step 4 in the +installing guide</a>.</p> +<p>Click <strong>Next</strong>.</p></li> + <li>Specify other app details, such as the: + <ul> + <li><em>Application Name</em>: The app name that appears to the user. Enter "My First +App".</li> + <li><em>Package Name</em>: The package namespace for your app (following the same +rules as packages in the Java programming language). Your package name +must be unique across all packages installed on the Android system. For this reason, it's important +that you use a standard domain-style package name that’s appropriate to your company or +publisher entity. For +your first app, you can use something like "com.example.myapp." However, you cannot publish your +app using the "com.example" namespace.</li> + <li><em>Create Activity</em>: This is the class name for the primary user activity in your +app (an activity represents a single screen in your app). Enter "MyFirstActivity".</li> + <li><em>Minimum SDK</em>: Select <em>4 (Android 1.6)</em>. + <p>Because this version is lower than the build target selected for the app, a warning +appears, but that's alright. You simply need to be sure that you don't use any APIs that require an +<a href="{@docRoot}guide/appendix/api-levels.html">API level</a> greater than the minimum SDK +version without first using some code to verify the device's system version (you'll see this in some +other classes).</p> + </li> + </ul> + <p>Click <strong>Finish</strong>.</p> + </li> +</ol> + +<p>Your Android project is now set up with some default files and you’re ready to begin +building the app. Continue to the <a href="running-app.html">next lesson</a>.</p> + + + +<h2 id="CommandLine">Create a Project with Command Line Tools</h2> + +<p>If you're not using the Eclipse IDE with the ADT plugin, you can instead create your project +using the SDK tools in a command line:</p> + +<ol> + <li>Change directories into the Android SDK’s <code>tools/</code> path.</li> + <li>Execute: +<pre class="no-pretty-print">android list targets</pre> +<p>This prints a list of the available Android platforms that you’ve downloaded for your SDK. Find +the platform against which you want to compile your app. Make a note of the target id. We +recommend that you select the highest version possible. You can still build your app to +support older versions, but setting the build target to the latest version allows you to optimize +your app for the latest devices.</p> +<p>If you don't see any targets listed, you need to +install some using the Android SDK +Manager tool. See <a href="{@docRoot}sdk/installing.html#AddingComponents">step 4 in the +installing guide</a>.</p></li> + <li>Execute: +<pre class="no-pretty-print"> +android create project --target <target-id> --name MyFirstApp \ +--path <path-to-workspace>/MyFirstApp --activity MyFirstActivity \ +--package com.example.myapp +</pre> +<p>Replace <code><target-id></code> with an id from the list of targets (from the previous step) +and replace +<code><path-to-workspace></code> with the location in which you want to save your Android +projects.</p></li> +</ol> + +<p>Your Android project is now set up with several default configurations and you’re ready to begin +building the app. Continue to the <a href="running-app.html">next lesson</a>.</p> + +<p class="note"><strong>Tip:</strong> Add the <code>platform-tools/</code> as well as the +<code>tools/</code> directory to your <code>PATH</code> environment variable.</p> + + + + diff --git a/docs/html/training/basics/firstapp/index.jd b/docs/html/training/basics/firstapp/index.jd new file mode 100644 index 0000000..a95ed8e --- /dev/null +++ b/docs/html/training/basics/firstapp/index.jd @@ -0,0 +1,64 @@ +page.title=Building Your First App + +trainingnavtop=true +startpage=true +next.title=Creating an Android Project +next.link=creating-project.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>Dependencies and prerequisites</h2> + +<ul> + <li>Android 1.6 or higher</li> + <li><a href="http://developer.android.com/sdk/index.html">Android SDK</a></li> +</ul> + +</div> +</div> + +<p>Welcome to Android application development!</p> + +<p>This class teaches you how to build your first Android app. You’ll learn how to create an Android +project and run a debuggable version of the app. You'll also learn some fundamentals of Android app +design, including how to build a simple user interface and handle user input.</p> + +<p>Before you start this class, be sure that you have your development environment set up. You need +to:</p> +<ol> + <li>Download the Android SDK Starter Package.</li> + <li>Install the ADT plugin for Eclipse (if you’ll use the Eclipse IDE).</li> + <li>Download the latest SDK tools and platforms using the SDK Manager.</li> +</ol> + +<p>If you haven't already done this setup, read <a href="{@docRoot}sdk/installing.html">Installing +the SDK</a>. Once you've finished the setup, you're ready to begin this class.</p> + +<p>This class uses a tutorial format that incrementally builds a small Android app in order to teach +you some fundamental concepts about Android development, so it's important that you follow each +step.</p> + +<p><strong><a href="creating-project.html">Start the first lesson ›</a></strong></p> + + +<h2>Lessons</h2> + +<dl> + <dt><b><a href="creating-project.html">Creating an Android Project</a></b></dt> + <dd>Shows how to create a project for an Android app, which includes a set of default +app files.</dd> + + <dt><b><a href="running-app.html">Running Your Application</a></b></dt> + <dd>Shows how to run your app on an Android-powered device or the Android +emulator.</dd> + + <dt><b><a href="building-ui.html">Building a Simple User Interface</a></b></dt> + <dd>Shows how to create a new user interface using an XML file.</dd> + + <dt><b><a href="starting-activity.html">Starting Another Activity</a></b></dt> + <dd>Shows how to respond to a button press, start another activity, send it some +data, then receive the data in the subsequent activity.</dd> +</dl> diff --git a/docs/html/training/basics/firstapp/running-app.jd b/docs/html/training/basics/firstapp/running-app.jd new file mode 100644 index 0000000..2398fa0 --- /dev/null +++ b/docs/html/training/basics/firstapp/running-app.jd @@ -0,0 +1,178 @@ +page.title=Running Your App +parent.title=Building Your First App +parent.link=index.html + +trainingnavtop=true +previous.title=Creating a Project +previous.link=creating-project.html +next.title=Building a Simple User Interface +next.link=building-ui.html + +@jd:body + + +<!-- This is the training bar --> +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> + +<ol> + <li><a href="#RealDevice">Run on a Real Device</a></li> + <li><a href="#Emulator">Run on the Emulator</a></li> +</ol> + +<h2>You should also read</h2> + +<ul> + <li><a href="{@docRoot}guide/developing/device.html">Using Hardware Devices</a></li> + <li><a href="{@docRoot}guide/developing/devices/index.html">Managing Virtual Devices</a></li> + <li><a href="{@docRoot}guide/developing/projects/index.html">Managing Projects</a></li> +</ul> + + +</div> +</div> + + +<p>If you followed the <a href="{@docRoot}creating-project.html">previous lesson</a> to create an +Android project, it includes a default set of "Hello World" source files that allow you to +run the app right away.</p> + +<p>How you run your app depends on two things: whether you have a real Android-powered device and +whether you’re using Eclipse. This lesson shows you how to install and run your app on a +real device and on the Android emulator, and in both cases with either Eclipse or the command line +tools.</p> + +<p>Before you run your app, you should be aware of a few directories and files in the Android +project:</p> + +<dl> + <dt><code>AndroidManifest.xml</code></dt> + <dd>This manifest file describes the fundamental characteristics of the app and defines each of +its components. You'll learn about various declarations in this file as you read more training +classes.</dd> + <dt><code>src/</code></dt> + <dd>Directory for your app's main source files. By default, it includes an {@link +android.app.Activity} class that runs when your app is launched using the app icon.</dd> + <dt><code>res/</code></dt> + <dd>Contains several sub-directories for app resources. Here are just a few: + <dl style="margin-top:1em"> + <dt><code>drawable-hdpi/</code></dt> + <dd>Directory for drawable objects (such as bitmaps) that are designed for high-density +(hdpi) screens. Other drawable directories contain assets designed for other screen densities.</dd> + <dt><code>layout/</code></dt> + <dd>Directory for files that define your app's user interface.</dd> + <dt><code>values/</code></dt> + <dd>Directory for other various XML files that contain a collection of resources, such as +string and color definitions.</dd> + </dl> + </dd> +</dl> + +<p>When you build and run the default Android project, the default {@link android.app.Activity} +class in the <code>src/</code> directory starts and loads a layout file from the +<code>layout/</code> directory, which includes a "Hello World" message. Not real exciting, but it's +important that you understand how to build and run your app before adding real functionality to +the app.</p> + + + +<h2 id="RealDevice">Run on a Real Device</h2> + +<p>Whether you’re using Eclipse or the command line, you need to:</p> + +<ol> + <li>Plug in your Android-powered device to your machine with a USB cable. +If you’re developing on Windows, you might need to install the appropriate USB driver for your +device. For help installing drivers, see the <a href=”{@docRoot}sdk/oem-usb.html”>OEM USB +Drivers</a> document.</li> + <li>Ensure that <strong>USB debugging</strong> is enabled in the device Settings (open Settings +and navitage to <strong>Applications > Development</strong> on most devices, or select +<strong>Developer options</strong> on Android 4.0 and higher).</li> +</ol> + +<p>To run the app from Eclipse, open one of your project's files and click +<strong>Run</strong> from the toolbar. Eclipse installs the app on your connected device and starts +it.</p> + + +<p>Or to run your app from a command line:</p> + +<ol> + <li>Change directories to the root of your Android project and execute: +<pre class="no-pretty-print">ant debug</pre></li> + <li>Make sure the Android SDK <code>platform-tools/</code> directory is included in your +<code>PATH</code> environment variable, then execute: +<pre class="no-pretty-print">adb install bin/MyFirstApp-debug.apk</pre></li> + <li>On your device, locate <em>MyFirstActivity</em> and open it.</li> +</ol> + +<p>To start adding stuff to the app, continue to the <a href="building-ui.html">next +lesson</a>.</p> + + + +<h2 id="Emulator">Run on the Emulator</h2> + +<p>Whether you’re using Eclipse or the command line, you need to first create an <a +href="{@docRoot}guide/developing/devices/index.html">Android Virtual +Device</a> (AVD). An AVD is a +device configuration for the Android emulator that allows you to model +different device configurations.</p> + +<div class="figure" style="width:457px"> + <img src="{@docRoot}images/screens_support/avds-config.png" alt="" /> + <p class="img-caption"><strong>Figure 1.</strong> The AVD Manager showing a few virtual +devices.</p> +</div> + +<p>To create an AVD:</p> +<ol> + <li>Launch the Android Virtual Device Manager: + <ol type="a"> + <li>In Eclipse, select <strong>Window > AVD Manager</strong>, or click the <em>AVD +Manager</em> icon in the Eclipse toolbar.</li> + <li>From the command line, change directories to <code><sdk>/tools/</code> and execute: +<pre class="no-pretty-print">./android avd</pre></li> + </ol> + </li> + <li>In the <em>Android Virtual Device Device Manager</em> panel, click <strong>New</strong>.</li> + <li>Fill in the details for the AVD. +Give it a name, a platform target, an SD card size, and a skin (HVGA is default).</li> + <li>Click <strong>Create AVD</strong>.</li> + <li>Select the new AVD from the <em>Android Virtual Device Manager</em> and click +<strong>Start</strong>.</li> + <li>After the emulator boots up, unlock the emulator screen.</li> +</ol> + +<p>To run the app from Eclipse, open one of your project's files and click +<strong>Run</strong> from the toolbar. Eclipse installs the app on your AVD and starts it.</p> + + +<p>Or to run your app from the command line:</p> + +<ol> + <li>Change directories to the root of your Android project and execute: +<pre class="no-pretty-print">ant debug</pre></li> + <li>Make sure the Android SDK <code>platform-tools/</code> directory is included in your +<code>PATH</code> environment +variable, then execute: +<pre class="no-pretty-print">adb install bin/MyFirstApp-debug.apk</pre></li> + <li>On the emulator, locate <em>MyFirstActivity</em> and open it.</li> +</ol> + + +<p>To start adding stuff to the app, continue to the <a href="building-ui.html">next +lesson</a>.</p> + + + + + + + + + + + diff --git a/docs/html/training/basics/firstapp/starting-activity.jd b/docs/html/training/basics/firstapp/starting-activity.jd new file mode 100644 index 0000000..16a6fd8 --- /dev/null +++ b/docs/html/training/basics/firstapp/starting-activity.jd @@ -0,0 +1,308 @@ +page.title=Starting Another Activity +parent.title=Building Your First App +parent.link=index.html + +trainingnavtop=true +previous.title=Building a Simpler User Interface +previous.link=building-ui.html + +@jd:body + + +<!-- This is the training bar --> +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> + +<ol> + <li><a href="#RespondToButton">Respond to the Send Button</a></li> + <li><a href="#BuildIntent">Build an Intent</a></li> + <li><a href="#StartActivity">Start the Second Activity</a></li> + <li><a href="#CreateActivity">Create the Second Activity</a> + <ol> + <li><a href="#AddToManifest">Add it to the manifest</a></li> + </ol> + </li> + <li><a href="#ReceiveIntent">Receive the Intent</a></li> + <li><a href="#DisplayMessage">Display the Message</a></li> +</ol> + +<h2>You should also read</h2> + +<ul> + <li><a href="{@docRoot}sdk/installing.html">Installing the +SDK</a></li> +</ul> + + +</div> +</div> + + + +<p>After completing the <a href="building-ui.html">previous lesson</a>, you have an app that +shows an activity (a single screen) with a text box and a button. In this lesson, you’ll add some +code to <code>MyFirstActivity</code> that +starts a new activity when the user selects the Send button.</p> + + +<h2 id="RespondToButton">Respond to the Send Button</h2> + +<p>To respond to the button's on-click event, open the <code>main.xml</code> layout file and add the +<a +href="{@docRoot}reference/android/view/View.html#attr_android:onClick">{@code android:onClick}</a> +attribute to the {@link android.widget.Button <Button>} element:</p> + +<pre> +<Button android:id="@+id/button_send" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button_send" + android:onClick="sendMessage" /> +</pre> + +<p>The <a +href="{@docRoot}reference/android/view/View.html#attr_android:onClick">{@code +android:onClick}</a> attribute’s value, <code>sendMessage</code>, is the name of a method in your +activity that you want to call when the user selects the button.</p> + +<p>Add the corresponding method inside the <code>MyFirstActivity</code> class:</p> + +<pre> +/** Called when the user selects the Send button */ +public void sendMessage(View view) { + // Do something in response to button +} +</pre> + +<p class="note"><strong>Tip:</strong> In Eclipse, press Ctrl + Shift + O to import missing classes +(Cmd + Shift + O on Mac).</p> + +<p>Note that, in order for the system to match this method to the method name given to <a +href="{@docRoot}reference/android/view/View.html#attr_android:onClick">{@code android:onClick}</a>, +the signature must be exactly as shown. Specifically, the method must:</p> + +<ul> +<li>Be public</li> +<li>Have a void return value</li> +<li>Have a {@link android.view.View} as the only parameter (this will be the {@link +android.view.View} that was clicked)</li> +</ul> + +<p>Next, you’ll fill in this method to read the contents of the text box and deliver that text to +another activity.</p> + + + +<h2 id="BuildIntent">Build an Intent</h2> + +<p>An {@link android.content.Intent} is an object that provides runtime binding between separate +components (such as two activities). The {@link android.content.Intent} represents an +app’s "intent to do something." You can use an {@link android.content.Intent} for a wide +variety of tasks, but most often they’re used to start another activity.</p> + +<p>Inside the {@code sendMessage()} method, create an {@link android.content.Intent} to start +an activity called {@code DisplayMessageActvity}:</p> + +<pre> +Intent intent = new Intent(this, DisplayMessageActivity.class); +</pre> + +<p>The constructor used here takes two parameters:</p> +<ul> + <li>A {@link +android.content.Context} as its first parameter ({@code this} is used because the {@link +android.app.Activity} class is a subclass of {@link android.content.Context}) + <li>The {@link java.lang.Class} of the app component to which the system should deliver +the {@link android.content.Intent} (in this case, the activity that should be started) +</ul> + +<div class="sidebox-wrapper"> +<div class="sidebox"> + <h3>Sending an intent to other apps</h3> + <p>The intent created in this lesson is what's considered an <em>explicit intent</em>, because the +{@link android.content.Intent} +specifies the exact app component to which the intent should be given. However, intents +can also be <em>implicit</em>, in which case the {@link android.content.Intent} does not specify +the desired component, but allows any app installed on the device to respond to the intent +as long as it satisfies the meta-data specifications for the action that's specified in various +{@link android.content.Intent} parameters. For more informations, see the class about <a +href="{@docRoot}training/intents/index.html">Interacting with Other Apps</a>.</p> +</div> +</div> + +<p class="note"><strong>Note:</strong> The reference to {@code DisplayMessageActivity} +will raise an error if you’re using an IDE such as Eclipse because the class doesn’t exist yet. +Ignore the error for now; you’ll create the class soon.</p> + +<p>An intent not only allows you to start another activity, but can carry a bundle of data to the +activity as well. So, use {@link android.app.Activity#findViewById findViewById()} to get the +{@link android.widget.EditText} element and add its message to the intent:</p> + +<pre> +Intent intent = new Intent(this, DisplayMessageActivity.class); +EditText editText = (EditText) findViewById(R.id.edit_message); +String message = editText.getText().toString(); +intent.putExtra(EXTRA_MESSAGE, message); +</pre> + +<p>An {@link android.content.Intent} can carry a collection of various data types as key-value +pairs called <em>extras</em>. The {@link android.content.Intent#putExtra putExtra()} method takes a +string as the key and the value in the second parameter.</p> + +<p>In order for the next activity to query the extra data, you should define your keys using a +public constant. So add the {@code EXTRA_MESSAGE} definition to the top of the {@code +MyFirstActivity} class:</p> + +<pre> +public class MyFirstActivity extends Activity { + public final static String EXTRA_MESSAGE = "com.example.myapp.MESSAGE"; + ... +} +</pre> + +<p>It's generally a good practice to define keys for extras with your app's package name as a prefix +to ensure it's unique, in case your app interacts with other apps.</p> + + +<h2 id="StartActivity">Start the Second Activity</h2> + +<p>To start an activity, you simply need to call {@link android.app.Activity#startActivity +startActivity()} and pass it your {@link android.content.Intent}.</p> + +<p>The system receives this call and starts an instance of the {@link android.app.Activity} +specified by the {@link android.content.Intent}.</p> + +<p>With this method included, the complete {@code sendMessage()} method that's invoked by the Send +button now looks like this:</p> + +<pre> +/** Called when the user selects the Send button */ +public void sendMessage(View view) { + Intent intent = new Intent(this, DisplayMessageActivity.class); + EditText editText = (EditText) findViewById(R.id.edit_message); + String message = editText.getText().toString(); + intent.putExtra(EXTRA_MESSAGE, message); + startActivity(intent); +} +</pre> + +<p>Now you need to create the {@code DisplayMessageActivity} class in order for this to +work.</p> + + + +<h2 id="CreateActivity">Create the Second Activity</h2> + +<p>In your project, create a new class file under the <code>src/<package-name>/</code> +directory called <code>DisplayMessageActivity.java</code>.</p> + +<p class="note"><strong>Tip:</strong> In Eclipse, right-click the package name under the +<code>src/</code> directory and select <strong>New > Class</strong>. +Enter "DisplayMessageActivity" for the name and {@code android.app.Activity} for the superclass.</p> + +<p>Inside the class, add the {@link android.app.Activity#onCreate onCreate()} callback method:</p> + +<pre> +public class DisplayMessageActivity extends Activity { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } +} +</pre> + +<p>All subclasses of {@link android.app.Activity} must implement the {@link +android.app.Activity#onCreate onCreate()} method. The system calls this when creating a new +instance of the activity. It is where you must define the activity layout and where you should +initialize essential activity components.</p> + + + +<h3 id="AddToManifest">Add it to the manifest</h3> + +<p>You must declare all activities in your manifest file, <code>AndroidManifest.xml</code>, using an +<a +href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> element.</p> + +<p>Because {@code DisplayMessageActivity} is invoked using an explicit intent, it does not require +any intent filters (such as those you can see in the manifest for <code>MyFirstActivity</code>). So +the declaration for <code>DisplayMessageActivity</code> can be simply one line of code inside the <a +href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a> +element:</p> + +<pre> +<application ... > + <activity android:name="com.example.myapp.DisplayMessageActivity" /> + ... +</application> +</pre> + +<p>The app is now runnable because the {@link android.content.Intent} in the +first activity now resolves to the {@code DisplayMessageActivity} class. If you run the app now, +pressing the Send button starts the +second activity, but it doesn't show anything yet.</p> + + +<h2 id="ReceiveIntent">Receive the Intent</h2> + +<p>Every {@link android.app.Activity} is invoked by an {@link android.content.Intent}, regardless of +how the user navigated there. You can get the {@link android.content.Intent} that started your +activity by calling {@link android.app.Activity#getIntent()} and the retrieve data contained +within it.</p> + +<p>In the {@code DisplayMessageActivity} class’s {@link android.app.Activity#onCreate onCreate()} +method, get the intent and extract the message delivered by {@code MyFirstActivity}:</p> + +<pre> +Intent intent = getIntent(); +String message = intent.getStringExtra(MyFirstActivity.EXTRA_MESSAGE); +</pre> + + + +<h2 id="DisplayMessage">Display the Message</h2> + +<p>To show the message on the screen, create a {@link android.widget.TextView} widget and set the +text using {@link android.widget.TextView#setText setText()}. Then add the {@link +android.widget.TextView} as the root view of the activity’s layout by passing it to {@link +android.app.Activity#setContentView setContentView()}.</p> + +<p>The complete {@link android.app.Activity#onCreate onCreate()} method for {@code +DisplayMessageActivity} now looks like this:</p> + +<pre> +@Override +public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Get the message from the intent + Intent intent = getIntent(); + String message = intent.getStringExtra(MyFirstActivity.EXTRA_MESSAGE); + + // Create the text view + TextView textView = new TextView(this); + textView.setTextSize(40); + textView.setText(message); + + setContentView(textView); +} +</pre> + +<p>You can now run the app, type a message in the text box, press Send, and view the message on the +second activity.</p> + +<img src="{@docRoot}images/training/firstapp/firstapp.png" /> +<p class="img-caption"><strong>Figure 1.</strong> Both activities in the final app, running +on Android 4.0. + +<p>That's it, you've built your first Android app!</p> + +<p>To learn more about building Android apps, continue to follow the +basic training classes. The next class is <a +href="{@docRoot}training/activity-lifecycle/index.html">Managing the Activity Lifecycle</a>.</p> + + + + diff --git a/docs/html/training/displaying-bitmaps/cache-bitmap.jd b/docs/html/training/displaying-bitmaps/cache-bitmap.jd new file mode 100644 index 0000000..94abe21 --- /dev/null +++ b/docs/html/training/displaying-bitmaps/cache-bitmap.jd @@ -0,0 +1,337 @@ +page.title=Caching Bitmaps +parent.title=Displaying Bitmaps Efficiently +parent.link=index.html + +trainingnavtop=true +next.title=Displaying Bitmaps in Your UI +next.link=display-bitmap.html +previous.title=Processing Bitmaps Off the UI Thread +previous.link=process-bitmap.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#memory-cache">Use a Memory Cache</a></li> + <li><a href="#disk-cache">Use a Disk Cache</a></li> + <li><a href="#config-changes">Handle Configuration Changes</a></li> +</ol> + +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}guide/topics/resources/runtime-changes.html">Handling Runtime Changes</a></li> +</ul> + +<h2>Try it out</h2> + +<div class="download-box"> + <a href="{@docRoot}shareables/training/BitmapFun.zip" class="button">Download the sample</a> + <p class="filename">BitmapFun.zip</p> +</div> + +</div> +</div> + +<p>Loading a single bitmap into your user interface (UI) is straightforward, however things get more +complicated if you need to load a larger set of images at once. In many cases (such as with +components like {@link android.widget.ListView}, {@link android.widget.GridView} or {@link +android.support.v4.view.ViewPager }), the total number of images on-screen combined with images that +might soon scroll onto the screen are essentially unlimited.</p> + +<p>Memory usage is kept down with components like this by recycling the child views as they move +off-screen. The garbage collector also frees up your loaded bitmaps, assuming you don't keep any +long lived references. This is all good and well, but in order to keep a fluid and fast-loading UI +you want to avoid continually processing these images each time they come back on-screen. A memory +and disk cache can often help here, allowing components to quickly reload processed images.</p> + +<p>This lesson walks you through using a memory and disk bitmap cache to improve the responsiveness +and fluidity of your UI when loading multiple bitmaps.</p> + +<h2 id="memory-cache">Use a Memory Cache</h2> + +<p>A memory cache offers fast access to bitmaps at the cost of taking up valuable application +memory. The {@link android.util.LruCache} class (also available in the <a +href="{@docRoot}reference/android/support/v4/util/LruCache.html">Support Library</a> for use back +to API Level 4) is particularly well suited to the task of caching bitmaps, keeping recently +referenced objects in a strong referenced {@link java.util.LinkedHashMap} and evicting the least +recently used member before the cache exceeds its designated size.</p> + +<p class="note"><strong>Note:</strong> In the past, a popular memory cache implementation was a +{@link java.lang.ref.SoftReference} or {@link java.lang.ref.WeakReference} bitmap cache, however +this is not recommended. Starting from Android 2.3 (API Level 9) the garbage collector is more +aggressive with collecting soft/weak references which makes them fairly ineffective. In addition, +prior to Android 3.0 (API Level 11), the backing data of a bitmap was stored in native memory which +is not released in a predictable manner, potentially causing an application to briefly exceed its +memory limits and crash.</p> + +<p>In order to choose a suitable size for a {@link android.util.LruCache}, a number of factors +should be taken into consideration, for example:</p> + +<ul> + <li>How memory intensive is the rest of your activity and/or application?</li> + <li>How many images will be on-screen at once? How many need to be available ready to come + on-screen?</li> + <li>What is the screen size and density of the device? An extra high density screen (xhdpi) device + like <a href="http://www.android.com/devices/detail/galaxy-nexus">Galaxy Nexus</a> will need a + larger cache to hold the same number of images in memory compared to a device like <a + href="http://www.android.com/devices/detail/nexus-s">Nexus S</a> (hdpi).</li> + <li>What dimensions and configuration are the bitmaps and therefore how much memory will each take + up?</li> + <li>How frequently will the images be accessed? Will some be accessed more frequently than others? + If so, perhaps you may want to keep certain items always in memory or even have multiple {@link + android.util.LruCache} objects for different groups of bitmaps.</li> + <li>Can you balance quality against quantity? Sometimes it can be more useful to store a larger + number of lower quality bitmaps, potentially loading a higher quality version in another + background task.</li> +</ul> + +<p>There is no specific size or formula that suits all applications, it's up to you to analyze your +usage and come up with a suitable solution. A cache that is too small causes additional overhead with +no benefit, a cache that is too large can once again cause {@code java.lang.OutOfMemory} exceptions +and leave the rest of your app little memory to work with.</p> + +<p>Here’s an example of setting up a {@link android.util.LruCache} for bitmaps:</p> + +<pre> +private LruCache<String, Bitmap> mMemoryCache; + +@Override +protected void onCreate(Bundle savedInstanceState) { + ... + // Get memory class of this device, exceeding this amount will throw an + // OutOfMemory exception. + final int memClass = ((ActivityManager) context.getSystemService( + Context.ACTIVITY_SERVICE)).getMemoryClass(); + + // Use 1/8th of the available memory for this memory cache. + final int cacheSize = 1024 * 1024 * memClass / 8; + + mMemoryCache = new LruCache<String, Bitmap>(cacheSize) { + @Override + protected int sizeOf(String key, Bitmap bitmap) { + // The cache size will be measured in bytes rather than number of items. + return bitmap.getByteCount(); + } + }; + ... +} + +public void addBitmapToMemoryCache(String key, Bitmap bitmap) { + if (getBitmapFromMemCache(key) == null) { + mMemoryCache.put(key, bitmap); + } +} + +public Bitmap getBitmapFromMemCache(String key) { + return mMemoryCache.get(key); +} +</pre> + +<p class="note"><strong>Note:</strong> In this example, one eighth of the application memory is +allocated for our cache. On a normal/hdpi device this is a minimum of around 4MB (32/8). A full +screen {@link android.widget.GridView} filled with images on a device with 800x480 resolution would +use around 1.5MB (800*480*4 bytes), so this would cache a minimum of around 2.5 pages of images in +memory.</p> + +<p>When loading a bitmap into an {@link android.widget.ImageView}, the {@link android.util.LruCache} +is checked first. If an entry is found, it is used immediately to update the {@link +android.widget.ImageView}, otherwise a background thread is spawned to process the image:</p> + +<pre> +public void loadBitmap(int resId, ImageView imageView) { + final String imageKey = String.valueOf(resId); + + final Bitmap bitmap = getBitmapFromMemCache(imageKey); + if (bitmap != null) { + mImageView.setImageBitmap(bitmap); + } else { + mImageView.setImageResource(R.drawable.image_placeholder); + BitmapWorkerTask task = new BitmapWorkerTask(mImageView); + task.execute(resId); + } +} +</pre> + +<p>The <a href="process-bitmap.html#BitmapWorkerTask">{@code BitmapWorkerTask}</a> also needs to be +updated to add entries to the memory cache:</p> + +<pre> +class BitmapWorkerTask extends AsyncTask<Integer, Void, Bitmap> { + ... + // Decode image in background. + @Override + protected Bitmap doInBackground(Integer... params) { + final Bitmap bitmap = decodeSampledBitmapFromResource( + getResources(), params[0], 100, 100)); + addBitmapToMemoryCache(String.valueOf(params[0]), bitmap); + return bitmap; + } + ... +} +</pre> + +<h2 id="disk-cache">Use a Disk Cache</h2> + +<p>A memory cache is useful in speeding up access to recently viewed bitmaps, however you cannot +rely on images being available in this cache. Components like {@link android.widget.GridView} with +larger datasets can easily fill up a memory cache. Your application could be interrupted by another +task like a phone call, and while in the background it might be killed and the memory cache +destroyed. Once the user resumes, your application it has to process each image again.</p> + +<p>A disk cache can be used in these cases to persist processed bitmaps and help decrease loading +times where images are no longer available in a memory cache. Of course, fetching images from disk +is slower than loading from memory and should be done in a background thread, as disk read times can +be unpredictable.</p> + +<p class="note"><strong>Note:</strong> A {@link android.content.ContentProvider} might be a more +appropriate place to store cached images if they are accessed more frequently, for example in an +image gallery application.</p> + +<p>Included in the sample code of this class is a basic {@code DiskLruCache} implementation. +However, a more robust and recommended {@code DiskLruCache} solution is included in the Android 4.0 +source code ({@code libcore/luni/src/main/java/libcore/io/DiskLruCache.java}). Back-porting this +class for use on previous Android releases should be fairly straightforward (a <a +href="http://www.google.com/search?q=disklrucache">quick search</a> shows others who have already +implemented this solution).</p> + +<p>Here’s updated example code that uses the simple {@code DiskLruCache} included in the sample +application of this class:</p> + +<pre> +private DiskLruCache mDiskCache; +private static final int DISK_CACHE_SIZE = 1024 * 1024 * 10; // 10MB +private static final String DISK_CACHE_SUBDIR = "thumbnails"; + +@Override +protected void onCreate(Bundle savedInstanceState) { + ... + // Initialize memory cache + ... + File cacheDir = getCacheDir(this, DISK_CACHE_SUBDIR); + mDiskCache = DiskLruCache.openCache(this, cacheDir, DISK_CACHE_SIZE); + ... +} + +class BitmapWorkerTask extends AsyncTask<Integer, Void, Bitmap> { + ... + // Decode image in background. + @Override + protected Bitmap doInBackground(Integer... params) { + final String imageKey = String.valueOf(params[0]); + + // Check disk cache in background thread + Bitmap bitmap = getBitmapFromDiskCache(imageKey); + + if (bitmap == null) { // Not found in disk cache + // Process as normal + final Bitmap bitmap = decodeSampledBitmapFromResource( + getResources(), params[0], 100, 100)); + } + + // Add final bitmap to caches + addBitmapToCache(String.valueOf(imageKey, bitmap); + + return bitmap; + } + ... +} + +public void addBitmapToCache(String key, Bitmap bitmap) { + // Add to memory cache as before + if (getBitmapFromMemCache(key) == null) { + mMemoryCache.put(key, bitmap); + } + + // Also add to disk cache + if (!mDiskCache.containsKey(key)) { + mDiskCache.put(key, bitmap); + } +} + +public Bitmap getBitmapFromDiskCache(String key) { + return mDiskCache.get(key); +} + +// Creates a unique subdirectory of the designated app cache directory. Tries to use external +// but if not mounted, falls back on internal storage. +public static File getCacheDir(Context context, String uniqueName) { + // Check if media is mounted or storage is built-in, if so, try and use external cache dir + // otherwise use internal cache dir + final String cachePath = Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED + || !Environment.isExternalStorageRemovable() ? + context.getExternalCacheDir().getPath() : context.getCacheDir().getPath(); + + return new File(cachePath + File.separator + uniqueName); +} +</pre> + +<p>While the memory cache is checked in the UI thread, the disk cache is checked in the background +thread. Disk operations should never take place on the UI thread. When image processing is +complete, the final bitmap is added to both the memory and disk cache for future use.</p> + +<h2 id="config-changes">Handle Configuration Changes</h2> + +<p>Runtime configuration changes, such as a screen orientation change, cause Android to destroy and +restart the running activity with the new configuration (For more information about this behavior, +see <a href="{@docRoot}guide/topics/resources/runtime-changes.html">Handling Runtime Changes</a>). +You want to avoid having to process all your images again so the user has a smooth and fast +experience when a configuration change occurs.</p> + +<p>Luckily, you have a nice memory cache of bitmaps that you built in the <a +href="#memory-cache">Use a Memory Cache</a> section. This cache can be passed through to the new +activity instance using a {@link android.app.Fragment} which is preserved by calling {@link +android.app.Fragment#setRetainInstance setRetainInstance(true)}). After the activity has been +recreated, this retained {@link android.app.Fragment} is reattached and you gain access to the +existing cache object, allowing images to be quickly fetched and re-populated into the {@link +android.widget.ImageView} objects.</p> + +<p>Here’s an example of retaining a {@link android.util.LruCache} object across configuration +changes using a {@link android.app.Fragment}:</p> + +<pre> +private LruCache<String, Bitmap> mMemoryCache; + +@Override +protected void onCreate(Bundle savedInstanceState) { + ... + RetainFragment mRetainFragment = + RetainFragment.findOrCreateRetainFragment(getFragmentManager()); + mMemoryCache = RetainFragment.mRetainedCache; + if (mMemoryCache == null) { + mMemoryCache = new LruCache<String, Bitmap>(cacheSize) { + ... // Initialize cache here as usual + } + mRetainFragment.mRetainedCache = mMemoryCache; + } + ... +} + +class RetainFragment extends Fragment { + private static final String TAG = "RetainFragment"; + public LruCache<String, Bitmap> mRetainedCache; + + public RetainFragment() {} + + public static RetainFragment findOrCreateRetainFragment(FragmentManager fm) { + RetainFragment fragment = (RetainFragment) fm.findFragmentByTag(TAG); + if (fragment == null) { + fragment = new RetainFragment(); + } + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + <strong>setRetainInstance(true);</strong> + } +} +</pre> + +<p>To test this out, try rotating a device both with and without retaining the {@link +android.app.Fragment}. You should notice little to no lag as the images populate the activity almost +instantly from memory when you retain the cache. Any images not found in the memory cache are +hopefully available in the disk cache, if not, they are processed as usual.</p> diff --git a/docs/html/training/displaying-bitmaps/display-bitmap.jd b/docs/html/training/displaying-bitmaps/display-bitmap.jd new file mode 100644 index 0000000..7a93313 --- /dev/null +++ b/docs/html/training/displaying-bitmaps/display-bitmap.jd @@ -0,0 +1,400 @@ +page.title=Displaying Bitmaps in Your UI +parent.title=Displaying Bitmaps Efficiently +parent.link=index.html + +trainingnavtop=true +previous.title=Caching Bitmaps +previous.link=cache-bitmap.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#viewpager">Load Bitmaps into a ViewPager Implementation</a></li> + <li><a href="#gridview">Load Bitmaps into a GridView Implementation</a></li> +</ol> + +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}design/patterns/swipe-views.html">Android Design: Swipe Views</a></li> + <li><a href="{@docRoot}design/building-blocks/grid-lists.html">Android Design: Grid Lists</a></li> +</ul> + +<h2>Try it out</h2> + +<div class="download-box"> + <a href="{@docRoot}shareables/training/BitmapFun.zip" class="button">Download the sample</a> + <p class="filename">BitmapFun.zip</p> +</div> + +</div> +</div> + +<p></p> + +<p>This lesson brings together everything from previous lessons, showing you how to load multiple +bitmaps into {@link android.support.v4.view.ViewPager} and {@link android.widget.GridView} +components using a background thread and bitmap cache, while dealing with concurrency and +configuration changes.</p> + +<h2 id="viewpager">Load Bitmaps into a ViewPager Implementation</h2> + +<p>The <a href="{@docRoot}design/patterns/swipe-views.html">swipe view pattern</a> is an excellent +way to navigate the detail view of an image gallery. You can implement this pattern using a {@link +android.support.v4.view.ViewPager} component backed by a {@link +android.support.v4.view.PagerAdapter}. However, a more suitable backing adapter is the subclass +{@link android.support.v4.app.FragmentStatePagerAdapter} which automatically destroys and saves +state of the {@link android.app.Fragment Fragments} in the {@link android.support.v4.view.ViewPager} +as they disappear off-screen, keeping memory usage down.</p> + +<p class="note"><strong>Note:</strong> If you have a smaller number of images and are confident they +all fit within the application memory limit, then using a regular {@link +android.support.v4.view.PagerAdapter} or {@link android.support.v4.app.FragmentPagerAdapter} might +be more appropriate.</p> + +<p>Here’s an implementation of a {@link android.support.v4.view.ViewPager} with {@link +android.widget.ImageView} children. The main activity holds the {@link +android.support.v4.view.ViewPager} and the adapter:</p> + +<pre> +public class ImageDetailActivity extends FragmentActivity { + public static final String EXTRA_IMAGE = "extra_image"; + + private ImagePagerAdapter mAdapter; + private ViewPager mPager; + + // A static dataset to back the ViewPager adapter + public final static Integer[] imageResIds = new Integer[] { + R.drawable.sample_image_1, R.drawable.sample_image_2, R.drawable.sample_image_3, + R.drawable.sample_image_4, R.drawable.sample_image_5, R.drawable.sample_image_6, + R.drawable.sample_image_7, R.drawable.sample_image_8, R.drawable.sample_image_9}; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.image_detail_pager); // Contains just a ViewPager + + mAdapter = new ImagePagerAdapter(getSupportFragmentManager(), imageResIds.length); + mPager = (ViewPager) findViewById(R.id.pager); + mPager.setAdapter(mAdapter); + } + + public static class ImagePagerAdapter extends FragmentStatePagerAdapter { + private final int mSize; + + public ImagePagerAdapter(FragmentManager fm, int size) { + super(fm); + mSize = size; + } + + @Override + public int getCount() { + return mSize; + } + + @Override + public Fragment getItem(int position) { + return ImageDetailFragment.newInstance(position); + } + } +} +</pre> + +<p>The details {@link android.app.Fragment} holds the {@link android.widget.ImageView} children:</p> + +<pre> +public class ImageDetailFragment extends Fragment { + private static final String IMAGE_DATA_EXTRA = "resId"; + private int mImageNum; + private ImageView mImageView; + + static ImageDetailFragment newInstance(int imageNum) { + final ImageDetailFragment f = new ImageDetailFragment(); + final Bundle args = new Bundle(); + args.putInt(IMAGE_DATA_EXTRA, imageNum); + f.setArguments(args); + return f; + } + + // Empty constructor, required as per Fragment docs + public ImageDetailFragment() {} + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mImageNum = getArguments() != null ? getArguments().getInt(IMAGE_DATA_EXTRA) : -1; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // image_detail_fragment.xml contains just an ImageView + final View v = inflater.inflate(R.layout.image_detail_fragment, container, false); + mImageView = (ImageView) v.findViewById(R.id.imageView); + return v; + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + final int resId = ImageDetailActivity.imageResIds[mImageNum]; + <strong>mImageView.setImageResource(resId);</strong> // Load image into ImageView + } +} +</pre> + +<p>Hopefully you noticed the issue with this implementation; The images are being read from +resources on the UI thread which can lead to an application hanging and being force closed. Using an +{@link android.os.AsyncTask} as described in the <a href="process-bitmap.html">Processing Bitmaps Off +the UI Thread</a> lesson, it’s straightforward to move image loading and processing to a background +thread:</p> + +<pre> +public class ImageDetailActivity extends FragmentActivity { + ... + + public void loadBitmap(int resId, ImageView imageView) { + mImageView.setImageResource(R.drawable.image_placeholder); + BitmapWorkerTask task = new BitmapWorkerTask(mImageView); + task.execute(resId); + } + + ... // include <a href="process-bitmap.html#BitmapWorkerTask">{@code BitmapWorkerTask}</a> class +} + +public class ImageDetailFragment extends Fragment { + ... + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + if (ImageDetailActivity.class.isInstance(getActivity())) { + final int resId = ImageDetailActivity.imageResIds[mImageNum]; + // Call out to ImageDetailActivity to load the bitmap in a background thread + ((ImageDetailActivity) getActivity()).loadBitmap(resId, mImageView); + } + } +} +</pre> + +<p>Any additional processing (such as resizing or fetching images from the network) can take place +in the <a href="process-bitmap.html#BitmapWorkerTask">{@code BitmapWorkerTask}</a> without affecting +responsiveness of the main UI. If the background thread is doing more than just loading an image +directly from disk, it can also be beneficial to add a memory and/or disk cache as described in the +lesson <a href="cache-bitmap.html#memory-cache">Caching Bitmaps</a>. Here's the additional +modifications for a memory cache:</p> + +<pre> +public class ImageDetailActivity extends FragmentActivity { + ... + private LruCache<String, Bitmap> mMemoryCache; + + @Override + public void onCreate(Bundle savedInstanceState) { + ... + // initialize LruCache as per <a href="cache-bitmap.html#memory-cache">Use a Memory Cache</a> section + } + + public void loadBitmap(int resId, ImageView imageView) { + final String imageKey = String.valueOf(resId); + + final Bitmap bitmap = mMemoryCache.get(imageKey); + if (bitmap != null) { + mImageView.setImageBitmap(bitmap); + } else { + mImageView.setImageResource(R.drawable.image_placeholder); + BitmapWorkerTask task = new BitmapWorkerTask(mImageView); + task.execute(resId); + } + } + + ... // include updated BitmapWorkerTask from <a href="cache-bitmap.html#memory-cache">Use a Memory Cache</a> section +} +</pre> + +<p>Putting all these pieces together gives you a responsive {@link +android.support.v4.view.ViewPager} implementation with minimal image loading latency and the ability +to do as much or as little background processing on your images as needed.</p> + +<h2 id="gridview">Load Bitmaps into a GridView Implementation</h2> + +<p>The <a href="{@docRoot}design/building-blocks/grid-lists.html">grid list building block</a> is +useful for showing image data sets and can be implemented using a {@link android.widget.GridView} +component in which many images can be on-screen at any one time and many more need to be ready to +appear if the user scrolls up or down. When implementing this type of control, you must ensure the +UI remains fluid, memory usage remains under control and concurrency is handled correctly (due to +the way {@link android.widget.GridView} recycles its children views).</p> + +<p>To start with, here is a standard {@link android.widget.GridView} implementation with {@link +android.widget.ImageView} children placed inside a {@link android.app.Fragment}:</p> + +<pre> +public class ImageGridFragment extends Fragment implements AdapterView.OnItemClickListener { + private ImageAdapter mAdapter; + + // A static dataset to back the GridView adapter + public final static Integer[] imageResIds = new Integer[] { + R.drawable.sample_image_1, R.drawable.sample_image_2, R.drawable.sample_image_3, + R.drawable.sample_image_4, R.drawable.sample_image_5, R.drawable.sample_image_6, + R.drawable.sample_image_7, R.drawable.sample_image_8, R.drawable.sample_image_9}; + + // Empty constructor as per Fragment docs + public ImageGridFragment() {} + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mAdapter = new ImageAdapter(getActivity()); + } + + @Override + public View onCreateView( + LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + final View v = inflater.inflate(R.layout.image_grid_fragment, container, false); + final GridView mGridView = (GridView) v.findViewById(R.id.gridView); + mGridView.setAdapter(mAdapter); + mGridView.setOnItemClickListener(this); + return v; + } + + @Override + public void onItemClick(AdapterView<?> parent, View v, int position, long id) { + final Intent i = new Intent(getActivity(), ImageDetailActivity.class); + i.putExtra(ImageDetailActivity.EXTRA_IMAGE, position); + startActivity(i); + } + + private class ImageAdapter extends BaseAdapter { + private final Context mContext; + + public ImageAdapter(Context context) { + super(); + mContext = context; + } + + @Override + public int getCount() { + return imageResIds.length; + } + + @Override + public Object getItem(int position) { + return imageResIds[position]; + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup container) { + ImageView imageView; + if (convertView == null) { // if it's not recycled, initialize some attributes + imageView = new ImageView(mContext); + imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); + imageView.setLayoutParams(new GridView.LayoutParams( + LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); + } else { + imageView = (ImageView) convertView; + } + <strong>imageView.setImageResource(imageResIds[position]);</strong> // Load image into ImageView + return imageView; + } + } +} +</pre> + +<p>Once again, the problem with this implementation is that the image is being set in the UI thread. +While this may work for small, simple images (due to system resource loading and caching), if any +additional processing needs to be done, your UI grinds to a halt.</p> + +<p>The same asynchronous processing and caching methods from the previous section can be implemented +here. However, you also need to wary of concurrency issues as the {@link android.widget.GridView} +recycles its children views. To handle this, use the techniques discussed in the <a +href="process-bitmap#concurrency">Processing Bitmaps Off the UI Thread</a> lesson. Here is the updated +solution:</p> + +<pre> +public class ImageGridFragment extends Fragment implements AdapterView.OnItemClickListener { + ... + + private class ImageAdapter extends BaseAdapter { + ... + + @Override + public View getView(int position, View convertView, ViewGroup container) { + ... + <strong>loadBitmap(imageResIds[position], imageView)</strong> + return imageView; + } + } + + public void loadBitmap(int resId, ImageView imageView) { + if (cancelPotentialWork(resId, imageView)) { + final BitmapWorkerTask task = new BitmapWorkerTask(imageView); + final AsyncDrawable asyncDrawable = + new AsyncDrawable(getResources(), mPlaceHolderBitmap, task); + imageView.setImageDrawable(asyncDrawable); + task.execute(resId); + } + } + + static class AsyncDrawable extends BitmapDrawable { + private final WeakReference<BitmapWorkerTask> bitmapWorkerTaskReference; + + public AsyncDrawable(Resources res, Bitmap bitmap, + BitmapWorkerTask bitmapWorkerTask) { + super(res, bitmap); + bitmapWorkerTaskReference = + new WeakReference<BitmapWorkerTask>(bitmapWorkerTask); + } + + public BitmapWorkerTask getBitmapWorkerTask() { + return bitmapWorkerTaskReference.get(); + } + } + + public static boolean cancelPotentialWork(int data, ImageView imageView) { + final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); + + if (bitmapWorkerTask != null) { + final int bitmapData = bitmapWorkerTask.data; + if (bitmapData != data) { + // Cancel previous task + bitmapWorkerTask.cancel(true); + } else { + // The same work is already in progress + return false; + } + } + // No task associated with the ImageView, or an existing task was cancelled + return true; + } + + private static BitmapWorkerTask getBitmapWorkerTask(ImageView imageView) { + if (imageView != null) { + final Drawable drawable = imageView.getDrawable(); + if (drawable instanceof AsyncDrawable) { + final AsyncDrawable asyncDrawable = (AsyncDrawable) drawable; + return asyncDrawable.getBitmapWorkerTask(); + } + } + return null; + } + + ... // include updated <a href="process-bitmap.html#BitmapWorkerTaskUpdated">{@code BitmapWorkerTask}</a> class +</pre> + +<p class="note"><strong>Note:</strong> The same code can easily be adapted to work with {@link +android.widget.ListView} as well.</p> + +<p>This implementation allows for flexibility in how the images are processed and loaded without +impeding the smoothness of the UI. In the background task you can load images from the network or +resize large digital camera photos and the images appear as the tasks finish processing.</p> + +<p>For a full example of this and other concepts discussed in this lesson, please see the included +sample application.</p> diff --git a/docs/html/training/displaying-bitmaps/index.jd b/docs/html/training/displaying-bitmaps/index.jd new file mode 100644 index 0000000..6755c24 --- /dev/null +++ b/docs/html/training/displaying-bitmaps/index.jd @@ -0,0 +1,78 @@ +page.title=Displaying Bitmaps Efficiently + +trainingnavtop=true +startpage=true +next.title=Loading Large Bitmaps Efficiently +next.link=load-bitmap.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>Dependencies and prerequisites</h2> +<ul> + <li>Android 2.1 (API Level 7) or higher</li> + <li><a href="{@docRoot}sdk/compatibility-library.html">Support Library</a></li> +</ul> + +<h2>Try it out</h2> + +<div class="download-box"> + <a href="{@docRoot}shareables/training/BitmapFun.zip" class="button">Download the sample</a> + <p class="filename">BitmapFun.zip</p> +</div> + +</div> +</div> + +<p>This class covers some common techniques for processing and loading {@link +android.graphics.Bitmap} objects in a way that keeps your user interface (UI) components responsive +and avoids exceeding your application memory limit. If you're not careful, bitmaps can quickly +consume your available memory budget leading to an application crash due to the dreaded +exception:<br />{@code java.lang.OutofMemoryError: bitmap size exceeds VM budget}.</p> + +<p>There are a number of reasons why loading bitmaps in your Android application is tricky:</p> + +<ul> + <li>Mobile devices typically have constrained system resources. Android devices can have as little + as 16MB of memory available to a single application. The <a + href="http://source.android.com/compatibility/downloads.html">Android Compatibility Definition + Document</a> (CDD), <i>Section 3.7. Virtual Machine Compatibility</i> gives the required minimum + application memory for various screen sizes and densities. Applications should be optimized to + perform under this minimum memory limit. However, keep in mind many devices are configured with + higher limits.</li> + <li>Bitmaps take up a lot of memory, especially for rich images like photographs. For example, the + camera on the <a href="http://www.google.com/nexus/">Galaxy Nexus</a> takes photos up to 2592x1936 + pixels (5 megapixels). If the bitmap configuration used is {@link + android.graphics.Bitmap.Config ARGB_8888} (the default from the Android 2.3 onward) then loading + this image into memory takes about 19MB of memory (2592*1936*4 bytes), immediately exhausting the + per-app limit on some devices.</li> + <li>Android app UI’s frequently require several bitmaps to be loaded at once. Components such as + {@link android.widget.ListView}, {@link android.widget.GridView} and {@link + android.support.v4.view.ViewPager} commonly include multiple bitmaps on-screen at once with many + more potentially off-screen ready to show at the flick of a finger.</li> +</ul> + +<h2>Lessons</h2> + +<dl> + <dt><b><a href="load-bitmap.html">Loading Large Bitmaps Efficiently</a></b></dt> + <dd>This lesson walks you through decoding large bitmaps without exceeding the per application + memory limit.</dd> + + <dt><b><a href="process-bitmap.html">Processing Bitmaps Off the UI Thread</a></b></dt> + <dd>Bitmap processing (resizing, downloading from a remote source, etc.) should never take place + on the main UI thread. This lesson walks you through processing bitmaps in a background thread + using {@link android.os.AsyncTask} and explains how to handle concurrency issues.</dd> + + <dt><b><a href="cache-bitmap.html">Caching Bitmaps</a></b></dt> + <dd>This lesson walks you through using a memory and disk bitmap cache to improve the + responsiveness and fluidity of your UI when loading multiple bitmaps.</dd> + + <dt><b><a href="display-bitmap.html">Displaying Bitmaps in Your UI</a></b></dt> + <dd>This lesson brings everything together, showing you how to load multiple bitmaps into + components like {@link android.support.v4.view.ViewPager} and {@link android.widget.GridView} + using a background thread and bitmap cache.</dd> + +</dl>
\ No newline at end of file diff --git a/docs/html/training/displaying-bitmaps/load-bitmap.jd b/docs/html/training/displaying-bitmaps/load-bitmap.jd new file mode 100644 index 0000000..c0a5709 --- /dev/null +++ b/docs/html/training/displaying-bitmaps/load-bitmap.jd @@ -0,0 +1,165 @@ +page.title=Loading Large Bitmaps Efficiently +parent.title=Displaying Bitmaps Efficiently +parent.link=index.html + +trainingnavtop=true +next.title=Processing Bitmaps Off the UI Thread +next.link=process-bitmap.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#read-bitmap">Read Bitmap Dimensions and Type</a></li> + <li><a href="#load-bitmap">Load a Scaled Down Version into Memory</a></li> +</ol> + +<h2>Try it out</h2> + +<div class="download-box"> + <a href="{@docRoot}shareables/training/BitmapFun.zip" class="button">Download the sample</a> + <p class="filename">BitmapFun.zip</p> +</div> + +</div> +</div> + +<p>Images come in all shapes and sizes. In many cases they are larger than required for a typical +application user interface (UI). For example, the system Gallery application displays photos taken +using your Android devices's camera which are typically much higher resolution than the screen +density of your device.</p> + +<p>Given that you are working with limited memory, ideally you only want to load a lower resolution +version in memory. The lower resolution version should match the size of the UI component that +displays it. An image with a higher resolution does not provide any visible benefit, but still takes +up precious memory and incurs additional performance overhead due to additional on the fly +scaling.</p> + +<p>This lesson walks you through decoding large bitmaps without exceeding the per application +memory limit by loading a smaller subsampled version in memory.</p> + +<h2 id="read-bitmap">Read Bitmap Dimensions and Type</h2> + +<p>The {@link android.graphics.BitmapFactory} class provides several decoding methods ({@link +android.graphics.BitmapFactory#decodeByteArray(byte[],int,int,android.graphics.BitmapFactory.Options) +decodeByteArray()}, {@link +android.graphics.BitmapFactory#decodeFile(java.lang.String,android.graphics.BitmapFactory.Options) +decodeFile()}, {@link +android.graphics.BitmapFactory#decodeResource(android.content.res.Resources,int,android.graphics.BitmapFactory.Options) +decodeResource()}, etc.) for creating a {@link android.graphics.Bitmap} from various sources. Choose +the most appropriate decode method based on your image data source. These methods attempt to +allocate memory for the constructed bitmap and therefore can easily result in an {@code OutOfMemory} +exception. Each type of decode method has additional signatures that let you specify decoding +options via the {@link android.graphics.BitmapFactory.Options} class. Setting the {@link +android.graphics.BitmapFactory.Options#inJustDecodeBounds} property to {@code true} while decoding +avoids memory allocation, returning {@code null} for the bitmap object but setting {@link +android.graphics.BitmapFactory.Options#outWidth}, {@link +android.graphics.BitmapFactory.Options#outHeight} and {@link +android.graphics.BitmapFactory.Options#outMimeType}. This technique allows you to read the +dimensions and type of the image data prior to construction (and memory allocation) of the +bitmap.</p> + +<pre> +BitmapFactory.Options options = new BitmapFactory.Options(); +options.inJustDecodeBounds = true; +BitmapFactory.decodeResource(getResources(), R.id.myimage, options); +int imageHeight = options.outHeight; +int imageWidth = options.outWidth; +String imageType = options.outMimeType; +</pre> + +<p>To avoid {@code java.lang.OutOfMemory} exceptions, check the dimensions of a bitmap before +decoding it, unless you absolutely trust the source to provide you with predictably sized image data +that comfortably fits within the available memory.</p> + +<h2 id="load-bitmap">Load a Scaled Down Version into Memory</h2> + +<p>Now that the image dimensions are known, they can be used to decide if the full image should be +loaded into memory or if a subsampled version should be loaded instead. Here are some factors to +consider:</p> + +<ul> + <li>Estimated memory usage of loading the full image in memory.</li> + <li>Amount of memory you are willing to commit to loading this image given any other memory + requirements of your application.</li> + <li>Dimensions of the target {@link android.widget.ImageView} or UI component that the image + is to be loaded into.</li> + <li>Screen size and density of the current device.</li> +</ul> + +<p>For example, it’s not worth loading a 1024x768 pixel image into memory if it will eventually be +displayed in a 128x96 pixel thumbnail in an {@link android.widget.ImageView}.</p> + +<p>To tell the decoder to subsample the image, loading a smaller version into memory, set {@link +android.graphics.BitmapFactory.Options#inSampleSize} to {@code true} in your {@link +android.graphics.BitmapFactory.Options} object. For example, an image with resolution 2048x1536 that +is decoded with an {@link android.graphics.BitmapFactory.Options#inSampleSize} of 4 produces a +bitmap of approximately 512x384. Loading this into memory uses 0.75MB rather than 12MB for the full +image (assuming a bitmap configuration of {@link android.graphics.Bitmap.Config ARGB_8888}). Here’s +a method to calculate a the sample size value based on a target width and height:</p> + +<pre> +public static int calculateInSampleSize( + BitmapFactory.Options options, int reqWidth, int reqHeight) { + // Raw height and width of image + final int height = options.outHeight; + final int width = options.outWidth; + int inSampleSize = 1; + + if (height > reqHeight || width > reqWidth) { + if (width > height) { + inSampleSize = Math.round((float)height / (float)reqHeight); + } else { + inSampleSize = Math.round((float)width / (float)reqWidth); + } + } + return inSampleSize; +} +</pre> + +<p class="note"><strong>Note:</strong> Using powers of 2 for {@link +android.graphics.BitmapFactory.Options#inSampleSize} values is faster and more efficient for the +decoder. However, if you plan to cache the resized versions in memory or on disk, it’s usually still +worth decoding to the most appropriate image dimensions to save space.</p> + +<p>To use this method, first decode with {@link +android.graphics.BitmapFactory.Options#inJustDecodeBounds} set to {@code true}, pass the options +through and then decode again using the new {@link +android.graphics.BitmapFactory.Options#inSampleSize} value and {@link +android.graphics.BitmapFactory.Options#inJustDecodeBounds} set to {@code false}:</p> + +<a name="decodeSampledBitmapFromResource"></a> +<pre> +public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, + int reqWidth, int reqHeight) { + + // First decode with inJustDecodeBounds=true to check dimensions + final BitmapFactory.Options options = new BitmapFactory.Options(); + options.inJustDecodeBounds = true; + BitmapFactory.decodeResource(res, resId, options); + + // Calculate inSampleSize + options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); + + // Decode bitmap with inSampleSize set + options.inJustDecodeBounds = false; + return BitmapFactory.decodeResource(res, resId, options); +} +</pre> + +<p>This method makes it easy to load a bitmap of arbitrarily large size into an {@link +android.widget.ImageView} that displays a 100x100 pixel thumbnail, as shown in the following example +code:</p> + +<pre> +mImageView.setImageBitmap( + decodeSampledBitmapFromResource(getResources(), R.id.myimage, 100, 100)); +</pre> + +<p>You can follow a similar process to decode bitmaps from other sources, by substituting the +appropriate {@link +android.graphics.BitmapFactory#decodeByteArray(byte[],int,int,android.graphics.BitmapFactory.Options) +BitmapFactory.decode*} method as needed.</p>
\ No newline at end of file diff --git a/docs/html/training/displaying-bitmaps/process-bitmap.jd b/docs/html/training/displaying-bitmaps/process-bitmap.jd new file mode 100644 index 0000000..c1450b4 --- /dev/null +++ b/docs/html/training/displaying-bitmaps/process-bitmap.jd @@ -0,0 +1,239 @@ +page.title=Processing Bitmaps Off the UI Thread +parent.title=Displaying Bitmaps Efficiently +parent.link=index.html + +trainingnavtop=true +next.title=Caching Bitmaps +next.link=cache-bitmap.html +previous.title=Loading Large Bitmaps Efficiently +previous.link=load-bitmap.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#async-task">Use an AsyncTask</a></li> + <li><a href="#concurrency">Handle Concurrency</a></li> +</ol> + +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}guide/practices/design/responsiveness.html">Designing for Responsiveness</a></li> + <li><a + href="http://android-developers.blogspot.com/2010/07/multithreading-for-performance.html">Multithreading + for Performance</a></li> +</ul> + +<h2>Try it out</h2> + +<div class="download-box"> + <a href="{@docRoot}shareables/training/BitmapFun.zip" class="button">Download the sample</a> + <p class="filename">BitmapFun.zip</p> +</div> + +</div> +</div> + +<p>The {@link +android.graphics.BitmapFactory#decodeByteArray(byte[],int,int,android.graphics.BitmapFactory.Options) +BitmapFactory.decode*} methods, discussed in the <a href="load-bitmap.html">Load Large Bitmaps +Efficiently</a> lesson, should not be executed on the main UI thread if the source data is read from +disk or a network location (or really any source other than memory). The time this data takes to +load is unpredictable and depends on a variety of factors (speed of reading from disk or network, +size of image, power of CPU, etc.). If one of these tasks blocks the UI thread, the system flags +your application as non-responsive and the user has the option of closing it (see <a +href="{@docRoot}guide/practices/design/responsiveness.html">Designing for Responsiveness</a> for +more information).</p> + +<p>This lesson walks you through processing bitmaps in a background thread using +{@link android.os.AsyncTask} and shows you how to handle concurrency issues.</p> + +<h2 id="async-task">Use an AsyncTask</h2> + +<p>The {@link android.os.AsyncTask} class provides an easy way to execute some work in a background +thread and publish the results back on the UI thread. To use it, create a subclass and override the +provided methods. Here’s an example of loading a large image into an {@link +android.widget.ImageView} using {@link android.os.AsyncTask} and <a +href="load-bitmap.html#decodeSampledBitmapFromResource">{@code +decodeSampledBitmapFromResource()}</a>: </p> + +<a name="BitmapWorkerTask"></a> +<pre> +class BitmapWorkerTask extends AsyncTask<Integer, Void, Bitmap> { + private final WeakReference<ImageView> imageViewReference; + private int data = 0; + + public BitmapWorkerTask(ImageView imageView) { + // Use a WeakReference to ensure the ImageView can be garbage collected + imageViewReference = new WeakReference<ImageView>(imageView); + } + + // Decode image in background. + @Override + protected Bitmap doInBackground(Integer... params) { + data = params[0]; + return decodeSampledBitmapFromResource(getResources(), data, 100, 100)); + } + + // Once complete, see if ImageView is still around and set bitmap. + @Override + protected void onPostExecute(Bitmap bitmap) { + if (imageViewReference != null && bitmap != null) { + final ImageView imageView = imageViewReference.get(); + if (imageView != null) { + imageView.setImageBitmap(bitmap); + } + } + } +} +</pre> + +<p>The {@link java.lang.ref.WeakReference} to the {@link android.widget.ImageView} ensures that the +{@link android.os.AsyncTask} does not prevent the {@link android.widget.ImageView} and anything it +references from being garbage collected. There’s no guarantee the {@link android.widget.ImageView} +is still around when the task finishes, so you must also check the reference in {@link +android.os.AsyncTask#onPostExecute(Result) onPostExecute()}. The {@link android.widget.ImageView} +may no longer exist, if for example, the user navigates away from the activity or if a +configuration change happens before the task finishes.</p> + +<p>To start loading the bitmap asynchronously, simply create a new task and execute it:</p> + +<pre> +public void loadBitmap(int resId, ImageView imageView) { + BitmapWorkerTask task = new BitmapWorkerTask(imageView); + task.execute(resId); +} +</pre> + +<h2 id="concurrency">Handle Concurrency</h2> + +<p>Common view components such as {@link android.widget.ListView} and {@link +android.widget.GridView} introduce another issue when used in conjunction with the {@link +android.os.AsyncTask} as demonstrated in the previous section. In order to be efficient with memory, +these components recycle child views as the user scrolls. If each child view triggers an {@link +android.os.AsyncTask}, there is no guarantee that when it completes, the associated view has not +already been recycled for use in another child view. Furthermore, there is no guarantee that the +order in which asynchronous tasks are started is the order that they complete.</p> + +<p>The blog post <a +href="http://android-developers.blogspot.com/2010/07/multithreading-for-performance.html">Multithreading +for Performance</a> further discusses dealing with concurrency, and offers a solution where the +{@link android.widget.ImageView} stores a reference to the most recent {@link android.os.AsyncTask} +which can later be checked when the task completes. Using a similar method, the {@link +android.os.AsyncTask} from the previous section can be extended to follow a similar pattern.</p> + +<p>Create a dedicated {@link android.graphics.drawable.Drawable} subclass to store a reference +back to the worker task. In this case, a {@link android.graphics.drawable.BitmapDrawable} is used so +that a placeholder image can be displayed in the {@link android.widget.ImageView} while the task +completes:</p> + +<a name="AsyncDrawable"></a> +<pre> +static class AsyncDrawable extends BitmapDrawable { + private final WeakReference<BitmapWorkerTask> bitmapWorkerTaskReference; + + public AsyncDrawable(Resources res, Bitmap bitmap, + BitmapWorkerTask bitmapWorkerTask) { + super(res, bitmap); + bitmapWorkerTaskReference = + new WeakReference<BitmapWorkerTask>(bitmapWorkerTask); + } + + public BitmapWorkerTask getBitmapWorkerTask() { + return bitmapWorkerTaskReference.get(); + } +} +</pre> + +<p>Before executing the <a href="#BitmapWorkerTask">{@code BitmapWorkerTask}</a>, you create an <a +href="#AsyncDrawable">{@code AsyncDrawable}</a> and bind it to the target {@link +android.widget.ImageView}:</p> + +<pre> +public void loadBitmap(int resId, ImageView imageView) { + if (cancelPotentialWork(resId, imageView)) { + final BitmapWorkerTask task = new BitmapWorkerTask(imageView); + final AsyncDrawable asyncDrawable = + new AsyncDrawable(getResources(), mPlaceHolderBitmap, task); + imageView.setImageDrawable(asyncDrawable); + task.execute(resId); + } +} +</pre> + +<p>The {@code cancelPotentialWork} method referenced in the code sample above checks if another +running task is already associated with the {@link android.widget.ImageView}. If so, it attempts to +cancel the previous task by calling {@link android.os.AsyncTask#cancel cancel()}. In a small number +of cases, the new task data matches the existing task and nothing further needs to happen. Here is +the implementation of {@code cancelPotentialWork}:</p> + +<pre> +public static boolean cancelPotentialWork(int data, ImageView imageView) { + final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); + + if (bitmapWorkerTask != null) { + final int bitmapData = bitmapWorkerTask.data; + if (bitmapData != data) { + // Cancel previous task + bitmapWorkerTask.cancel(true); + } else { + // The same work is already in progress + return false; + } + } + // No task associated with the ImageView, or an existing task was cancelled + return true; +} +</pre> + +<p>A helper method, {@code getBitmapWorkerTask()}, is used above to retrieve the task associated +with a particular {@link android.widget.ImageView}:</p> + +<pre> +private static BitmapWorkerTask getBitmapWorkerTask(ImageView imageView) { + if (imageView != null) { + final Drawable drawable = imageView.getDrawable(); + if (drawable instanceof AsyncDrawable) { + final AsyncDrawable asyncDrawable = (AsyncDrawable) drawable; + return asyncDrawable.getBitmapWorkerTask(); + } + } + return null; +} +</pre> + +<p>The last step is updating {@code onPostExecute()} in <a href="#BitmapWorkerTask">{@code +BitmapWorkerTask}</a> so that it checks if the task is cancelled and if the current task matches the +one associated with the {@link android.widget.ImageView}:</p> + +<a name="BitmapWorkerTaskUpdated"></a> +<pre> +class BitmapWorkerTask extends AsyncTask<Integer, Void, Bitmap> { + ... + + @Override + protected void onPostExecute(Bitmap bitmap) { + <strong>if (isCancelled()) { + bitmap = null; + }</strong> + + if (imageViewReference != null && bitmap != null) { + final ImageView imageView = imageViewReference.get(); + <strong>final BitmapWorkerTask bitmapWorkerTask = + getBitmapWorkerTask(imageView);</strong> + if (<strong>this == bitmapWorkerTask &&</strong> imageView != null) { + imageView.setImageBitmap(bitmap); + } + } + } +} +</pre> + +<p>This implementation is now suitable for use in {@link android.widget.ListView} and {@link +android.widget.GridView} components as well as any other components that recycle their child +views. Simply call {@code loadBitmap} where you normally set an image to your {@link +android.widget.ImageView}. For example, in a {@link android.widget.GridView} implementation this +would be in the {@link android.widget.Adapter#getView getView()} method of the backing adapter.</p>
\ No newline at end of file diff --git a/docs/html/training/tv/index.jd b/docs/html/training/tv/index.jd new file mode 100644 index 0000000..ae13c4a --- /dev/null +++ b/docs/html/training/tv/index.jd @@ -0,0 +1,52 @@ +page.title=Designing for TV + +trainingnavtop=true +startpage=true +next.title=Optimizing layouts for TV +next.link=optimizing-layouts-tv.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<!-- Required platform, tools, add-ons, devices, knowledge, etc. --> +<h2>Dependencies and prerequisites</h2> +<ul> + <li>Android 2.0 (API Level 5) or higher</li> +</ul> + +</div> +</div> +<p> + Smart TVs powered by Android bring your favorite Android apps to the best screen in your house. + Thousands of apps in the Google Play Store are already optimized for TVs. This class shows how + you can optimize your Android app for TVs, including how to build a layout that + works great when the user is ten feet away and navigating with a remote control. +</p> + +<h2>Lessons</h2> + +<dl> + <dt><b><a href="optimizing-layouts-tv.html">Optimizing Layouts for TV</a></b></dt> + <dd>Shows you how to optimize app layouts for TV screens, which have some unique characteristics such as: + <ul> + <li>permanent "landscape" mode</li> + <li>high-resolution displays</li> + <li>"10 foot UI" environment.</li> + </ul> + </dd> + + <dt><b><a href="optimizing-navigation-tv.html">Optimizing Navigation for TV</a></b></dt> + <dd>Shows you how to design navigation for TVs, including: + <ul> + <li>handling D-pad navigation</li> + <li>providing navigational feedback</li> + <li>providing easily-accessible controls on the screen.</li> + </ul> + </dd> + + <dt><b><a href="unsupported-features-tv.html">Handling features not supported on TV</a></b></dt> + <dd>Lists the hardware features that are usually not available on TVs. This lesson also shows you how to + provide alternatives for missing features or check for missing features and disable code at run time.</dd> +</dl>
\ No newline at end of file diff --git a/docs/html/training/tv/optimizing-layouts-tv.jd b/docs/html/training/tv/optimizing-layouts-tv.jd new file mode 100644 index 0000000..e4a8e69 --- /dev/null +++ b/docs/html/training/tv/optimizing-layouts-tv.jd @@ -0,0 +1,246 @@ +page.title=Optimizing Layouts for TV +parent.title=Designing for TV +parent.link=index.html + +trainingnavtop=true +next.title=Optimizing Navigation for TV +next.link=optimizing-navigation-tv.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#DesignLandscapeLayouts">Design Landscape Layouts</a></li> + <li><a href="#MakeTextControlsEasyToSee">Make Text and Controls Easy to See</a></li> + <li><a href="#DesignForLargeScreens">Design for High-Density Large Screens</a></li> + <li><a href="#HandleLargeBitmaps">Design to Handle Large Bitmaps</a></li> +</ol> + +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a></li> +</ul> + +</div> +</div> + +<p> +When your application is running on a television set, you should assume that the user is sitting about +ten feet away from the screen. This user environment is referred to as the +<a href="http://en.wikipedia.org/wiki/10-foot_user_interface">10-foot UI</a>. To provide your +users with a usable and enjoyable experience, you should style and lay out your UI accordingly.. +</p> +<p> +This lesson shows you how to optimize layouts for TV by: +</p> +<ul> + <li>Providing appropriate layout resources for landscape mode.</li> + <li>Ensuring that text and controls are large enough to be visible from a distance.</li> + <li>Providing high resolution bitmaps and icons for HD TV screens.</li> +</ul> + +<h2 id="DesignLandscapeLayouts">Design Landscape Layouts</h2> + +<p> +TV screens are always in landscape orientation. Follow these tips to build landscape layouts optimized for TV screens: +</p> +<ul> + <li>Put on-screen navigational controls on the left or right side of the screen and save the + vertical space for content.</li> + <li>Create UIs that are divided into sections, by using <a href="{@docRoot}guide/topics/fundamentals/fragments.html">Fragments</a> + and use view groups like {@link android.widget.GridView} instead + of {@link android.widget.ListView} to make better use of the + horizontal screen space.</li> + <li>Use view groups such as {@link android.widget.RelativeLayout} + or {@link android.widget.LinearLayout} to arrange views. + This allows the Android system to adjust the position of the views to the size, alignment, + aspect ratio, and pixel density of the TV screen.</li> + <li>Add sufficient margins between layout controls to avoid a cluttered UI.</li> +</ul> + +<p> +For example, the following layout is optimized for TV: +</p> + +<img src="{@docRoot}images/training/panoramio-grid.png" /> + +<p> +In this layout, the controls are on the lefthand side. The UI is displayed within a +{@link android.widget.GridView}, which is well-suited to landscape orientation. +In this layout both GridView and Fragment have the width and height set +dynamically, so they can adjust to the screen resolution. Controls are added to the left side Fragment programatically at runtime. +The layout file for this UI is {@code res/layout-land-large/photogrid_tv.xml}. +(This layout file is placed in {@code layout-land-large} because TVs have large screens with landscape orientation. For details refer to +<a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>.)</p> + +res/layout-land-large/photogrid_tv.xml +<pre> +<RelativeLayout + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <fragment + android:id="@+id/leftsidecontrols" + android:layout_width="0dip" + android:layout_marginLeft="5dip" + android:layout_height="match_parent" /> + + <GridView + android:id="@+id/gridview" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + +</RelativeLayout> +</pre> + +<p> +To set up action bar items on the left side of the screen, you can also include the <a +href="http://code.google.com/p/googletv-android-samples/source/browse/#git%2FLeftNavBarLibrary"> +Left navigation bar library</a> in your application to set up action items on the left side +of the screen, instead of creating a custom Fragment to add controls: +</p> + +<pre> +LeftNavBar bar = (LeftNavBarService.instance()).getLeftNavBar(this); +</pre> + +<p> +When you have an activity in which the content scrolls vertically, always use a left navigation bar; +otherwise, your users have to scroll to the top of the content to switch between the content view and +the ActionBar. Look at the +<a href="http://code.google.com/p/googletv-android-samples/source/browse/#git%2FLeftNavBarDemo"> +Left navigation bar sample app</a> to see how to simple it is to include the left navigation bar in your app. +</p> + +<h2 id="MakeTextControlsEasyToSee">Make Text and Controls Easy to See</h2> +<p> +The text and controls in a TV application's UI should be easily visible and navigable from a distance. +Follow these tips to make them easier to see from a distance : +</p> + +<ul> + <li>Break text into small chunks that users can quickly scan.</li> + <li>Use light text on a dark background. This style is easier to read on a TV.</li> + <li>Avoid lightweight fonts or fonts that have both very narrow and very broad strokes. Use simple sans-serif + fonts and use anti-aliasing to increase readability.</li> + <li>Use Android's standard font sizes: + <pre> + <TextView + android:id="@+id/atext" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:singleLine="true" + android:textAppearance="?android:attr/textAppearanceMedium"/> + </pre></li> + <li>Ensure that all your view widgets are large enough to be clearly visible to someone sitting 10 feet away + from the screen (this distance is greater for very large screens). The best way to do this is to use + layout-relative sizing rather than absolute sizing, and density-independent pixel units instead of absolute + pixel units. For example, to set the width of a widget, use wrap_content instead of a pixel measurement, + and to set the margin for a widget, use dip instead of px values. + </li> +</ul> +<p> + +</p> + +<h2 id="DesignForLargeScreens">Design for High-Density Large Screens</h2> + +<p> +The common HDTV display resolutions are 720p, 1080i, and 1080p. Design your UI for 1080p, and then +allow the Android system to downscale your UI to 720p if necessary. In general, downscaling (removing pixels) +does not degrade the UI (Notice that the converse is not true; you should avoid upscaling because it degrades +UI quality). +</p> + +<p> +To get the best scaling results for images, provide them as <a href="{@docRoot}guide/developing/tools/draw9patch.html"> +9-patch image</a> elements if possible. +If you provide low quality or small images in your layouts, they will appear pixelated, fuzzy, or grainy. This +is not a good experience for the user. Instead, use high-quality images. +</p> + +<p> +For more information on optimizing apps for large screens see <a href="{@docRoot}training/multiscreen/index.html"> +Designing for multiple screens</a>. +</p> + +<h2 id="HandleLargeBitmaps">Design to Handle Large Bitmaps</h2> + +<p> +The Android system has a limited amount of memory, so downloading and storing high-resolution images can often +cause out-of-memory errors in your app. To avoid this, follow these tips: +</p> + +<ul> + <li>Load images only when they're displayed on the screen. For example, when displaying multiple images in + a {@link android.widget.GridView} or + {@link android.widget.Gallery}, only load an image when + {@link android.widget.Adapter#getView(int, View, ViewGroup) getView()} + is called on the View's {@link android.widget.Adapter}. + </li> + <li>Call {@link android.graphics.Bitmap#recycle()} on + {@link android.graphics.Bitmap} views that are no longer needed. + </li> + <li>Use {@link java.lang.ref.WeakReference} for storing references + to {@link android.graphics.Bitmap} objects in a in-memory + <a href="{@link java.util.Collection}.</li> + <li>If you fetch images from the network, use {@link android.os.AsyncTask} + to fetch them and store them on the SD card for faster access. + Never do network transactions on the application's UI thread. + </li> + <li>Scale down really large images to a more appropriate size as you download them; otherwise, downloading the image + itself may cause an "Out of Memory" exception. Here is sample code that scales down images while downloading: + + <pre> + // Get the source image's dimensions + BitmapFactory.Options options = new BitmapFactory.Options(); + // This does not download the actual image, just downloads headers. + options.inJustDecodeBounds = true; + BitmapFactory.decodeFile(IMAGE_FILE_URL, options); + // The actual width of the image. + int srcWidth = options.outWidth; + // The actual height of the image. + int srcHeight = options.outHeight; + + // Only scale if the source is bigger than the width of the destination view. + if(desiredWidth > srcWidth) + desiredWidth = srcWidth; + + // Calculate the correct inSampleSize/scale value. This helps reduce memory use. It should be a power of 2. + int inSampleSize = 1; + while(srcWidth / 2 > desiredWidth){ + srcWidth /= 2; + srcHeight /= 2; + inSampleSize *= 2; + } + + float desiredScale = (float) desiredWidth / srcWidth; + + // Decode with inSampleSize + options.inJustDecodeBounds = false; + options.inDither = false; + options.inSampleSize = inSampleSize; + options.inScaled = false; + // Ensures the image stays as a 32-bit ARGB_8888 image. + // This preserves image quality. + options.inPreferredConfig = Bitmap.Config.ARGB_8888; + + Bitmap sampledSrcBitmap = BitmapFactory.decodeFile(IMAGE_FILE_URL, options); + + // Resize + Matrix matrix = new Matrix(); + matrix.postScale(desiredScale, desiredScale); + Bitmap scaledBitmap = Bitmap.createBitmap(sampledSrcBitmap, 0, 0, + sampledSrcBitmap.getWidth(), sampledSrcBitmap.getHeight(), matrix, true); + sampledSrcBitmap = null; + + // Save + FileOutputStream out = new FileOutputStream(LOCAL_PATH_TO_STORE_IMAGE); + scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); + scaledBitmap = null; + </pre> + </li> </ul>
\ No newline at end of file diff --git a/docs/html/training/tv/optimizing-navigation-tv.jd b/docs/html/training/tv/optimizing-navigation-tv.jd new file mode 100644 index 0000000..bb78258 --- /dev/null +++ b/docs/html/training/tv/optimizing-navigation-tv.jd @@ -0,0 +1,206 @@ +page.title=Optimizing Navigation for TV +parent.title=Designing for TV +parent.link=index.html + +trainingnavtop=true +previous.title=Optimizing Layouts for TV +previous.link=optimizing-layouts-tv.html +next.title=Handling Features Not Supported on TV +next.link=unsupported-features-tv.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#HandleDpadNavigation">Handle D-pad Navigation</a></li> + <li><a href="#HandleFocusSelection">Provide Clear Visual Indication for Focus and Selection</a></li> + <li><a href="#DesignForEasyNavigation">Design for Easy Navigation</a></li> +</ol> + +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}training/design-navigation/index.html">Designing Effective Navigation</a></li> +</ul> + +</div> +</div> + +<p> +An important aspect of the user experience when operating a TV is the direct human interface: a remote control. +As you optimize your Android application for TVs, you should pay special attention to how the user actually navigates +around your application when using a remote control instead of a touchscreen. +</p> +<p> +This lesson shows you how to optimize navigation for TV by: +</p> + +<ul> + <li>Ensuring all layout controls are D-pad navigable.</li> + <li>Providing highly obvious feedback for UI navigation.</li> + <li>Placing layout controls for easy access.</li> +</ul> + +<h2 id="HandleDpadNavigation">Handle D-pad Navigation</h2> + +<p> +On a TV, users navigate with controls on a TV remote, using either a D-pad or arrow keys. +This limits movement to up, down, left, and right. +To build a great TV-optimized app, you must provide a navigation scheme in which the user can +quickly learn how to navigate your app using the remote. +</p> + +<p> +When you design navigation for D-pad, follow these guidelines: +</p> + +<ul> + <li>Ensure that the D-pad can navigate to all the visible controls on the screen.</li> + <li>For scrolling lists with focus, D-pad up/down keys scroll the list and Enter key selects an item in the list. Ensure that users can + select an element in the list and that the list still scrolls when an element is selected.</li> + <li>Ensure that movement between controls is straightforward and predictable.</li> +</ul> + +<p> +Android usually handles navigation order between layout elements automatically, so you don't need to do anything extra. If the screen layout +makes navigation difficult, or if you want users to move through the layout in a specific way, you can set up explicit navigation for your +controls. +For example, for an {@code android.widget.EditText}, to define the next control to receive focus, use: +<pre> +<EditText android:id="@+id/LastNameField" android:nextFocusDown="@+id/FirstNameField"\> +</pre> +The following table lists all of the available navigation attributes: +</p> + +<table> +<tr> +<th>Attribute</th> +<th>Function</th> +</tr> +<tr> +<td>{@link android.R.attr#nextFocusDown}</td> +<td>Defines the next view to receive focus when the user navigates down.</td> +</tr> +<tr> +<td>{@link android.R.attr#nextFocusLeft}</td> +<td>Defines the next view to receive focus when the user navigates left.</td> +</tr> +<tr> +<td>{@link android.R.attr#nextFocusRight}</td> +<td>Defines the next view to receive focus when the user navigates right.</td> +</tr> +<tr> +<td>{@link android.R.attr#nextFocusUp}</td> +<td>Defines the next view to receive focus when the user navigates up.</td> +</tr> +</table> + +<p> +To use one of these explicit navigation attributes, set the value to the ID (android:id value) of another widget in the layout. You should set +up the navigation order as a loop, so that the last control directs focus back to the first one. +</p> + +<p> +Note: You should only use these attributes to modify the navigation order if the default order that the system applies does not work well. +</p> + +<h2 id="HandleFocusSelection">Provide Clear Visual Indication for Focus and Selection</h2> + +<p> +Use appropriate color highlights for all navigable and selectable elements in the UI. This makes it easy for users to know whether the control +is currently focused or selected when they navigate with a D-pad. Also, use uniform highlight scheme across your application. +</p> + +<p> +Android provides <a href="{@docRoot}guide/topics/resources/drawable-resource.html#StateList">Drawable State List Resources</a> to implement highlights +for selected and focused controls. For example: +</p> + +res/drawable/button.xml: +<pre> +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" + android:drawable="@drawable/button_pressed" /> <!-- pressed --> + <item android:state_focused="true" + android:drawable="@drawable/button_focused" /> <!-- focused --> + <item android:state_hovered="true" + android:drawable="@drawable/button_focused" /> <!-- hovered --> + <item android:drawable="@drawable/button_normal" /> <!-- default --> +</selector> +</pre> + +<p> +This layout XML applies the above state list drawable to a {@link android.widget.Button}: +</p> +<pre> +<Button + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:background="@drawable/button" /> +</pre> + +<p> +Provide sufficient padding within the focusable and selectable controls so that the highlights around them are clearly visible. +</p> + +<h2 id="DesignForEasyNavigation">Design for Easy Navigation</h2> + +<p> +Users should be able to navigate to any UI control with a couple of D-pad clicks. Navigation should be easy and intuitive to +understand. For any non-intuitive actions, provide users with written help, using a dialog triggered by a help button or action bar icon. +</p> + +<p> +Predict the next screen that the user will want to navigate to and provide one click navigation to it. If the current screen UI is very sparse, +consider making it a multi pane screen. Use fragments for making multi-pane screens. For example, consider the multi-pane UI below with continent names +on the left and list of cool places in each continent on the right. +</p> + +<img src="{@docRoot}images/training/cool-places.png" alt="" /> + +<p> +The above UI consists of three Fragments - <code>left_side_action_controls</code>, <code>continents</code> and +<code>places</code> - as shown in its layout +xml file below. Such multi-pane UIs make D-pad navigation easier and make good use of the horizontal screen space for +TVs. +</p> +res/layout/cool_places.xml +<pre> +<LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal" + > + <fragment + android:id="@+id/left_side_action_controls" + android:layout_width="0px" + android:layout_height="match_parent" + android:layout_marginLeft="10dip" + android:layout_weight="0.2"/> + <fragment + android:id="@+id/continents" + android:layout_width="0px" + android:layout_height="match_parent" + android:layout_marginLeft="10dip" + android:layout_weight="0.2"/> + + <fragment + android:id="@+id/places" + android:layout_width="0px" + android:layout_height="match_parent" + android:layout_marginLeft="10dip" + android:layout_weight="0.6"/> + +</LinearLayout> +</pre> + +<p> +Also, notice in the UI layout above action controls are on the left hand side of a vertically scrolling list to make +them easily accessible using D-pad. +In general, for layouts with horizontally scrolling components, place action controls on left or right hand side and +vice versa for vertically scrolling components. +</p> + diff --git a/docs/html/training/tv/unsupported-features-tv.jd b/docs/html/training/tv/unsupported-features-tv.jd new file mode 100644 index 0000000..6b0f8c8 --- /dev/null +++ b/docs/html/training/tv/unsupported-features-tv.jd @@ -0,0 +1,156 @@ +page.title=Handling Features Not Supported on TV +parent.title=Designing for TV +parent.link=index.html + +trainingnavtop=true +previous.title=Optimizing Navigation for TV +previous.link=optimizing-navigation-tv.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#WorkaroundUnsupportedFeatures">Work Around Features Not Supported on TV</a></li> + <li><a href="#CheckAvailableFeatures">Check for Available Features at Runtime</a></li> +</ol> + +</div> +</div> + +<p> +TVs are much different from other Android-powered devices: +</p> +<ul> + <li>They're not mobile.</li> + <li>Out of habit, people use them for watching media with little or no interaction.</li> + <li>People interact with them from a distance.</li> +</ul> + +<p> +Because TVs have a different purpose from other devices, they usually don't have hardware features +that other Android-powered devices often have. For this reason, the Android system does not +support the following features for a TV device: +<table> +<tr> +<th>Hardware</th> +<th>Android feature descriptor</th> +</tr> +<tr> +<td>Camera</td> +<td>android.hardware.camera</td> +</tr> +<tr> +<td>GPS</td> +<td>android.hardware.location.gps</td> +</tr> +<tr> +<td>Microphone</td> +<td>android.hardware.microphone</td> +</tr> +<tr> +<td>Near Field Communications (NFC)</td> +<td>android.hardware.nfc</td> +</tr> +<tr> +<td>Telephony</td> +<td>android.hardware.telephony</td> +</tr> +<tr> +<td>Touchscreen</td> +<td>android.hardware.touchscreen</td> +</tr> +</table> +</p> + +<p> +This lesson shows you how to work around features that are not available on TV by: +<ul> + <li>Providing work arounds for some non-supported features.</li> + <li>Checking for available features at runtime and conditionally activating/deactivating certain code + paths based on availability of those features.</li> +</ul> +</p> + + +<h2 id="WorkaroundUnsupportedFeatures">Work Around Features Not Supported on TV</h2> + +<p> +Android doesn't support touchscreen interaction for TV devices, most TVs don't have touch screens, +and interacting with a TV using a touchscreen is not consistent with the 10 foot environment. For +these reasons, users interact with Android-powered TVs using a remote. In consideration of this, +ensure that every control in your app can be accessed with the D-pad. Refer back to the previous two lessons +<a href="{@docRoot}training/tv/optimizing-layouts-tv">Optimizing Layouts for TV</a> and +<a href="{@docRoot}training/tv/optimizing-navigation-tv">Optimize Navigation for TV</a> for more details +on this topic. The Android system assumes that a device has a touchscreen, so if you want your application +to run on a TV, you must <strong>explicitly</strong> disable the touchscreen requirement in your manifest file: +<pre> +<uses-feature android:name="android.hardware.touchscreen" android:required="false"/> +</pre> +</p> + +<p> +Although a TV doesn't have a camera, you can still provide a photography-related application on a TV. +For example, if you have an app that takes, views and edits photos, you can disable its picture-taking +functionality for TVs and still allow users to view and even edit photos. The next section talks about how to +deactivate or activate specific functions in the application based on runtime device type detection. +</p> + +<p> +Because TVs are stationary, indoor devices, they don't have built-in GPS. If your application uses location +information, allow users to search for a location or use a "static" location provider to get +a location from the zip code configured during the TV setup. +<pre> +LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); +Location location = locationManager.getLastKnownLocation("static"); +Geocoder geocoder = new Geocoder(this); +Address address = null; + +try { + address = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1).get(0); + Log.d("Zip code", address.getPostalCode()); + +} catch (IOException e) { + Log.e(TAG, "Geocoder error", e); +} +</pre> +</p> + +<p> +TVs usually don't support microphones, but if you have an application that uses voice control, +you can create a mobile device app that takes voice input and then acts as a remote control for a TV. +</p> + +<h2 id="CheckAvailableFeatures">Check for Available Features at Runtime</h2> + +<p> +To check if a feature is available at runtime, call +{@link android.content.pm.PackageManager#hasSystemFeature(String)}. + This method takes a single argument : a string corresponding to the +feature you want to check. For example, to check for touchscreen, use +{@link android.content.pm.PackageManager#hasSystemFeature(String)} with the argument +{@link android.content.pm.PackageManager#FEATURE_TOUCHSCREEN}. +</p> + +<p> +The following code snippet demonstrates how to detect device type at runtime based on supported features: + +<pre> +// Check if android.hardware.telephony feature is available. +if (getPackageManager().hasSystemFeature("android.hardware.telephony")) { + Log.d("Mobile Test", "Running on phone"); +// Check if android.hardware.touchscreen feature is available. +} else if (getPackageManager().hasSystemFeature("android.hardware.touchscreen")) { + Log.d("Tablet Test", "Running on devices that don't support telphony but have a touchscreen."); +} else { + Log.d("TV Test", "Running on a TV!"); +} +</pre> +</p> + +<p> +This is just one example of using runtime checks to deactivate app functionality that depends on features +that aren't available on TVs. +</p>
\ No newline at end of file diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java index 6f939be..c726d0e 100644 --- a/graphics/java/android/graphics/Bitmap.java +++ b/graphics/java/android/graphics/Bitmap.java @@ -19,6 +19,7 @@ package android.graphics; import android.os.Parcel; import android.os.Parcelable; import android.util.DisplayMetrics; + import java.io.OutputStream; import java.nio.Buffer; import java.nio.ByteBuffer; @@ -57,6 +58,7 @@ public final class Bitmap implements Parcelable { private final boolean mIsMutable; private byte[] mNinePatchChunk; // may be null + private int[] mLayoutBounds; // may be null private int mWidth = -1; private int mHeight = -1; private boolean mRecycled; @@ -95,6 +97,19 @@ public final class Bitmap implements Parcelable { */ /*package*/ Bitmap(int nativeBitmap, byte[] buffer, boolean isMutable, byte[] ninePatchChunk, int density) { + this(nativeBitmap, buffer, isMutable, ninePatchChunk, null, density); + } + + /** + * @noinspection UnusedDeclaration + */ + /* Private constructor that must received an already allocated native + bitmap int (pointer). + + This can be called from JNI code. + */ + /*package*/ Bitmap(int nativeBitmap, byte[] buffer, boolean isMutable, byte[] ninePatchChunk, + int[] layoutBounds, int density) { if (nativeBitmap == 0) { throw new RuntimeException("internal error: native bitmap is 0"); } @@ -106,6 +121,7 @@ public final class Bitmap implements Parcelable { mIsMutable = isMutable; mNinePatchChunk = ninePatchChunk; + mLayoutBounds = layoutBounds; if (density >= 0) { mDensity = density; } @@ -164,6 +180,16 @@ public final class Bitmap implements Parcelable { } /** + * Sets the layout bounds as an array of left, top, right, bottom integers + * @param bounds the array containing the padding values + * + * @hide + */ + public void setLayoutBounds(int[] bounds) { + mLayoutBounds = bounds; + } + + /** * Free the native object associated with this bitmap, and clear the * reference to the pixel data. This will not free the pixel data synchronously; * it simply allows it to be garbage collected if there are no other references. @@ -690,6 +716,14 @@ public final class Bitmap implements Parcelable { } /** + * @hide + * @return the layout padding [left, right, top, bottom] + */ + public int[] getLayoutBounds() { + return mLayoutBounds; + } + + /** * Specifies the known formats a bitmap can be compressed into */ public enum CompressFormat { diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java index c5705f6..1599e40 100644 --- a/graphics/java/android/graphics/BitmapFactory.java +++ b/graphics/java/android/graphics/BitmapFactory.java @@ -424,6 +424,7 @@ public class BitmapFactory { throw new ArrayIndexOutOfBoundsException(); } Bitmap bm = nativeDecodeByteArray(data, offset, length, opts); + if (bm == null && opts != null && opts.inBitmap != null) { throw new IllegalArgumentException("Problem decoding into existing bitmap"); } @@ -554,7 +555,6 @@ public class BitmapFactory { if (targetDensity == 0 || density == targetDensity || density == opts.inScreenDensity) { return bm; } - byte[] np = bm.getNinePatchChunk(); final boolean isNinePatch = np != null && NinePatch.isNinePatchChunk(np); if (opts.inScaled || isNinePatch) { diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java index dcda67d..7e92973 100644 --- a/graphics/java/android/graphics/Canvas.java +++ b/graphics/java/android/graphics/Canvas.java @@ -40,14 +40,8 @@ public class Canvas { // assigned in constructors, freed in finalizer final int mNativeCanvas; - /* Our native canvas can be either a raster, gl, or picture canvas. - If we are raster, then mGL will be null, and mBitmap may or may not be - present (our default constructor creates a raster canvas but no - java-bitmap is). If we are a gl-based, then mBitmap will be null, and - mGL will not be null. Thus both cannot be non-null, but its possible - for both to be null. - */ - private Bitmap mBitmap; // if not null, mGL must be null + // may be null + private Bitmap mBitmap; // optional field set by the caller private DrawFilter mDrawFilter; @@ -66,7 +60,7 @@ public class Canvas { // Used by native code @SuppressWarnings({"UnusedDeclaration"}) - private int mSurfaceFormat; + private int mSurfaceFormat; /** * Flag for drawTextRun indicating left-to-right run direction. diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java index 0521e69..e101581 100644 --- a/graphics/java/android/graphics/SurfaceTexture.java +++ b/graphics/java/android/graphics/SurfaceTexture.java @@ -161,7 +161,31 @@ public class SurfaceTexture { public void updateTexImage() { int err = nativeUpdateTexImage(); if (err != 0) { - throw new RuntimeException("Error during updateTexImage (see logs)"); + throw new RuntimeException("Error during updateTexImage (see logcat for details)"); + } + } + + /** + * Detach the SurfaceTexture from the OpenGL ES context with which it is currently associated. + * This can be used to change from one OpenGL ES context to another. + * + * @hide + */ + public void detachFromGLContext() { + int err = nativeDetachFromGLContext(); + if (err != 0) { + throw new RuntimeException("Error during detachFromGLContext (see logcat for details)"); + } + } + + /** + * + * @hide + */ + public void attachToGLContext(int texName) { + int err = nativeAttachToGLContext(texName); + if (err != 0) { + throw new RuntimeException("Error during detachFromGLContext (see logcat for details)"); } } @@ -269,6 +293,8 @@ public class SurfaceTexture { private native long nativeGetTimestamp(); private native void nativeSetDefaultBufferSize(int width, int height); private native int nativeUpdateTexImage(); + private native int nativeDetachFromGLContext(); + private native int nativeAttachToGLContext(int texName); private native int nativeGetQueuedCount(); private native void nativeRelease(); diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java index 043adae..86e824b 100644 --- a/graphics/java/android/graphics/drawable/Drawable.java +++ b/graphics/java/android/graphics/drawable/Drawable.java @@ -773,7 +773,13 @@ public abstract class Drawable { np = null; pad = null; } - return drawableFromBitmap(res, bm, np, pad, srcName); + int[] layoutBounds = bm.getLayoutBounds(); + Rect layoutBoundsRect = null; + if (layoutBounds != null) { + layoutBoundsRect = new Rect(layoutBounds[0], layoutBounds[1], + layoutBounds[2], layoutBounds[3]); + } + return drawableFromBitmap(res, bm, np, pad, layoutBoundsRect, srcName); } return null; } @@ -875,7 +881,7 @@ public abstract class Drawable { Bitmap bm = BitmapFactory.decodeFile(pathName); if (bm != null) { - return drawableFromBitmap(null, bm, null, null, pathName); + return drawableFromBitmap(null, bm, null, null, null, pathName); } return null; @@ -956,10 +962,12 @@ public abstract class Drawable { } private static Drawable drawableFromBitmap(Resources res, Bitmap bm, byte[] np, - Rect pad, String srcName) { + Rect pad, Rect layoutBounds, String srcName) { if (np != null) { - return new NinePatchDrawable(res, bm, np, pad, srcName); + NinePatchDrawable npd = new NinePatchDrawable(res, bm, np, pad, srcName); + npd.setLayoutBounds(layoutBounds); + return npd; } return new BitmapDrawable(res, bm); diff --git a/graphics/java/android/graphics/drawable/NinePatchDrawable.java b/graphics/java/android/graphics/drawable/NinePatchDrawable.java index 18b8bc7..1272071 100644 --- a/graphics/java/android/graphics/drawable/NinePatchDrawable.java +++ b/graphics/java/android/graphics/drawable/NinePatchDrawable.java @@ -47,6 +47,7 @@ public class NinePatchDrawable extends Drawable { private NinePatchState mNinePatchState; private NinePatch mNinePatch; private Rect mPadding; + private Rect mLayoutBounds; private Paint mPaint; private boolean mMutated; @@ -98,6 +99,13 @@ public class NinePatchDrawable extends Drawable { mNinePatchState.mTargetDensity = mTargetDensity; } + /** + * @hide + */ + void setLayoutBounds(Rect layoutBounds) { + mLayoutBounds = layoutBounds; + } + private void setNinePatchState(NinePatchState state, Resources res) { mNinePatchState = state; mNinePatch = state.mNinePatch; @@ -258,7 +266,7 @@ public class NinePatchDrawable extends Drawable { } options.inScreenDensity = DisplayMetrics.DENSITY_DEVICE; - final Rect padding = new Rect(); + final Rect padding = new Rect(); Bitmap bitmap = null; try { diff --git a/include/androidfw/Input.h b/include/androidfw/Input.h index a4ebd95..f8cbdde 100644 --- a/include/androidfw/Input.h +++ b/include/androidfw/Input.h @@ -811,6 +811,31 @@ private: VelocityTracker mVelocityTracker; }; +/* + * Identifies a device. + */ +struct InputDeviceIdentifier { + inline InputDeviceIdentifier() : + bus(0), vendor(0), product(0), version(0) { + } + + // Information provided by the kernel. + String8 name; + String8 location; + String8 uniqueId; + uint16_t bus; + uint16_t vendor; + uint16_t product; + uint16_t version; + + // A composite input device descriptor string that uniquely identifies the device + // even across reboots or reconnections. The value of this field is used by + // upper layers of the input system to associate settings with individual devices. + // It is hashed from whatever kernel provided information is available. + // Ideally, the way this value is computed should not change between Android releases + // because that would invalidate persistent settings that rely on it. + String8 descriptor; +}; /* * Describes the characteristics and capabilities of an input device. @@ -830,10 +855,11 @@ public: float fuzz; }; - void initialize(int32_t id, const String8& name); + void initialize(int32_t id, const String8& name, const String8& descriptor); inline int32_t getId() const { return mId; } inline const String8 getName() const { return mName; } + inline const String8 getDescriptor() const { return mDescriptor; } inline uint32_t getSources() const { return mSources; } const MotionRange* getMotionRange(int32_t axis, uint32_t source) const; @@ -856,6 +882,7 @@ public: private: int32_t mId; String8 mName; + String8 mDescriptor; uint32_t mSources; int32_t mKeyboardType; String8 mKeyCharacterMapFile; @@ -863,23 +890,6 @@ private: Vector<MotionRange> mMotionRanges; }; -/* - * Identifies a device. - */ -struct InputDeviceIdentifier { - inline InputDeviceIdentifier() : - bus(0), vendor(0), product(0), version(0) { - } - - String8 name; - String8 location; - String8 uniqueId; - uint16_t bus; - uint16_t vendor; - uint16_t product; - uint16_t version; -}; - /* Types of input device configuration files. */ enum InputDeviceConfigurationFileType { INPUT_DEVICE_CONFIGURATION_FILE_TYPE_CONFIGURATION = 0, /* .idc file */ diff --git a/libs/androidfw/Input.cpp b/libs/androidfw/Input.cpp index da57839..2e4b26f 100644 --- a/libs/androidfw/Input.cpp +++ b/libs/androidfw/Input.cpp @@ -1226,21 +1226,24 @@ void VelocityControl::move(nsecs_t eventTime, float* deltaX, float* deltaY) { // --- InputDeviceInfo --- InputDeviceInfo::InputDeviceInfo() { - initialize(-1, String8("uninitialized device info")); + initialize(-1, String8("uninitialized device info"), String8("unknown")); } InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other) : - mId(other.mId), mName(other.mName), mSources(other.mSources), + mId(other.mId), mName(other.mName), mDescriptor(other.mDescriptor), + mSources(other.mSources), mKeyboardType(other.mKeyboardType), + mKeyCharacterMapFile(other.mKeyCharacterMapFile), mMotionRanges(other.mMotionRanges) { } InputDeviceInfo::~InputDeviceInfo() { } -void InputDeviceInfo::initialize(int32_t id, const String8& name) { +void InputDeviceInfo::initialize(int32_t id, const String8& name, const String8& descriptor) { mId = id; mName = name; + mDescriptor = descriptor; mSources = 0; mKeyboardType = AINPUT_KEYBOARD_TYPE_NONE; mMotionRanges.clear(); diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index ec9b56b..2a908ab 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -260,7 +260,7 @@ status_t OpenGLRenderer::invokeFunctors(Rect& dirty) { Rect localDirty(info.dirtyLeft, info.dirtyTop, info.dirtyRight, info.dirtyBottom); dirty.unionWith(localDirty); - if (result == DrawGlInfo::kStatusInvoke) { + if (result & DrawGlInfo::kStatusInvoke) { mFunctors.push(f); } } @@ -300,7 +300,7 @@ status_t OpenGLRenderer::callDrawGLFunction(Functor* functor, Rect& dirty) { Rect localDirty(info.dirtyLeft, info.dirtyTop, info.dirtyRight, info.dirtyBottom); dirty.unionWith(localDirty); - if (result == DrawGlInfo::kStatusInvoke) { + if (result & DrawGlInfo::kStatusInvoke) { mFunctors.push(functor); } } @@ -631,6 +631,9 @@ void OpenGLRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) { const bool fboLayer = current->flags & Snapshot::kFlagIsFboLayer; if (fboLayer) { + // Detach the texture from the FBO + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); + // Unbind current FBO and restore previous one glBindFramebuffer(GL_FRAMEBUFFER, previous->fbo); } @@ -671,11 +674,6 @@ void OpenGLRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) { // code path // See LayerRenderer::destroyLayer(Layer*) - // Detach the texture from the FBO - glBindFramebuffer(GL_FRAMEBUFFER, current->fbo); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); - glBindFramebuffer(GL_FRAMEBUFFER, previous->fbo); - // Put the FBO name back in the cache, if it doesn't fit, it will be destroyed mCaches.fboCache.put(current->fbo); layer->setFbo(0); @@ -1330,18 +1328,18 @@ void OpenGLRenderer::setupDrawVertices(GLvoid* vertices) { * are set up for each individual segment. */ void OpenGLRenderer::setupDrawAALine(GLvoid* vertices, GLvoid* widthCoords, - GLvoid* lengthCoords, float boundaryWidthProportion) { + GLvoid* lengthCoords, float boundaryWidthProportion, int& widthSlot, int& lengthSlot) { bool force = mCaches.unbindMeshBuffer(); mCaches.bindPositionVertexPointer(force, mCaches.currentProgram->position, vertices, gAAVertexStride); mCaches.resetTexCoordsVertexPointer(); mCaches.unbindIndicesBuffer(); - int widthSlot = mCaches.currentProgram->getAttrib("vtxWidth"); + widthSlot = mCaches.currentProgram->getAttrib("vtxWidth"); glEnableVertexAttribArray(widthSlot); glVertexAttribPointer(widthSlot, 1, GL_FLOAT, GL_FALSE, gAAVertexStride, widthCoords); - int lengthSlot = mCaches.currentProgram->getAttrib("vtxLength"); + lengthSlot = mCaches.currentProgram->getAttrib("vtxLength"); glEnableVertexAttribArray(lengthSlot); glVertexAttribPointer(lengthSlot, 1, GL_FLOAT, GL_FALSE, gAAVertexStride, lengthCoords); @@ -1350,7 +1348,12 @@ void OpenGLRenderer::setupDrawAALine(GLvoid* vertices, GLvoid* widthCoords, // Setting the inverse value saves computations per-fragment in the shader int inverseBoundaryWidthSlot = mCaches.currentProgram->getUniform("inverseBoundaryWidth"); - glUniform1f(inverseBoundaryWidthSlot, (1 / boundaryWidthProportion)); + glUniform1f(inverseBoundaryWidthSlot, 1.0f / boundaryWidthProportion); +} + +void OpenGLRenderer::finishDrawAALine(const int widthSlot, const int lengthSlot) { + glDisableVertexAttribArray(widthSlot); + glDisableVertexAttribArray(lengthSlot); } void OpenGLRenderer::finishDrawTexture() { @@ -1722,13 +1725,18 @@ void OpenGLRenderer::drawAARect(float left, float top, float right, float bottom float width = right - left; float height = bottom - top; + int widthSlot; + int lengthSlot; + float boundaryWidthProportion = (width != 0) ? (2 * boundarySizeX) / width : 0; float boundaryHeightProportion = (height != 0) ? (2 * boundarySizeY) / height : 0; - setupDrawAALine((void*) aaVertices, widthCoords, lengthCoords, boundaryWidthProportion); + setupDrawAALine((void*) aaVertices, widthCoords, lengthCoords, + boundaryWidthProportion, widthSlot, lengthSlot); + int boundaryLengthSlot = mCaches.currentProgram->getUniform("boundaryLength"); int inverseBoundaryLengthSlot = mCaches.currentProgram->getUniform("inverseBoundaryLength"); glUniform1f(boundaryLengthSlot, boundaryHeightProportion); - glUniform1f(inverseBoundaryLengthSlot, (1 / boundaryHeightProportion)); + glUniform1f(inverseBoundaryLengthSlot, (1.0f / boundaryHeightProportion)); if (!quickReject(left, top, right, bottom)) { AAVertex::set(aaVertices++, left, bottom, 1, 1); @@ -1738,6 +1746,8 @@ void OpenGLRenderer::drawAARect(float left, float top, float right, float bottom dirtyLayer(left, top, right, bottom, *mSnapshot->transform); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } + + finishDrawAALine(widthSlot, lengthSlot); } /** @@ -1768,11 +1778,14 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { // A stroke width of 0 has a special meaning in Skia: // it draws a line 1 px wide regardless of current transform bool isHairLine = paint->getStrokeWidth() == 0.0f; + float inverseScaleX = 1.0f; float inverseScaleY = 1.0f; bool scaled = false; + int alpha; SkXfermode::Mode mode; + int generatedVerticesCount = 0; int verticesCount = count; if (count > 4) { @@ -1792,10 +1805,13 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { float m10 = mat->data[Matrix4::kSkewX]; float m11 = mat->data[Matrix4::kScaleX]; float m12 = mat->data[6]; + float scaleX = sqrtf(m00 * m00 + m01 * m01); float scaleY = sqrtf(m10 * m10 + m11 * m11); + inverseScaleX = (scaleX != 0) ? (inverseScaleX / scaleX) : 0; inverseScaleY = (scaleY != 0) ? (inverseScaleY / scaleY) : 0; + if (inverseScaleX != 1.0f || inverseScaleY != 1.0f) { scaled = true; } @@ -1825,10 +1841,16 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { // Expand boundary to enable AA calculations on the quad border halfStrokeWidth += .5f; } + + int widthSlot; + int lengthSlot; + Vertex lines[verticesCount]; Vertex* vertices = &lines[0]; + AAVertex wLines[verticesCount]; AAVertex* aaVertices = &wLines[0]; + if (CC_UNLIKELY(!isAA)) { setupDrawVertices(vertices); } else { @@ -1840,7 +1862,8 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { // We will need to calculate the actual width proportion on each segment for // scaled non-hairlines, since the boundary proportion may differ per-axis when scaled. float boundaryWidthProportion = 1 / (2 * halfStrokeWidth); - setupDrawAALine((void*) aaVertices, widthCoords, lengthCoords, boundaryWidthProportion); + setupDrawAALine((void*) aaVertices, widthCoords, lengthCoords, + boundaryWidthProportion, widthSlot, lengthSlot); } AAVertex* prevAAVertex = NULL; @@ -1850,10 +1873,12 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { int inverseBoundaryLengthSlot = -1; int boundaryWidthSlot = -1; int inverseBoundaryWidthSlot = -1; + for (int i = 0; i < count; i += 4) { // a = start point, b = end point vec2 a(points[i], points[i + 1]); vec2 b(points[i + 2], points[i + 3]); + float length = 0; float boundaryLengthProportion = 0; float boundaryWidthProportion = 0; @@ -1870,6 +1895,7 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { } n *= wideningFactor; } + if (scaled) { n.x *= inverseScaleX; n.y *= inverseScaleY; @@ -1880,11 +1906,13 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { extendedN /= 2; extendedN.x *= inverseScaleX; extendedN.y *= inverseScaleY; + float extendedNLength = extendedN.length(); // We need to set this value on the shader prior to drawing boundaryWidthProportion = extendedNLength / (halfStrokeWidth + extendedNLength); n += extendedN; } + float x = n.x; n.x = -n.y; n.y = x; @@ -1894,6 +1922,7 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { vec2 abVector = (b - a); length = abVector.length(); abVector.normalize(); + if (scaled) { abVector.x *= inverseScaleX; abVector.y *= inverseScaleY; @@ -1902,6 +1931,7 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { } else { boundaryLengthProportion = .5 / (length + 1); } + abVector /= 2; a -= abVector; b += abVector; @@ -1930,10 +1960,12 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { Vertex::set(vertices++, p1.x, p1.y); generatedVerticesCount += 2; } + Vertex::set(vertices++, p1.x, p1.y); Vertex::set(vertices++, p2.x, p2.y); Vertex::set(vertices++, p4.x, p4.y); Vertex::set(vertices++, p3.x, p3.y); + prevVertex = vertices - 1; generatedVerticesCount += 4; } else { @@ -1946,14 +1978,17 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { inverseBoundaryWidthSlot = mCaches.currentProgram->getUniform("inverseBoundaryWidth"); } + glUniform1f(boundaryWidthSlot, boundaryWidthProportion); glUniform1f(inverseBoundaryWidthSlot, (1 / boundaryWidthProportion)); } + if (boundaryLengthSlot < 0) { boundaryLengthSlot = mCaches.currentProgram->getUniform("boundaryLength"); inverseBoundaryLengthSlot = mCaches.currentProgram->getUniform("inverseBoundaryLength"); } + glUniform1f(boundaryLengthSlot, boundaryLengthProportion); glUniform1f(inverseBoundaryLengthSlot, (1 / boundaryLengthProportion)); @@ -1967,21 +2002,29 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { AAVertex::set(aaVertices++, p4.x, p4.y, 1, 1); generatedVerticesCount += 2; } + AAVertex::set(aaVertices++, p4.x, p4.y, 1, 1); AAVertex::set(aaVertices++, p1.x, p1.y, 1, 0); AAVertex::set(aaVertices++, p3.x, p3.y, 0, 1); AAVertex::set(aaVertices++, p2.x, p2.y, 0, 0); + prevAAVertex = aaVertices - 1; generatedVerticesCount += 4; } + dirtyLayer(a.x == b.x ? left - 1 : left, a.y == b.y ? top - 1 : top, a.x == b.x ? right: right, a.y == b.y ? bottom: bottom, *mSnapshot->transform); } } + if (generatedVerticesCount > 0) { glDrawArrays(GL_TRIANGLE_STRIP, 0, generatedVerticesCount); } + + if (isAA) { + finishDrawAALine(widthSlot, lengthSlot); + } } void OpenGLRenderer::drawPoints(float* points, int count, SkPaint* paint) { @@ -2027,10 +2070,12 @@ void OpenGLRenderer::drawPoints(float* points, int count, SkPaint* paint) { for (int i = 0; i < count; i += 2) { TextureVertex::set(vertex++, points[i], points[i + 1], 0.0f, 0.0f); generatedVerticesCount++; + float left = points[i] - halfWidth; float right = points[i] + halfWidth; float top = points[i + 1] - halfWidth; float bottom = points [i + 1] + halfWidth; + dirtyLayer(left, top, right, bottom, *mSnapshot->transform); } diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index ab137cc..b52d2b0 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -553,7 +553,8 @@ private: void setupDrawMeshIndices(GLvoid* vertices, GLvoid* texCoords); void setupDrawVertices(GLvoid* vertices); void setupDrawAALine(GLvoid* vertices, GLvoid* distanceCoords, GLvoid* lengthCoords, - float strokeWidth); + float strokeWidth, int& widthSlot, int& lengthSlot); + void finishDrawAALine(const int widthSlot, const int lengthSlot); void finishDrawTexture(); void accountForClear(SkXfermode::Mode mode); diff --git a/libs/storage/Android.mk b/libs/storage/Android.mk index b42c34f..7a9dd6c 100644 --- a/libs/storage/Android.mk +++ b/libs/storage/Android.mk @@ -7,10 +7,6 @@ LOCAL_SRC_FILES:= \ IObbActionListener.cpp \ IMountService.cpp -LOCAL_STATIC_LIBRARIES := \ - libutils \ - libbinder - LOCAL_MODULE:= libstorage include $(BUILD_STATIC_LIBRARY) diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index 82dd308..41d5c32 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -903,9 +903,18 @@ public class AudioManager { * @hide */ public void setMasterMute(boolean state) { + setMasterMute(state, FLAG_SHOW_UI); + } + + /** + * set master mute state with optional flags. + * + * @hide + */ + public void setMasterMute(boolean state, int flags) { IAudioService service = getService(); try { - service.setMasterMute(state, mICallBack); + service.setMasterMute(state, flags, mICallBack); } catch (RemoteException e) { Log.e(TAG, "Dead object in setMasterMute", e); } @@ -2228,6 +2237,14 @@ public class AudioManager { * docking station */ public static final int DEVICE_OUT_DGTL_DOCK_HEADSET = AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET; + /** {@hide} The audio output device code for a USB audio accessory. The accessory is in USB host + * mode and the Android device in USB device mode + */ + public static final int DEVICE_OUT_USB_ACCESSORY = AudioSystem.DEVICE_OUT_USB_ACCESSORY; + /** {@hide} The audio output device code for a USB audio device. The device is in USB device + * mode and the Android device in USB host mode + */ + public static final int DEVICE_OUT_USB_DEVICE = AudioSystem.DEVICE_OUT_USB_DEVICE; /** {@hide} This is not used as a returned value from {@link #getDevicesForStream}, but could be * used in the future in a set method to select whatever default device is chosen by the * platform-specific implementation. diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index c66a03f..48d3712 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -126,6 +126,7 @@ public class AudioService extends IAudioService.Stub { private static final int MSG_RCDISPLAY_CLEAR = 13; private static final int MSG_RCDISPLAY_UPDATE = 14; private static final int MSG_SET_ALL_VOLUMES = 15; + private static final int MSG_PERSIST_MASTER_VOLUME_MUTE = 16; // flags for MSG_PERSIST_VOLUME indicating if current and/or last audible volume should be @@ -388,9 +389,11 @@ public class AudioService extends IAudioService.Stub { intentFilter.addAction(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED); intentFilter.addAction(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED); intentFilter.addAction(Intent.ACTION_DOCK_EVENT); - intentFilter.addAction(Intent.ACTION_USB_ANLG_HEADSET_PLUG); - intentFilter.addAction(Intent.ACTION_USB_DGTL_HEADSET_PLUG); + intentFilter.addAction(Intent.ACTION_ANALOG_AUDIO_DOCK_PLUG); + intentFilter.addAction(Intent.ACTION_DIGITAL_AUDIO_DOCK_PLUG); intentFilter.addAction(Intent.ACTION_HDMI_AUDIO_PLUG); + intentFilter.addAction(Intent.ACTION_USB_AUDIO_ACCESSORY_PLUG); + intentFilter.addAction(Intent.ACTION_USB_AUDIO_DEVICE_PLUG); intentFilter.addAction(Intent.ACTION_BOOT_COMPLETED); intentFilter.addAction(Intent.ACTION_SCREEN_ON); intentFilter.addAction(Intent.ACTION_SCREEN_OFF); @@ -501,6 +504,10 @@ public class AudioService extends IAudioService.Stub { System.MUTE_STREAMS_AFFECTED, ((1 << AudioSystem.STREAM_MUSIC)|(1 << AudioSystem.STREAM_RING)|(1 << AudioSystem.STREAM_SYSTEM))); + boolean masterMute = System.getInt(cr, System.VOLUME_MASTER_MUTE, 0) == 1; + AudioSystem.setMasterMute(masterMute); + broadcastMasterMuteStatus(masterMute); + // Each stream will read its own persisted settings // Broadcast the sticky intent @@ -740,9 +747,14 @@ public class AudioService extends IAudioService.Stub { // UI update and Broadcast Intent private void sendMasterMuteUpdate(boolean muted, int flags) { mVolumePanel.postMasterMuteChanged(flags); + broadcastMasterMuteStatus(muted); + } + private void broadcastMasterMuteStatus(boolean muted) { Intent intent = new Intent(AudioManager.MASTER_MUTE_CHANGED_ACTION); intent.putExtra(AudioManager.EXTRA_MASTER_VOLUME_MUTED, muted); + intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT + | Intent.FLAG_RECEIVER_REPLACE_PENDING); long origCallerIdentityToken = Binder.clearCallingIdentity(); mContext.sendStickyBroadcast(intent); Binder.restoreCallingIdentity(origCallerIdentityToken); @@ -817,10 +829,13 @@ public class AudioService extends IAudioService.Stub { } /** @see AudioManager#setMasterMute(boolean, IBinder) */ - public void setMasterMute(boolean state, IBinder cb) { + public void setMasterMute(boolean state, int flags, IBinder cb) { if (state != AudioSystem.getMasterMute()) { AudioSystem.setMasterMute(state); - sendMasterMuteUpdate(state, AudioManager.FLAG_SHOW_UI); + // Post a persist master volume msg + sendMsg(mAudioHandler, MSG_PERSIST_MASTER_VOLUME_MUTE, SENDMSG_REPLACE, state ? 1 + : 0, 0, null, PERSIST_DELAY); + sendMasterMuteUpdate(state, flags); } } @@ -2551,6 +2566,11 @@ public class AudioService extends IAudioService.Stub { (float)msg.arg1 / (float)1000.0); break; + case MSG_PERSIST_MASTER_VOLUME_MUTE: + Settings.System.putInt(mContentResolver, Settings.System.VOLUME_MASTER_MUTE, + msg.arg1); + break; + case MSG_PERSIST_RINGER_MODE: // note that the value persisted is the current ringer mode, not the // value of ringer mode as of the time the request was made to persist @@ -2782,6 +2802,28 @@ public class AudioService extends IAudioService.Stub { } } + private boolean handleDeviceConnection(boolean connected, int device, String params) { + synchronized (mConnectedDevices) { + boolean isConnected = (mConnectedDevices.containsKey(device) && + mConnectedDevices.get(device).equals(params)); + + if (isConnected && !connected) { + AudioSystem.setDeviceConnectionState(device, + AudioSystem.DEVICE_STATE_UNAVAILABLE, + params); + mConnectedDevices.remove(device); + return true; + } else if (!isConnected && connected) { + AudioSystem.setDeviceConnectionState(device, + AudioSystem.DEVICE_STATE_AVAILABLE, + params); + mConnectedDevices.put(new Integer(device), params); + return true; + } + } + return false; + } + /* cache of the address of the last dock the device was connected to */ private String mDockAddress; @@ -2792,6 +2834,8 @@ public class AudioService extends IAudioService.Stub { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); + int device; + int state; if (action.equals(Intent.ACTION_DOCK_EVENT)) { int dockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, @@ -2816,15 +2860,15 @@ public class AudioService extends IAudioService.Stub { } AudioSystem.setForceUse(AudioSystem.FOR_DOCK, config); } else if (action.equals(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED)) { - int state = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, + state = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, BluetoothProfile.STATE_DISCONNECTED); BluetoothDevice btDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); handleA2dpConnectionStateChange(btDevice, state); } else if (action.equals(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED)) { - int state = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, + state = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, BluetoothProfile.STATE_DISCONNECTED); - int device = AudioSystem.DEVICE_OUT_BLUETOOTH_SCO; + device = AudioSystem.DEVICE_OUT_BLUETOOTH_SCO; String address = null; BluetoothDevice btDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); @@ -2850,129 +2894,56 @@ public class AudioService extends IAudioService.Stub { address = ""; } - synchronized (mConnectedDevices) { - boolean isConnected = (mConnectedDevices.containsKey(device) && - mConnectedDevices.get(device).equals(address)); - + boolean connected = (state == BluetoothProfile.STATE_CONNECTED); + if (handleDeviceConnection(connected, device, address)) { synchronized (mScoClients) { - if (isConnected && state != BluetoothProfile.STATE_CONNECTED) { - AudioSystem.setDeviceConnectionState(device, - AudioSystem.DEVICE_STATE_UNAVAILABLE, - address); - mConnectedDevices.remove(device); + if (connected) { + mBluetoothHeadsetDevice = btDevice; + } else { mBluetoothHeadsetDevice = null; resetBluetoothSco(); - } else if (!isConnected && state == BluetoothProfile.STATE_CONNECTED) { - AudioSystem.setDeviceConnectionState(device, - AudioSystem.DEVICE_STATE_AVAILABLE, - address); - mConnectedDevices.put(new Integer(device), address); - mBluetoothHeadsetDevice = btDevice; } } } } else if (action.equals(Intent.ACTION_HEADSET_PLUG)) { - int state = intent.getIntExtra("state", 0); + state = intent.getIntExtra("state", 0); int microphone = intent.getIntExtra("microphone", 0); - synchronized (mConnectedDevices) { - if (microphone != 0) { - boolean isConnected = - mConnectedDevices.containsKey(AudioSystem.DEVICE_OUT_WIRED_HEADSET); - if (state == 0 && isConnected) { - AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADSET, - AudioSystem.DEVICE_STATE_UNAVAILABLE, - ""); - mConnectedDevices.remove(AudioSystem.DEVICE_OUT_WIRED_HEADSET); - } else if (state == 1 && !isConnected) { - AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_WIRED_HEADSET, - AudioSystem.DEVICE_STATE_AVAILABLE, - ""); - mConnectedDevices.put( - new Integer(AudioSystem.DEVICE_OUT_WIRED_HEADSET), ""); - } - } else { - boolean isConnected = - mConnectedDevices.containsKey(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE); - if (state == 0 && isConnected) { - AudioSystem.setDeviceConnectionState( - AudioSystem.DEVICE_OUT_WIRED_HEADPHONE, - AudioSystem.DEVICE_STATE_UNAVAILABLE, - ""); - mConnectedDevices.remove(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE); - } else if (state == 1 && !isConnected) { - AudioSystem.setDeviceConnectionState( - AudioSystem.DEVICE_OUT_WIRED_HEADPHONE, - AudioSystem.DEVICE_STATE_AVAILABLE, - ""); - mConnectedDevices.put( - new Integer(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE), ""); - } - } - } - } else if (action.equals(Intent.ACTION_USB_ANLG_HEADSET_PLUG)) { - int state = intent.getIntExtra("state", 0); - Log.v(TAG, "Broadcast Receiver: Got ACTION_USB_ANLG_HEADSET_PLUG, state = "+state); - synchronized (mConnectedDevices) { - boolean isConnected = - mConnectedDevices.containsKey(AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET); - if (state == 0 && isConnected) { - AudioSystem.setDeviceConnectionState( - AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET, - AudioSystem.DEVICE_STATE_UNAVAILABLE, - ""); - mConnectedDevices.remove(AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET); - } else if (state == 1 && !isConnected) { - AudioSystem.setDeviceConnectionState( - AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET, - AudioSystem.DEVICE_STATE_AVAILABLE, - ""); - mConnectedDevices.put( - new Integer(AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET), ""); - } + if (microphone != 0) { + device = AudioSystem.DEVICE_OUT_WIRED_HEADSET; + } else { + device = AudioSystem.DEVICE_OUT_WIRED_HEADPHONE; } + handleDeviceConnection((state == 1), device, ""); + } else if (action.equals(Intent.ACTION_ANALOG_AUDIO_DOCK_PLUG)) { + state = intent.getIntExtra("state", 0); + Log.v(TAG, "Broadcast Receiver: Got ACTION_ANALOG_AUDIO_DOCK_PLUG, state = "+state); + handleDeviceConnection((state == 1), AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET, ""); } else if (action.equals(Intent.ACTION_HDMI_AUDIO_PLUG)) { - int state = intent.getIntExtra("state", 0); + state = intent.getIntExtra("state", 0); Log.v(TAG, "Broadcast Receiver: Got ACTION_HDMI_AUDIO_PLUG, state = "+state); - synchronized (mConnectedDevices) { - boolean isConnected = - mConnectedDevices.containsKey(AudioSystem.DEVICE_OUT_AUX_DIGITAL); - if (state == 0 && isConnected) { - AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_AUX_DIGITAL, - AudioSystem.DEVICE_STATE_UNAVAILABLE, - ""); - mConnectedDevices.remove(AudioSystem.DEVICE_OUT_AUX_DIGITAL); - } else if (state == 1 && !isConnected) { - AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_AUX_DIGITAL, - AudioSystem.DEVICE_STATE_AVAILABLE, - ""); - mConnectedDevices.put( new Integer(AudioSystem.DEVICE_OUT_AUX_DIGITAL), ""); - } - } - } else if (action.equals(Intent.ACTION_USB_DGTL_HEADSET_PLUG)) { - int state = intent.getIntExtra("state", 0); - Log.v(TAG, "Broadcast Receiver: Got ACTION_USB_DGTL_HEADSET_PLUG, state = "+state); - synchronized (mConnectedDevices) { - boolean isConnected = - mConnectedDevices.containsKey(AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET); - if (state == 0 && isConnected) { - AudioSystem.setDeviceConnectionState( - AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET, - AudioSystem.DEVICE_STATE_UNAVAILABLE, - ""); - mConnectedDevices.remove(AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET); - } else if (state == 1 && !isConnected) { - AudioSystem.setDeviceConnectionState( - AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET, - AudioSystem.DEVICE_STATE_AVAILABLE, - ""); - mConnectedDevices.put( - new Integer(AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET), ""); - } - } + handleDeviceConnection((state == 1), AudioSystem.DEVICE_OUT_AUX_DIGITAL, ""); + } else if (action.equals(Intent.ACTION_DIGITAL_AUDIO_DOCK_PLUG)) { + state = intent.getIntExtra("state", 0); + Log.v(TAG, + "Broadcast Receiver Got ACTION_DIGITAL_AUDIO_DOCK_PLUG, state = " + state); + handleDeviceConnection((state == 1), AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET, ""); + } else if (action.equals(Intent.ACTION_USB_AUDIO_ACCESSORY_PLUG) || + action.equals(Intent.ACTION_USB_AUDIO_DEVICE_PLUG)) { + state = intent.getIntExtra("state", 0); + int alsaCard = intent.getIntExtra("card", -1); + int alsaDevice = intent.getIntExtra("device", -1); + String params = "card=" + alsaCard + ";device=" + alsaDevice; + device = action.equals(Intent.ACTION_USB_AUDIO_ACCESSORY_PLUG) ? + AudioSystem.DEVICE_OUT_USB_ACCESSORY : AudioSystem.DEVICE_OUT_USB_DEVICE; + Log.v(TAG, "Broadcast Receiver: Got " + + (action.equals(Intent.ACTION_USB_AUDIO_ACCESSORY_PLUG) ? + "ACTION_USB_AUDIO_ACCESSORY_PLUG" : "ACTION_USB_AUDIO_DEVICE_PLUG") + + ", state = " + state + ", card: " + alsaCard + ", device: " + alsaDevice); + handleDeviceConnection((state == 1), device, params); } else if (action.equals(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED)) { boolean broadcast = false; - int state = AudioManager.SCO_AUDIO_STATE_ERROR; + int scoAudioState = AudioManager.SCO_AUDIO_STATE_ERROR; synchronized (mScoClients) { int btState = intent.getIntExtra(BluetoothProfile.EXTRA_STATE, -1); // broadcast intent if the connection was initated by AudioService @@ -2984,7 +2955,7 @@ public class AudioService extends IAudioService.Stub { } switch (btState) { case BluetoothHeadset.STATE_AUDIO_CONNECTED: - state = AudioManager.SCO_AUDIO_STATE_CONNECTED; + scoAudioState = AudioManager.SCO_AUDIO_STATE_CONNECTED; if (mScoAudioState != SCO_STATE_ACTIVE_INTERNAL && mScoAudioState != SCO_STATE_DEACTIVATE_REQ && mScoAudioState != SCO_STATE_DEACTIVATE_EXT_REQ) { @@ -2992,7 +2963,7 @@ public class AudioService extends IAudioService.Stub { } break; case BluetoothHeadset.STATE_AUDIO_DISCONNECTED: - state = AudioManager.SCO_AUDIO_STATE_DISCONNECTED; + scoAudioState = AudioManager.SCO_AUDIO_STATE_DISCONNECTED; mScoAudioState = SCO_STATE_INACTIVE; clearAllScoClients(0, false); break; @@ -3009,11 +2980,11 @@ public class AudioService extends IAudioService.Stub { } } if (broadcast) { - broadcastScoConnectionState(state); + broadcastScoConnectionState(scoAudioState); //FIXME: this is to maintain compatibility with deprecated intent // AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED. Remove when appropriate. Intent newIntent = new Intent(AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED); - newIntent.putExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, state); + newIntent.putExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, scoAudioState); mContext.sendStickyBroadcast(newIntent); } } else if (action.equals(Intent.ACTION_BOOT_COMPLETED)) { @@ -3038,11 +3009,6 @@ public class AudioService extends IAudioService.Stub { adapter.getProfileProxy(mContext, mBluetoothProfileServiceListener, BluetoothProfile.A2DP); } - - if (mUseMasterVolume) { - // Send sticky broadcast for initial master mute state - sendMasterMuteUpdate(false, 0); - } } else if (action.equals(Intent.ACTION_PACKAGE_REMOVED)) { if (!intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) { // a package is being removed, not replaced diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java index 18a00bc..9bafa5c 100644 --- a/media/java/android/media/AudioSystem.java +++ b/media/java/android/media/AudioSystem.java @@ -202,6 +202,9 @@ public class AudioSystem public static final int DEVICE_OUT_AUX_DIGITAL = 0x400; public static final int DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800; public static final int DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000; + public static final int DEVICE_OUT_USB_ACCESSORY = 0x2000; + public static final int DEVICE_OUT_USB_DEVICE = 0x4000; + public static final int DEVICE_OUT_DEFAULT = 0x8000; public static final int DEVICE_OUT_ALL = (DEVICE_OUT_EARPIECE | DEVICE_OUT_SPEAKER | @@ -216,10 +219,18 @@ public class AudioSystem DEVICE_OUT_AUX_DIGITAL | DEVICE_OUT_ANLG_DOCK_HEADSET | DEVICE_OUT_DGTL_DOCK_HEADSET | + DEVICE_OUT_USB_ACCESSORY | + DEVICE_OUT_USB_DEVICE | DEVICE_OUT_DEFAULT); public static final int DEVICE_OUT_ALL_A2DP = (DEVICE_OUT_BLUETOOTH_A2DP | DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER); + public static final int DEVICE_OUT_ALL_SCO = (DEVICE_OUT_BLUETOOTH_SCO | + DEVICE_OUT_BLUETOOTH_SCO_HEADSET | + DEVICE_OUT_BLUETOOTH_SCO_CARKIT); + public static final int DEVICE_OUT_ALL_USB = (DEVICE_OUT_USB_ACCESSORY | + DEVICE_OUT_USB_DEVICE); + // input devices public static final int DEVICE_IN_COMMUNICATION = 0x10000; public static final int DEVICE_IN_AMBIENT = 0x20000; diff --git a/media/java/android/media/Crypto.java b/media/java/android/media/Crypto.java new file mode 100644 index 0000000..43e34fb --- /dev/null +++ b/media/java/android/media/Crypto.java @@ -0,0 +1,49 @@ +/* + * 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.media; + +/** + * Crypto class can be used in conjunction with MediaCodec to decode + * encrypted media data. + * @hide +*/ +public final class Crypto { + public static final native boolean isCryptoSchemeSupported(byte[] uuid); + + public Crypto(byte[] uuid, byte[] initData) { + native_setup(uuid, initData); + } + + public final native boolean requiresSecureDecoderComponent(String mime); + + @Override + protected void finalize() { + native_finalize(); + } + + public native final void release(); + private static native final void native_init(); + private native final void native_setup(byte[] uuid, byte[] initData); + private native final void native_finalize(); + + static { + System.loadLibrary("media_jni"); + native_init(); + } + + private int mNativeContext; +} diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl index 17d8e4d..b775095 100644 --- a/media/java/android/media/IAudioService.aidl +++ b/media/java/android/media/IAudioService.aidl @@ -45,7 +45,7 @@ interface IAudioService { boolean isStreamMute(int streamType); - void setMasterMute(boolean state, IBinder cb); + void setMasterMute(boolean state, int flags, IBinder cb); boolean isMasterMute(); diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java index 7629d60..410383d 100644 --- a/media/java/android/media/MediaCodec.java +++ b/media/java/android/media/MediaCodec.java @@ -16,6 +16,7 @@ package android.media; +import android.media.Crypto; import android.view.Surface; import java.nio.ByteBuffer; import java.util.Map; @@ -25,8 +26,7 @@ import java.util.Map; * encoder/decoder components. * @hide */ -public class MediaCodec -{ +final public class MediaCodec { /** Per buffer metadata includes an offset and size specifying the range of valid data in the associated codec buffer. */ @@ -45,10 +45,16 @@ public class MediaCodec public int mFlags; }; + // The follow flag constants MUST stay in sync with their equivalents + // in MediaCodec.h ! public static int FLAG_SYNCFRAME = 1; public static int FLAG_CODECCONFIG = 2; public static int FLAG_EOS = 4; - public static int FLAG_ENCRYPTED = 8; + + // The following mode constants MUST stay in sync with their equivalents + // in media/hardware/CryptoAPI.h ! + public static int MODE_UNENCRYPTED = 0; + public static int MODE_AES_CTR = 1; /** Instantiate a codec component by mime type. For decoder components this is the mime type of media that this decoder should be able to @@ -113,11 +119,14 @@ public class MediaCodec * * @param surface Specify a surface on which to render the output of this * decoder. + * @param crypto Specify a crypto object to facilitate secure decryption + * of the media data. * @param flags Specify {@link #CONFIGURE_FLAG_ENCODE} to configure the * component as an encoder. */ public void configure( - Map<String, Object> format, Surface surface, int flags) { + Map<String, Object> format, + Surface surface, Crypto crypto, int flags) { String[] keys = null; Object[] values = null; @@ -133,11 +142,12 @@ public class MediaCodec } } - native_configure(keys, values, surface, flags); + native_configure(keys, values, surface, crypto, flags); } private native final void native_configure( - String[] keys, Object[] values, Surface surface, int flags); + String[] keys, Object[] values, + Surface surface, Crypto crypto, int flags); /** After successfully configuring the component, call start. On return * you can query the component for its input/output buffers. @@ -172,6 +182,36 @@ public class MediaCodec int index, int offset, int size, long presentationTimeUs, int flags); + /** Similar to {@link queueInputBuffer} but submits a buffer that is + * potentially encrypted. The buffer's data is considered to be + * partitioned into "subSamples", each subSample starts with a + * (potentially empty) run of plain, unencrypted bytes followed + * by a (also potentially empty) run of encrypted bytes. + * @param numBytesOfClearData The number of leading unencrypted bytes in + * each subSample. + * @param numBytesOfEncryptedData The number of trailing encrypted bytes + * in each subSample. + * @param numSubSamples The number of subSamples that make up the + * buffer's contents. + * @param key A 16-byte opaque key + * @param iv A 16-byte initialization vector + * @param mode The type of encryption that has been applied + * + * Either numBytesOfClearData or numBytesOfEncryptedData (but not both) + * can be null to indicate that all respective sizes are 0. + */ + public native final void queueSecureInputBuffer( + int index, + int offset, + int[] numBytesOfClearData, + int[] numBytesOfEncryptedData, + int numSubSamples, + byte[] key, + byte[] iv, + int mode, + long presentationTimeUs, + int flags); + // Returns the index of an input buffer to be filled with valid data // or -1 if no such buffer is currently available. // This method will return immediately if timeoutUs == 0, wait indefinitely diff --git a/media/java/android/media/MediaExtractor.java b/media/java/android/media/MediaExtractor.java index 9ea3d0e..9c3b6a7 100644 --- a/media/java/android/media/MediaExtractor.java +++ b/media/java/android/media/MediaExtractor.java @@ -23,8 +23,7 @@ import java.util.Map; * MediaExtractor * @hide */ -public class MediaExtractor -{ +final public class MediaExtractor { public MediaExtractor(String path) { native_setup(path); } diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java index 2f4ed89..26089ad 100644 --- a/media/java/android/media/MediaScanner.java +++ b/media/java/android/media/MediaScanner.java @@ -609,6 +609,10 @@ public class MediaScanner mCompilation = parseSubstring(value, 0, 0); } else if (name.equalsIgnoreCase("isdrm")) { mIsDrm = (parseSubstring(value, 0, 0) == 1); + } else if (name.equalsIgnoreCase("width")) { + mWidth = parseSubstring(value, 0, 0); + } else if (name.equalsIgnoreCase("height")) { + mHeight = parseSubstring(value, 0, 0); } else { //Log.v(TAG, "unknown tag: " + name + " (" + mProcessGenres + ")"); } @@ -734,9 +738,11 @@ public class MediaScanner map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.IS_DRM, mIsDrm); + String resolution = null; if (mWidth > 0 && mHeight > 0) { map.put(MediaStore.MediaColumns.WIDTH, mWidth); map.put(MediaStore.MediaColumns.HEIGHT, mHeight); + resolution = mWidth + "x" + mHeight; } if (!mNoMedia) { @@ -746,7 +752,9 @@ public class MediaScanner map.put(Video.Media.ALBUM, (mAlbum != null && mAlbum.length() > 0 ? mAlbum : MediaStore.UNKNOWN_STRING)); map.put(Video.Media.DURATION, mDuration); - // FIXME - add RESOLUTION + if (resolution != null) { + map.put(Video.Media.RESOLUTION, resolution); + } } else if (MediaFile.isImageFileType(mFileType)) { // FIXME - add DESCRIPTION } else if (MediaFile.isAudioFileType(mFileType)) { diff --git a/media/jni/Android.mk b/media/jni/Android.mk index dd1e505..a3361d4 100644 --- a/media/jni/Android.mk +++ b/media/jni/Android.mk @@ -2,6 +2,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ + android_media_Crypto.cpp \ android_media_MediaCodec.cpp \ android_media_MediaCodecList.cpp \ android_media_MediaExtractor.cpp \ diff --git a/media/jni/android_media_Crypto.cpp b/media/jni/android_media_Crypto.cpp new file mode 100644 index 0000000..e1a60a1 --- /dev/null +++ b/media/jni/android_media_Crypto.cpp @@ -0,0 +1,291 @@ +/* + * 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. + */ + +//#define LOG_NDEBUG 0 +#define LOG_TAG "Crypto-JNI" +#include <utils/Log.h> + +#include "android_media_Crypto.h" + +#include "android_runtime/AndroidRuntime.h" +#include "jni.h" +#include "JNIHelp.h" + +#include <binder/IServiceManager.h> +#include <media/ICrypto.h> +#include <media/IMediaPlayerService.h> +#include <media/stagefright/foundation/ADebug.h> + +namespace android { + +struct fields_t { + jfieldID context; +}; + +static fields_t gFields; + +static sp<JCrypto> getCrypto(JNIEnv *env, jobject thiz) { + return (JCrypto *)env->GetIntField(thiz, gFields.context); +} + +JCrypto::JCrypto( + JNIEnv *env, jobject thiz, + const uint8_t uuid[16], const void *initData, size_t initSize) { + mObject = env->NewWeakGlobalRef(thiz); + + mCrypto = MakeCrypto(uuid, initData, initSize); +} + +JCrypto::~JCrypto() { + mCrypto.clear(); + + JNIEnv *env = AndroidRuntime::getJNIEnv(); + + env->DeleteWeakGlobalRef(mObject); + mObject = NULL; +} + +// static +sp<ICrypto> JCrypto::MakeCrypto() { + sp<IServiceManager> sm = defaultServiceManager(); + + sp<IBinder> binder = + sm->getService(String16("media.player")); + + sp<IMediaPlayerService> service = + interface_cast<IMediaPlayerService>(binder); + + if (service == NULL) { + return NULL; + } + + sp<ICrypto> crypto = service->makeCrypto(); + + if (crypto == NULL || crypto->initCheck() != OK) { + return NULL; + } + + return crypto; +} + +// static +sp<ICrypto> JCrypto::MakeCrypto( + const uint8_t uuid[16], const void *initData, size_t initSize) { + sp<ICrypto> crypto = MakeCrypto(); + + if (crypto == NULL) { + return NULL; + } + + status_t err = crypto->createPlugin(uuid, initData, initSize); + + if (err != OK) { + return NULL; + } + + return crypto; +} + +bool JCrypto::requiresSecureDecoderComponent(const char *mime) const { + if (mCrypto == NULL) { + return false; + } + + return mCrypto->requiresSecureDecoderComponent(mime); +} + +// static +bool JCrypto::IsCryptoSchemeSupported(const uint8_t uuid[16]) { + sp<ICrypto> crypto = MakeCrypto(); + + if (crypto == NULL) { + return false; + } + + return crypto->isCryptoSchemeSupported(uuid); +} + +status_t JCrypto::initCheck() const { + return mCrypto == NULL ? NO_INIT : OK; +} + +// static +sp<ICrypto> JCrypto::GetCrypto(JNIEnv *env, jobject obj) { + jclass clazz = env->FindClass("android/media/Crypto"); + CHECK(clazz != NULL); + + if (!env->IsInstanceOf(obj, clazz)) { + return NULL; + } + + sp<JCrypto> jcrypto = getCrypto(env, obj); + + if (jcrypto == NULL) { + return NULL; + } + + return jcrypto->mCrypto; +} + +} // namespace android + +using namespace android; + +static sp<JCrypto> setCrypto( + JNIEnv *env, jobject thiz, const sp<JCrypto> &crypto) { + sp<JCrypto> old = (JCrypto *)env->GetIntField(thiz, gFields.context); + if (crypto != NULL) { + crypto->incStrong(thiz); + } + if (old != NULL) { + old->decStrong(thiz); + } + env->SetIntField(thiz, gFields.context, (int)crypto.get()); + + return old; +} + +static void android_media_Crypto_release(JNIEnv *env, jobject thiz) { + setCrypto(env, thiz, NULL); +} + +static void android_media_Crypto_native_init(JNIEnv *env) { + jclass clazz = env->FindClass("android/media/Crypto"); + CHECK(clazz != NULL); + + gFields.context = env->GetFieldID(clazz, "mNativeContext", "I"); + CHECK(gFields.context != NULL); +} + +static void android_media_Crypto_native_setup( + JNIEnv *env, jobject thiz, + jbyteArray uuidObj, jbyteArray initDataObj) { + jsize uuidLength = env->GetArrayLength(uuidObj); + + if (uuidLength != 16) { + jniThrowException( + env, + "java/lang/IllegalArgumentException", + NULL); + return; + } + + jboolean isCopy; + jbyte *uuid = env->GetByteArrayElements(uuidObj, &isCopy); + + jsize initDataLength = env->GetArrayLength(initDataObj); + jbyte *initData = env->GetByteArrayElements(initDataObj, &isCopy); + + sp<JCrypto> crypto = new JCrypto( + env, thiz, (const uint8_t *)uuid, initData, initDataLength); + + status_t err = crypto->initCheck(); + + env->ReleaseByteArrayElements(initDataObj, initData, 0); + initData = NULL; + + env->ReleaseByteArrayElements(uuidObj, uuid, 0); + uuid = NULL; + + if (err != OK) { + jniThrowException( + env, + "java/io/IOException", + "Failed to instantiate crypto object."); + return; + } + + setCrypto(env,thiz, crypto); +} + +static void android_media_Crypto_native_finalize( + JNIEnv *env, jobject thiz) { + android_media_Crypto_release(env, thiz); +} + +static jboolean android_media_Crypto_isCryptoSchemeSupported( + JNIEnv *env, jobject thiz, jbyteArray uuidObj) { + jsize uuidLength = env->GetArrayLength(uuidObj); + + if (uuidLength != 16) { + jniThrowException( + env, + "java/lang/IllegalArgumentException", + NULL); + return false; + } + + jboolean isCopy; + jbyte *uuid = env->GetByteArrayElements(uuidObj, &isCopy); + + bool result = JCrypto::IsCryptoSchemeSupported((const uint8_t *)uuid); + + env->ReleaseByteArrayElements(uuidObj, uuid, 0); + uuid = NULL; + + return result; +} + +static jboolean android_media_Crypto_requiresSecureDecoderComponent( + JNIEnv *env, jobject thiz, jstring mimeObj) { + if (mimeObj == NULL) { + jniThrowException(env, "java/lang/IllegalArgumentException", NULL); + return false; + } + + sp<JCrypto> crypto = getCrypto(env, thiz); + + if (crypto == NULL) { + jniThrowException(env, "java/lang/IllegalArgumentException", NULL); + return false; + } + + const char *mime = env->GetStringUTFChars(mimeObj, NULL); + + if (mime == NULL) { + return false; + } + + bool result = crypto->requiresSecureDecoderComponent(mime); + + env->ReleaseStringUTFChars(mimeObj, mime); + mime = NULL; + + return result; +} + +static JNINativeMethod gMethods[] = { + { "release", "()V", (void *)android_media_Crypto_release }, + { "native_init", "()V", (void *)android_media_Crypto_native_init }, + + { "native_setup", "([B[B)V", + (void *)android_media_Crypto_native_setup }, + + { "native_finalize", "()V", + (void *)android_media_Crypto_native_finalize }, + + { "isCryptoSchemeSupported", "([B)Z", + (void *)android_media_Crypto_isCryptoSchemeSupported }, + + { "requiresSecureDecoderComponent", "(Ljava/lang/String;)Z", + (void *)android_media_Crypto_requiresSecureDecoderComponent }, +}; + +int register_android_media_Crypto(JNIEnv *env) { + return AndroidRuntime::registerNativeMethods(env, + "android/media/Crypto", gMethods, NELEM(gMethods)); +} + diff --git a/media/jni/android_media_Crypto.h b/media/jni/android_media_Crypto.h new file mode 100644 index 0000000..505725e --- /dev/null +++ b/media/jni/android_media_Crypto.h @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#ifndef _ANDROID_MEDIA_CRYPTO_H_ +#define _ANDROID_MEDIA_CRYPTO_H_ + +#include "jni.h" + +#include <media/stagefright/foundation/ABase.h> +#include <utils/Errors.h> +#include <utils/RefBase.h> + +namespace android { + +struct ICrypto; + +struct JCrypto : public RefBase { + static bool IsCryptoSchemeSupported(const uint8_t uuid[16]); + + JCrypto(JNIEnv *env, jobject thiz, + const uint8_t uuid[16], const void *initData, size_t initSize); + + status_t initCheck() const; + + bool requiresSecureDecoderComponent(const char *mime) const; + + static sp<ICrypto> GetCrypto(JNIEnv *env, jobject obj); + +protected: + virtual ~JCrypto(); + +private: + jweak mObject; + sp<ICrypto> mCrypto; + + static sp<ICrypto> MakeCrypto(); + + static sp<ICrypto> MakeCrypto( + const uint8_t uuid[16], const void *initData, size_t initSize); + + DISALLOW_EVIL_CONSTRUCTORS(JCrypto); +}; + +} // namespace android + +#endif // _ANDROID_MEDIA_CRYPTO_H_ diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp index 4b7a811..01d3833 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -20,6 +20,7 @@ #include "android_media_MediaCodec.h" +#include "android_media_Crypto.h" #include "android_media_Utils.h" #include "android_runtime/AndroidRuntime.h" #include "android_runtime/android_view_Surface.h" @@ -98,12 +99,13 @@ JMediaCodec::~JMediaCodec() { status_t JMediaCodec::configure( const sp<AMessage> &format, const sp<ISurfaceTexture> &surfaceTexture, + const sp<ICrypto> &crypto, int flags) { sp<SurfaceTextureClient> client; if (surfaceTexture != NULL) { client = new SurfaceTextureClient(surfaceTexture); } - return mCodec->configure(format, client, NULL /* crypto */, flags); + return mCodec->configure(format, client, crypto, flags); } status_t JMediaCodec::start() { @@ -124,6 +126,21 @@ status_t JMediaCodec::queueInputBuffer( return mCodec->queueInputBuffer(index, offset, size, timeUs, flags); } +status_t JMediaCodec::queueSecureInputBuffer( + size_t index, + size_t offset, + const CryptoPlugin::SubSample *subSamples, + size_t numSubSamples, + const uint8_t key[16], + const uint8_t iv[16], + CryptoPlugin::Mode mode, + int64_t presentationTimeUs, + uint32_t flags) { + return mCodec->queueSecureInputBuffer( + index, offset, subSamples, numSubSamples, key, iv, mode, + presentationTimeUs, flags); +} + status_t JMediaCodec::dequeueInputBuffer(size_t *index, int64_t timeoutUs) { return mCodec->dequeueInputBuffer(index, timeoutUs); } @@ -256,6 +273,7 @@ static void android_media_MediaCodec_native_configure( jobject thiz, jobjectArray keys, jobjectArray values, jobject jsurface, + jobject jcrypto, jint flags) { sp<JMediaCodec> codec = getMediaCodec(env, thiz); @@ -286,7 +304,12 @@ static void android_media_MediaCodec_native_configure( } } - err = codec->configure(format, surfaceTexture, flags); + sp<ICrypto> crypto; + if (jcrypto != NULL) { + crypto = JCrypto::GetCrypto(env, jcrypto); + } + + err = codec->configure(format, surfaceTexture, crypto, flags); throwExceptionAsNecessary(env, err); } @@ -359,6 +382,125 @@ static void android_media_MediaCodec_queueInputBuffer( throwExceptionAsNecessary(env, err); } +static void android_media_MediaCodec_queueSecureInputBuffer( + JNIEnv *env, + jobject thiz, + jint index, + jint offset, + jintArray numBytesOfClearDataObj, + jintArray numBytesOfEncryptedDataObj, + jint numSubSamples, + jbyteArray keyObj, + jbyteArray ivObj, + jint mode, + jlong timestampUs, + jint flags) { + ALOGV("android_media_MediaCodec_queueSecureInputBuffer"); + + sp<JMediaCodec> codec = getMediaCodec(env, thiz); + + if (codec == NULL) { + jniThrowException(env, "java/lang/IllegalStateException", NULL); + return; + } + + status_t err = OK; + + CryptoPlugin::SubSample *subSamples = NULL; + jbyte *key = NULL; + jbyte *iv = NULL; + + if (numSubSamples <= 0) { + err = -EINVAL; + } else if (numBytesOfClearDataObj == NULL + && numBytesOfEncryptedDataObj == NULL) { + err = -EINVAL; + } else if (numBytesOfEncryptedDataObj != NULL + && env->GetArrayLength(numBytesOfEncryptedDataObj) < numSubSamples) { + err = -ERANGE; + } else if (numBytesOfClearDataObj != NULL + && env->GetArrayLength(numBytesOfClearDataObj) < numSubSamples) { + err = -ERANGE; + } else { + jboolean isCopy; + + jint *numBytesOfClearData = + (numBytesOfClearDataObj == NULL) + ? NULL + : env->GetIntArrayElements(numBytesOfClearDataObj, &isCopy); + + jint *numBytesOfEncryptedData = + (numBytesOfEncryptedDataObj == NULL) + ? NULL + : env->GetIntArrayElements(numBytesOfEncryptedDataObj, &isCopy); + + subSamples = new CryptoPlugin::SubSample[numSubSamples]; + + for (jint i = 0; i < numSubSamples; ++i) { + subSamples[i].mNumBytesOfClearData = + (numBytesOfClearData == NULL) ? 0 : numBytesOfClearData[i]; + + subSamples[i].mNumBytesOfEncryptedData = + (numBytesOfEncryptedData == NULL) + ? 0 : numBytesOfEncryptedData[i]; + } + + if (numBytesOfEncryptedData != NULL) { + env->ReleaseIntArrayElements( + numBytesOfEncryptedDataObj, numBytesOfEncryptedData, 0); + numBytesOfEncryptedData = NULL; + } + + if (numBytesOfClearData != NULL) { + env->ReleaseIntArrayElements( + numBytesOfClearDataObj, numBytesOfClearData, 0); + numBytesOfClearData = NULL; + } + } + + if (err == OK && keyObj != NULL) { + if (env->GetArrayLength(keyObj) != 16) { + err = -EINVAL; + } else { + jboolean isCopy; + key = env->GetByteArrayElements(keyObj, &isCopy); + } + } + + if (err == OK && ivObj != NULL) { + if (env->GetArrayLength(ivObj) != 16) { + err = -EINVAL; + } else { + jboolean isCopy; + iv = env->GetByteArrayElements(ivObj, &isCopy); + } + } + + if (err == OK) { + err = codec->queueSecureInputBuffer( + index, offset, + subSamples, numSubSamples, + (const uint8_t *)key, (const uint8_t *)iv, + (CryptoPlugin::Mode)mode, + timestampUs, flags); + } + + if (iv != NULL) { + env->ReleaseByteArrayElements(ivObj, iv, 0); + iv = NULL; + } + + if (key != NULL) { + env->ReleaseByteArrayElements(keyObj, key, 0); + key = NULL; + } + + delete[] subSamples; + subSamples = NULL; + + throwExceptionAsNecessary(env, err); +} + static jint android_media_MediaCodec_dequeueInputBuffer( JNIEnv *env, jobject thiz, jlong timeoutUs) { ALOGV("android_media_MediaCodec_dequeueInputBuffer"); @@ -513,7 +655,8 @@ static JNINativeMethod gMethods[] = { { "release", "()V", (void *)android_media_MediaCodec_release }, { "native_configure", - "([Ljava/lang/String;[Ljava/lang/Object;Landroid/view/Surface;I)V", + "([Ljava/lang/String;[Ljava/lang/Object;Landroid/view/Surface;" + "Landroid/media/Crypto;I)V", (void *)android_media_MediaCodec_native_configure }, { "start", "()V", (void *)android_media_MediaCodec_start }, @@ -523,6 +666,9 @@ static JNINativeMethod gMethods[] = { { "queueInputBuffer", "(IIIJI)V", (void *)android_media_MediaCodec_queueInputBuffer }, + { "queueSecureInputBuffer", "(II[I[II[B[BIJI)V", + (void *)android_media_MediaCodec_queueSecureInputBuffer }, + { "dequeueInputBuffer", "(J)I", (void *)android_media_MediaCodec_dequeueInputBuffer }, diff --git a/media/jni/android_media_MediaCodec.h b/media/jni/android_media_MediaCodec.h index 6b1257d..570c33b 100644 --- a/media/jni/android_media_MediaCodec.h +++ b/media/jni/android_media_MediaCodec.h @@ -19,6 +19,7 @@ #include "jni.h" +#include <media/hardware/CryptoAPI.h> #include <media/stagefright/foundation/ABase.h> #include <utils/Errors.h> #include <utils/RefBase.h> @@ -27,6 +28,7 @@ namespace android { struct ALooper; struct AMessage; +struct ICrypto; struct ISurfaceTexture; struct MediaCodec; @@ -40,6 +42,7 @@ struct JMediaCodec : public RefBase { status_t configure( const sp<AMessage> &format, const sp<ISurfaceTexture> &surfaceTexture, + const sp<ICrypto> &crypto, int flags); status_t start(); @@ -51,6 +54,17 @@ struct JMediaCodec : public RefBase { size_t index, size_t offset, size_t size, int64_t timeUs, uint32_t flags); + status_t queueSecureInputBuffer( + size_t index, + size_t offset, + const CryptoPlugin::SubSample *subSamples, + size_t numSubSamples, + const uint8_t key[16], + const uint8_t iv[16], + CryptoPlugin::Mode mode, + int64_t presentationTimeUs, + uint32_t flags); + status_t dequeueInputBuffer(size_t *index, int64_t timeoutUs); status_t dequeueOutputBuffer( diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp index 3074bb1..2e74ffd 100644 --- a/media/jni/android_media_MediaPlayer.cpp +++ b/media/jni/android_media_MediaPlayer.cpp @@ -879,6 +879,7 @@ static int register_android_media_MediaPlayer(JNIEnv *env) "android/media/MediaPlayer", gMethods, NELEM(gMethods)); } +extern int register_android_media_Crypto(JNIEnv *env); extern int register_android_media_MediaCodec(JNIEnv *env); extern int register_android_media_MediaExtractor(JNIEnv *env); extern int register_android_media_MediaCodecList(JNIEnv *env); @@ -968,6 +969,11 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) goto bail; } + if (register_android_media_Crypto(env) < 0) { + ALOGE("ERROR: MediaCodec native registration failed"); + goto bail; + } + /* success -- return valid version number */ result = JNI_VERSION_1_4; diff --git a/media/tests/MediaFrameworkTest/AndroidManifest.xml b/media/tests/MediaFrameworkTest/AndroidManifest.xml index dd5e026..b698705 100644 --- a/media/tests/MediaFrameworkTest/AndroidManifest.xml +++ b/media/tests/MediaFrameworkTest/AndroidManifest.xml @@ -4,9 +4,9 @@ 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. @@ -16,7 +16,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.mediaframeworktest"> - + <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.INTERNET" /> @@ -24,7 +24,7 @@ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> - <application> + <application> <uses-library android:name="android.test.runner" /> <activity android:label="@string/app_name" android:name="MediaFrameworkTest" @@ -34,12 +34,18 @@ <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - </application> + </application> + + <instrumentation android:name=".CameraStressTestRunner" + android:targetPackage="com.android.mediaframeworktest" + android:label="Camera stress tests InstrumentationRunner"> + </instrumentation> + <instrumentation android:name=".MediaFrameworkTestRunner" android:targetPackage="com.android.mediaframeworktest" android:label="MediaFramework tests InstrumentationRunner"> </instrumentation> - + <instrumentation android:name=".MediaFrameworkPerfTestRunner" android:targetPackage="com.android.mediaframeworktest" android:label="MediaFramework Performance tests InstrumentationRunner"> @@ -49,7 +55,7 @@ android:targetPackage="com.android.mediaframeworktest" android:label="MediaFramework unit tests InstrumentationRunner"> </instrumentation> - + <instrumentation android:name=".MediaRecorderStressTestRunner" android:targetPackage="com.android.mediaframeworktest" android:label="MediaRecorder stress tests InstrumentationRunner"> diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/CameraStressTestRunner.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/CameraStressTestRunner.java new file mode 100644 index 0000000..fa59fa4 --- /dev/null +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/CameraStressTestRunner.java @@ -0,0 +1,38 @@ +/* + * 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.mediaframeworktest; + +import android.test.InstrumentationTestRunner; +import android.test.InstrumentationTestSuite; +import com.android.mediaframeworktest.stress.CameraStressTest; + +import junit.framework.TestSuite; + +public class CameraStressTestRunner extends InstrumentationTestRunner { + + @Override + public TestSuite getAllTests() { + TestSuite suite = new InstrumentationTestSuite(this); + suite.addTestSuite(CameraStressTest.class); + return suite; + } + + @Override + public ClassLoader getLoader() { + return CameraStressTestRunner.class.getClassLoader(); + } +} diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java index c501d3f..7be2707 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java @@ -22,7 +22,7 @@ import com.android.mediaframeworktest.MediaProfileReader; import com.android.mediaframeworktest.functional.CodecTest; import android.content.Context; -import android.test.ActivityInstrumentationTestCase; +import android.test.ActivityInstrumentationTestCase2; import android.util.Log; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; @@ -33,25 +33,28 @@ import java.io.File; /** * Junit / Instrumentation test case for the media player api */ -public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> { - private boolean duratoinWithinTolerence = false; - private String TAG = "MediaPlayerApiTest"; - private boolean isWMAEnable = false; - private boolean isWMVEnable = false; +public class MediaPlayerApiTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> { + private boolean duratoinWithinTolerence = false; + private String TAG = "MediaPlayerApiTest"; + private boolean isWMAEnable = false; + private boolean isWMVEnable = false; - Context mContext; + Context mContext; - public MediaPlayerApiTest() { - super("com.android.mediaframeworktest", MediaFrameworkTest.class); - isWMAEnable = MediaProfileReader.getWMAEnable(); - isWMVEnable = MediaProfileReader.getWMVEnable(); - } + public MediaPlayerApiTest() { + super("com.android.mediaframeworktest", MediaFrameworkTest.class); + isWMAEnable = MediaProfileReader.getWMAEnable(); + isWMVEnable = MediaProfileReader.getWMVEnable(); + } 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(); + super.setUp(); + } + public boolean verifyDuration(int duration, int expectedDuration){ if ((duration > expectedDuration * 1.1) || (duration < expectedDuration * 0.9)) return false; diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/CameraStressTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/CameraStressTest.java new file mode 100644 index 0000000..a9c6119 --- /dev/null +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/CameraStressTest.java @@ -0,0 +1,280 @@ +/* + * 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.mediaframeworktest.stress; + +import com.android.mediaframeworktest.MediaFrameworkTest; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FilenameFilter; +import java.io.FileWriter; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.Writer; +import java.util.concurrent.Semaphore; +import java.util.concurrent.TimeUnit; + +import android.hardware.Camera; +import android.hardware.Camera.PictureCallback; +import android.hardware.Camera.ShutterCallback; +import android.os.Environment; +import android.os.Handler; +import android.os.Looper; +import android.test.ActivityInstrumentationTestCase2; +import android.test.suitebuilder.annotation.LargeTest; +import android.util.Log; +import android.view.SurfaceHolder; +import com.android.mediaframeworktest.CameraStressTestRunner; + +import junit.framework.Assert; + +/** + * Junit / Instrumentation test case for the camera zoom api + * + * adb shell am instrument + * -e class com.android.mediaframeworktest.stress.CameraStressTest + * -w com.android.mediaframeworktest/.CameraStressTestRunner + */ +public class CameraStressTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> { + private String TAG = "CameraStressTest"; + private Camera mCamera; + + private static final int NUMBER_OF_ZOOM_LOOPS = 100; + private static final long WAIT_GENERIC = 3 * 1000; // 3 seconds + private static final long WAIT_TIMEOUT = 10 * 1000; // 10 seconds + private static final long WAIT_ZOOM_ANIMATION = 5 * 1000; // 5 seconds + private static final String CAMERA_STRESS_OUTPUT = + "/sdcard/cameraStressOutput.txt"; + private final CameraErrorCallback mCameraErrorCallback = new CameraErrorCallback(); + + private Thread mLooperThread; + private Handler mHandler; + + public CameraStressTest() { + super("com.android.mediaframeworktest", MediaFrameworkTest.class); + } + + protected void setUp() throws Exception { + final Semaphore sem = new Semaphore(0); + mLooperThread = new Thread() { + @Override + public void run() { + Log.v(TAG, "starting looper"); + Looper.prepare(); + mHandler = new Handler(); + sem.release(); + Looper.loop(); + Log.v(TAG, "quit looper"); + } + }; + mLooperThread.start(); + if (!sem.tryAcquire(WAIT_TIMEOUT, TimeUnit.MILLISECONDS)) { + fail("Failed to start the looper."); + } + getActivity(); + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + if (mHandler != null) { + mHandler.getLooper().quit(); + mHandler = null; + } + if (mLooperThread != null) { + mLooperThread.join(WAIT_TIMEOUT); + if (mLooperThread.isAlive()) { + fail("Failed to stop the looper."); + } + mLooperThread = null; + } + + super.tearDown(); + } + + private void runOnLooper(final Runnable command) throws InterruptedException { + final Semaphore sem = new Semaphore(0); + mHandler.post(new Runnable() { + @Override + public void run() { + try { + command.run(); + } finally { + sem.release(); + } + } + }); + if (!sem.tryAcquire(WAIT_TIMEOUT, TimeUnit.MILLISECONDS)) { + fail("Failed to run the command on the looper."); + } + } + + private final class CameraErrorCallback implements android.hardware.Camera.ErrorCallback { + public void onError(int error, android.hardware.Camera camera) { + if (error == android.hardware.Camera.CAMERA_ERROR_SERVER_DIED) { + assertTrue("Camera test mediaserver died", false); + } + } + } + + private ShutterCallback shutterCallback = new ShutterCallback() { + @Override + public void onShutter() { + Log.v(TAG, "Shutter"); + } + }; + + private PictureCallback rawCallback = new PictureCallback() { + @Override + public void onPictureTaken(byte[] data, Camera camera) { + Log.v(TAG, "Raw picture taken"); + } + }; + + private PictureCallback jpegCallback = new PictureCallback() { + @Override + public void onPictureTaken(byte[] data, Camera camera) { + FileOutputStream fos = null; + + try { + Log.v(TAG, "JPEG picture taken"); + fos = new FileOutputStream(String.format("%s/zoom-test-%d.jpg", + Environment.getExternalStorageDirectory(), System.currentTimeMillis())); + fos.write(data); + } + catch (FileNotFoundException e) { + Log.v(TAG, "File not found: " + e.toString()); + } + catch (IOException e) { + Log.v(TAG, "Error accessing file: " + e.toString()); + } + finally { + try { + if (fos != null) { + fos.close(); + } + } + catch (IOException e) { + Log.v(TAG, "Error closing file: " + e.toString()); + } + } + } + }; + + // Helper method for cleaning up pics taken during testStressCameraZoom + private void cleanupZoomImages() { + try { + File sdcard = Environment.getExternalStorageDirectory(); + File[] zoomImages = null; + + FilenameFilter filter = new FilenameFilter() { + public boolean accept(File dir, String name) { + return name.startsWith("zoom-test-"); + } + }; + + zoomImages = sdcard.listFiles(filter); + + for (File f : zoomImages) { + f.delete(); + } + } + catch (SecurityException e) { + Log.v(TAG, "Security manager access violation: " + e.toString()); + } + } + + // Test case for stressing the camera zoom in/out feature + @LargeTest + public void testStressCameraZoom() throws Exception { + SurfaceHolder mSurfaceHolder; + mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder(); + File stressOutFile = new File(CAMERA_STRESS_OUTPUT); + Writer output = new BufferedWriter(new FileWriter(stressOutFile, true)); + output.write("Camera zoom stress:\n"); + output.write("Total number of loops: " + NUMBER_OF_ZOOM_LOOPS + "\n"); + + try { + Log.v(TAG, "Start preview"); + output.write("No of loop: "); + + mCamera = Camera.open(); + Camera.Parameters params = mCamera.getParameters(); + mCamera.release(); + + if (!params.isSmoothZoomSupported() && !params.isZoomSupported()) { + Log.v(TAG, "Device camera does not support zoom"); + assertTrue("Camera zoom stress test", false); + } + else { + Log.v(TAG, "Device camera does support zoom"); + + int nextZoomLevel = 0; + + for (int i = 0; i < NUMBER_OF_ZOOM_LOOPS; i++) { + runOnLooper(new Runnable() { + @Override + public void run() { + mCamera = Camera.open(); + } + }); + + mCamera.setErrorCallback(mCameraErrorCallback); + mCamera.setPreviewDisplay(mSurfaceHolder); + mCamera.startPreview(); + Thread.sleep(WAIT_GENERIC); + + params = mCamera.getParameters(); + int currentZoomLevel = params.getZoom(); + + if (nextZoomLevel >= params.getMaxZoom()) { + nextZoomLevel = 0; + } + ++nextZoomLevel; + + if (params.isSmoothZoomSupported()) { + mCamera.startSmoothZoom(nextZoomLevel); + } + else { + params.setZoom(nextZoomLevel); + mCamera.setParameters(params); + } + Log.v(TAG, "Zooming from " + currentZoomLevel + " to " + nextZoomLevel); + + // sleep allows for zoom animation to finish + Thread.sleep(WAIT_ZOOM_ANIMATION); + + // take picture + mCamera.takePicture(shutterCallback, rawCallback, jpegCallback); + Thread.sleep(WAIT_GENERIC); + mCamera.stopPreview(); + mCamera.release(); + output.write(" ," + i); + } + } + + cleanupZoomImages(); + } + catch (Exception e) { + assertTrue("Camera zoom stress test Exception", false); + Log.v(TAG, e.toString()); + } + output.write("\n\n"); + output.close(); + } +} diff --git a/obex/MODULE_LICENSE_BSD_LIKE b/obex/MODULE_LICENSE_BSD_LIKE new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/obex/MODULE_LICENSE_BSD_LIKE diff --git a/obex/NOTICE b/obex/NOTICE new file mode 100644 index 0000000..92e8e59 --- /dev/null +++ b/obex/NOTICE @@ -0,0 +1,29 @@ +Copyright (c) 2008-2009, Motorola, Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +- Neither the name of the Motorola, Inc. nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/InputDevices/Android.mk b/packages/InputDevices/Android.mk new file mode 100644 index 0000000..446b47e --- /dev/null +++ b/packages/InputDevices/Android.mk @@ -0,0 +1,16 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_JAVA_LIBRARIES := + +LOCAL_PACKAGE_NAME := InputDevices +LOCAL_CERTIFICATE := platform + +include $(BUILD_PACKAGE) + +######################## +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/packages/InputDevices/AndroidManifest.xml b/packages/InputDevices/AndroidManifest.xml new file mode 100644 index 0000000..6831a74 --- /dev/null +++ b/packages/InputDevices/AndroidManifest.xml @@ -0,0 +1,19 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.inputdevices" + coreApp="true" + android:sharedUserId="android.uid.system"> + + <application + android:allowClearUserData="false" + android:label="@string/app_label" + android:process="system"> + + <receiver android:name=".InputDeviceReceiver"> + <intent-filter> + <action android:name="android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS" /> + </intent-filter> + <meta-data android:name="android.hardware.input.metadata.KEYBOARD_LAYOUTS" + android:resource="@xml/keyboard_layouts" /> + </receiver> + </application> +</manifest> diff --git a/packages/InputDevices/MODULE_LICENSE_APACHE2 b/packages/InputDevices/MODULE_LICENSE_APACHE2 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/packages/InputDevices/MODULE_LICENSE_APACHE2 diff --git a/packages/InputDevices/NOTICE b/packages/InputDevices/NOTICE new file mode 100644 index 0000000..c5b1efa --- /dev/null +++ b/packages/InputDevices/NOTICE @@ -0,0 +1,190 @@ + + 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/packages/InputDevices/res/raw/keyboard_layout_english_us.kcm b/packages/InputDevices/res/raw/keyboard_layout_english_us.kcm new file mode 100644 index 0000000..a7823fd --- /dev/null +++ b/packages/InputDevices/res/raw/keyboard_layout_english_us.kcm @@ -0,0 +1,15 @@ +# 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. + +# PLACEHOLDER CONTENT # diff --git a/packages/InputDevices/res/raw/keyboard_layout_english_us_dvorak.kcm b/packages/InputDevices/res/raw/keyboard_layout_english_us_dvorak.kcm new file mode 100644 index 0000000..a7823fd --- /dev/null +++ b/packages/InputDevices/res/raw/keyboard_layout_english_us_dvorak.kcm @@ -0,0 +1,15 @@ +# 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. + +# PLACEHOLDER CONTENT # diff --git a/packages/InputDevices/res/raw/keyboard_layout_german.kcm b/packages/InputDevices/res/raw/keyboard_layout_german.kcm new file mode 100644 index 0000000..a7823fd --- /dev/null +++ b/packages/InputDevices/res/raw/keyboard_layout_german.kcm @@ -0,0 +1,15 @@ +# 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. + +# PLACEHOLDER CONTENT # diff --git a/packages/InputDevices/res/values/strings.xml b/packages/InputDevices/res/values/strings.xml new file mode 100644 index 0000000..6d5ee98 --- /dev/null +++ b/packages/InputDevices/res/values/strings.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <!-- Name of the application. [CHAR LIMIT=35] --> + <string name="app_label">Input Devices</string> + + <!-- US English keyboard layout label. [CHAR LIMIT=35] --> + <string name="keyboard_layout_english_us_label">English (US)</string> + + <!-- US English (Dvorak style) keyboard layout label. [CHAR LIMIT=35] --> + <string name="keyboard_layout_english_us_dvorak_label">English (US), Dvorak</string> + + <!-- German keyboard layout label. [CHAR LIMIT=35] --> + <string name="keyboard_layout_german_label">German</string> +</resources> diff --git a/packages/InputDevices/res/xml/keyboard_layouts.xml b/packages/InputDevices/res/xml/keyboard_layouts.xml new file mode 100644 index 0000000..459a0e4 --- /dev/null +++ b/packages/InputDevices/res/xml/keyboard_layouts.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<keyboard-layouts xmlns:android="http://schemas.android.com/apk/res/android"> + <keyboard-layout android:name="keyboard_layout_english_us" + android:label="@string/keyboard_layout_english_us_label" + android:kcm="@raw/keyboard_layout_english_us" /> + + <keyboard-layout android:name="keyboard_layout_english_us_dvorak" + android:label="@string/keyboard_layout_english_us_dvorak_label" + android:kcm="@raw/keyboard_layout_english_us_dvorak" /> + + <keyboard-layout android:name="keyboard_layout_german" + android:label="@string/keyboard_layout_german_label" + android:kcm="@raw/keyboard_layout_german" /> +</keyboard-layouts> diff --git a/packages/InputDevices/src/com/android/inputdevices/InputDeviceReceiver.java b/packages/InputDevices/src/com/android/inputdevices/InputDeviceReceiver.java new file mode 100644 index 0000000..50a7c2f --- /dev/null +++ b/packages/InputDevices/src/com/android/inputdevices/InputDeviceReceiver.java @@ -0,0 +1,28 @@ +/* + * 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.inputdevices; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +public class InputDeviceReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + // Nothing to do at this time. + } +} diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml index aa27861..715ccba 100644 --- a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml @@ -66,7 +66,7 @@ android:layout_height="wrap_content" android:textSize="@dimen/status_bar_recents_app_label_text_size" android:fadingEdge="horizontal" - android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length" + android:fadingEdgeLength="@dimen/status_bar_recents_text_fading_edge_length" android:scrollHorizontally="true" android:layout_alignLeft="@id/app_thumbnail" android:layout_below="@id/app_thumbnail" @@ -82,7 +82,7 @@ android:layout_height="wrap_content" android:textSize="@dimen/status_bar_recents_app_description_text_size" android:fadingEdge="horizontal" - android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length" + android:fadingEdgeLength="@dimen/status_bar_recents_text_fading_edge_length" android:scrollHorizontally="true" android:layout_alignLeft="@id/app_thumbnail" android:layout_below="@id/app_label" diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml index 180f022..dba1dd9 100644 --- a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml +++ b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml @@ -41,7 +41,7 @@ android:stackFromBottom="true" android:fadingEdge="horizontal" android:scrollbars="none" - android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length" + android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length" android:layout_gravity="bottom|left" android:orientation="horizontal" android:clipToPadding="false" diff --git a/packages/SystemUI/res/layout-port/status_bar_recent_item.xml b/packages/SystemUI/res/layout-port/status_bar_recent_item.xml index bc389f9..ca72530 100644 --- a/packages/SystemUI/res/layout-port/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout-port/status_bar_recent_item.xml @@ -35,7 +35,7 @@ android:layout_height="wrap_content" android:textSize="@dimen/status_bar_recents_app_label_text_size" android:fadingEdge="horizontal" - android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length" + android:fadingEdgeLength="@dimen/status_bar_recents_text_fading_edge_length" android:scrollHorizontally="true" android:layout_alignParentLeft="true" android:layout_alignTop="@id/app_icon" @@ -89,7 +89,7 @@ android:layout_height="wrap_content" android:textSize="@dimen/status_bar_recents_app_description_text_size" android:fadingEdge="horizontal" - android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length" + android:fadingEdgeLength="@dimen/status_bar_recents_text_fading_edge_length" android:scrollHorizontally="true" android:layout_alignParentLeft="true" android:layout_marginLeft="@dimen/status_bar_recents_app_label_left_margin" diff --git a/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml index e6a077a..73c3da5 100644 --- a/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml +++ b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml @@ -40,7 +40,7 @@ android:stackFromBottom="true" android:fadingEdge="vertical" android:scrollbars="none" - android:fadingEdgeLength="@*android:dimen/status_bar_height" + android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length" android:layout_gravity="bottom|left" android:clipToPadding="false" android:clipChildren="false"> diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml index 333fcda..7d639ec 100644 --- a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml +++ b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml @@ -28,7 +28,7 @@ android:layout_height="wrap_content" android:textSize="@dimen/status_bar_recents_app_label_text_size" android:fadingEdge="horizontal" - android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length" + android:fadingEdgeLength="@dimen/status_bar_recents_text_fading_edge_length" android:scrollHorizontally="true" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" @@ -86,7 +86,7 @@ android:layout_height="wrap_content" android:textSize="@dimen/status_bar_recents_app_description_text_size" android:fadingEdge="horizontal" - android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length" + android:fadingEdgeLength="@dimen/status_bar_recents_text_fading_edge_length" android:scrollHorizontally="true" android:layout_alignParentLeft="true" android:layout_below="@id/recents_callout_line" diff --git a/packages/SystemUI/res/layout/status_bar.xml b/packages/SystemUI/res/layout/status_bar.xml index b1aaade..0ba8cce 100644 --- a/packages/SystemUI/res/layout/status_bar.xml +++ b/packages/SystemUI/res/layout/status_bar.xml @@ -26,6 +26,7 @@ android:orientation="vertical" android:focusable="true" android:descendantFocusability="afterDescendants" + android:fitsSystemWindows="true" > <LinearLayout android:id="@+id/icons" diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index ba1cdfa..8c1ac55 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -53,8 +53,10 @@ <dimen name="status_bar_recents_app_label_width">97dip</dimen> <!-- Left margin for application label --> <dimen name="status_bar_recents_app_label_left_margin">16dip</dimen> - <!-- Size of fading edge for scroll effect --> - <dimen name="status_bar_recents_fading_edge_length">20dip</dimen> + <!-- Size of fading edge for text --> + <dimen name="status_bar_recents_text_fading_edge_length">20dip</dimen> + <!-- Size of fading edge for scrolling --> + <dimen name="status_bar_recents_scroll_fading_edge_length">10dip</dimen> <!-- Margin between recents container and glow on the right --> <dimen name="status_bar_recents_right_glow_margin">100dip</dimen> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 2c22e3c..4441ca6 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -33,8 +33,10 @@ <dimen name="status_bar_recents_app_label_text_size">14dip</dimen> <!-- Size of application description text --> <dimen name="status_bar_recents_app_description_text_size">14dip</dimen> - <!-- Size of fading edge for scroll effect --> - <dimen name="status_bar_recents_fading_edge_length">20dip</dimen> + <!-- Size of fading edge for text --> + <dimen name="status_bar_recents_text_fading_edge_length">20dip</dimen> + <!-- Size of fading edge for scrolling --> + <dimen name="status_bar_recents_scroll_fading_edge_length">10dip</dimen> <!-- Margin between recents container and glow on the right --> <dimen name="status_bar_recents_right_glow_margin">100dip</dimen> <!-- Amount to offset bottom of notification peek window from top of status bar. --> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index dc5c540..02411d4 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -67,8 +67,6 @@ <!-- Standard animations for hiding and showing the status bar. --> <style name="Animation.StatusBar"> - <item name="android:windowEnterAnimation">@anim/status_bar_enter</item> - <item name="android:windowExitAnimation">@anim/status_bar_exit</item> </style> <style name="Animation.StatusBar.IntruderAlert"> diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIService.java b/packages/SystemUI/src/com/android/systemui/SystemUIService.java index d7a5056..1ae15be 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIService.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIService.java @@ -69,9 +69,9 @@ public class SystemUIService extends Service { IWindowManager wm = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); try { - SERVICES[0] = wm.canStatusBarHide() - ? R.string.config_statusBarComponent - : R.string.config_systemBarComponent; + SERVICES[0] = wm.hasSystemNavBar() + ? R.string.config_systemBarComponent + : R.string.config_statusBarComponent; } catch (RemoteException e) { Slog.w(TAG, "Failing checking whether status bar can hide", e); } diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index ebed522..5d6e315 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -68,6 +68,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG || false; private Context mContext; private BaseStatusBar mBar; + private PopupMenu mPopup; private View mRecentsScrim; private View mRecentsNoApps; private ViewGroup mRecentsContainer; @@ -313,6 +314,10 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener setFocusable(true); setFocusableInTouchMode(true); requestFocus(); + } else { + if (mPopup != null) { + mPopup.dismiss(); + } } } @@ -325,6 +330,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener setVisibility(View.GONE); } if (mBar != null) { + // This will indirectly cause show(false, ...) to get called mBar.animateCollapse(); } } @@ -729,10 +735,20 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener getContext().startActivity(intent); } + public boolean onInterceptTouchEvent(MotionEvent ev) { + if (mPopup != null) { + return true; + } else { + return super.onInterceptTouchEvent(ev); + } + } + public void handleLongPress( final View selectedView, final View anchorView, final View thumbnailView) { thumbnailView.setSelected(true); - PopupMenu popup = new PopupMenu(mContext, anchorView == null ? selectedView : anchorView); + final PopupMenu popup = + new PopupMenu(mContext, anchorView == null ? selectedView : anchorView); + mPopup = popup; popup.getMenuInflater().inflate(R.menu.recent_popup_menu, popup.getMenu()); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { @@ -756,6 +772,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener popup.setOnDismissListener(new PopupMenu.OnDismissListener() { public void onDismiss(PopupMenu menu) { thumbnailView.setSelected(false); + mPopup = null; } }); popup.show(); diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java index 5529d0c..6bd1826 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java @@ -37,15 +37,11 @@ public class RecentsScrollViewPerformanceHelper { public static final boolean OPTIMIZE_SW_RENDERED_RECENTS = true; public static final boolean USE_DARK_FADE_IN_HW_ACCELERATED_MODE = true; private View mScrollView; - private LinearLayout mLinearLayout; private RecentsCallback mCallback; - private boolean mShowBackground = false; private int mFadingEdgeLength; - private Drawable.ConstantState mBackgroundDrawable; private Context mContext; private boolean mIsVertical; - private boolean mFirstTime = true; private boolean mSoftwareRendered = false; private boolean mAttachedToWindow = false; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 12c05ed..804ae06 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -591,10 +591,14 @@ public class PhoneStatusBar extends BaseStatusBar { } final StatusBarNotification oldNotification = oldEntry.notification; - final RemoteViews oldContentView = oldNotification.notification.contentView; - - final RemoteViews contentView = notification.notification.contentView; + // XXX: modify when we do something more intelligent with the two content views + final RemoteViews oldContentView = (oldNotification.notification.bigContentView != null) + ? oldNotification.notification.bigContentView + : oldNotification.notification.contentView; + final RemoteViews contentView = (notification.notification.bigContentView != null) + ? notification.notification.bigContentView + : notification.notification.contentView; if (DEBUG) { Slog.d(TAG, "old notification: when=" + oldNotification.notification.when @@ -1766,11 +1770,6 @@ public class PhoneStatusBar extends BaseStatusBar { // HWComposer is unable to handle SW-rendered RGBX_8888 layers. PixelFormat.RGB_565); - // the status bar should be in an overlay if possible - final Display defaultDisplay - = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)) - .getDefaultDisplay(); - // We explicitly leave FLAG_HARDWARE_ACCELERATED out of the flags. The status bar occupies // very little screen real-estate and is updated fairly frequently. By using CPU rendering // for the status bar, we prevent the GPU from having to wake up just to do these small @@ -1779,9 +1778,7 @@ public class PhoneStatusBar extends BaseStatusBar { lp.gravity = getStatusBarGravity(); lp.setTitle("StatusBar"); lp.packageName = mContext.getPackageName(); - lp.windowAnimations = R.style.Animation_StatusBar; WindowManagerImpl.getDefault().addView(makeStatusBarView(), lp); - } void addExpandedWindow() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java index cc07240..0c8208f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java @@ -23,6 +23,7 @@ import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.graphics.Canvas; import android.graphics.RectF; +import android.hardware.input.InputManager; import android.os.RemoteException; import android.os.SystemClock; import android.os.ServiceManager; @@ -47,7 +48,6 @@ public class KeyButtonView extends ImageView { final float GLOW_MAX_SCALE_FACTOR = 1.8f; final float BUTTON_QUIESCENT_ALPHA = 0.6f; - IWindowManager mWindowManager; long mDownTime; int mCode; int mTouchSlop; @@ -93,9 +93,6 @@ public class KeyButtonView extends ImageView { a.recycle(); - mWindowManager = IWindowManager.Stub.asInterface( - ServiceManager.getService(Context.WINDOW_SERVICE)); - setClickable(true); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); } @@ -276,12 +273,7 @@ public class KeyButtonView extends ImageView { 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags | KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY, InputDevice.SOURCE_KEYBOARD); - try { - //Slog.d(TAG, "injecting event " + ev); - mWindowManager.injectInputEventNoWait(ev); - } catch (RemoteException ex) { - // System process is dead - } + InputManager.injectInputEvent(ev, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HeightReceiver.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HeightReceiver.java deleted file mode 100644 index 3e9a9d8..0000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HeightReceiver.java +++ /dev/null @@ -1,114 +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. - */ - -package com.android.systemui.statusbar.tablet; - -import java.util.ArrayList; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.res.Resources; -import android.util.DisplayMetrics; -import android.util.Slog; -import android.view.Display; -import android.view.WindowManager; -import android.view.WindowManagerImpl; -import android.view.WindowManagerPolicy; - -public class HeightReceiver extends BroadcastReceiver { - private static final String TAG = "StatusBar.HeightReceiver"; - - public interface OnBarHeightChangedListener { - public void onBarHeightChanged(int height); - } - - Context mContext; - ArrayList<OnBarHeightChangedListener> mListeners = new ArrayList<OnBarHeightChangedListener>(); - WindowManager mWindowManager; - int mHeight; - boolean mPlugged; - - public HeightReceiver(Context context) { - mContext = context; - mWindowManager = WindowManagerImpl.getDefault(); - } - - public void addOnBarHeightChangedListener(OnBarHeightChangedListener l) { - mListeners.add(l); - l.onBarHeightChanged(mHeight); - } - - public void removeOnBarHeightChangedListener(OnBarHeightChangedListener l) { - mListeners.remove(l); - } - - @Override - public void onReceive(Context context, Intent intent) { - final boolean plugged - = intent.getBooleanExtra(WindowManagerPolicy.EXTRA_HDMI_PLUGGED_STATE, false); - setPlugged(plugged); - } - - public void registerReceiver() { - final IntentFilter filter = new IntentFilter(); - filter.addAction(WindowManagerPolicy.ACTION_HDMI_PLUGGED); - final Intent val = mContext.registerReceiver(this, filter); - onReceive(mContext, val); - } - - private void setPlugged(boolean plugged) { - mPlugged = plugged; - updateHeight(); - } - - public void updateHeight() { - final Resources res = mContext.getResources(); - - int height = -1; - if (mPlugged) { - final DisplayMetrics metrics = new DisplayMetrics(); - Display display = mWindowManager.getDefaultDisplay(); - display.getRealMetrics(metrics); - - //Slog.i(TAG, "updateHeight: display metrics=" + metrics); - final int shortSide = Math.min(metrics.widthPixels, metrics.heightPixels); - final int externalShortSide = Math.min(display.getRawExternalWidth(), - display.getRawExternalHeight()); - height = shortSide - externalShortSide; - } - - final int minHeight - = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height); - if (height < minHeight) { - height = minHeight; - } - Slog.i(TAG, "Resizing status bar plugged=" + mPlugged + " height=" - + height + " old=" + mHeight); - mHeight = height; - - final int N = mListeners.size(); - for (int i=0; i<N; i++) { - mListeners.get(i).onBarHeightChanged(height); - } - } - - public int getHeight() { - return mHeight; - } -} - diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 7325a37..ba51108 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -87,7 +87,6 @@ import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.statusbar.policy.Prefs; public class TabletStatusBar extends BaseStatusBar implements - HeightReceiver.OnBarHeightChangedListener, InputMethodsPanel.OnHardKeyboardEnabledChangeListener, RecentsPanelView.OnRecentsPanelVisibilityChangedListener { public static final boolean DEBUG = false; @@ -162,7 +161,6 @@ public class TabletStatusBar extends BaseStatusBar implements ViewGroup mPile; - HeightReceiver mHeightReceiver; BatteryController mBatteryController; BluetoothController mBluetoothController; LocationController mLocationController; @@ -204,12 +202,11 @@ public class TabletStatusBar extends BaseStatusBar implements private void addStatusBarWindow() { final View sb = makeStatusBarView(); - final int height = getStatusBarHeight(); final WindowManager.LayoutParams lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, - height, - WindowManager.LayoutParams.TYPE_STATUS_BAR, + ViewGroup.LayoutParams.MATCH_PARENT, + WindowManager.LayoutParams.TYPE_NAVIGATION_BAR, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, @@ -218,20 +215,14 @@ public class TabletStatusBar extends BaseStatusBar implements // HWComposer is unable to handle SW-rendered RGBX_8888 layers. PixelFormat.RGB_565); - // the status bar should be in an overlay if possible - final Display defaultDisplay - = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)) - .getDefaultDisplay(); - // We explicitly leave FLAG_HARDWARE_ACCELERATED out of the flags. The status bar occupies // very little screen real-estate and is updated fairly frequently. By using CPU rendering // for the status bar, we prevent the GPU from having to wake up just to do these small // updates, which should help keep power consumption down. lp.gravity = getStatusBarGravity(); - lp.setTitle("StatusBar"); + lp.setTitle("SystemBar"); lp.packageName = mContext.getPackageName(); - lp.windowAnimations = R.style.Animation_StatusBar; WindowManagerImpl.getDefault().addView(sb, lp); } @@ -414,7 +405,6 @@ public class TabletStatusBar extends BaseStatusBar implements @Override protected void onConfigurationChanged(Configuration newConfig) { - mHeightReceiver.updateHeight(); // display size may have changed loadDimens(); mNotificationPanelParams.height = getNotificationPanelHeight(); WindowManagerImpl.getDefault().updateViewLayout(mNotificationPanel, @@ -426,7 +416,7 @@ public class TabletStatusBar extends BaseStatusBar implements final Resources res = mContext.getResources(); mNaturalBarHeight = res.getDimensionPixelSize( - com.android.internal.R.dimen.system_bar_height); + com.android.internal.R.dimen.navigation_bar_height); int newIconSize = res.getDimensionPixelSize( com.android.internal.R.dimen.system_bar_icon_size); @@ -478,10 +468,6 @@ public class TabletStatusBar extends BaseStatusBar implements mWindowManager = IWindowManager.Stub.asInterface( ServiceManager.getService(Context.WINDOW_SERVICE)); - // This guy will listen for HDMI plugged broadcasts so we can resize the - // status bar as appropriate. - mHeightReceiver = new HeightReceiver(mContext); - mHeightReceiver.registerReceiver(); loadDimens(); final TabletStatusBarView sb = (TabletStatusBarView)View.inflate( @@ -637,8 +623,6 @@ public class TabletStatusBar extends BaseStatusBar implements // set the initial view visibility setAreThereNotifications(); - mHeightReceiver.addOnBarHeightChangedListener(this); - // receive broadcasts IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); @@ -674,7 +658,9 @@ public class TabletStatusBar extends BaseStatusBar implements } public int getStatusBarHeight() { - return mHeightReceiver.getHeight(); + return mStatusBarView != null ? mStatusBarView.getHeight() + : mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.navigation_bar_height); } protected int getStatusBarGravity() { @@ -881,9 +867,14 @@ public class TabletStatusBar extends BaseStatusBar implements } final StatusBarNotification oldNotification = oldEntry.notification; - final RemoteViews oldContentView = oldNotification.notification.contentView; - final RemoteViews contentView = notification.notification.contentView; + // XXX: modify when we do something more intelligent with the two content views + final RemoteViews oldContentView = (oldNotification.notification.bigContentView != null) + ? oldNotification.notification.bigContentView + : oldNotification.notification.contentView; + final RemoteViews contentView = (notification.notification.bigContentView != null) + ? notification.notification.bigContentView + : notification.notification.contentView; if (DEBUG) { Slog.d(TAG, "old notification: when=" + oldNotification.notification.when @@ -1336,14 +1327,6 @@ public class TabletStatusBar extends BaseStatusBar implements } } - private void sendKey(KeyEvent key) { - try { - if (DEBUG) Slog.d(TAG, "injecting key event: " + key); - mWindowManager.injectInputEventNoWait(key); - } catch (RemoteException ex) { - } - } - private View.OnClickListener mOnClickListener = new View.OnClickListener() { public void onClick(View v) { if (v == mRecentButton) { diff --git a/policy/src/com/android/internal/policy/impl/FaceUnlock.java b/policy/src/com/android/internal/policy/impl/FaceUnlock.java new file mode 100644 index 0000000..2ae99e6 --- /dev/null +++ b/policy/src/com/android/internal/policy/impl/FaceUnlock.java @@ -0,0 +1,375 @@ +/* + * 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. + */ + +package com.android.internal.policy.impl; + +import com.android.internal.R; +import com.android.internal.policy.IFaceLockCallback; +import com.android.internal.policy.IFaceLockInterface; +import com.android.internal.widget.LockPatternUtils; + +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; +import android.os.Handler; +import android.os.IBinder; +import android.os.Message; +import android.os.RemoteException; +import android.telephony.TelephonyManager; +import android.util.Log; +import android.view.View; + +public class FaceUnlock implements Handler.Callback { + + private static final boolean DEBUG = false; + private static final String TAG = "FULLockscreen"; + + private final Context mContext; + private final KeyguardUpdateMonitor mUpdateMonitor; + + private IFaceLockInterface mService; + private boolean mBoundToService = false; + private View mAreaView; + + private Handler mHandler; + private final int MSG_SHOW_AREA_VIEW = 0; + private final int MSG_HIDE_AREA_VIEW = 1; + + private boolean mServiceRunning = false; + private final Object mServiceRunningLock = new Object(); + + // Long enough to stay visible while dialer comes up + // Short enough to not be visible if the user goes back immediately + private final int VIEW_AREA_EMERGENCY_DIALER_TIMEOUT = 1000; + + // Long enough to stay visible while the service starts + // Short enough to not have to wait long for backup if service fails to start or crashes + // The service can take a couple of seconds to start on the first try after boot + private final int VIEW_AREA_SERVICE_TIMEOUT = 3000; + + // So the user has a consistent amount of time when brought to the backup method from FaceLock + private final int BACKUP_LOCK_TIMEOUT = 5000; + + /** + * Used to lookup the state of the lock pattern + */ + private final LockPatternUtils mLockPatternUtils; + + KeyguardScreenCallback mKeyguardScreenCallback; + + public FaceUnlock(Context context, KeyguardUpdateMonitor updateMonitor, + LockPatternUtils lockPatternUtils, KeyguardScreenCallback keyguardScreenCallback) { + mContext = context; + mUpdateMonitor = updateMonitor; + mLockPatternUtils = lockPatternUtils; + mKeyguardScreenCallback = keyguardScreenCallback; + mHandler = new Handler(this); + } + + public void cleanUp() { + if (mService != null) { + try { + mService.unregisterCallback(mFaceLockCallback); + } catch (RemoteException e) { + // Not much we can do + } + stop(); + mService = null; + } + } + + /** When screen is turned on and focused, need to bind to FaceLock service if we are using + * FaceLock, but only if we're not dealing with a call + */ + public void activateIfAble(boolean hasOverlay) { + final boolean tooManyFaceUnlockTries = mUpdateMonitor.getMaxFaceUnlockAttemptsReached(); + final int failedBackupAttempts = mUpdateMonitor.getFailedAttempts(); + final boolean backupIsTimedOut = + (failedBackupAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT); + if (tooManyFaceUnlockTries) Log.i(TAG, "tooManyFaceUnlockTries: " + tooManyFaceUnlockTries); + if (mUpdateMonitor.getPhoneState() == TelephonyManager.CALL_STATE_IDLE + && installedAndSelected() + && !hasOverlay + && !tooManyFaceUnlockTries + && !backupIsTimedOut) { + bind(); + + // Show FaceLock area, but only for a little bit so lockpattern will become visible if + // FaceLock fails to start or crashes + showAreaWithTimeout(VIEW_AREA_SERVICE_TIMEOUT); + + // When switching between portrait and landscape view while FaceLock is running, the + // screen will eventually go dark unless we poke the wakelock when FaceLock is + // restarted + mKeyguardScreenCallback.pokeWakelock(); + } else { + hideArea(); + } + } + + public boolean isServiceRunning() { + return mServiceRunning; + } + + public int viewAreaEmergencyDialerTimeout() { + return VIEW_AREA_EMERGENCY_DIALER_TIMEOUT; + } + + // Indicates whether FaceLock is in use + public boolean installedAndSelected() { + return (mLockPatternUtils.usingBiometricWeak() && + mLockPatternUtils.isBiometricWeakInstalled()); + } + + // Takes care of FaceLock area when layout is created + public void initializeAreaView(View view) { + if (installedAndSelected()) { + mAreaView = view.findViewById(R.id.faceLockAreaView); + if (mAreaView == null) { + Log.e(TAG, "Layout does not have areaView and FaceLock is enabled"); + } + } else { + mAreaView = null; // Set to null if not using FaceLock + } + } + + // Stops FaceLock if it is running and reports back whether it was running or not + public boolean stopIfRunning() { + if (installedAndSelected() && mBoundToService) { + stopAndUnbind(); + return true; + } + return false; + } + + // Handles covering or exposing FaceLock area on the client side when FaceLock starts or stops + // This needs to be done in a handler because the call could be coming from a callback from the + // FaceLock service that is in a thread that can't modify the UI + @Override + public boolean handleMessage(Message msg) { + switch (msg.what) { + case MSG_SHOW_AREA_VIEW: + if (mAreaView != null) { + mAreaView.setVisibility(View.VISIBLE); + } + break; + case MSG_HIDE_AREA_VIEW: + if (mAreaView != null) { + mAreaView.setVisibility(View.INVISIBLE); + } + break; + default: + Log.w(TAG, "Unhandled message"); + return false; + } + return true; + } + + // Removes show and hide messages from the message queue + private void removeAreaDisplayMessages() { + mHandler.removeMessages(MSG_SHOW_AREA_VIEW); + mHandler.removeMessages(MSG_HIDE_AREA_VIEW); + } + + // Shows the FaceLock area immediately + public void showArea() { + // Remove messages to prevent a delayed hide message from undo-ing the show + removeAreaDisplayMessages(); + mHandler.sendEmptyMessage(MSG_SHOW_AREA_VIEW); + } + + // Hides the FaceLock area immediately + public void hideArea() { + // Remove messages to prevent a delayed show message from undo-ing the hide + removeAreaDisplayMessages(); + mHandler.sendEmptyMessage(MSG_HIDE_AREA_VIEW); + } + + // Shows the FaceLock area for a period of time + public void showAreaWithTimeout(long timeoutMillis) { + showArea(); + mHandler.sendEmptyMessageDelayed(MSG_HIDE_AREA_VIEW, timeoutMillis); + } + + // Binds to FaceLock service. This call does not tell it to start, but it causes the service + // to call the onServiceConnected callback, which then starts FaceLock. + public void bind() { + if (installedAndSelected()) { + if (!mBoundToService) { + if (DEBUG) Log.d(TAG, "before bind to FaceLock service"); + mContext.bindService(new Intent(IFaceLockInterface.class.getName()), + mConnection, + Context.BIND_AUTO_CREATE); + if (DEBUG) Log.d(TAG, "after bind to FaceLock service"); + mBoundToService = true; + } else { + Log.w(TAG, "Attempt to bind to FaceLock when already bound"); + } + } + } + + // Tells FaceLock to stop and then unbinds from the FaceLock service + public void stopAndUnbind() { + if (installedAndSelected()) { + stop(); + + if (mBoundToService) { + if (DEBUG) Log.d(TAG, "before unbind from FaceLock service"); + if (mService != null) { + try { + mService.unregisterCallback(mFaceLockCallback); + } catch (RemoteException e) { + // Not much we can do + } + } + mContext.unbindService(mConnection); + if (DEBUG) Log.d(TAG, "after unbind from FaceLock service"); + mBoundToService = false; + } else { + // This is usually not an error when this happens. Sometimes we will tell it to + // unbind multiple times because it's called from both onWindowFocusChanged and + // onDetachedFromWindow. + if (DEBUG) Log.d(TAG, "Attempt to unbind from FaceLock when not bound"); + } + } + } + + private ServiceConnection mConnection = new ServiceConnection() { + // Completes connection, registers callback and starts FaceLock when service is bound + @Override + public void onServiceConnected(ComponentName className, IBinder iservice) { + mService = IFaceLockInterface.Stub.asInterface(iservice); + if (DEBUG) Log.d(TAG, "Connected to FaceLock service"); + try { + mService.registerCallback(mFaceLockCallback); + } catch (RemoteException e) { + Log.e(TAG, "Caught exception connecting to FaceLock: " + e.toString()); + mService = null; + mBoundToService = false; + return; + } + + if (mAreaView != null) { + int[] position; + position = new int[2]; + mAreaView.getLocationInWindow(position); + start(mAreaView.getWindowToken(), position[0], position[1], + mAreaView.getWidth(), mAreaView.getHeight()); + } + } + + // Cleans up if FaceLock service unexpectedly disconnects + @Override + public void onServiceDisconnected(ComponentName className) { + synchronized(mServiceRunningLock) { + mService = null; + mServiceRunning = false; + } + mBoundToService = false; + Log.w(TAG, "Unexpected disconnect from FaceLock service"); + } + }; + + // Tells the FaceLock service to start displaying its UI and perform recognition + public void start(IBinder windowToken, int x, int y, int w, int h) { + if (installedAndSelected()) { + synchronized (mServiceRunningLock) { + if (!mServiceRunning) { + if (DEBUG) Log.d(TAG, "Starting FaceLock"); + try { + mService.startUi(windowToken, x, y, w, h); + } catch (RemoteException e) { + Log.e(TAG, "Caught exception starting FaceLock: " + e.toString()); + return; + } + mServiceRunning = true; + } else { + if (DEBUG) Log.w(TAG, "start() attempted while running"); + } + } + } + } + + // Tells the FaceLock service to stop displaying its UI and stop recognition + public void stop() { + if (installedAndSelected()) { + // Note that attempting to stop FaceLock when it's not running is not an issue. + // FaceLock can return, which stops it and then we try to stop it when the + // screen is turned off. That's why we check. + synchronized (mServiceRunningLock) { + if (mServiceRunning) { + try { + if (DEBUG) Log.d(TAG, "Stopping FaceLock"); + mService.stopUi(); + } catch (RemoteException e) { + Log.e(TAG, "Caught exception stopping FaceLock: " + e.toString()); + } + mServiceRunning = false; + } + } + } + } + + // Implements the FaceLock service callback interface defined in AIDL + private final IFaceLockCallback mFaceLockCallback = new IFaceLockCallback.Stub() { + // Stops the FaceLock UI and indicates that the phone should be unlocked + @Override + public void unlock() { + if (DEBUG) Log.d(TAG, "FaceLock unlock()"); + showArea(); // Keep fallback covered + stopAndUnbind(); + + mKeyguardScreenCallback.keyguardDone(true); + mKeyguardScreenCallback.reportSuccessfulUnlockAttempt(); + } + + // Stops the FaceLock UI and exposes the backup method without unlocking + // This means the user has cancelled out + @Override + public void cancel() { + if (DEBUG) Log.d(TAG, "FaceLock cancel()"); + hideArea(); // Expose fallback + stopAndUnbind(); + mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT); + } + + // Stops the FaceLock UI and exposes the backup method without unlocking + // This means FaceLock failed to recognize them + @Override + public void reportFailedAttempt() { + if (DEBUG) Log.d(TAG, "FaceLock reportFailedAttempt()"); + mUpdateMonitor.reportFailedFaceUnlockAttempt(); + hideArea(); // Expose fallback + stopAndUnbind(); + mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT); + } + + // Removes the black area that covers the backup unlock method + @Override + public void exposeFallback() { + if (DEBUG) Log.d(TAG, "FaceLock exposeFallback()"); + hideArea(); // Expose fallback + } + + // Allows the Face Unlock service to poke the wake lock to keep the lockscreen alive + @Override + public void pokeWakelock() { + if (DEBUG) Log.d(TAG, "FaceLock pokeWakelock()"); + mKeyguardScreenCallback.pokeWakelock(); + } + }; +} diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java index 804cd9e..a472375 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java @@ -105,6 +105,7 @@ public class KeyguardUpdateMonitor { 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; + protected static final int MSG_USER_CHANGED = 310; /** * When we receive a @@ -209,6 +210,9 @@ public class KeyguardUpdateMonitor { case MSG_DPM_STATE_CHANGED: handleDevicePolicyManagerStateChanged(); break; + case MSG_USER_CHANGED: + handleUserChanged(msg.arg1); + break; } } }; @@ -268,6 +272,8 @@ public class KeyguardUpdateMonitor { filter.addAction(SPN_STRINGS_UPDATED_ACTION); filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); filter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED); + filter.addAction(Intent.ACTION_USER_SWITCHED); + filter.addAction(Intent.ACTION_USER_REMOVED); context.registerReceiver(new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { @@ -302,6 +308,9 @@ public class KeyguardUpdateMonitor { } else if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED .equals(action)) { mHandler.sendMessage(mHandler.obtainMessage(MSG_DPM_STATE_CHANGED)); + } else if (Intent.ACTION_USER_SWITCHED.equals(action)) { + mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_CHANGED, + intent.getIntExtra(Intent.EXTRA_USERID, 0), 0)); } } }, filter); @@ -313,6 +322,12 @@ public class KeyguardUpdateMonitor { } } + protected void handleUserChanged(int userId) { + for (int i = 0; i < mInfoCallbacks.size(); i++) { + mInfoCallbacks.get(i).onUserChanged(userId); + } + } + protected void handleDeviceProvisioned() { for (int i = 0; i < mInfoCallbacks.size(); i++) { mInfoCallbacks.get(i).onDeviceProvisioned(); @@ -542,6 +557,11 @@ public class KeyguardUpdateMonitor { * See {@link DevicePolicyManager#ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED} */ void onDevicePolicyManagerStateChanged(); + + /** + * Called when the user changes. + */ + void onUserChanged(int userId); } // Simple class that allows methods to easily be overwritten @@ -570,6 +590,9 @@ public class KeyguardUpdateMonitor { public void onDevicePolicyManagerStateChanged() { } + + public void onUserChanged(int userId) { + } } /** diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java index 377ea66..52fb875 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -85,7 +85,7 @@ import android.view.WindowManagerPolicy; * This class is created by the initialization routine of the {@link WindowManagerPolicy}, * and runs on its thread. The keyguard UI is created from that thread in the * constructor of this class. The apis may be called from other threads, including the - * {@link com.android.server.wm.InputManager}'s and {@link android.view.WindowManager}'s. + * {@link com.android.server.input.InputManagerService}'s and {@link android.view.WindowManager}'s. * Therefore, methods on this class are synchronized, and any action that is pointed * directly to the keyguard UI is posted to a {@link Handler} to ensure it is taken on the UI * thread of the keyguard. @@ -342,6 +342,10 @@ public class KeyguardViewMediator implements KeyguardViewCallback, if (soundPath == null || mUnlockSoundId == 0) { if (DEBUG) Log.d(TAG, "failed to load sound from " + soundPath); } + IntentFilter userFilter = new IntentFilter(); + userFilter.addAction(Intent.ACTION_USER_SWITCHED); + userFilter.addAction(Intent.ACTION_USER_REMOVED); + mContext.registerReceiver(mUserChangeReceiver, userFilter); } /** @@ -801,6 +805,29 @@ public class KeyguardViewMediator implements KeyguardViewCallback, return mKeyguardViewProperties.isSecure(); } + private void onUserSwitched(int userId) { + mLockPatternUtils.setCurrentUser(userId); + synchronized (KeyguardViewMediator.this) { + resetStateLocked(); + } + } + + private void onUserRemoved(int userId) { + mLockPatternUtils.removeUser(userId); + } + + private BroadcastReceiver mUserChangeReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + if (Intent.ACTION_USER_SWITCHED.equals(action)) { + onUserSwitched(intent.getIntExtra(Intent.EXTRA_USERID, 0)); + } else if (Intent.ACTION_USER_REMOVED.equals(action)) { + onUserRemoved(intent.getIntExtra(Intent.EXTRA_USERID, 0)); + } + } + }; + private BroadcastReceiver mBroadCastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java index 2e7769b..596040c 100644 --- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -20,8 +20,6 @@ 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; import com.android.internal.telephony.IccCard; import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockScreenWidgetCallback; @@ -36,12 +34,10 @@ import android.accounts.AuthenticatorException; import android.accounts.OperationCanceledException; import android.app.AlertDialog; import android.app.admin.DevicePolicyManager; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.content.res.Resources; -import android.content.ServiceConnection; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; @@ -50,12 +46,8 @@ import android.graphics.PixelFormat; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.os.Handler; -import android.os.Message; -import android.os.IBinder; import android.os.Parcelable; import android.os.PowerManager; -import android.os.RemoteException; import android.os.SystemClock; import android.os.SystemProperties; import android.telephony.TelephonyManager; @@ -82,7 +74,7 @@ import java.io.IOException; * {@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 { +public class LockPatternKeyguardView extends KeyguardViewBase { private static final int TRANSPORT_USERACTIVITY_TIMEOUT = 10000; @@ -110,30 +102,9 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler private boolean mShowLockBeforeUnlock = false; // The following were added to support FaceLock - private IFaceLockInterface mFaceLockService; - private boolean mBoundToFaceLockService = false; - private View mFaceLockAreaView; - - private boolean mFaceLockServiceRunning = false; - private final Object mFaceLockServiceRunningLock = new Object(); + private FaceUnlock mFaceUnlock; private final Object mFaceLockStartupLock = new Object(); - private Handler mHandler; - private final int MSG_SHOW_FACELOCK_AREA_VIEW = 0; - private final int MSG_HIDE_FACELOCK_AREA_VIEW = 1; - - // Long enough to stay visible while dialer comes up - // Short enough to not be visible if the user goes back immediately - private final int FACELOCK_VIEW_AREA_EMERGENCY_DIALER_TIMEOUT = 1000; - - // Long enough to stay visible while the service starts - // Short enough to not have to wait long for backup if service fails to start or crashes - // The service can take a couple of seconds to start on the first try after boot - private final int FACELOCK_VIEW_AREA_SERVICE_TIMEOUT = 3000; - - // So the user has a consistent amount of time when brought to the backup method from FaceLock - private final int BACKUP_LOCK_TIMEOUT = 5000; - 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 @@ -340,12 +311,12 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler mHasOverlay = true; // Continue showing FaceLock area until dialer comes up or call is resumed - if (usingFaceLock() && mFaceLockServiceRunning) { - showFaceLockAreaWithTimeout(FACELOCK_VIEW_AREA_EMERGENCY_DIALER_TIMEOUT); + if (mFaceUnlock.installedAndSelected() && mFaceUnlock.isServiceRunning()) { + mFaceUnlock.showAreaWithTimeout(mFaceUnlock.viewAreaEmergencyDialerTimeout()); } // FaceLock must be stopped if it is running when emergency call is pressed - stopAndUnbindFromFaceLock(); + mFaceUnlock.stopAndUnbind(); pokeWakelock(EMERGENCY_CALL_TIMEOUT); if (TelephonyManager.getDefault().getCallState() @@ -450,7 +421,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler LockPatternUtils lockPatternUtils, KeyguardWindowController controller) { super(context, callback); - mHandler = new Handler(this); + mFaceUnlock = new FaceUnlock(context, updateMonitor, lockPatternUtils, + mKeyguardScreenCallback); mConfiguration = context.getResources().getConfiguration(); mEnableFallback = false; mRequiresSim = TextUtils.isEmpty(SystemProperties.get("keyguard.no_require_sim")); @@ -570,36 +542,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler saveWidgetState(); // When screen is turned off, need to unbind from FaceLock service if using FaceLock - stopAndUnbindFromFaceLock(); - } - - /** When screen is turned on and focused, need to bind to FaceLock service if we are using - * FaceLock, but only if we're not dealing with a call - */ - private void activateFaceLockIfAble() { - final boolean tooManyFaceUnlockTries = mUpdateMonitor.getMaxFaceUnlockAttemptsReached(); - final int failedBackupAttempts = mUpdateMonitor.getFailedAttempts(); - final boolean backupIsTimedOut = - (failedBackupAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT); - if (tooManyFaceUnlockTries) Log.i(TAG, "tooManyFaceUnlockTries: " + tooManyFaceUnlockTries); - if (mUpdateMonitor.getPhoneState() == TelephonyManager.CALL_STATE_IDLE - && usingFaceLock() - && !mHasOverlay - && !tooManyFaceUnlockTries - && !backupIsTimedOut) { - bindToFaceLock(); - - // Show FaceLock area, but only for a little bit so lockpattern will become visible if - // FaceLock fails to start or crashes - showFaceLockAreaWithTimeout(FACELOCK_VIEW_AREA_SERVICE_TIMEOUT); - - // When switching between portrait and landscape view while FaceLock is running, the - // screen will eventually go dark unless we poke the wakelock when FaceLock is - // restarted - mKeyguardScreenCallback.pokeWakelock(); - } else { - hideFaceLockArea(); - } + mFaceUnlock.stopAndUnbind(); } @Override @@ -616,7 +559,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler restoreWidgetState(); - if (runFaceLock) activateFaceLockIfAble(); + if (runFaceLock) mFaceUnlock.activateIfAble(mHasOverlay); } private void saveWidgetState() { @@ -647,13 +590,13 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler if(mScreenOn && !mWindowFocused) runFaceLock = hasWindowFocus; mWindowFocused = hasWindowFocus; } - if(!hasWindowFocus) { + if (!hasWindowFocus) { mHasOverlay = true; - stopAndUnbindFromFaceLock(); - hideFaceLockArea(); + mFaceUnlock.stopAndUnbind(); + mFaceUnlock.hideArea(); } else { mHasDialog = false; - if (runFaceLock) activateFaceLockIfAble(); + if (runFaceLock) mFaceUnlock.activateIfAble(mHasOverlay); } } @@ -667,14 +610,14 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler ((KeyguardScreen) mUnlockScreen).onResume(); } - if (usingFaceLock() && !mHasOverlay) { + if (mFaceUnlock.installedAndSelected() && !mHasOverlay) { // Note that show() gets called before the screen turns off to set it up for next time // it is turned on. We don't want to set a timeout on the FaceLock area here because it // may be gone by the time the screen is turned on again. We set the timeout when the // screen turns on instead. - showFaceLockArea(); + mFaceUnlock.showArea(); } else { - hideFaceLockArea(); + mFaceUnlock.hideArea(); } } @@ -710,7 +653,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler // When view is hidden, need to unbind from FaceLock service if we are using FaceLock // e.g., when device becomes unlocked - stopAndUnbindFromFaceLock(); + mFaceUnlock.stopAndUnbind(); super.onDetachedFromWindow(); } @@ -734,9 +677,9 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler 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(); + if (!mFaceUnlock.isServiceRunning()) { + mFaceUnlock.stopAndUnbind(); + mFaceUnlock.hideArea(); } } @@ -753,10 +696,16 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler if (DEBUG) Log.d(TAG, "phone state: " + phoneState); if(phoneState == TelephonyManager.CALL_STATE_RINGING) { mHasOverlay = true; - stopAndUnbindFromFaceLock(); - hideFaceLockArea(); + mFaceUnlock.stopAndUnbind(); + mFaceUnlock.hideArea(); } } + + @Override + public void onUserChanged(int userId) { + mLockPatternUtils.setCurrentUser(userId); + updateScreen(getInitialMode(), true); + } }; @Override @@ -816,15 +765,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler mUnlockScreen = null; } mUpdateMonitor.removeCallback(this); - if (mFaceLockService != null) { - try { - mFaceLockService.unregisterCallback(mFaceLockCallback); - } catch (RemoteException e) { - // Not much we can do - } - stopFaceLock(); - mFaceLockService = null; - } + mFaceUnlock.cleanUp(); } private boolean isSecure() { @@ -874,9 +815,9 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler final UnlockMode unlockMode = getUnlockMode(); if (mode == Mode.UnlockScreen && unlockMode != UnlockMode.Unknown) { if (force || mUnlockScreen == null || unlockMode != mUnlockScreenMode) { - boolean restartFaceLock = stopFaceLockIfRunning(); + boolean restartFaceLock = mFaceUnlock.stopIfRunning(); recreateUnlockScreen(unlockMode); - if (restartFaceLock) activateFaceLockIfAble(); + if (restartFaceLock) mFaceUnlock.activateIfAble(mHasOverlay); } } @@ -989,7 +930,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler throw new IllegalArgumentException("unknown unlock mode " + unlockMode); } initializeTransportControlView(unlockView); - initializeFaceLockAreaView(unlockView); // Only shows view if FaceLock is enabled + mFaceUnlock.initializeAreaView(unlockView); // Only shows view if FaceLock is enabled mUnlockScreenMode = unlockMode; return unlockView; @@ -1171,254 +1112,4 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler return mBitmap.getHeight(); } } - - // Everything below pertains to FaceLock - might want to separate this out - - // Indicates whether FaceLock is in use - private boolean usingFaceLock() { - return (mLockPatternUtils.usingBiometricWeak() && - mLockPatternUtils.isBiometricWeakInstalled()); - } - - // Takes care of FaceLock area when layout is created - private void initializeFaceLockAreaView(View view) { - if (usingFaceLock()) { - mFaceLockAreaView = view.findViewById(R.id.faceLockAreaView); - if (mFaceLockAreaView == null) { - Log.e(TAG, "Layout does not have faceLockAreaView and FaceLock is enabled"); - } - } else { - mFaceLockAreaView = null; // Set to null if not using FaceLock - } - } - - // Stops FaceLock if it is running and reports back whether it was running or not - private boolean stopFaceLockIfRunning() { - if (usingFaceLock() && mBoundToFaceLockService) { - stopAndUnbindFromFaceLock(); - return true; - } - return false; - } - - // Handles covering or exposing FaceLock area on the client side when FaceLock starts or stops - // This needs to be done in a handler because the call could be coming from a callback from the - // FaceLock service that is in a thread that can't modify the UI - @Override - public boolean handleMessage(Message msg) { - switch (msg.what) { - case MSG_SHOW_FACELOCK_AREA_VIEW: - if (mFaceLockAreaView != null) { - mFaceLockAreaView.setVisibility(View.VISIBLE); - } - break; - case MSG_HIDE_FACELOCK_AREA_VIEW: - if (mFaceLockAreaView != null) { - mFaceLockAreaView.setVisibility(View.INVISIBLE); - } - break; - default: - Log.w(TAG, "Unhandled message"); - return false; - } - return true; - } - - // Removes show and hide messages from the message queue - private void removeFaceLockAreaDisplayMessages() { - mHandler.removeMessages(MSG_SHOW_FACELOCK_AREA_VIEW); - mHandler.removeMessages(MSG_HIDE_FACELOCK_AREA_VIEW); - } - - // Shows the FaceLock area immediately - private void showFaceLockArea() { - // Remove messages to prevent a delayed hide message from undo-ing the show - removeFaceLockAreaDisplayMessages(); - mHandler.sendEmptyMessage(MSG_SHOW_FACELOCK_AREA_VIEW); - } - - // Hides the FaceLock area immediately - private void hideFaceLockArea() { - // Remove messages to prevent a delayed show message from undo-ing the hide - removeFaceLockAreaDisplayMessages(); - mHandler.sendEmptyMessage(MSG_HIDE_FACELOCK_AREA_VIEW); - } - - // Shows the FaceLock area for a period of time - private void showFaceLockAreaWithTimeout(long timeoutMillis) { - showFaceLockArea(); - mHandler.sendEmptyMessageDelayed(MSG_HIDE_FACELOCK_AREA_VIEW, timeoutMillis); - } - - // Binds to FaceLock service. This call does not tell it to start, but it causes the service - // to call the onServiceConnected callback, which then starts FaceLock. - public void bindToFaceLock() { - if (usingFaceLock()) { - if (!mBoundToFaceLockService) { - if (DEBUG) Log.d(TAG, "before bind to FaceLock service"); - mContext.bindService(new Intent(IFaceLockInterface.class.getName()), - mFaceLockConnection, - Context.BIND_AUTO_CREATE); - if (DEBUG) Log.d(TAG, "after bind to FaceLock service"); - mBoundToFaceLockService = true; - } else { - Log.w(TAG, "Attempt to bind to FaceLock when already bound"); - } - } - } - - // Tells FaceLock to stop and then unbinds from the FaceLock service - public void stopAndUnbindFromFaceLock() { - if (usingFaceLock()) { - stopFaceLock(); - - if (mBoundToFaceLockService) { - if (DEBUG) Log.d(TAG, "before unbind from FaceLock service"); - if (mFaceLockService != null) { - try { - mFaceLockService.unregisterCallback(mFaceLockCallback); - } catch (RemoteException e) { - // Not much we can do - } - } - mContext.unbindService(mFaceLockConnection); - if (DEBUG) Log.d(TAG, "after unbind from FaceLock service"); - mBoundToFaceLockService = false; - } else { - // This is usually not an error when this happens. Sometimes we will tell it to - // unbind multiple times because it's called from both onWindowFocusChanged and - // onDetachedFromWindow. - if (DEBUG) Log.d(TAG, "Attempt to unbind from FaceLock when not bound"); - } - } - } - - private ServiceConnection mFaceLockConnection = new ServiceConnection() { - // Completes connection, registers callback and starts FaceLock when service is bound - @Override - public void onServiceConnected(ComponentName className, IBinder iservice) { - mFaceLockService = IFaceLockInterface.Stub.asInterface(iservice); - if (DEBUG) Log.d(TAG, "Connected to FaceLock service"); - try { - mFaceLockService.registerCallback(mFaceLockCallback); - } catch (RemoteException e) { - Log.e(TAG, "Caught exception connecting to FaceLock: " + e.toString()); - mFaceLockService = null; - mBoundToFaceLockService = false; - return; - } - - if (mFaceLockAreaView != null) { - int[] faceLockPosition; - faceLockPosition = new int[2]; - mFaceLockAreaView.getLocationInWindow(faceLockPosition); - startFaceLock(mFaceLockAreaView.getWindowToken(), - faceLockPosition[0], faceLockPosition[1], - mFaceLockAreaView.getWidth(), mFaceLockAreaView.getHeight()); - } - } - - // Cleans up if FaceLock service unexpectedly disconnects - @Override - public void onServiceDisconnected(ComponentName className) { - synchronized(mFaceLockServiceRunningLock) { - mFaceLockService = null; - mFaceLockServiceRunning = false; - } - mBoundToFaceLockService = false; - Log.w(TAG, "Unexpected disconnect from FaceLock service"); - } - }; - - // Tells the FaceLock service to start displaying its UI and perform recognition - public void startFaceLock(IBinder windowToken, int x, int y, int w, int h) - { - if (usingFaceLock()) { - synchronized (mFaceLockServiceRunningLock) { - if (!mFaceLockServiceRunning) { - if (DEBUG) Log.d(TAG, "Starting FaceLock"); - try { - mFaceLockService.startUi(windowToken, x, y, w, h); - } catch (RemoteException e) { - Log.e(TAG, "Caught exception starting FaceLock: " + e.toString()); - return; - } - mFaceLockServiceRunning = true; - } else { - if (DEBUG) Log.w(TAG, "startFaceLock() attempted while running"); - } - } - } - } - - // Tells the FaceLock service to stop displaying its UI and stop recognition - public void stopFaceLock() - { - if (usingFaceLock()) { - // Note that attempting to stop FaceLock when it's not running is not an issue. - // FaceLock can return, which stops it and then we try to stop it when the - // screen is turned off. That's why we check. - synchronized (mFaceLockServiceRunningLock) { - if (mFaceLockServiceRunning) { - try { - if (DEBUG) Log.d(TAG, "Stopping FaceLock"); - mFaceLockService.stopUi(); - } catch (RemoteException e) { - Log.e(TAG, "Caught exception stopping FaceLock: " + e.toString()); - } - mFaceLockServiceRunning = false; - } - } - } - } - - // Implements the FaceLock service callback interface defined in AIDL - private final IFaceLockCallback mFaceLockCallback = new IFaceLockCallback.Stub() { - - // Stops the FaceLock UI and indicates that the phone should be unlocked - @Override - public void unlock() { - if (DEBUG) Log.d(TAG, "FaceLock unlock()"); - showFaceLockArea(); // Keep fallback covered - stopAndUnbindFromFaceLock(); - - mKeyguardScreenCallback.keyguardDone(true); - mKeyguardScreenCallback.reportSuccessfulUnlockAttempt(); - } - - // Stops the FaceLock UI and exposes the backup method without unlocking - // This means the user has cancelled out - @Override - public void cancel() { - if (DEBUG) Log.d(TAG, "FaceLock cancel()"); - hideFaceLockArea(); // Expose fallback - stopAndUnbindFromFaceLock(); - mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT); - } - - // Stops the FaceLock UI and exposes the backup method without unlocking - // This means FaceLock failed to recognize them - @Override - public void reportFailedAttempt() { - if (DEBUG) Log.d(TAG, "FaceLock reportFailedAttempt()"); - mUpdateMonitor.reportFailedFaceUnlockAttempt(); - hideFaceLockArea(); // Expose fallback - stopAndUnbindFromFaceLock(); - mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT); - } - - // Removes the black area that covers the backup unlock method - @Override - public void exposeFallback() { - if (DEBUG) Log.d(TAG, "FaceLock exposeFallback()"); - hideFaceLockArea(); // Expose fallback - } - - // Allows the Face Unlock service to poke the wake lock to keep the lockscreen alive - @Override - public void pokeWakelock() { - if (DEBUG) Log.d(TAG, "FaceLock pokeWakelock()"); - mKeyguardScreenCallback.pokeWakelock(); - } - }; } diff --git a/policy/src/com/android/internal/policy/impl/LockScreen.java b/policy/src/com/android/internal/policy/impl/LockScreen.java index c9a130b..e8ba21d 100644 --- a/policy/src/com/android/internal/policy/impl/LockScreen.java +++ b/policy/src/com/android/internal/policy/impl/LockScreen.java @@ -17,10 +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.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; @@ -29,6 +27,7 @@ import com.android.internal.widget.multiwaveview.MultiWaveView; import android.app.ActivityManager; import android.app.ActivityManagerNative; +import android.app.SearchManager; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; @@ -39,6 +38,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.*; +import android.speech.RecognizerIntent; import android.util.Log; import android.media.AudioManager; import android.os.RemoteException; @@ -79,7 +79,8 @@ class LockScreen extends LinearLayout implements KeyguardScreen { private KeyguardStatusViewManager mStatusViewManager; private UnlockWidgetCommonMethods mUnlockWidgetMethods; private View mUnlockWidget; - public boolean mCameraDisabled; + private boolean mCameraDisabled; + private boolean mSearchDisabled; InfoCallbackImpl mInfoCallback = new InfoCallbackImpl() { @@ -94,14 +95,14 @@ class LockScreen extends LinearLayout implements KeyguardScreen { @Override public void onDevicePolicyManagerStateChanged() { - updateCameraTarget(); + updateTargets(); } }; SimStateCallback mSimStateCallback = new SimStateCallback() { public void onSimStateChanged(State simState) { - updateCameraTarget(); + updateTargets(); } }; @@ -243,11 +244,12 @@ class LockScreen extends LinearLayout implements KeyguardScreen { MultiWaveViewMethods(MultiWaveView multiWaveView) { mMultiWaveView = multiWaveView; + + // TODO: get search icon. See Launcher.updateGlobalSearchIcon() } - public boolean isCameraTargetPresent() { - return mMultiWaveView - .getTargetPosition(com.android.internal.R.drawable.ic_lockscreen_camera) != -1; + public boolean isTargetPresent(int resId) { + return mMultiWaveView.getTargetPosition(resId) != -1; } public void updateResources() { @@ -263,6 +265,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen { mMultiWaveView.setTargetResources(resId); } setEnabled(com.android.internal.R.drawable.ic_lockscreen_camera, !mCameraDisabled); + setEnabled(com.android.internal.R.drawable.ic_lockscreen_search, !mSearchDisabled); } public void onGrabbed(View v, int handle) { @@ -276,8 +279,13 @@ class LockScreen extends LinearLayout implements KeyguardScreen { public void onTrigger(View v, int target) { final int resId = mMultiWaveView.getResourceIdForTarget(target); switch (resId) { + case com.android.internal.R.drawable.ic_lockscreen_search: + launchActivity(new Intent(RecognizerIntent.ACTION_WEB_SEARCH)); + mCallback.pokeWakelock(); + break; + case com.android.internal.R.drawable.ic_lockscreen_camera: - launchCamera(); + launchActivity(new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA)); mCallback.pokeWakelock(); break; @@ -292,8 +300,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen { } } - private void launchCamera() { - Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA); + private void launchActivity(Intent intent) { intent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP @@ -457,18 +464,29 @@ class LockScreen extends LinearLayout implements KeyguardScreen { } } - private void updateCameraTarget() { + private void updateTargets() { boolean disabledByAdmin = mLockPatternUtils.getDevicePolicyManager() .getCameraDisabled(null); boolean disabledBySimState = mUpdateMonitor.isSimLocked(); - boolean targetPresent = (mUnlockWidgetMethods instanceof MultiWaveViewMethods) - ? ((MultiWaveViewMethods) mUnlockWidgetMethods).isCameraTargetPresent() : false; + boolean cameraTargetPresent = (mUnlockWidgetMethods instanceof MultiWaveViewMethods) + ? ((MultiWaveViewMethods) mUnlockWidgetMethods) + .isTargetPresent(com.android.internal.R.drawable.ic_lockscreen_camera) + : false; + boolean searchTargetPresent = (mUnlockWidgetMethods instanceof MultiWaveViewMethods) + ? ((MultiWaveViewMethods) mUnlockWidgetMethods) + .isTargetPresent(com.android.internal.R.drawable.ic_lockscreen_search) + : false; + + // TODO: test to see if search is available + boolean searchActionAvailable = true; + 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; + mCameraDisabled = disabledByAdmin || disabledBySimState || !cameraTargetPresent; + mSearchDisabled = disabledBySimState || !searchActionAvailable || !searchTargetPresent; mUnlockWidgetMethods.updateResources(); } diff --git a/policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java b/policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java index 9a6d2cc..17e671d 100644 --- a/policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java @@ -41,7 +41,7 @@ import java.util.List; class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient implements KeyguardScreen { - private static final boolean DEBUG = false; + private static final boolean DEBUG = true; /* TODO: revert before JB release */ private static final String TAG = "UnlockScreen"; // how long before we clear the wrong pattern @@ -321,6 +321,7 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient implements LockPatternView.OnPatternListener { public void onPatternStart() { + if (DEBUG) Log.d(TAG, "Got pattern start"); mLockPatternView.removeCallbacks(mCancelPatternRunnable); } @@ -336,6 +337,7 @@ class PatternUnlockScreen extends LinearLayoutWithDefaultTouchRecepient // Give just a little extra time if they hit one of the first few dots mCallback.pokeWakelock(UNLOCK_PATTERN_WAKE_INTERVAL_FIRST_DOTS_MS); } + if (DEBUG) Log.d(TAG, "Got pattern cell"); } public void onPatternDetected(List<LockPatternView.Cell> pattern) { diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index fb1e106..5697284 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -1,5 +1,4 @@ /* - * Copyright (C) 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. @@ -72,6 +71,7 @@ import android.util.EventLog; import android.util.Log; import android.util.Slog; import android.util.SparseArray; +import android.view.Display; import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.IApplicationToken; @@ -132,6 +132,9 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR; import static android.view.WindowManager.LayoutParams.TYPE_BOOT_PROGRESS; import android.view.WindowManagerImpl; import android.view.WindowManagerPolicy; +import static android.view.WindowManagerPolicy.WindowManagerFuncs.LID_ABSENT; +import static android.view.WindowManagerPolicy.WindowManagerFuncs.LID_OPEN; +import static android.view.WindowManagerPolicy.WindowManagerFuncs.LID_CLOSED; import android.view.KeyCharacterMap.FallbackAction; import android.view.accessibility.AccessibilityEvent; import android.view.animation.Animation; @@ -237,8 +240,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final int SYSTEM_UI_CHANGING_LAYOUT = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN; - // Useful scan codes. - private static final int SW_LID = 0x00; private static final int BTN_MOUSE = 0x110; /* Table of Application Launch keys. Maps from key codes to intent categories. @@ -299,11 +300,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean mHeadless; boolean mSafeMode; WindowState mStatusBar = null; - boolean mStatusBarCanHide; + boolean mHasSystemNavBar; int mStatusBarHeight; final ArrayList<WindowState> mStatusBarPanels = new ArrayList<WindowState>(); WindowState mNavigationBar = null; boolean mHasNavigationBar = false; + boolean mCanHideNavigationBar = false; + boolean mNavigationBarOnBottom = true; int mNavigationBarWidth = 0, mNavigationBarHeight = 0; WindowState mKeyguard = null; @@ -320,15 +323,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { RecentApplicationsDialog mRecentAppsDialog; int mRecentAppsDialogHeldModifiers; - private static final int LID_ABSENT = -1; - private static final int LID_CLOSED = 0; - private static final int LID_OPEN = 1; - int mLidOpen = LID_ABSENT; boolean mSystemReady; boolean mSystemBooted; boolean mHdmiPlugged; + int mExternalDisplayWidth; + int mExternalDisplayHeight; int mUiMode; int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED; int mLidOpenRotation; @@ -464,6 +465,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { // (See Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR.) int mIncallPowerBehavior; + Display mDisplay; + int mLandscapeRotation = 0; // default landscape rotation int mSeascapeRotation = 0; // "other" landscape rotation, 180 degrees from mLandscapeRotation int mPortraitRotation = 0; // default portrait rotation @@ -927,10 +930,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } - public void setInitialDisplaySize(int width, int height) { - int shortSize; + public void setInitialDisplaySize(Display display, int width, int height) { + mDisplay = display; + + int shortSize, longSize; if (width > height) { shortSize = height; + longSize = width; mLandscapeRotation = Surface.ROTATION_0; mSeascapeRotation = Surface.ROTATION_180; if (mContext.getResources().getBoolean( @@ -943,6 +949,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } else { shortSize = width; + longSize = height; mPortraitRotation = Surface.ROTATION_0; mUpsideDownRotation = Surface.ROTATION_180; if (mContext.getResources().getBoolean( @@ -955,36 +962,62 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } + mExternalDisplayWidth = mDisplay.getRawExternalWidth(); + mExternalDisplayHeight = mDisplay.getRawExternalHeight(); + + mStatusBarHeight = mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.status_bar_height); + mNavigationBarHeight = mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.navigation_bar_height); + mNavigationBarWidth = mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.navigation_bar_width); + // Determine whether the status bar can hide based on the size - // of the screen. We assume sizes > 600dp are tablets where we + // of the screen. We assume sizes >= 600dp are tablets where we // will use the system bar. + // XXX: This will change to 720dp soon. int shortSizeDp = shortSize * DisplayMetrics.DENSITY_DEFAULT / DisplayMetrics.DENSITY_DEVICE; - mStatusBarCanHide = shortSizeDp < 600; - mStatusBarHeight = mContext.getResources().getDimensionPixelSize( - mStatusBarCanHide - ? com.android.internal.R.dimen.status_bar_height - : com.android.internal.R.dimen.system_bar_height); - - mHasNavigationBar = mContext.getResources().getBoolean( - com.android.internal.R.bool.config_showNavigationBar); - // Allow a system property to override this. Used by the emulator. - // See also hasNavigationBar(). - String navBarOverride = SystemProperties.get("qemu.hw.mainkeys"); - if (! "".equals(navBarOverride)) { - if (navBarOverride.equals("1")) mHasNavigationBar = false; - else if (navBarOverride.equals("0")) mHasNavigationBar = true; - } - - mNavigationBarHeight = mHasNavigationBar - ? mContext.getResources().getDimensionPixelSize( - com.android.internal.R.dimen.navigation_bar_height) - : 0; - mNavigationBarWidth = mHasNavigationBar - ? mContext.getResources().getDimensionPixelSize( - com.android.internal.R.dimen.navigation_bar_width) - : 0; + mHasSystemNavBar = shortSizeDp >= 600; + + if (!mHasSystemNavBar) { + mHasNavigationBar = mContext.getResources().getBoolean( + com.android.internal.R.bool.config_showNavigationBar); + // Allow a system property to override this. Used by the emulator. + // See also hasNavigationBar(). + String navBarOverride = SystemProperties.get("qemu.hw.mainkeys"); + if (! "".equals(navBarOverride)) { + if (navBarOverride.equals("1")) mHasNavigationBar = false; + else if (navBarOverride.equals("0")) mHasNavigationBar = true; + } + } else { + mHasNavigationBar = false; + } + + if (mHasSystemNavBar) { + // The system bar is always at the bottom. If you are watching + // a video in landscape, we don't need to hide it if we can still + // show a 16:9 aspect ratio with it. + int longSizeDp = longSize + * DisplayMetrics.DENSITY_DEFAULT + / DisplayMetrics.DENSITY_DEVICE; + int barHeightDp = mNavigationBarHeight + * DisplayMetrics.DENSITY_DEFAULT + / DisplayMetrics.DENSITY_DEVICE; + int aspect = ((shortSizeDp-barHeightDp) * 16) / longSizeDp; + // We have computed the aspect ratio with the bar height taken + // out to be 16:aspect. If this is less than 9, then hiding + // the navigation bar will provide more useful space for wide + // screen movies. + mCanHideNavigationBar = aspect < 9; + } else if (mHasNavigationBar) { + // The navigation bar is at the right in landscape; it seems always + // useful to hide it for showing a video. + mCanHideNavigationBar = true; + } else { + mCanHideNavigationBar = false; + } if ("portrait".equals(SystemProperties.get("persist.demo.hdmirotation"))) { mHdmiRotation = mPortraitRotation; @@ -1085,16 +1118,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { lp.inputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL; wm.addView(mPointerLocationView, lp); - try { - mPointerLocationInputChannel = - mWindowManager.monitorInput("PointerLocationView"); - mPointerLocationInputEventReceiver = - new PointerLocationInputEventReceiver(mPointerLocationInputChannel, - Looper.myLooper(), mPointerLocationView); - } catch (RemoteException ex) { - Slog.e(TAG, "Could not set up input monitoring channel for PointerLocation.", - ex); - } + mPointerLocationInputChannel = + mWindowManagerFuncs.monitorInput("PointerLocationView"); + mPointerLocationInputEventReceiver = + new PointerLocationInputEventReceiver(mPointerLocationInputChannel, + Looper.myLooper(), mPointerLocationView); } } @@ -1188,18 +1216,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } void readLidState() { - try { - int sw = mWindowManager.getSwitchState(SW_LID); - if (sw > 0) { - mLidOpen = LID_OPEN; - } else if (sw == 0) { - mLidOpen = LID_CLOSED; - } else { - mLidOpen = LID_ABSENT; - } - } catch (RemoteException e) { - // Ignore - } + mLidOpen = mWindowManagerFuncs.getLidState(); } private int determineHiddenState(int mode, int hiddenValue, int visibleValue) { @@ -1318,13 +1335,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { return STATUS_BAR_LAYER; } - public boolean canStatusBarHide() { - return mStatusBarCanHide; + public boolean hasSystemNavBar() { + return mHasSystemNavBar; } public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation) { // Assumes that the navigation bar appears on the side of the display in landscape. - if (fullWidth > fullHeight) { + if (mHasNavigationBar && fullWidth > fullHeight) { return fullWidth - mNavigationBarWidth; } return fullWidth; @@ -1333,8 +1350,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation) { // Assumes the navigation bar appears on the bottom of the display in portrait. return fullHeight - - (mStatusBarCanHide ? 0 : mStatusBarHeight) - - ((fullWidth > fullHeight) ? 0 : mNavigationBarHeight); + - (mHasSystemNavBar ? mNavigationBarHeight : 0) + - ((mHasNavigationBar && fullWidth > fullHeight) ? 0 : mNavigationBarHeight); } public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation) { @@ -1348,7 +1365,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { // exclude it since applications can't generally use that part of the // screen. return getNonDecorDisplayHeight(fullWidth, fullHeight, rotation) - - (mStatusBarCanHide ? mStatusBarHeight : 0); + - (mHasSystemNavBar ? 0 : mStatusBarHeight); } public boolean doesForceHide(WindowState win, WindowManager.LayoutParams attrs) { @@ -1357,6 +1374,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { public boolean canBeForceHidden(WindowState win, WindowManager.LayoutParams attrs) { return attrs.type != WindowManager.LayoutParams.TYPE_STATUS_BAR + && attrs.type != WindowManager.LayoutParams.TYPE_NAVIGATION_BAR && attrs.type != WindowManager.LayoutParams.TYPE_WALLPAPER; } @@ -1495,10 +1513,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.STATUS_BAR_SERVICE, "PhoneWindowManager"); - // TODO: Need to handle the race condition of the status bar proc - // dying and coming back before the removeWindowLw cleanup has happened. if (mStatusBar != null) { - return WindowManagerImpl.ADD_MULTIPLE_SINGLETON; + if (mStatusBar.isAlive()) { + return WindowManagerImpl.ADD_MULTIPLE_SINGLETON; + } } mStatusBar = win; break; @@ -1506,6 +1524,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.STATUS_BAR_SERVICE, "PhoneWindowManager"); + if (mNavigationBar != null) { + if (mNavigationBar.isAlive()) { + return WindowManagerImpl.ADD_MULTIPLE_SINGLETON; + } + } mNavigationBar = win; if (DEBUG_LAYOUT) Log.i(TAG, "NAVIGATION BAR: " + mNavigationBar); break; @@ -1550,7 +1573,28 @@ public class PhoneWindowManager implements WindowManagerPolicy { public int selectAnimationLw(WindowState win, int transit) { if (PRINT_ANIM) Log.i(TAG, "selectAnimation in " + win + ": transit=" + transit); - if (transit == TRANSIT_PREVIEW_DONE) { + if (win == mStatusBar) { + if (transit == TRANSIT_EXIT || transit == TRANSIT_HIDE) { + return R.anim.dock_top_exit; + } else if (transit == TRANSIT_ENTER || transit == TRANSIT_SHOW) { + return R.anim.dock_top_enter; + } + } else if (win == mNavigationBar) { + // This can be on either the bottom or the right. + if (mNavigationBarOnBottom) { + if (transit == TRANSIT_EXIT || transit == TRANSIT_HIDE) { + return R.anim.dock_bottom_exit; + } else if (transit == TRANSIT_ENTER || transit == TRANSIT_SHOW) { + return R.anim.dock_bottom_enter; + } + } else { + if (transit == TRANSIT_EXIT || transit == TRANSIT_HIDE) { + return R.anim.dock_right_exit; + } else if (transit == TRANSIT_ENTER || transit == TRANSIT_SHOW) { + return R.anim.dock_right_enter; + } + } + } if (transit == TRANSIT_PREVIEW_DONE) { if (win.hasAppShownWindows()) { if (PRINT_ANIM) Log.i(TAG, "**** STARTING EXIT"); return com.android.internal.R.anim.app_starting_exit; @@ -2036,7 +2080,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { if ((fl & (FLAG_LAYOUT_IN_SCREEN | FLAG_FULLSCREEN | FLAG_LAYOUT_INSET_DECOR)) == (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR)) { int availRight, availBottom; - if ((attrs.systemUiVisibility & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0) { + if (mCanHideNavigationBar && + (attrs.systemUiVisibility & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0) { availRight = mUnrestrictedScreenLeft + mUnrestrictedScreenWidth; availBottom = mUnrestrictedScreenTop + mUnrestrictedScreenHeight; } else { @@ -2082,8 +2127,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { pf.right = df.right = vf.right = mDockRight; pf.bottom = df.bottom = vf.bottom = mDockBottom; - final boolean navVisible = (mNavigationBar == null || mNavigationBar.isVisibleLw()) && - (mLastSystemUiFlags&View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0; + // For purposes of putting out fake window up to steal focus, we will + // drive nav being hidden only by whether it is requested. + boolean navVisible = (mLastSystemUiFlags&View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0; // When the navigation bar isn't visible, we put up a fake // input window to catch all touch events. This way we can @@ -2101,117 +2147,107 @@ public class PhoneWindowManager implements WindowManagerPolicy { 0, false, false, true); } - // decide where the status bar goes ahead of time - if (mStatusBar != null) { - if (mNavigationBar != null) { - // Force the navigation bar to its appropriate place and - // size. We need to do this directly, instead of relying on - // it to bubble up from the nav bar, because this needs to - // change atomically with screen rotations. - if (displayWidth < displayHeight) { - // Portrait screen; nav bar goes on bottom. - mTmpNavigationFrame.set(0, displayHeight-mNavigationBarHeight, - displayWidth, displayHeight); - mStableBottom = mTmpNavigationFrame.top; - if (navVisible) { - mDockBottom = mTmpNavigationFrame.top; - mRestrictedScreenHeight = mDockBottom - mDockTop; - } else { - // We currently want to hide the navigation UI. Do this by just - // moving it off the screen, so it can still receive input events - // to know when to be re-shown. - mTmpNavigationFrame.offset(0, mNavigationBarHeight); + // For purposes of positioning and showing the nav bar, if we have + // decided that it can't be hidden (because of the screen aspect ratio), + // then take that into account. + navVisible |= !mCanHideNavigationBar; + + if (mNavigationBar != null) { + // Force the navigation bar to its appropriate place and + // size. We need to do this directly, instead of relying on + // it to bubble up from the nav bar, because this needs to + // change atomically with screen rotations. + mNavigationBarOnBottom = !mHasNavigationBar || displayWidth < displayHeight; + if (mNavigationBarOnBottom) { + // It's a system nav bar or a portrait screen; nav bar goes on bottom. + int top = displayHeight - mNavigationBarHeight; + if (mHdmiPlugged) { + if (top > mExternalDisplayHeight) { + top = mExternalDisplayHeight; } + } + mTmpNavigationFrame.set(0, top, displayWidth, displayHeight); + mStableBottom = mTmpNavigationFrame.top; + if (navVisible) { + mNavigationBar.showLw(true); + mDockBottom = mTmpNavigationFrame.top; + mRestrictedScreenHeight = mDockBottom - mDockTop; } else { - // Landscape screen; nav bar goes to the right. - mTmpNavigationFrame.set(displayWidth-mNavigationBarWidth, 0, - displayWidth, displayHeight); - mStableRight = mTmpNavigationFrame.left; - if (navVisible) { - mDockRight = mTmpNavigationFrame.left; - mRestrictedScreenWidth = mDockRight - mDockLeft; - } else { - // We currently want to hide the navigation UI. Do this by just - // moving it off the screen, so it can still receive input events - // to know when to be re-shown. - mTmpNavigationFrame.offset(mNavigationBarWidth, 0); + // We currently want to hide the navigation UI. + mNavigationBar.hideLw(true); + } + } else { + // Landscape screen; nav bar goes to the right. + int left = displayWidth - mNavigationBarWidth; + if (mHdmiPlugged) { + if (left > mExternalDisplayWidth) { + left = mExternalDisplayWidth; } } - // Make sure the content and current rectangles are updated to - // account for the restrictions from the navigation bar. - mContentTop = mCurTop = mDockTop; - mContentBottom = mCurBottom = mDockBottom; - mContentLeft = mCurLeft = mDockLeft; - mContentRight = mCurRight = mDockRight; - // And compute the final frame. - mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame, - mTmpNavigationFrame, mTmpNavigationFrame); - if (DEBUG_LAYOUT) Log.i(TAG, "mNavigationBar frame: " + mTmpNavigationFrame); + mTmpNavigationFrame.set(left, 0, displayWidth, displayHeight); + mStableRight = mTmpNavigationFrame.left; + if (navVisible) { + mNavigationBar.showLw(true); + mDockRight = mTmpNavigationFrame.left; + mRestrictedScreenWidth = mDockRight - mDockLeft; + } else { + // We currently want to hide the navigation UI. + mNavigationBar.hideLw(true); + } } - if (DEBUG_LAYOUT) Log.i(TAG, String.format("mDock rect: (%d,%d - %d,%d)", - mDockLeft, mDockTop, mDockRight, mDockBottom)); + // Make sure the content and current rectangles are updated to + // account for the restrictions from the navigation bar. + mContentTop = mCurTop = mDockTop; + mContentBottom = mCurBottom = mDockBottom; + mContentLeft = mCurLeft = mDockLeft; + mContentRight = mCurRight = mDockRight; + // And compute the final frame. + mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame, + mTmpNavigationFrame, mTmpNavigationFrame); + if (DEBUG_LAYOUT) Log.i(TAG, "mNavigationBar frame: " + mTmpNavigationFrame); + } + if (DEBUG_LAYOUT) Log.i(TAG, String.format("mDock rect: (%d,%d - %d,%d)", + mDockLeft, mDockTop, mDockRight, mDockBottom)); - // apply navigation bar insets - pf.left = df.left = vf.left = mDockLeft; - pf.top = df.top = vf.top = mDockTop; - pf.right = df.right = vf.right = mDockRight; - pf.bottom = df.bottom = vf.bottom = mDockBottom; + // decide where the status bar goes ahead of time + if (mStatusBar != null) { + // apply any navigation bar insets + pf.left = df.left = mUnrestrictedScreenLeft; + pf.top = df.top = mUnrestrictedScreenTop; + pf.right = df.right = mUnrestrictedScreenWidth - mUnrestrictedScreenLeft; + pf.bottom = df.bottom = mUnrestrictedScreenHeight - mUnrestrictedScreenTop; + vf.left = mStableLeft; + vf.top = mStableTop; + vf.right = mStableRight; + vf.bottom = mStableBottom; mStatusBar.computeFrameLw(pf, df, vf, vf); final Rect r = mStatusBar.getFrameLw(); // Compute the stable dimensions whether or not the status bar is hidden. - if (mStatusBarCanHide) { - if (mDockTop == r.top) mStableTop = r.bottom; - else if (mDockBottom == r.bottom) mStableBottom = r.top; - } else { - if (mStableTop == r.top) { - mStableTop = r.bottom; - } else if (mStableBottom == r.bottom) { - mStableBottom = r.top; - } - } + if (mDockTop == r.top) mStableTop = r.bottom; + else if (mDockBottom == r.bottom) mStableBottom = r.top; + // If the status bar is hidden, we don't want to cause + // windows behind it to scroll. if (mStatusBar.isVisibleLw()) { - // If the status bar is hidden, we don't want to cause - // windows behind it to scroll. - if (mStatusBarCanHide) { - // Status bar may go away, so the screen area it occupies - // is available to apps but just covering them when the - // status bar is visible. - if (mDockTop == r.top) mDockTop = r.bottom; - else if (mDockBottom == r.bottom) mDockBottom = r.top; - - mContentTop = mCurTop = mDockTop; - mContentBottom = mCurBottom = mDockBottom; - mContentLeft = mCurLeft = mDockLeft; - mContentRight = mCurRight = mDockRight; - - if (DEBUG_LAYOUT) Log.v(TAG, "Status bar: " + - String.format( - "dock=[%d,%d][%d,%d] content=[%d,%d][%d,%d] cur=[%d,%d][%d,%d]", - mDockLeft, mDockTop, mDockRight, mDockBottom, - mContentLeft, mContentTop, mContentRight, mContentBottom, - mCurLeft, mCurTop, mCurRight, mCurBottom)); - } else { - // Status bar can't go away; the part of the screen it - // covers does not exist for anything behind it. - if (mRestrictedScreenTop == r.top) { - mRestrictedScreenTop = r.bottom; - mRestrictedScreenHeight -= (r.bottom-r.top); - } else if ((mRestrictedScreenHeight-mRestrictedScreenTop) == r.bottom) { - mRestrictedScreenHeight -= (r.bottom-r.top); - } + // Status bar may go away, so the screen area it occupies + // is available to apps but just covering them when the + // status bar is visible. + if (mDockTop == r.top) mDockTop = r.bottom; + else if (mDockBottom == r.bottom) mDockBottom = r.top; + + mContentTop = mCurTop = mDockTop; + mContentBottom = mCurBottom = mDockBottom; + mContentLeft = mCurLeft = mDockLeft; + mContentRight = mCurRight = mDockRight; - mContentTop = mCurTop = mDockTop = mRestrictedScreenTop; - mContentBottom = mCurBottom = mDockBottom - = mRestrictedScreenTop + mRestrictedScreenHeight; - if (DEBUG_LAYOUT) Log.v(TAG, "Status bar: restricted screen area: (" - + mRestrictedScreenLeft + "," - + mRestrictedScreenTop + "," - + (mRestrictedScreenLeft + mRestrictedScreenWidth) + "," - + (mRestrictedScreenTop + mRestrictedScreenHeight) + ")"); - } + if (DEBUG_LAYOUT) Log.v(TAG, "Status bar: " + + String.format( + "dock=[%d,%d][%d,%d] content=[%d,%d][%d,%d] cur=[%d,%d][%d,%d]", + mDockLeft, mDockTop, mDockRight, mDockBottom, + mContentLeft, mContentTop, mContentRight, mContentBottom, + mCurLeft, mCurTop, mCurRight, mCurBottom)); } } } @@ -2333,7 +2369,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { "Laying out status bar window: (%d,%d - %d,%d)", pf.left, pf.top, pf.right, pf.bottom)); } - } else if ((sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0 + } else if (mCanHideNavigationBar + && (sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0 && attrs.type >= WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW && attrs.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) { // Asking for layout as if the nav bar is hidden, lets the @@ -2426,7 +2463,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { pf.right = df.right = cf.right = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth; pf.bottom = df.bottom = cf.bottom = mUnrestrictedScreenTop+mUnrestrictedScreenHeight; - } else if ((sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0 + } else if (mCanHideNavigationBar + && (sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0 && attrs.type >= WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW && attrs.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) { // Asking for layout as if the nav bar is hidden, lets the @@ -2623,19 +2661,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { // has the FLAG_FULLSCREEN set. Not sure if there is another way that to be the // case though. if (topIsFullscreen) { - if (mStatusBarCanHide) { - if (DEBUG_LAYOUT) Log.v(TAG, "** HIDING status bar"); - if (mStatusBar.hideLw(true)) { - changes |= FINISH_LAYOUT_REDO_LAYOUT; - - mHandler.post(new Runnable() { public void run() { - if (mStatusBarService != null) { - try { - mStatusBarService.collapse(); - } catch (RemoteException ex) {} - } - }}); - } + if (DEBUG_LAYOUT) Log.v(TAG, "** HIDING status bar"); + if (mStatusBar.hideLw(true)) { + changes |= FINISH_LAYOUT_REDO_LAYOUT; + + mHandler.post(new Runnable() { public void run() { + if (mStatusBarService != null) { + try { + mStatusBarService.collapse(); + } catch (RemoteException ex) {} + } + }}); } else if (DEBUG_LAYOUT) { Log.v(TAG, "Preventing status bar from hiding by policy"); } @@ -2699,30 +2735,24 @@ public class PhoneWindowManager implements WindowManagerPolicy { // behind it. return false; } - if (false) { - // Don't do this on the tablet, since the system bar never completely - // covers the screen, and with all its transparency this will - // incorrectly think it does cover it when it doesn't. We'll revisit - // this later when we re-do the phone status bar. - if (mStatusBar != null && mStatusBar.isVisibleLw()) { - RectF rect = new RectF(mStatusBar.getShownFrameLw()); - for (int i=mStatusBarPanels.size()-1; i>=0; i--) { - WindowState w = mStatusBarPanels.get(i); - if (w.isVisibleLw()) { - rect.union(w.getShownFrameLw()); - } - } - final int insetw = mRestrictedScreenWidth/10; - final int inseth = mRestrictedScreenHeight/10; - if (rect.contains(insetw, inseth, mRestrictedScreenWidth-insetw, - mRestrictedScreenHeight-inseth)) { - // All of the status bar windows put together cover the - // screen, so the app can't be seen. (Note this test doesn't - // work if the rects of these windows are at off offsets or - // sizes, causing gaps in the rect union we have computed.) - return false; + if (mStatusBar != null && mStatusBar.isVisibleLw()) { + RectF rect = new RectF(mStatusBar.getShownFrameLw()); + for (int i=mStatusBarPanels.size()-1; i>=0; i--) { + WindowState w = mStatusBarPanels.get(i); + if (w.isVisibleLw()) { + rect.union(w.getShownFrameLw()); } } + final int insetw = mRestrictedScreenWidth/10; + final int inseth = mRestrictedScreenHeight/10; + if (rect.contains(insetw, inseth, mRestrictedScreenWidth-insetw, + mRestrictedScreenHeight-inseth)) { + // All of the status bar windows put together cover the + // screen, so the app can't be seen. (Note this test doesn't + // work if the rects of these windows are at odd offsets or + // sizes, causing gaps in the rect union we have computed.) + return false; + } } return true; } @@ -2776,7 +2806,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { void setHdmiPlugged(boolean plugged) { if (mHdmiPlugged != plugged) { mHdmiPlugged = plugged; - updateRotation(true); + if (plugged && mDisplay != null) { + mExternalDisplayWidth = mDisplay.getRawExternalWidth(); + mExternalDisplayHeight = mDisplay.getRawExternalHeight(); + } + updateRotation(true, true); Intent intent = new Intent(ACTION_HDMI_PLUGGED); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); intent.putExtra(EXTRA_HDMI_PLUGGED_STATE, plugged); @@ -3596,29 +3630,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } - public boolean detectSafeMode() { - try { - int menuState = mWindowManager.getKeycodeState(KeyEvent.KEYCODE_MENU); - int sState = mWindowManager.getKeycodeState(KeyEvent.KEYCODE_S); - int dpadState = mWindowManager.getDPadKeycodeState(KeyEvent.KEYCODE_DPAD_CENTER); - int trackballState = mWindowManager.getTrackballScancodeState(BTN_MOUSE); - int volumeDownState = mWindowManager.getKeycodeState(KeyEvent.KEYCODE_VOLUME_DOWN); - mSafeMode = menuState > 0 || sState > 0 || dpadState > 0 || trackballState > 0 - || volumeDownState > 0; - performHapticFeedbackLw(null, mSafeMode - ? HapticFeedbackConstants.SAFE_MODE_ENABLED - : HapticFeedbackConstants.SAFE_MODE_DISABLED, true); - if (mSafeMode) { - Log.i(TAG, "SAFE MODE ENABLED (menu=" + menuState + " s=" + sState - + " dpad=" + dpadState + " trackball=" + trackballState + ")"); - } else { - Log.i(TAG, "SAFE MODE not enabled"); - } - return mSafeMode; - } catch (RemoteException e) { - // Doom! (it's also local) - throw new RuntimeException("window manager dead"); - } + public void setSafeMode(boolean safeMode) { + mSafeMode = safeMode; + performHapticFeedbackLw(null, safeMode + ? HapticFeedbackConstants.SAFE_MODE_ENABLED + : HapticFeedbackConstants.SAFE_MODE_DISABLED, true); } static long[] getLongIntArray(Resources r, int resid) { @@ -3871,7 +3887,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { void updateRotation(boolean alwaysSendConfiguration) { try { //set orientation on WindowManager - mWindowManager.updateRotation(alwaysSendConfiguration); + mWindowManager.updateRotation(alwaysSendConfiguration, false); + } catch (RemoteException e) { + // Ignore + } + } + + void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout) { + try { + //set orientation on WindowManager + mWindowManager.updateRotation(alwaysSendConfiguration, forceRelayout); } catch (RemoteException e) { // Ignore } diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp index 1b74aa6..7060ae2 100644 --- a/services/input/EventHub.cpp +++ b/services/input/EventHub.cpp @@ -40,6 +40,7 @@ #include <androidfw/KeyCharacterMap.h> #include <androidfw/VirtualKeyMap.h> +#include <sha1.h> #include <string.h> #include <stdint.h> #include <dirent.h> @@ -78,6 +79,20 @@ static inline const char* toString(bool value) { return value ? "true" : "false"; } +static String8 sha1(const String8& in) { + SHA1_CTX ctx; + SHA1Init(&ctx); + SHA1Update(&ctx, reinterpret_cast<const u_char*>(in.string()), in.size()); + u_char digest[SHA1_DIGEST_LENGTH]; + SHA1Final(digest, &ctx); + + String8 out; + for (size_t i = 0; i < SHA1_DIGEST_LENGTH; i++) { + out.appendFormat("%02x", digest[i]); + } + return out; +} + // --- Global Functions --- uint32_t getAbsAxisUsage(int32_t axis, uint32_t deviceClasses) { @@ -209,11 +224,11 @@ EventHub::~EventHub(void) { release_wake_lock(WAKE_LOCK_ID); } -String8 EventHub::getDeviceName(int32_t deviceId) const { +InputDeviceIdentifier EventHub::getDeviceIdentifier(int32_t deviceId) const { AutoMutex _l(mLock); Device* device = getDeviceLocked(deviceId); - if (device == NULL) return String8(); - return device->identifier.name; + if (device == NULL) return InputDeviceIdentifier(); + return device->identifier; } uint32_t EventHub::getDeviceClasses(int32_t deviceId) const { @@ -893,6 +908,30 @@ status_t EventHub::openDeviceLocked(const char *devicePath) { identifier.uniqueId.setTo(buffer); } + // Compute a device descriptor that uniquely identifies the device. + // The descriptor is assumed to be a stable identifier. Its value should not + // change between reboots, reconnections, firmware updates or new releases of Android. + // Ideally, we also want the descriptor to be short and relatively opaque. + String8 rawDescriptor; + rawDescriptor.appendFormat(":%04x:%04x:", identifier.vendor, identifier.product); + if (!identifier.uniqueId.isEmpty()) { + rawDescriptor.append("uniqueId:"); + rawDescriptor.append(identifier.uniqueId); + } if (identifier.vendor == 0 && identifier.product == 0) { + // If we don't know the vendor and product id, then the device is probably + // built-in so we need to rely on other information to uniquely identify + // the input device. Usually we try to avoid relying on the device name or + // location but for built-in input device, they are unlikely to ever change. + if (!identifier.name.isEmpty()) { + rawDescriptor.append("name:"); + rawDescriptor.append(identifier.name); + } else if (!identifier.location.isEmpty()) { + rawDescriptor.append("location:"); + rawDescriptor.append(identifier.location); + } + } + identifier.descriptor = sha1(rawDescriptor); + // Make file descriptor non-blocking for use with poll(). if (fcntl(fd, F_SETFL, O_NONBLOCK)) { ALOGE("Error %d making device file descriptor non-blocking.", errno); @@ -904,19 +943,18 @@ status_t EventHub::openDeviceLocked(const char *devicePath) { int32_t deviceId = mNextDeviceId++; Device* device = new Device(fd, deviceId, String8(devicePath), identifier); -#if 0 - ALOGI("add device %d: %s\n", deviceId, devicePath); - ALOGI(" bus: %04x\n" - " vendor %04x\n" - " product %04x\n" - " version %04x\n", + ALOGV("add device %d: %s\n", deviceId, devicePath); + ALOGV(" bus: %04x\n" + " vendor %04x\n" + " product %04x\n" + " version %04x\n", identifier.bus, identifier.vendor, identifier.product, identifier.version); - ALOGI(" name: \"%s\"\n", identifier.name.string()); - ALOGI(" location: \"%s\"\n", identifier.location.string()); - ALOGI(" unique id: \"%s\"\n", identifier.uniqueId.string()); - ALOGI(" driver: v%d.%d.%d\n", + ALOGV(" name: \"%s\"\n", identifier.name.string()); + ALOGV(" location: \"%s\"\n", identifier.location.string()); + ALOGV(" unique id: \"%s\"\n", identifier.uniqueId.string()); + ALOGV(" descriptor: \"%s\" (%s)\n", identifier.descriptor.string(), rawDescriptor.string()); + ALOGV(" driver: v%d.%d.%d\n", driverVersion >> 16, (driverVersion >> 8) & 0xff, driverVersion & 0xff); -#endif // Load the configuration file for the device. loadConfigurationLocked(device); @@ -1065,18 +1103,35 @@ status_t EventHub::openDeviceLocked(const char *devicePath) { // Enable wake-lock behavior on kernels that support it. // TODO: Only need this for devices that can really wake the system. - bool usingSuspendBlock = ioctl(fd, EVIOCSSUSPENDBLOCK, 1) == 0; + bool usingSuspendBlockIoctl = !ioctl(fd, EVIOCSSUSPENDBLOCK, 1); + + // Tell the kernel that we want to use the monotonic clock for reporting timestamps + // associated with input events. This is important because the input system + // uses the timestamps extensively and assumes they were recorded using the monotonic + // clock. + // + // In older kernel, before Linux 3.4, there was no way to tell the kernel which + // clock to use to input event timestamps. The standard kernel behavior was to + // record a real time timestamp, which isn't what we want. Android kernels therefore + // contained a patch to the evdev_event() function in drivers/input/evdev.c to + // replace the call to do_gettimeofday() with ktime_get_ts() to cause the monotonic + // clock to be used instead of the real time clock. + // + // As of Linux 3.4, there is a new EVIOCSCLOCKID ioctl to set the desired clock. + // Therefore, we no longer require the Android-specific kernel patch described above + // as long as we make sure to set select the monotonic clock. We do that here. + bool usingClockIoctl = !ioctl(fd, EVIOCSCLOCKID, CLOCK_MONOTONIC); ALOGI("New device: id=%d, fd=%d, path='%s', name='%s', classes=0x%x, " "configuration='%s', keyLayout='%s', keyCharacterMap='%s', builtinKeyboard=%s, " - "usingSuspendBlock=%s", + "usingSuspendBlockIoctl=%s, usingClockIoctl=%s", deviceId, fd, devicePath, device->identifier.name.string(), device->classes, device->configurationFile.string(), device->keyMap.keyLayoutFile.string(), device->keyMap.keyCharacterMapFile.string(), toString(mBuiltInKeyboardId == deviceId), - toString(usingSuspendBlock)); + toString(usingSuspendBlockIoctl), toString(usingClockIoctl)); mDevices.add(deviceId, device); @@ -1303,6 +1358,7 @@ void EventHub::dump(String8& dump) { } dump.appendFormat(INDENT3 "Classes: 0x%08x\n", device->classes); dump.appendFormat(INDENT3 "Path: %s\n", device->path.string()); + dump.appendFormat(INDENT3 "Descriptor: %s\n", device->identifier.descriptor.string()); dump.appendFormat(INDENT3 "Location: %s\n", device->identifier.location.string()); dump.appendFormat(INDENT3 "UniqueId: %s\n", device->identifier.uniqueId.string()); dump.appendFormat(INDENT3 "Identifier: bus=0x%04x, vendor=0x%04x, " diff --git a/services/input/EventHub.h b/services/input/EventHub.h index 4eb47c6..bd21a3d 100644 --- a/services/input/EventHub.h +++ b/services/input/EventHub.h @@ -151,7 +151,7 @@ public: virtual uint32_t getDeviceClasses(int32_t deviceId) const = 0; - virtual String8 getDeviceName(int32_t deviceId) const = 0; + virtual InputDeviceIdentifier getDeviceIdentifier(int32_t deviceId) const = 0; virtual void getConfiguration(int32_t deviceId, PropertyMap* outConfiguration) const = 0; @@ -230,7 +230,7 @@ public: virtual uint32_t getDeviceClasses(int32_t deviceId) const; - virtual String8 getDeviceName(int32_t deviceId) const; + virtual InputDeviceIdentifier getDeviceIdentifier(int32_t deviceId) const; virtual void getConfiguration(int32_t deviceId, PropertyMap* outConfiguration) const; diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp index eccce29..ddd870d 100644 --- a/services/input/InputReader.cpp +++ b/services/input/InputReader.cpp @@ -344,18 +344,19 @@ void InputReader::processEventsLocked(const RawEvent* rawEvents, size_t count) { } void InputReader::addDeviceLocked(nsecs_t when, int32_t deviceId) { - String8 name = mEventHub->getDeviceName(deviceId); + InputDeviceIdentifier identifier = mEventHub->getDeviceIdentifier(deviceId); uint32_t classes = mEventHub->getDeviceClasses(deviceId); - InputDevice* device = createDeviceLocked(deviceId, name, classes); + InputDevice* device = createDeviceLocked(deviceId, identifier, classes); device->configure(when, &mConfig, 0); device->reset(when); if (device->isIgnored()) { - ALOGI("Device added: id=%d, name='%s' (ignored non-input device)", deviceId, name.string()); + ALOGI("Device added: id=%d, name='%s' (ignored non-input device)", deviceId, + identifier.name.string()); } else { - ALOGI("Device added: id=%d, name='%s', sources=0x%08x", deviceId, name.string(), - device->getSources()); + ALOGI("Device added: id=%d, name='%s', sources=0x%08x", deviceId, + identifier.name.string(), device->getSources()); } ssize_t deviceIndex = mDevices.indexOfKey(deviceId); @@ -392,8 +393,8 @@ void InputReader::removeDeviceLocked(nsecs_t when, int32_t deviceId) { } InputDevice* InputReader::createDeviceLocked(int32_t deviceId, - const String8& name, uint32_t classes) { - InputDevice* device = new InputDevice(&mContext, deviceId, name, classes); + const InputDeviceIdentifier& identifier, uint32_t classes) { + InputDevice* device = new InputDevice(&mContext, deviceId, identifier, classes); // External devices. if (classes & INPUT_DEVICE_CLASS_EXTERNAL) { @@ -851,9 +852,9 @@ bool InputReaderThread::threadLoop() { // --- InputDevice --- -InputDevice::InputDevice(InputReaderContext* context, int32_t id, const String8& name, - uint32_t classes) : - mContext(context), mId(id), mName(name), mClasses(classes), +InputDevice::InputDevice(InputReaderContext* context, int32_t id, + const InputDeviceIdentifier& identifier, uint32_t classes) : + mContext(context), mId(id), mIdentifier(identifier), mClasses(classes), mSources(0), mIsExternal(false), mDropUntilNextSync(false) { } @@ -961,7 +962,7 @@ void InputDevice::process(const RawEvent* rawEvents, size_t count) { #endif } } else if (rawEvent->type == EV_SYN && rawEvent->scanCode == SYN_DROPPED) { - ALOGI("Detected input event buffer overrun for device %s.", mName.string()); + ALOGI("Detected input event buffer overrun for device %s.", getName().string()); mDropUntilNextSync = true; reset(rawEvent->when); } else { @@ -982,7 +983,7 @@ void InputDevice::timeoutExpired(nsecs_t when) { } void InputDevice::getDeviceInfo(InputDeviceInfo* outDeviceInfo) { - outDeviceInfo->initialize(mId, mName); + outDeviceInfo->initialize(mId, mIdentifier.name, mIdentifier.descriptor); size_t numMappers = mMappers.size(); for (size_t i = 0; i < numMappers; i++) { diff --git a/services/input/InputReader.h b/services/input/InputReader.h index 9bbe49c..8520a75 100644 --- a/services/input/InputReader.h +++ b/services/input/InputReader.h @@ -338,7 +338,7 @@ public: protected: // These members are protected so they can be instrumented by test cases. virtual InputDevice* createDeviceLocked(int32_t deviceId, - const String8& name, uint32_t classes); + const InputDeviceIdentifier& identifier, uint32_t classes); class ContextImpl : public InputReaderContext { InputReader* mReader; @@ -432,12 +432,13 @@ private: /* Represents the state of a single input device. */ class InputDevice { public: - InputDevice(InputReaderContext* context, int32_t id, const String8& name, uint32_t classes); + InputDevice(InputReaderContext* context, int32_t id, + const InputDeviceIdentifier& identifier, uint32_t classes); ~InputDevice(); inline InputReaderContext* getContext() { return mContext; } inline int32_t getId() { return mId; } - inline const String8& getName() { return mName; } + inline const String8& getName() { return mIdentifier.name; } inline uint32_t getClasses() { return mClasses; } inline uint32_t getSources() { return mSources; } @@ -486,7 +487,7 @@ public: private: InputReaderContext* mContext; int32_t mId; - String8 mName; + InputDeviceIdentifier mIdentifier; uint32_t mClasses; Vector<InputMapper*> mMappers; diff --git a/services/input/tests/InputReader_test.cpp b/services/input/tests/InputReader_test.cpp index 08efe7d..2cccf9f 100644 --- a/services/input/tests/InputReader_test.cpp +++ b/services/input/tests/InputReader_test.cpp @@ -274,7 +274,7 @@ class FakeEventHub : public EventHubInterface { }; struct Device { - String8 name; + InputDeviceIdentifier identifier; uint32_t classes; PropertyMap configuration; KeyedVector<int, RawAbsoluteAxisInfo> absoluteAxes; @@ -287,8 +287,8 @@ class FakeEventHub : public EventHubInterface { KeyedVector<int32_t, bool> leds; Vector<VirtualKeyDefinition> virtualKeys; - Device(const String8& name, uint32_t classes) : - name(name), classes(classes) { + Device(uint32_t classes) : + classes(classes) { } }; @@ -307,7 +307,8 @@ public: FakeEventHub() { } void addDevice(int32_t deviceId, const String8& name, uint32_t classes) { - Device* device = new Device(name, classes); + Device* device = new Device(classes); + device->identifier.name = name; mDevices.add(deviceId, device); enqueueEvent(ARBITRARY_TIME, deviceId, EventHubInterface::DEVICE_ADDED, 0, 0, 0, 0); @@ -433,9 +434,9 @@ private: return device ? device->classes : 0; } - virtual String8 getDeviceName(int32_t deviceId) const { + virtual InputDeviceIdentifier getDeviceIdentifier(int32_t deviceId) const { Device* device = getDevice(deviceId); - return device ? device->name : String8("unknown"); + return device ? device->identifier : InputDeviceIdentifier(); } virtual void getConfiguration(int32_t deviceId, PropertyMap* outConfiguration) const { @@ -857,18 +858,20 @@ public: } InputDevice* newDevice(int32_t deviceId, const String8& name, uint32_t classes) { - return new InputDevice(&mContext, deviceId, name, classes); + InputDeviceIdentifier identifier; + identifier.name = name; + return new InputDevice(&mContext, deviceId, identifier, classes); } protected: virtual InputDevice* createDeviceLocked(int32_t deviceId, - const String8& name, uint32_t classes) { + const InputDeviceIdentifier& identifier, uint32_t classes) { if (mNextDevice) { InputDevice* device = mNextDevice; mNextDevice = NULL; return device; } - return InputReader::createDeviceLocked(deviceId, name, classes); + return InputReader::createDeviceLocked(deviceId, identifier, classes); } friend class InputReaderTest; @@ -1231,7 +1234,9 @@ protected: mFakeContext = new FakeInputReaderContext(mFakeEventHub, mFakePolicy, mFakeListener); mFakeEventHub->addDevice(DEVICE_ID, String8(DEVICE_NAME), 0); - mDevice = new InputDevice(mFakeContext, DEVICE_ID, String8(DEVICE_NAME), DEVICE_CLASSES); + InputDeviceIdentifier identifier; + identifier.name = DEVICE_NAME; + mDevice = new InputDevice(mFakeContext, DEVICE_ID, identifier, DEVICE_CLASSES); } virtual void TearDown() { @@ -1411,7 +1416,9 @@ protected: mFakePolicy = new FakeInputReaderPolicy(); mFakeListener = new FakeInputListener(); mFakeContext = new FakeInputReaderContext(mFakeEventHub, mFakePolicy, mFakeListener); - mDevice = new InputDevice(mFakeContext, DEVICE_ID, String8(DEVICE_NAME), DEVICE_CLASSES); + InputDeviceIdentifier identifier; + identifier.name = DEVICE_NAME; + mDevice = new InputDevice(mFakeContext, DEVICE_ID, identifier, DEVICE_CLASSES); mFakeEventHub->addDevice(DEVICE_ID, String8(DEVICE_NAME), 0); } diff --git a/services/java/com/android/server/AlarmManagerService.java b/services/java/com/android/server/AlarmManagerService.java index 0574405..32ac8e1 100644 --- a/services/java/com/android/server/AlarmManagerService.java +++ b/services/java/com/android/server/AlarmManagerService.java @@ -34,9 +34,9 @@ import android.os.Message; import android.os.PowerManager; import android.os.SystemClock; import android.os.SystemProperties; +import android.os.WorkSource; import android.text.TextUtils; import android.text.format.Time; -import android.util.EventLog; import android.util.Slog; import android.util.TimeUtils; @@ -50,6 +50,7 @@ import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedList; import java.util.Map; import java.util.TimeZone; @@ -89,6 +90,7 @@ class AlarmManagerService extends IAlarmManager.Stub { private int mDescriptor; private int mBroadcastRefCount = 0; private PowerManager.WakeLock mWakeLock; + private LinkedList<PendingIntent> mInFlight = new LinkedList<PendingIntent>(); private final AlarmThread mWaitThread = new AlarmThread(); private final AlarmHandler mHandler = new AlarmHandler(); private ClockReceiver mClockReceiver; @@ -668,10 +670,12 @@ class AlarmManagerService extends IAlarmManager.Stub { Intent.EXTRA_ALARM_COUNT, alarm.count), mResultReceiver, mHandler); - // we have an active broadcast so stay awake. + // we have an active broadcast so stay awake. if (mBroadcastRefCount == 0) { + setWakelockWorkSource(alarm.operation); mWakeLock.acquire(); } + mInFlight.add(alarm.operation); mBroadcastRefCount++; BroadcastStats bs = getStatsLocked(alarm.operation); @@ -700,7 +704,22 @@ class AlarmManagerService extends IAlarmManager.Stub { } } } - + + void setWakelockWorkSource(PendingIntent pi) { + try { + final int uid = ActivityManagerNative.getDefault() + .getUidForIntentSender(pi.getTarget()); + if (uid >= 0) { + mWakeLock.setWorkSource(new WorkSource(uid)); + return; + } + } catch (Exception e) { + } + + // Something went wrong; fall back to attributing the lock to the OS + mWakeLock.setWorkSource(null); + } + private class AlarmHandler extends Handler { public static final int ALARM_EVENT = 1; public static final int MINUTE_CHANGE_EVENT = 2; @@ -876,9 +895,20 @@ class AlarmManagerService extends IAlarmManager.Stub { fs.count++; } } + mInFlight.removeFirst(); mBroadcastRefCount--; if (mBroadcastRefCount == 0) { mWakeLock.release(); + } else { + // the next of our alarms is now in flight. reattribute the wakelock. + final PendingIntent nowInFlight = mInFlight.peekFirst(); + if (nowInFlight != null) { + setWakelockWorkSource(nowInFlight); + } else { + // should never happen + Slog.e(TAG, "Alarm wakelock still held but sent queue empty"); + mWakeLock.setWorkSource(null); + } } } } diff --git a/services/java/com/android/server/NsdService.java b/services/java/com/android/server/NsdService.java new file mode 100644 index 0000000..768be7d --- /dev/null +++ b/services/java/com/android/server/NsdService.java @@ -0,0 +1,269 @@ +/* + * 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. + */ + +package com.android.server; + +import android.content.Context; +import android.content.pm.PackageManager; +import android.net.nsd.DnsSdServiceInfo; +import android.net.nsd.DnsSdTxtRecord; +import android.net.nsd.INsdManager; +import android.net.nsd.NsdManager; +import android.os.Binder; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Message; +import android.os.Messenger; +import android.os.IBinder; +import android.util.Slog; + +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.concurrent.CountDownLatch; +import java.util.List; + +import com.android.internal.app.IBatteryStats; +import com.android.internal.telephony.TelephonyIntents; +import com.android.internal.util.AsyncChannel; +import com.android.server.am.BatteryStatsService; +import com.android.server.NativeDaemonConnector.Command; +import com.android.internal.R; + +/** + * Network Service Discovery Service handles remote service discovery operation requests by + * implementing the INsdManager interface. + * + * @hide + */ +public class NsdService extends INsdManager.Stub { + private static final String TAG = "NsdService"; + private static final String MDNS_TAG = "mDnsConnector"; + + private static final boolean DBG = true; + + private Context mContext; + + /** + * Clients receiving asynchronous messages + */ + private List<AsyncChannel> mClients = new ArrayList<AsyncChannel>(); + + private AsyncChannel mReplyChannel = new AsyncChannel(); + + /** + * Handles client(app) connections + */ + private class AsyncServiceHandler extends Handler { + + AsyncServiceHandler(android.os.Looper looper) { + super(looper); + } + + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case AsyncChannel.CMD_CHANNEL_HALF_CONNECTED: + if (msg.arg1 == AsyncChannel.STATUS_SUCCESSFUL) { + AsyncChannel c = (AsyncChannel) msg.obj; + if (DBG) Slog.d(TAG, "New client listening to asynchronous messages"); + c.sendMessage(AsyncChannel.CMD_CHANNEL_FULLY_CONNECTED); + mClients.add(c); + } else { + Slog.e(TAG, "Client connection failure, error=" + msg.arg1); + } + break; + case AsyncChannel.CMD_CHANNEL_DISCONNECTED: + if (msg.arg1 == AsyncChannel.STATUS_SEND_UNSUCCESSFUL) { + Slog.e(TAG, "Send failed, client connection lost"); + } else { + if (DBG) Slog.d(TAG, "Client connection lost with reason: " + msg.arg1); + } + mClients.remove((AsyncChannel) msg.obj); + break; + case AsyncChannel.CMD_CHANNEL_FULL_CONNECTION: + AsyncChannel ac = new AsyncChannel(); + ac.connect(mContext, this, msg.replyTo); + break; + case NsdManager.DISCOVER_SERVICES: + if (DBG) Slog.d(TAG, "Discover services"); + DnsSdServiceInfo s = (DnsSdServiceInfo) msg.obj; + discoverServices(1, s.getServiceType()); + mReplyChannel.replyToMessage(msg, NsdManager.DISCOVER_SERVICES_STARTED); + break; + case NsdManager.STOP_DISCOVERY: + if (DBG) Slog.d(TAG, "Stop service discovery"); + mReplyChannel.replyToMessage(msg, NsdManager.STOP_DISCOVERY_FAILED); + break; + case NsdManager.REGISTER_SERVICE: + if (DBG) Slog.d(TAG, "Register service"); + mReplyChannel.replyToMessage(msg, NsdManager.REGISTER_SERVICE_FAILED); + break; + case NsdManager.UPDATE_SERVICE: + if (DBG) Slog.d(TAG, "Update service"); + mReplyChannel.replyToMessage(msg, NsdManager.UPDATE_SERVICE_FAILED); + break; + default: + Slog.d(TAG, "NsdServicehandler.handleMessage ignoring msg=" + msg); + break; + } + } + } + private AsyncServiceHandler mAsyncServiceHandler; + + private NativeDaemonConnector mNativeConnector; + private final CountDownLatch mNativeDaemonConnected = new CountDownLatch(1); + + private NsdService(Context context) { + mContext = context; + + HandlerThread nsdThread = new HandlerThread("NsdService"); + nsdThread.start(); + mAsyncServiceHandler = new AsyncServiceHandler(nsdThread.getLooper()); + + /* + mNativeConnector = new NativeDaemonConnector(new NativeCallbackReceiver(), "mdns", 10, + MDNS_TAG, 25); + Thread th = new Thread(mNativeConnector, MDNS_TAG); + th.start(); + */ + } + + public static NsdService create(Context context) throws InterruptedException { + NsdService service = new NsdService(context); + /* service.mNativeDaemonConnected.await(); */ + return service; + } + + public Messenger getMessenger() { + return new Messenger(mAsyncServiceHandler); + } + + /* These should be in sync with system/netd/mDnsResponseCode.h */ + class NativeResponseCode { + public static final int SERVICE_FOUND = 101; + public static final int SERVICE_LOST = 102; + public static final int SERVICE_DISCOVERY_FAILED = 103; + + public static final int SERVICE_REGISTERED = 104; + public static final int SERVICE_REGISTRATION_FAILED = 105; + + public static final int SERVICE_UPDATED = 106; + public static final int SERVICE_UPDATE_FAILED = 107; + + public static final int SERVICE_RESOLVED = 108; + public static final int SERVICE_RESOLUTION_FAILED = 109; + } + + + class NativeCallbackReceiver implements INativeDaemonConnectorCallbacks { + public void onDaemonConnected() { + mNativeDaemonConnected.countDown(); + } + + public boolean onEvent(int code, String raw, String[] cooked) { + switch (code) { + case NativeResponseCode.SERVICE_FOUND: + /* NNN uniqueId serviceName regType */ + break; + case NativeResponseCode.SERVICE_LOST: + /* NNN uniqueId serviceName regType */ + break; + case NativeResponseCode.SERVICE_DISCOVERY_FAILED: + /* NNN uniqueId errorCode */ + break; + case NativeResponseCode.SERVICE_REGISTERED: + /* NNN regId serviceName regType */ + break; + case NativeResponseCode.SERVICE_REGISTRATION_FAILED: + /* NNN regId errorCode */ + break; + case NativeResponseCode.SERVICE_UPDATED: + /* NNN regId */ + break; + case NativeResponseCode.SERVICE_UPDATE_FAILED: + /* NNN regId errorCode */ + break; + case NativeResponseCode.SERVICE_RESOLVED: + /* NNN resolveId fullName hostName port txtlen txtdata */ + break; + case NativeResponseCode.SERVICE_RESOLUTION_FAILED: + /* NNN resovleId errorCode */ + break; + default: + break; + } + return false; + } + } + + private void registerService(int regId, DnsSdServiceInfo service) { + try { + //Add txtlen and txtdata + mNativeConnector.execute("mdnssd", "register", regId, service.getServiceName(), + service.getServiceType(), service.getPort()); + } catch(NativeDaemonConnectorException e) { + Slog.e(TAG, "Failed to execute registerService"); + } + } + + private void updateService(int regId, DnsSdTxtRecord t) { + try { + if (t == null) return; + mNativeConnector.execute("mdnssd", "update", regId, t.size(), t.getRawData()); + } catch(NativeDaemonConnectorException e) { + Slog.e(TAG, "Failed to updateServices"); + } + } + + private void discoverServices(int discoveryId, String serviceType) { + try { + mNativeConnector.execute("mdnssd", "discover", discoveryId, serviceType); + } catch(NativeDaemonConnectorException e) { + Slog.e(TAG, "Failed to discoverServices"); + } + } + + private void stopServiceDiscovery(int discoveryId) { + try { + mNativeConnector.execute("mdnssd", "stopdiscover", discoveryId); + } catch(NativeDaemonConnectorException e) { + Slog.e(TAG, "Failed to stopServiceDiscovery"); + } + } + + private void resolveService(DnsSdServiceInfo service) { + try { + mNativeConnector.execute("mdnssd", "resolve", service.getServiceName(), + service.getServiceType()); + } catch(NativeDaemonConnectorException e) { + Slog.e(TAG, "Failed to resolveService"); + } + } + + @Override + protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) + != PackageManager.PERMISSION_GRANTED) { + pw.println("Permission Denial: can't dump ServiceDiscoverService from from pid=" + + Binder.getCallingPid() + + ", uid=" + Binder.getCallingUid()); + return; + } + + pw.println("Internal state:"); + } +} diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 423dad6..7dd736d 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -47,6 +47,7 @@ import android.view.WindowManager; import com.android.internal.app.ShutdownThread; import com.android.internal.os.BinderInternal; import com.android.internal.os.SamplingProfilerIntegration; +import com.android.internal.widget.LockSettingsService; import com.android.server.accessibility.AccessibilityManagerService; import com.android.server.am.ActivityManagerService; import com.android.server.net.NetworkPolicyManagerService; @@ -120,6 +121,7 @@ class ServerThread extends Thread { ConnectivityService connectivity = null; WifiP2pService wifiP2p = null; WifiService wifi = null; + NsdService serviceDiscovery= null; IPackageManager pm = null; Context context = null; WindowManagerService wm = null; @@ -219,6 +221,7 @@ class ServerThread extends Thread { factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL, !firstBoot); ServiceManager.addService(Context.WINDOW_SERVICE, wm); + ServiceManager.addService(Context.INPUT_SERVICE, wm.getInputManagerService()); ActivityManagerService.self().setWindowManager(wm); @@ -265,6 +268,7 @@ class ServerThread extends Thread { LocationManagerService location = null; CountryDetectorService countryDetector = null; TextServicesManagerService tsms = null; + LockSettingsService lockSettings = null; // Bring up services needed for UI. if (factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) { @@ -307,6 +311,14 @@ class ServerThread extends Thread { if (factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) { try { + Slog.i(TAG, "LockSettingsService"); + lockSettings = new LockSettingsService(context); + ServiceManager.addService("lock_settings", lockSettings); + } catch (Throwable e) { + reportWtf("starting LockSettingsService service", e); + } + + try { Slog.i(TAG, "Device Policy"); devicePolicy = new DevicePolicyManagerService(context); ServiceManager.addService(Context.DEVICE_POLICY_SERVICE, devicePolicy); @@ -394,6 +406,15 @@ class ServerThread extends Thread { } try { + Slog.i(TAG, "Network Service Discovery Service"); + serviceDiscovery = NsdService.create(context); + ServiceManager.addService( + Context.NSD_SERVICE, serviceDiscovery); + } catch (Throwable e) { + reportWtf("starting Service Discovery Service", e); + } + + try { Slog.i(TAG, "Throttle Service"); throttle = new ThrottleService(context); ServiceManager.addService( @@ -651,6 +672,11 @@ class ServerThread extends Thread { } catch (Throwable e) { reportWtf("making Package Manager Service ready", e); } + try { + lockSettings.systemReady(); + } catch (Throwable e) { + reportWtf("making Lock Settings Service ready", e); + } // These are needed to propagate to the runnable below. final Context contextF = context; diff --git a/services/java/com/android/server/TelephonyRegistry.java b/services/java/com/android/server/TelephonyRegistry.java index 8c8e725..1b1638a 100644 --- a/services/java/com/android/server/TelephonyRegistry.java +++ b/services/java/com/android/server/TelephonyRegistry.java @@ -29,6 +29,7 @@ import android.telephony.CellLocation; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; import android.telephony.SignalStrength; +import android.telephony.CellInfo; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Slog; @@ -107,6 +108,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { private int mOtaspMode = ServiceStateTracker.OTASP_UNKNOWN; + private CellInfo mCellInfo = null; + static final int PHONE_STATE_PERMISSION_MASK = PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR | PhoneStateListener.LISTEN_CALL_STATE | @@ -236,6 +239,13 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { remove(r.binder); } } + if ((events & PhoneStateListener.LISTEN_CELL_INFO) != 0) { + try { + r.callback.onCellInfoChanged(new CellInfo(mCellInfo)); + } catch (RemoteException ex) { + remove(r.binder); + } + } } } } else { @@ -325,6 +335,26 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { broadcastSignalStrengthChanged(signalStrength); } + public void notifyCellInfo(CellInfo cellInfo) { + if (!checkNotifyPermission("notifyCellInfo()")) { + return; + } + + synchronized (mRecords) { + mCellInfo = cellInfo; + for (Record r : mRecords) { + if ((r.events & PhoneStateListener.LISTEN_CELL_INFO) != 0) { + try { + r.callback.onCellInfoChanged(new CellInfo(cellInfo)); + } catch (RemoteException ex) { + mRemoveList.add(r.binder); + } + } + } + handleRemoveListLocked(); + } + } + public void notifyMessageWaitingChanged(boolean mwi) { if (!checkNotifyPermission("notifyMessageWaitingChanged()")) { return; @@ -530,6 +560,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { pw.println(" mDataConnectionLinkProperties=" + mDataConnectionLinkProperties); pw.println(" mDataConnectionLinkCapabilities=" + mDataConnectionLinkCapabilities); pw.println(" mCellLocation=" + mCellLocation); + pw.println(" mCellInfo=" + mCellInfo); pw.println("registrations: count=" + recordCount); for (Record r : mRecords) { pw.println(" " + r.pkgForDebug + " 0x" + Integer.toHexString(r.events)); @@ -655,6 +686,12 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } + if ((events & PhoneStateListener.LISTEN_CELL_INFO) != 0) { + mContext.enforceCallingOrSelfPermission( + android.Manifest.permission.ACCESS_COARSE_LOCATION, null); + + } + if ((events & PHONE_STATE_PERMISSION_MASK) != 0) { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.READ_PHONE_STATE, null); diff --git a/services/java/com/android/server/WiredAccessoryObserver.java b/services/java/com/android/server/WiredAccessoryObserver.java index 9b4eddc..53d1f0e 100644 --- a/services/java/com/android/server/WiredAccessoryObserver.java +++ b/services/java/com/android/server/WiredAccessoryObserver.java @@ -301,13 +301,13 @@ class WiredAccessoryObserver extends UEventObserver { // Pack up the values and broadcast them to everyone if (headset == BIT_USB_HEADSET_ANLG) { - intent = new Intent(Intent.ACTION_USB_ANLG_HEADSET_PLUG); + intent = new Intent(Intent.ACTION_ANALOG_AUDIO_DOCK_PLUG); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); intent.putExtra("state", state); intent.putExtra("name", headsetName); ActivityManagerNative.broadcastStickyIntent(intent, null); } else if (headset == BIT_USB_HEADSET_DGTL) { - intent = new Intent(Intent.ACTION_USB_DGTL_HEADSET_PLUG); + intent = new Intent(Intent.ACTION_DIGITAL_AUDIO_DOCK_PLUG); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); intent.putExtra("state", state); intent.putExtra("name", headsetName); diff --git a/services/java/com/android/server/accessibility/AccessibilityInputFilter.java b/services/java/com/android/server/accessibility/AccessibilityInputFilter.java index 769cb6a..31aa21e 100644 --- a/services/java/com/android/server/accessibility/AccessibilityInputFilter.java +++ b/services/java/com/android/server/accessibility/AccessibilityInputFilter.java @@ -16,7 +16,7 @@ package com.android.server.accessibility; -import com.android.server.wm.InputFilter; +import com.android.server.input.InputFilter; import android.content.Context; import android.util.Slog; diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java index 41cf9a6..d07aa7a 100644 --- a/services/java/com/android/server/accessibility/TouchExplorer.java +++ b/services/java/com/android/server/accessibility/TouchExplorer.java @@ -29,7 +29,7 @@ import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import com.android.server.accessibility.AccessibilityInputFilter.Explorer; -import com.android.server.wm.InputFilter; +import com.android.server.input.InputFilter; import java.util.Arrays; diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index a6fbdd7..80e59cd 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -62,10 +62,10 @@ import android.content.ContentProvider; import android.content.ContentResolver; import android.content.Context; import android.content.DialogInterface; -import android.content.Intent; -import android.content.IntentFilter; import android.content.IIntentReceiver; import android.content.IIntentSender; +import android.content.Intent; +import android.content.IntentFilter; import android.content.IntentSender; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; @@ -75,12 +75,12 @@ import android.content.pm.IPackageManager; import android.content.pm.InstrumentationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PathPermission; import android.content.pm.ProviderInfo; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.content.pm.UserInfo; -import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.graphics.Bitmap; @@ -113,10 +113,10 @@ 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; import android.util.Log; +import android.util.Pair; import android.util.PrintWriterPrinter; +import android.util.Slog; import android.util.SparseArray; import android.util.SparseIntArray; import android.util.TimeUtils; @@ -140,7 +140,6 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StringWriter; -import java.lang.IllegalStateException; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collection; @@ -4445,6 +4444,17 @@ public final class ActivityManagerService extends ActivityManagerNative return null; } + public int getUidForIntentSender(IIntentSender sender) { + if (sender instanceof PendingIntentRecord) { + try { + PendingIntentRecord res = (PendingIntentRecord)sender; + return res.uid; + } catch (ClassCastException e) { + } + } + return -1; + } + public boolean isIntentSenderTargetedToPackage(IIntentSender pendingResult) { if (!(pendingResult instanceof PendingIntentRecord)) { return false; @@ -10263,6 +10273,29 @@ public final class ActivityManagerService extends ActivityManagerNative } pw.println(); pw.print("Total PSS: "); pw.print(totalPss); pw.println(" kB"); + final int[] SINGLE_LONG_FORMAT = new int[] { + Process.PROC_SPACE_TERM|Process.PROC_OUT_LONG + }; + long[] longOut = new long[1]; + Process.readProcFile("/sys/kernel/mm/ksm/pages_shared", + SINGLE_LONG_FORMAT, null, longOut, null); + long shared = longOut[0] * ProcessList.PAGE_SIZE / 1024; + longOut[0] = 0; + Process.readProcFile("/sys/kernel/mm/ksm/pages_sharing", + SINGLE_LONG_FORMAT, null, longOut, null); + long sharing = longOut[0] * ProcessList.PAGE_SIZE / 1024; + longOut[0] = 0; + Process.readProcFile("/sys/kernel/mm/ksm/pages_unshared", + SINGLE_LONG_FORMAT, null, longOut, null); + long unshared = longOut[0] * ProcessList.PAGE_SIZE / 1024; + longOut[0] = 0; + Process.readProcFile("/sys/kernel/mm/ksm/pages_volatile", + SINGLE_LONG_FORMAT, null, longOut, null); + long voltile = longOut[0] * ProcessList.PAGE_SIZE / 1024; + pw.print(" KSM: "); pw.print(sharing); pw.print(" kB saved from shared "); + pw.print(shared); pw.println(" kB"); + pw.print(" "); pw.print(unshared); pw.print(" kB unshared; "); + pw.print(voltile); pw.println(" kB volatile"); } } @@ -13281,6 +13314,102 @@ public final class ActivityManagerService extends ActivityManagerNative } } + @Override + public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity) { + ActivityRecord srec = ActivityRecord.forToken(token); + return srec.task.affinity != null && srec.task.affinity.equals(destAffinity); + } + + public boolean navigateUpTo(IBinder token, Intent destIntent, int resultCode, + Intent resultData) { + ComponentName dest = destIntent.getComponent(); + + synchronized (this) { + ActivityRecord srec = ActivityRecord.forToken(token); + ArrayList<ActivityRecord> history = srec.stack.mHistory; + final int start = history.indexOf(srec); + if (start < 0) { + // Current activity is not in history stack; do nothing. + return false; + } + int finishTo = start - 1; + ActivityRecord parent = null; + boolean foundParentInTask = false; + if (dest != null) { + TaskRecord tr = srec.task; + for (int i = start - 1; i >= 0; i--) { + ActivityRecord r = history.get(i); + if (tr != r.task) { + // Couldn't find parent in the same task; stop at the one above this. + // (Root of current task; in-app "home" behavior) + // Always at least finish the current activity. + finishTo = Math.min(start - 1, i + 1); + parent = history.get(finishTo); + break; + } else if (r.info.packageName.equals(dest.getPackageName()) && + r.info.name.equals(dest.getClassName())) { + finishTo = i; + parent = r; + foundParentInTask = true; + break; + } + } + } + + if (mController != null) { + ActivityRecord next = mMainStack.topRunningActivityLocked(token, 0); + if (next != null) { + // ask watcher if this is allowed + boolean resumeOK = true; + try { + resumeOK = mController.activityResuming(next.packageName); + } catch (RemoteException e) { + mController = null; + } + + if (!resumeOK) { + return false; + } + } + } + final long origId = Binder.clearCallingIdentity(); + for (int i = start; i > finishTo; i--) { + ActivityRecord r = history.get(i); + mMainStack.requestFinishActivityLocked(r.appToken, resultCode, resultData, + "navigate-up"); + // Only return the supplied result for the first activity finished + resultCode = Activity.RESULT_CANCELED; + resultData = null; + } + + if (parent != null && foundParentInTask) { + final int parentLaunchMode = parent.info.launchMode; + final int destIntentFlags = destIntent.getFlags(); + if (parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE || + parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TASK || + parentLaunchMode == ActivityInfo.LAUNCH_SINGLE_TOP || + (destIntentFlags & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) { + parent.deliverNewIntentLocked(srec.app.uid, destIntent); + } else { + try { + ActivityInfo aInfo = AppGlobals.getPackageManager().getActivityInfo( + destIntent.getComponent(), 0, UserId.getCallingUserId()); + int res = mMainStack.startActivityLocked(srec.app.thread, destIntent, + null, aInfo, parent.appToken, null, + 0, -1, parent.launchedFromUid, 0, null, true, null); + foundParentInTask = res == ActivityManager.START_SUCCESS; + } catch (RemoteException e) { + foundParentInTask = false; + } + mMainStack.requestFinishActivityLocked(parent.appToken, resultCode, + resultData, "navigate-up"); + } + } + Binder.restoreCallingIdentity(origId); + return foundParentInTask; + } + } + // ========================================================= // LIFETIME MANAGEMENT // ========================================================= diff --git a/services/java/com/android/server/am/ActivityRecord.java b/services/java/com/android/server/am/ActivityRecord.java index d60ff2b..a098f18 100644 --- a/services/java/com/android/server/am/ActivityRecord.java +++ b/services/java/com/android/server/am/ActivityRecord.java @@ -16,6 +16,7 @@ package com.android.server.am; +import com.android.internal.app.ResolverActivity; import com.android.server.AttributeCache; import com.android.server.am.ActivityStack.ActivityState; @@ -382,7 +383,7 @@ final class ActivityRecord { _intent.getData() == null && _intent.getType() == null && (intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0 && - !"android".equals(realActivity.getClassName())) { + !ResolverActivity.class.getName().equals(realActivity.getClassName())) { // This sure looks like a home activity! // Note the last check is so we don't count the resolver // activity as being home... really, we don't care about diff --git a/services/java/com/android/server/wm/InputApplicationHandle.java b/services/java/com/android/server/input/InputApplicationHandle.java index 1812f11..42c1052 100644 --- a/services/java/com/android/server/wm/InputApplicationHandle.java +++ b/services/java/com/android/server/input/InputApplicationHandle.java @@ -14,8 +14,7 @@ * limitations under the License. */ -package com.android.server.wm; - +package com.android.server.input; /** * Functions as a handle for an application that can receive input. @@ -30,7 +29,7 @@ public final class InputApplicationHandle { private int ptr; // The window manager's application window token. - public final AppWindowToken appWindowToken; + public final Object appWindowToken; // Application name. public String name; @@ -40,7 +39,7 @@ public final class InputApplicationHandle { private native void nativeDispose(); - public InputApplicationHandle(AppWindowToken appWindowToken) { + public InputApplicationHandle(Object appWindowToken) { this.appWindowToken = appWindowToken; } diff --git a/services/java/com/android/server/wm/InputFilter.java b/services/java/com/android/server/input/InputFilter.java index 8f0001a..2ce0a02 100644 --- a/services/java/com/android/server/wm/InputFilter.java +++ b/services/java/com/android/server/input/InputFilter.java @@ -14,7 +14,9 @@ * limitations under the License. */ -package com.android.server.wm; +package com.android.server.input; + +import com.android.server.wm.WindowManagerService; import android.os.Handler; import android.os.Looper; @@ -33,7 +35,7 @@ import android.view.WindowManagerPolicy; * system's behavior changes as follows: * <ul> * <li>Input events are first delivered to the {@link WindowManagerPolicy} - * interception methods before queueing as usual. This critical step takes care of managing + * interception methods before queuing as usual. This critical step takes care of managing * the power state of the device and handling wake keys.</li> * <li>Input events are then asynchronously delivered to the input filter's * {@link #onInputEvent(InputEvent)} method instead of being enqueued for dispatch to @@ -79,7 +81,7 @@ import android.view.WindowManagerPolicy; * {@link WindowManagerPolicy#FLAG_PASS_TO_USER} policy flag. The input filter may * sometimes receive events that do not have this flag set. It should take note of * the fact that the policy intends to drop the event, clean up its state, and - * then send appropriate cancelation events to the dispatcher if needed. + * then send appropriate cancellation events to the dispatcher if needed. * </p><p> * For example, suppose the input filter is processing a gesture and one of the touch events * it receives does not have the {@link WindowManagerPolicy#FLAG_PASS_TO_USER} flag set. @@ -89,8 +91,8 @@ import android.view.WindowManagerPolicy; * Corollary: Events that set sent to the dispatcher should usually include the * {@link WindowManagerPolicy#FLAG_PASS_TO_USER} flag. Otherwise, they will be dropped! * </p><p> - * It may be prudent to disable automatic key repeating for synthetically generated - * keys by setting the {@link WindowManagerPolicy#FLAG_DISABLE_KEY_REPEAT} policy flag. + * It may be prudent to disable automatic key repeating for synthetic key events + * by setting the {@link WindowManagerPolicy#FLAG_DISABLE_KEY_REPEAT} policy flag. * </p> */ public abstract class InputFilter { diff --git a/services/java/com/android/server/wm/InputManager.java b/services/java/com/android/server/input/InputManagerService.java index 56c3519..b8cc65e 100644 --- a/services/java/com/android/server/wm/InputManager.java +++ b/services/java/com/android/server/input/InputManagerService.java @@ -14,10 +14,12 @@ * limitations under the License. */ -package com.android.server.wm; +package com.android.server.input; import com.android.internal.util.XmlUtils; import com.android.server.Watchdog; +import com.android.server.input.InputFilter.Host; +import com.android.server.wm.WindowManagerService; import org.xmlpull.v1.XmlPullParser; @@ -25,9 +27,14 @@ import android.content.Context; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.database.ContentObserver; +import android.hardware.input.IInputManager; +import android.hardware.input.InputManager; +import android.os.Binder; import android.os.Environment; +import android.os.Handler; import android.os.Looper; import android.os.MessageQueue; +import android.os.Process; import android.os.SystemProperties; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; @@ -44,6 +51,7 @@ import android.view.WindowManager; import android.view.WindowManagerPolicy; import java.io.File; +import java.io.FileDescriptor; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; @@ -53,62 +61,65 @@ import java.util.ArrayList; /* * Wraps the C++ InputManager and provides its callbacks. */ -public class InputManager implements Watchdog.Monitor { +public class InputManagerService extends IInputManager.Stub implements Watchdog.Monitor { static final String TAG = "InputManager"; - - private static final boolean DEBUG = false; + static final boolean DEBUG = false; + + private static final String EXCLUDED_DEVICES_PATH = "etc/excluded-input-devices.xml"; + + // Pointer to native input manager service object. + private final int mPtr; - private final Callbacks mCallbacks; private final Context mContext; - private final WindowManagerService mWindowManagerService; - - private static native void nativeInit(Context context, - Callbacks callbacks, MessageQueue messageQueue); - private static native void nativeStart(); - private static native void nativeSetDisplaySize(int displayId, int width, int height, - int externalWidth, int externalHeight); - private static native void nativeSetDisplayOrientation(int displayId, int rotation); + private final Callbacks mCallbacks; + private final Handler mHandler; + + private static native int nativeInit(InputManagerService service, + Context context, MessageQueue messageQueue); + private static native void nativeStart(int ptr); + private static native void nativeSetDisplaySize(int ptr, int displayId, + int width, int height, int externalWidth, int externalHeight); + private static native void nativeSetDisplayOrientation(int ptr, int displayId, int rotation); - private static native int nativeGetScanCodeState(int deviceId, int sourceMask, - int scanCode); - private static native int nativeGetKeyCodeState(int deviceId, int sourceMask, - int keyCode); - private static native int nativeGetSwitchState(int deviceId, int sourceMask, - int sw); - private static native boolean nativeHasKeys(int deviceId, int sourceMask, - int[] keyCodes, boolean[] keyExists); - private static native void nativeRegisterInputChannel(InputChannel inputChannel, + private static native int nativeGetScanCodeState(int ptr, + int deviceId, int sourceMask, int scanCode); + private static native int nativeGetKeyCodeState(int ptr, + int deviceId, int sourceMask, int keyCode); + private static native int nativeGetSwitchState(int ptr, + int deviceId, int sourceMask, int sw); + private static native boolean nativeHasKeys(int ptr, + int deviceId, int sourceMask, int[] keyCodes, boolean[] keyExists); + private static native void nativeRegisterInputChannel(int ptr, InputChannel inputChannel, InputWindowHandle inputWindowHandle, boolean monitor); - private static native void nativeUnregisterInputChannel(InputChannel inputChannel); - private static native void nativeSetInputFilterEnabled(boolean enable); - private static native int nativeInjectInputEvent(InputEvent event, + private static native void nativeUnregisterInputChannel(int ptr, InputChannel inputChannel); + private static native void nativeSetInputFilterEnabled(int ptr, boolean enable); + private static native int nativeInjectInputEvent(int ptr, InputEvent event, int injectorPid, int injectorUid, int syncMode, int timeoutMillis, int policyFlags); - private static native void nativeSetInputWindows(InputWindowHandle[] windowHandles); - private static native void nativeSetInputDispatchMode(boolean enabled, boolean frozen); - private static native void nativeSetSystemUiVisibility(int visibility); - private static native void nativeSetFocusedApplication(InputApplicationHandle application); - private static native InputDevice nativeGetInputDevice(int deviceId); - private static native void nativeGetInputConfiguration(Configuration configuration); - private static native int[] nativeGetInputDeviceIds(); - private static native boolean nativeTransferTouchFocus(InputChannel fromChannel, - InputChannel toChannel); - private static native void nativeSetPointerSpeed(int speed); - private static native void nativeSetShowTouches(boolean enabled); - private static native String nativeDump(); - private static native void nativeMonitor(); - + private static native void nativeSetInputWindows(int ptr, InputWindowHandle[] windowHandles); + private static native void nativeSetInputDispatchMode(int ptr, boolean enabled, boolean frozen); + private static native void nativeSetSystemUiVisibility(int ptr, int visibility); + private static native void nativeSetFocusedApplication(int ptr, + InputApplicationHandle application); + private static native InputDevice nativeGetInputDevice(int ptr, int deviceId); + private static native void nativeGetInputConfiguration(int ptr, Configuration configuration); + private static native int[] nativeGetInputDeviceIds(int ptr); + private static native boolean nativeTransferTouchFocus(int ptr, + InputChannel fromChannel, InputChannel toChannel); + private static native void nativeSetPointerSpeed(int ptr, int speed); + private static native void nativeSetShowTouches(int ptr, boolean enabled); + private static native String nativeDump(int ptr); + private static native void nativeMonitor(int ptr); + // Input event injection constants defined in InputDispatcher.h. - static final int INPUT_EVENT_INJECTION_SUCCEEDED = 0; - static final int INPUT_EVENT_INJECTION_PERMISSION_DENIED = 1; - static final int INPUT_EVENT_INJECTION_FAILED = 2; - static final int INPUT_EVENT_INJECTION_TIMED_OUT = 3; - - // Input event injection synchronization modes defined in InputDispatcher.h - static final int INPUT_EVENT_INJECTION_SYNC_NONE = 0; - static final int INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT = 1; - static final int INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH = 2; - + private static final int INPUT_EVENT_INJECTION_SUCCEEDED = 0; + private static final int INPUT_EVENT_INJECTION_PERMISSION_DENIED = 1; + private static final int INPUT_EVENT_INJECTION_FAILED = 2; + private static final int INPUT_EVENT_INJECTION_TIMED_OUT = 3; + + // Maximum number of milliseconds to wait for input event injection. + private static final int INJECTION_TIMEOUT_MILLIS = 30 * 1000; + // Key states (may be returned by queries about the current state of a // particular key code, scan code or switch). @@ -129,23 +140,21 @@ public class InputManager implements Watchdog.Monitor { InputFilter mInputFilter; InputFilterHost mInputFilterHost; - public InputManager(Context context, WindowManagerService windowManagerService) { + public InputManagerService(Context context, Callbacks callbacks) { this.mContext = context; - this.mWindowManagerService = windowManagerService; - this.mCallbacks = new Callbacks(); - - Looper looper = windowManagerService.mH.getLooper(); + this.mCallbacks = callbacks; + this.mHandler = new Handler(); Slog.i(TAG, "Initializing input manager"); - nativeInit(mContext, mCallbacks, looper.getQueue()); - - // Add ourself to the Watchdog monitors. - Watchdog.getInstance().addMonitor(this); + mPtr = nativeInit(this, mContext, mHandler.getLooper().getQueue()); } public void start() { Slog.i(TAG, "Starting input manager"); - nativeStart(); + nativeStart(mPtr); + + // Add ourself to the Watchdog monitors. + Watchdog.getInstance().addMonitor(this); registerPointerSpeedSettingObserver(); registerShowTouchesSettingObserver(); @@ -164,7 +173,7 @@ public class InputManager implements Watchdog.Monitor { Slog.d(TAG, "Setting display #" + displayId + " size to " + width + "x" + height + " external size " + externalWidth + "x" + externalHeight); } - nativeSetDisplaySize(displayId, width, height, externalWidth, externalHeight); + nativeSetDisplaySize(mPtr, displayId, width, height, externalWidth, externalHeight); } public void setDisplayOrientation(int displayId, int rotation) { @@ -175,7 +184,7 @@ public class InputManager implements Watchdog.Monitor { if (DEBUG) { Slog.d(TAG, "Setting display #" + displayId + " orientation to " + rotation); } - nativeSetDisplayOrientation(displayId, rotation); + nativeSetDisplayOrientation(mPtr, displayId, rotation); } public void getInputConfiguration(Configuration config) { @@ -183,9 +192,9 @@ public class InputManager implements Watchdog.Monitor { throw new IllegalArgumentException("config must not be null."); } - nativeGetInputConfiguration(config); + nativeGetInputConfiguration(mPtr, config); } - + /** * Gets the current state of a key or button by key code. * @param deviceId The input device id, or -1 to consult all devices. @@ -196,7 +205,7 @@ public class InputManager implements Watchdog.Monitor { * @return The key state. */ public int getKeyCodeState(int deviceId, int sourceMask, int keyCode) { - return nativeGetKeyCodeState(deviceId, sourceMask, keyCode); + return nativeGetKeyCodeState(mPtr, deviceId, sourceMask, keyCode); } /** @@ -209,7 +218,7 @@ public class InputManager implements Watchdog.Monitor { * @return The key state. */ public int getScanCodeState(int deviceId, int sourceMask, int scanCode) { - return nativeGetScanCodeState(deviceId, sourceMask, scanCode); + return nativeGetScanCodeState(mPtr, deviceId, sourceMask, scanCode); } /** @@ -222,7 +231,7 @@ public class InputManager implements Watchdog.Monitor { * @return The switch state. */ public int getSwitchState(int deviceId, int sourceMask, int switchCode) { - return nativeGetSwitchState(deviceId, sourceMask, switchCode); + return nativeGetSwitchState(mPtr, deviceId, sourceMask, switchCode); } /** @@ -237,6 +246,7 @@ public class InputManager implements Watchdog.Monitor { * key codes. * @return True if the lookup was successful, false otherwise. */ + @Override public boolean hasKeys(int deviceId, int sourceMask, int[] keyCodes, boolean[] keyExists) { if (keyCodes == null) { throw new IllegalArgumentException("keyCodes must not be null."); @@ -246,7 +256,7 @@ public class InputManager implements Watchdog.Monitor { + "least as large as keyCodes."); } - return nativeHasKeys(deviceId, sourceMask, keyCodes, keyExists); + return nativeHasKeys(mPtr, deviceId, sourceMask, keyCodes, keyExists); } /** @@ -260,7 +270,7 @@ public class InputManager implements Watchdog.Monitor { } InputChannel[] inputChannels = InputChannel.openInputChannelPair(inputChannelName); - nativeRegisterInputChannel(inputChannels[0], null, true); + nativeRegisterInputChannel(mPtr, inputChannels[0], null, true); inputChannels[0].dispose(); // don't need to retain the Java object reference return inputChannels[1]; } @@ -277,7 +287,7 @@ public class InputManager implements Watchdog.Monitor { throw new IllegalArgumentException("inputChannel must not be null."); } - nativeRegisterInputChannel(inputChannel, inputWindowHandle, false); + nativeRegisterInputChannel(mPtr, inputChannel, inputWindowHandle, false); } /** @@ -289,7 +299,7 @@ public class InputManager implements Watchdog.Monitor { throw new IllegalArgumentException("inputChannel must not be null."); } - nativeUnregisterInputChannel(inputChannel); + nativeUnregisterInputChannel(mPtr, inputChannel); } /** @@ -323,47 +333,46 @@ public class InputManager implements Watchdog.Monitor { filter.install(mInputFilterHost); } - nativeSetInputFilterEnabled(filter != null); + nativeSetInputFilterEnabled(mPtr, filter != null); } } - /** - * Injects an input event into the event system on behalf of an application. - * The synchronization mode determines whether the method blocks while waiting for - * input injection to proceed. - * - * {@link #INPUT_EVENT_INJECTION_SYNC_NONE} never blocks. Injection is asynchronous and - * is assumed always to be successful. - * - * {@link #INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT} waits for previous events to be - * dispatched so that the input dispatcher can determine whether input event injection will - * be permitted based on the current input focus. Does not wait for the input event to - * finish processing. - * - * {@link #INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH} waits for the input event to - * be completely processed. - * - * @param event The event to inject. - * @param injectorPid The pid of the injecting application. - * @param injectorUid The uid of the injecting application. - * @param syncMode The synchronization mode. - * @param timeoutMillis The injection timeout in milliseconds. - * @return One of the INPUT_EVENT_INJECTION_XXX constants. - */ - public int injectInputEvent(InputEvent event, int injectorPid, int injectorUid, - int syncMode, int timeoutMillis) { + @Override + public boolean injectInputEvent(InputEvent event, int mode) { if (event == null) { throw new IllegalArgumentException("event must not be null"); } - if (injectorPid < 0 || injectorUid < 0) { - throw new IllegalArgumentException("injectorPid and injectorUid must not be negative."); - } - if (timeoutMillis <= 0) { - throw new IllegalArgumentException("timeoutMillis must be positive"); + if (mode != InputManager.INJECT_INPUT_EVENT_MODE_ASYNC + && mode != InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH + && mode != InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT) { + throw new IllegalArgumentException("mode is invalid"); } - return nativeInjectInputEvent(event, injectorPid, injectorUid, syncMode, timeoutMillis, - WindowManagerPolicy.FLAG_DISABLE_KEY_REPEAT); + final int pid = Binder.getCallingPid(); + final int uid = Binder.getCallingUid(); + final long ident = Binder.clearCallingIdentity(); + final int result; + try { + result = nativeInjectInputEvent(mPtr, event, pid, uid, mode, + INJECTION_TIMEOUT_MILLIS, WindowManagerPolicy.FLAG_DISABLE_KEY_REPEAT); + } finally { + Binder.restoreCallingIdentity(ident); + } + switch (result) { + case INPUT_EVENT_INJECTION_PERMISSION_DENIED: + Slog.w(TAG, "Input event injection from pid " + pid + " permission denied."); + throw new SecurityException( + "Injecting to another application requires INJECT_EVENTS permission"); + case INPUT_EVENT_INJECTION_SUCCEEDED: + return true; + case INPUT_EVENT_INJECTION_TIMED_OUT: + Slog.w(TAG, "Input event injection from pid " + pid + " timed out."); + return false; + case INPUT_EVENT_INJECTION_FAILED: + default: + Slog.w(TAG, "Input event injection from pid " + pid + " failed."); + return false; + } } /** @@ -371,32 +380,34 @@ public class InputManager implements Watchdog.Monitor { * @param id The device id. * @return The input device or null if not found. */ + @Override public InputDevice getInputDevice(int deviceId) { - return nativeGetInputDevice(deviceId); + return nativeGetInputDevice(mPtr, deviceId); } /** * Gets the ids of all input devices in the system. * @return The input device ids. */ + @Override public int[] getInputDeviceIds() { - return nativeGetInputDeviceIds(); + return nativeGetInputDeviceIds(mPtr); } public void setInputWindows(InputWindowHandle[] windowHandles) { - nativeSetInputWindows(windowHandles); + nativeSetInputWindows(mPtr, windowHandles); } public void setFocusedApplication(InputApplicationHandle application) { - nativeSetFocusedApplication(application); + nativeSetFocusedApplication(mPtr, application); } public void setInputDispatchMode(boolean enabled, boolean frozen) { - nativeSetInputDispatchMode(enabled, frozen); + nativeSetInputDispatchMode(mPtr, enabled, frozen); } public void setSystemUiVisibility(int visibility) { - nativeSetSystemUiVisibility(visibility); + nativeSetSystemUiVisibility(mPtr, visibility); } /** @@ -419,7 +430,7 @@ public class InputManager implements Watchdog.Monitor { if (toChannel == null) { throw new IllegalArgumentException("toChannel must not be null."); } - return nativeTransferTouchFocus(fromChannel, toChannel); + return nativeTransferTouchFocus(mPtr, fromChannel, toChannel); } /** @@ -427,20 +438,31 @@ public class InputManager implements Watchdog.Monitor { * @param speed The pointer speed as a value between -7 (slowest) and 7 (fastest) * where 0 is the default speed. */ - public void setPointerSpeed(int speed) { - speed = Math.min(Math.max(speed, -7), 7); - nativeSetPointerSpeed(speed); + @Override + public void tryPointerSpeed(int speed) { + if (!checkCallingPermission(android.Manifest.permission.SET_POINTER_SPEED, + "tryPointerSpeed()")) { + throw new SecurityException("Requires SET_POINTER_SPEED permission"); + } + + setPointerSpeedUnchecked(speed); } public void updatePointerSpeedFromSettings() { - int speed = getPointerSpeedSetting(0); - setPointerSpeed(speed); + int speed = getPointerSpeedSetting(); + setPointerSpeedUnchecked(speed); + } + + private void setPointerSpeedUnchecked(int speed) { + speed = Math.min(Math.max(speed, InputManager.MIN_POINTER_SPEED), + InputManager.MAX_POINTER_SPEED); + nativeSetPointerSpeed(mPtr, speed); } private void registerPointerSpeedSettingObserver() { mContext.getContentResolver().registerContentObserver( Settings.System.getUriFor(Settings.System.POINTER_SPEED), true, - new ContentObserver(mWindowManagerService.mH) { + new ContentObserver(mHandler) { @Override public void onChange(boolean selfChange) { updatePointerSpeedFromSettings(); @@ -448,8 +470,8 @@ public class InputManager implements Watchdog.Monitor { }); } - private int getPointerSpeedSetting(int defaultValue) { - int speed = defaultValue; + private int getPointerSpeedSetting() { + int speed = InputManager.DEFAULT_POINTER_SPEED; try { speed = Settings.System.getInt(mContext.getContentResolver(), Settings.System.POINTER_SPEED); @@ -460,13 +482,13 @@ public class InputManager implements Watchdog.Monitor { public void updateShowTouchesFromSettings() { int setting = getShowTouchesSetting(0); - nativeSetShowTouches(setting != 0); + nativeSetShowTouches(mPtr, setting != 0); } private void registerShowTouchesSettingObserver() { mContext.getContentResolver().registerContentObserver( Settings.System.getUriFor(Settings.System.SHOW_TOUCHES), true, - new ContentObserver(mWindowManagerService.mH) { + new ContentObserver(mHandler) { @Override public void onChange(boolean selfChange) { updateShowTouchesFromSettings(); @@ -484,200 +506,238 @@ public class InputManager implements Watchdog.Monitor { return result; } - public void dump(PrintWriter pw) { - String dumpStr = nativeDump(); + @Override + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + if (mContext.checkCallingOrSelfPermission("android.permission.DUMP") + != PackageManager.PERMISSION_GRANTED) { + pw.println("Permission Denial: can't dump InputManager from from pid=" + + Binder.getCallingPid() + + ", uid=" + Binder.getCallingUid()); + return; + } + + pw.println("INPUT MANAGER (dumpsys input)\n"); + String dumpStr = nativeDump(mPtr); if (dumpStr != null) { pw.println(dumpStr); } } - // Called by the heartbeat to ensure locks are not held indefnitely (for deadlock detection). + private boolean checkCallingPermission(String permission, String func) { + // Quick check: if the calling permission is me, it's all okay. + if (Binder.getCallingPid() == Process.myPid()) { + return true; + } + + if (mContext.checkCallingPermission(permission) == PackageManager.PERMISSION_GRANTED) { + return true; + } + String msg = "Permission Denial: " + func + " from pid=" + + Binder.getCallingPid() + + ", uid=" + Binder.getCallingUid() + + " requires " + permission; + Slog.w(TAG, msg); + return false; + } + + // Called by the heartbeat to ensure locks are not held indefinitely (for deadlock detection). public void monitor() { synchronized (mInputFilterLock) { } - nativeMonitor(); + nativeMonitor(mPtr); } - private final class InputFilterHost implements InputFilter.Host { - private boolean mDisconnected; + // Native callback. + private void notifyConfigurationChanged(long whenNanos) { + mCallbacks.notifyConfigurationChanged(); + } - public void disconnectLocked() { - mDisconnected = true; - } + // Native callback. + private void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) { + mCallbacks.notifyLidSwitchChanged(whenNanos, lidOpen); + } - public void sendInputEvent(InputEvent event, int policyFlags) { - if (event == null) { - throw new IllegalArgumentException("event must not be null"); - } + // Native callback. + private void notifyInputChannelBroken(InputWindowHandle inputWindowHandle) { + mCallbacks.notifyInputChannelBroken(inputWindowHandle); + } - synchronized (mInputFilterLock) { - if (!mDisconnected) { - nativeInjectInputEvent(event, 0, 0, INPUT_EVENT_INJECTION_SYNC_NONE, 0, - policyFlags | WindowManagerPolicy.FLAG_FILTERED); - } + // Native callback. + private long notifyANR(InputApplicationHandle inputApplicationHandle, + InputWindowHandle inputWindowHandle) { + return mCallbacks.notifyANR(inputApplicationHandle, inputWindowHandle); + } + + // Native callback. + final boolean filterInputEvent(InputEvent event, int policyFlags) { + synchronized (mInputFilterLock) { + if (mInputFilter != null) { + mInputFilter.filterInputEvent(event, policyFlags); + return false; } } + event.recycle(); + return true; } - /* - * Callbacks from native. - */ - private final class Callbacks { - static final String TAG = "InputManager-Callbacks"; - - private static final boolean DEBUG_VIRTUAL_KEYS = false; - private static final String EXCLUDED_DEVICES_PATH = "etc/excluded-input-devices.xml"; - private static final String CALIBRATION_DIR_PATH = "usr/idc/"; - - @SuppressWarnings("unused") - public void notifyConfigurationChanged(long whenNanos) { - mWindowManagerService.mInputMonitor.notifyConfigurationChanged(); - } - - @SuppressWarnings("unused") - public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) { - mWindowManagerService.mInputMonitor.notifyLidSwitchChanged(whenNanos, lidOpen); - } - - @SuppressWarnings("unused") - public void notifyInputChannelBroken(InputWindowHandle inputWindowHandle) { - mWindowManagerService.mInputMonitor.notifyInputChannelBroken(inputWindowHandle); - } - - @SuppressWarnings("unused") - public long notifyANR(InputApplicationHandle inputApplicationHandle, - InputWindowHandle inputWindowHandle) { - return mWindowManagerService.mInputMonitor.notifyANR( - inputApplicationHandle, inputWindowHandle); - } + // Native callback. + private int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn) { + return mCallbacks.interceptKeyBeforeQueueing( + event, policyFlags, isScreenOn); + } - @SuppressWarnings("unused") - final boolean filterInputEvent(InputEvent event, int policyFlags) { - synchronized (mInputFilterLock) { - if (mInputFilter != null) { - mInputFilter.filterInputEvent(event, policyFlags); - return false; - } - } - event.recycle(); - return true; - } + // Native callback. + private int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags) { + return mCallbacks.interceptMotionBeforeQueueingWhenScreenOff(policyFlags); + } - @SuppressWarnings("unused") - public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn) { - return mWindowManagerService.mInputMonitor.interceptKeyBeforeQueueing( - event, policyFlags, isScreenOn); - } + // Native callback. + private long interceptKeyBeforeDispatching(InputWindowHandle focus, + KeyEvent event, int policyFlags) { + return mCallbacks.interceptKeyBeforeDispatching(focus, event, policyFlags); + } - @SuppressWarnings("unused") - public int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags) { - return mWindowManagerService.mInputMonitor.interceptMotionBeforeQueueingWhenScreenOff( - policyFlags); - } + // Native callback. + private KeyEvent dispatchUnhandledKey(InputWindowHandle focus, + KeyEvent event, int policyFlags) { + return mCallbacks.dispatchUnhandledKey(focus, event, policyFlags); + } - @SuppressWarnings("unused") - public long interceptKeyBeforeDispatching(InputWindowHandle focus, - KeyEvent event, int policyFlags) { - return mWindowManagerService.mInputMonitor.interceptKeyBeforeDispatching( - focus, event, policyFlags); - } - - @SuppressWarnings("unused") - public KeyEvent dispatchUnhandledKey(InputWindowHandle focus, - KeyEvent event, int policyFlags) { - return mWindowManagerService.mInputMonitor.dispatchUnhandledKey( - focus, event, policyFlags); - } - - @SuppressWarnings("unused") - public boolean checkInjectEventsPermission(int injectorPid, int injectorUid) { - return mContext.checkPermission( - android.Manifest.permission.INJECT_EVENTS, injectorPid, injectorUid) - == PackageManager.PERMISSION_GRANTED; - } + // Native callback. + private boolean checkInjectEventsPermission(int injectorPid, int injectorUid) { + return mContext.checkPermission(android.Manifest.permission.INJECT_EVENTS, + injectorPid, injectorUid) == PackageManager.PERMISSION_GRANTED; + } - @SuppressWarnings("unused") - public int getVirtualKeyQuietTimeMillis() { - return mContext.getResources().getInteger( - com.android.internal.R.integer.config_virtualKeyQuietTimeMillis); - } + // Native callback. + private int getVirtualKeyQuietTimeMillis() { + return mContext.getResources().getInteger( + com.android.internal.R.integer.config_virtualKeyQuietTimeMillis); + } - @SuppressWarnings("unused") - public String[] getExcludedDeviceNames() { - ArrayList<String> names = new ArrayList<String>(); - - // Read partner-provided list of excluded input devices - XmlPullParser parser = null; - // Environment.getRootDirectory() is a fancy way of saying ANDROID_ROOT or "/system". - File confFile = new File(Environment.getRootDirectory(), EXCLUDED_DEVICES_PATH); - FileReader confreader = null; - try { - confreader = new FileReader(confFile); - parser = Xml.newPullParser(); - parser.setInput(confreader); - XmlUtils.beginDocument(parser, "devices"); - - while (true) { - XmlUtils.nextElement(parser); - if (!"device".equals(parser.getName())) { - break; - } - String name = parser.getAttributeValue(null, "name"); - if (name != null) { - names.add(name); - } + // Native callback. + private String[] getExcludedDeviceNames() { + ArrayList<String> names = new ArrayList<String>(); + + // Read partner-provided list of excluded input devices + XmlPullParser parser = null; + // Environment.getRootDirectory() is a fancy way of saying ANDROID_ROOT or "/system". + File confFile = new File(Environment.getRootDirectory(), EXCLUDED_DEVICES_PATH); + FileReader confreader = null; + try { + confreader = new FileReader(confFile); + parser = Xml.newPullParser(); + parser.setInput(confreader); + XmlUtils.beginDocument(parser, "devices"); + + while (true) { + XmlUtils.nextElement(parser); + if (!"device".equals(parser.getName())) { + break; + } + String name = parser.getAttributeValue(null, "name"); + if (name != null) { + names.add(name); } - } catch (FileNotFoundException e) { - // It's ok if the file does not exist. - } catch (Exception e) { - Slog.e(TAG, "Exception while parsing '" + confFile.getAbsolutePath() + "'", e); - } finally { - try { if (confreader != null) confreader.close(); } catch (IOException e) { } } - - return names.toArray(new String[names.size()]); + } catch (FileNotFoundException e) { + // It's ok if the file does not exist. + } catch (Exception e) { + Slog.e(TAG, "Exception while parsing '" + confFile.getAbsolutePath() + "'", e); + } finally { + try { if (confreader != null) confreader.close(); } catch (IOException e) { } } - @SuppressWarnings("unused") - public int getKeyRepeatTimeout() { - return ViewConfiguration.getKeyRepeatTimeout(); - } + return names.toArray(new String[names.size()]); + } - @SuppressWarnings("unused") - public int getKeyRepeatDelay() { - return ViewConfiguration.getKeyRepeatDelay(); - } + // Native callback. + private int getKeyRepeatTimeout() { + return ViewConfiguration.getKeyRepeatTimeout(); + } - @SuppressWarnings("unused") - public int getHoverTapTimeout() { - return ViewConfiguration.getHoverTapTimeout(); - } + // Native callback. + private int getKeyRepeatDelay() { + return ViewConfiguration.getKeyRepeatDelay(); + } - @SuppressWarnings("unused") - public int getHoverTapSlop() { - return ViewConfiguration.getHoverTapSlop(); - } + // Native callback. + private int getHoverTapTimeout() { + return ViewConfiguration.getHoverTapTimeout(); + } - @SuppressWarnings("unused") - public int getDoubleTapTimeout() { - return ViewConfiguration.getDoubleTapTimeout(); - } + // Native callback. + private int getHoverTapSlop() { + return ViewConfiguration.getHoverTapSlop(); + } - @SuppressWarnings("unused") - public int getLongPressTimeout() { - return ViewConfiguration.getLongPressTimeout(); - } + // Native callback. + private int getDoubleTapTimeout() { + return ViewConfiguration.getDoubleTapTimeout(); + } + + // Native callback. + private int getLongPressTimeout() { + return ViewConfiguration.getLongPressTimeout(); + } - @SuppressWarnings("unused") - public int getPointerLayer() { - return mWindowManagerService.mPolicy.windowTypeToLayerLw( - WindowManager.LayoutParams.TYPE_POINTER) - * WindowManagerService.TYPE_LAYER_MULTIPLIER - + WindowManagerService.TYPE_LAYER_OFFSET; + // Native callback. + private int getPointerLayer() { + return mCallbacks.getPointerLayer(); + } + + // Native callback. + private PointerIcon getPointerIcon() { + return PointerIcon.getDefaultIcon(mContext); + } + + /** + * Callback interface implemented by the Window Manager. + */ + public interface Callbacks { + public void notifyConfigurationChanged(); + + public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen); + + public void notifyInputChannelBroken(InputWindowHandle inputWindowHandle); + + public long notifyANR(InputApplicationHandle inputApplicationHandle, + InputWindowHandle inputWindowHandle); + + public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn); + + public int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags); + + public long interceptKeyBeforeDispatching(InputWindowHandle focus, + KeyEvent event, int policyFlags); + + public KeyEvent dispatchUnhandledKey(InputWindowHandle focus, + KeyEvent event, int policyFlags); + + public int getPointerLayer(); + } + + /** + * Hosting interface for input filters to call back into the input manager. + */ + private final class InputFilterHost implements InputFilter.Host { + private boolean mDisconnected; + + public void disconnectLocked() { + mDisconnected = true; } - @SuppressWarnings("unused") - public PointerIcon getPointerIcon() { - return PointerIcon.getDefaultIcon(mContext); + public void sendInputEvent(InputEvent event, int policyFlags) { + if (event == null) { + throw new IllegalArgumentException("event must not be null"); + } + + synchronized (mInputFilterLock) { + if (!mDisconnected) { + nativeInjectInputEvent(mPtr, event, 0, 0, + InputManager.INJECT_INPUT_EVENT_MODE_ASYNC, 0, + policyFlags | WindowManagerPolicy.FLAG_FILTERED); + } + } } } } diff --git a/services/java/com/android/server/wm/InputWindowHandle.java b/services/java/com/android/server/input/InputWindowHandle.java index 264877c..03d66af 100644 --- a/services/java/com/android/server/wm/InputWindowHandle.java +++ b/services/java/com/android/server/input/InputWindowHandle.java @@ -14,11 +14,10 @@ * limitations under the License. */ -package com.android.server.wm; +package com.android.server.input; import android.graphics.Region; import android.view.InputChannel; -import android.view.WindowManagerPolicy; /** * Functions as a handle for a window that can receive input. @@ -35,7 +34,7 @@ public final class InputWindowHandle { public final InputApplicationHandle inputApplicationHandle; // The window manager's window state. - public final WindowManagerPolicy.WindowState windowState; + public final Object windowState; // The input channel associated with the window. public InputChannel inputChannel; @@ -91,7 +90,7 @@ public final class InputWindowHandle { private native void nativeDispose(); public InputWindowHandle(InputApplicationHandle inputApplicationHandle, - WindowManagerPolicy.WindowState windowState) { + Object windowState) { this.inputApplicationHandle = inputApplicationHandle; this.windowState = windowState; } diff --git a/services/java/com/android/server/net/NetworkIdentitySet.java b/services/java/com/android/server/net/NetworkIdentitySet.java index af03fb3..397f9f4 100644 --- a/services/java/com/android/server/net/NetworkIdentitySet.java +++ b/services/java/com/android/server/net/NetworkIdentitySet.java @@ -21,7 +21,6 @@ import android.net.NetworkIdentity; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; -import java.net.ProtocolException; import java.util.HashSet; /** @@ -33,48 +32,46 @@ import java.util.HashSet; public class NetworkIdentitySet extends HashSet<NetworkIdentity> { private static final int VERSION_INIT = 1; private static final int VERSION_ADD_ROAMING = 2; + private static final int VERSION_ADD_NETWORK_ID = 3; public NetworkIdentitySet() { } public NetworkIdentitySet(DataInputStream in) throws IOException { final int version = in.readInt(); - switch (version) { - case VERSION_INIT: { - final int size = in.readInt(); - for (int i = 0; i < size; i++) { - final int ignoredVersion = in.readInt(); - final int type = in.readInt(); - final int subType = in.readInt(); - final String subscriberId = readOptionalString(in); - add(new NetworkIdentity(type, subType, subscriberId, false)); - } - break; + final int size = in.readInt(); + for (int i = 0; i < size; i++) { + if (version <= VERSION_INIT) { + final int ignored = in.readInt(); } - case VERSION_ADD_ROAMING: { - final int size = in.readInt(); - for (int i = 0; i < size; i++) { - final int type = in.readInt(); - final int subType = in.readInt(); - final String subscriberId = readOptionalString(in); - final boolean roaming = in.readBoolean(); - add(new NetworkIdentity(type, subType, subscriberId, roaming)); - } - break; + final int type = in.readInt(); + final int subType = in.readInt(); + final String subscriberId = readOptionalString(in); + final String networkId; + if (version >= VERSION_ADD_NETWORK_ID) { + networkId = readOptionalString(in); + } else { + networkId = null; } - default: { - throw new ProtocolException("unexpected version: " + version); + final boolean roaming; + if (version >= VERSION_ADD_ROAMING) { + roaming = in.readBoolean(); + } else { + roaming = false; } + + add(new NetworkIdentity(type, subType, subscriberId, networkId, false)); } } public void writeToStream(DataOutputStream out) throws IOException { - out.writeInt(VERSION_ADD_ROAMING); + out.writeInt(VERSION_ADD_NETWORK_ID); out.writeInt(size()); for (NetworkIdentity ident : this) { out.writeInt(ident.getType()); out.writeInt(ident.getSubType()); writeOptionalString(out, ident.getSubscriberId()); + writeOptionalString(out, ident.getNetworkId()); out.writeBoolean(ident.getRoaming()); } } diff --git a/services/java/com/android/server/net/NetworkPolicyManagerService.java b/services/java/com/android/server/net/NetworkPolicyManagerService.java index 1f1e720..fa62e49 100644 --- a/services/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/java/com/android/server/net/NetworkPolicyManagerService.java @@ -48,6 +48,7 @@ import static android.net.NetworkTemplate.MATCH_MOBILE_ALL; import static android.net.NetworkTemplate.MATCH_WIFI; import static android.net.NetworkTemplate.buildTemplateMobileAll; import static android.net.TrafficStats.MB_IN_BYTES; +import static android.telephony.TelephonyManager.SIM_STATE_READY; import static android.text.format.DateUtils.DAY_IN_MILLIS; import static com.android.internal.util.Preconditions.checkNotNull; import static com.android.server.NetworkManagementService.LIMIT_GLOBAL_ALERT; @@ -113,6 +114,7 @@ import android.util.Xml; import com.android.internal.R; import com.android.internal.os.AtomicFile; import com.android.internal.util.FastXmlSerializer; +import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.Objects; import com.google.android.collect.Lists; import com.google.android.collect.Maps; @@ -160,6 +162,8 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { 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; + private static final int VERSION_ADDED_NETWORK_ID = 9; + private static final int VERSION_LATEST = VERSION_ADDED_NETWORK_ID; // @VisibleForTesting public static final int TYPE_WARNING = 0x1; @@ -175,6 +179,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { private static final String ATTR_RESTRICT_BACKGROUND = "restrictBackground"; private static final String ATTR_NETWORK_TEMPLATE = "networkTemplate"; private static final String ATTR_SUBSCRIBER_ID = "subscriberId"; + private static final String ATTR_NETWORK_ID = "networkId"; private static final String ATTR_CYCLE_DAY = "cycleDay"; private static final String ATTR_CYCLE_TIMEZONE = "cycleTimezone"; private static final String ATTR_WARNING_BYTES = "warningBytes"; @@ -491,6 +496,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { for (NetworkPolicy policy : mNetworkPolicy.values()) { // ignore policies that aren't relevant to user if (!isTemplateRelevant(policy.template)) continue; + if (!policy.hasCycle()) continue; final long start = computeLastCycleBoundary(currentTime, policy); final long end = currentTime; @@ -528,21 +534,24 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { /** * Test if given {@link NetworkTemplate} is relevant to user based on - * current device state, such as when {@link #getActiveSubscriberId()} - * matches. This is regardless of data connection status. + * current device state, such as when + * {@link TelephonyManager#getSubscriberId()} matches. This is regardless of + * data connection status. */ private boolean isTemplateRelevant(NetworkTemplate template) { + final TelephonyManager tele = TelephonyManager.from(mContext); + switch (template.getMatchRule()) { case MATCH_MOBILE_3G_LOWER: case MATCH_MOBILE_4G: case MATCH_MOBILE_ALL: - // mobile templates aren't relevant in airplane mode - if (isAirplaneModeOn(mContext)) { + // mobile templates are relevant when SIM is ready and + // subscriberId matches. + if (tele.getSimState() == SIM_STATE_READY) { + return Objects.equal(tele.getSubscriberId(), template.getSubscriberId()); + } else { return false; } - - // mobile templates are relevant when subscriberid is active - return Objects.equal(getActiveSubscriberId(), template.getSubscriberId()); } return true; } @@ -761,7 +770,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { final long currentTime = currentTimeMillis(); for (NetworkPolicy policy : mNetworkPolicy.values()) { // shortcut when policy has no limit - if (policy.limitBytes == LIMIT_DISABLED) { + if (policy.limitBytes == LIMIT_DISABLED || !policy.hasCycle()) { setNetworkTemplateEnabled(policy.template, true); continue; } @@ -784,13 +793,16 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { * for the given {@link NetworkTemplate}. */ private void setNetworkTemplateEnabled(NetworkTemplate template, boolean enabled) { + final TelephonyManager tele = TelephonyManager.from(mContext); + switch (template.getMatchRule()) { case MATCH_MOBILE_3G_LOWER: case MATCH_MOBILE_4G: case MATCH_MOBILE_ALL: // TODO: offer more granular control over radio states once // 4965893 is available. - if (Objects.equal(getActiveSubscriberId(), template.getSubscriberId())) { + if (tele.getSimState() == SIM_STATE_READY + && Objects.equal(tele.getSubscriberId(), template.getSubscriberId())) { setPolicyDataEnable(TYPE_MOBILE, enabled); setPolicyDataEnable(TYPE_WIMAX, enabled); } @@ -863,9 +875,15 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { for (NetworkPolicy policy : mNetworkRules.keySet()) { final String[] ifaces = mNetworkRules.get(policy); - final long start = computeLastCycleBoundary(currentTime, policy); - final long end = currentTime; - final long totalBytes = getTotalBytes(policy.template, start, end); + final long start; + final long totalBytes; + if (policy.hasCycle()) { + start = computeLastCycleBoundary(currentTime, policy); + totalBytes = getTotalBytes(policy.template, start, currentTime); + } else { + start = Long.MAX_VALUE; + totalBytes = 0; + } if (LOGD) { Slog.d(TAG, "applying policy " + policy.toString() + " to ifaces " @@ -923,9 +941,14 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { if (LOGV) Slog.v(TAG, "ensureActiveMobilePolicyLocked()"); if (mSuppressDefaultPolicy) return; - final String subscriberId = getActiveSubscriberId(); + final TelephonyManager tele = TelephonyManager.from(mContext); + + // avoid creating policy when SIM isn't ready + if (tele.getSimState() != SIM_STATE_READY) return; + + final String subscriberId = tele.getSubscriberId(); final NetworkIdentity probeIdent = new NetworkIdentity( - TYPE_MOBILE, TelephonyManager.NETWORK_TYPE_UNKNOWN, subscriberId, false); + TYPE_MOBILE, TelephonyManager.NETWORK_TYPE_UNKNOWN, subscriberId, null, false); // examine to see if any policy is defined for active mobile boolean mobileDefined = false; @@ -986,6 +1009,12 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } else if (TAG_NETWORK_POLICY.equals(tag)) { final int networkTemplate = readIntAttribute(in, ATTR_NETWORK_TEMPLATE); final String subscriberId = in.getAttributeValue(null, ATTR_SUBSCRIBER_ID); + final String networkId; + if (version >= VERSION_ADDED_NETWORK_ID) { + networkId = in.getAttributeValue(null, ATTR_NETWORK_ID); + } else { + networkId = null; + } final int cycleDay = readIntAttribute(in, ATTR_CYCLE_DAY); final String cycleTimezone; if (version >= VERSION_ADDED_TIMEZONE) { @@ -1031,12 +1060,12 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } final NetworkTemplate template = new NetworkTemplate( - networkTemplate, subscriberId); + networkTemplate, subscriberId, networkId); mNetworkPolicy.put(template, new NetworkPolicy(template, cycleDay, cycleTimezone, warningBytes, limitBytes, lastWarningSnooze, lastLimitSnooze, metered, inferred)); - } else if (TAG_UID_POLICY.equals(tag)) { + } else if (TAG_UID_POLICY.equals(tag) && version < VERSION_SWITCH_APP_ID) { final int uid = readIntAttribute(in, ATTR_UID); final int policy = readIntAttribute(in, ATTR_POLICY); @@ -1046,7 +1075,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } else { Slog.w(TAG, "unable to apply policy to UID " + uid + "; ignoring"); } - } else if (TAG_APP_POLICY.equals(tag)) { + } else if (TAG_APP_POLICY.equals(tag) && version >= VERSION_SWITCH_APP_ID) { final int appId = readIntAttribute(in, ATTR_APP_ID); final int policy = readIntAttribute(in, ATTR_POLICY); @@ -1099,7 +1128,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { out.startDocument(null, true); out.startTag(null, TAG_POLICY_LIST); - writeIntAttribute(out, ATTR_VERSION, VERSION_SWITCH_APP_ID); + writeIntAttribute(out, ATTR_VERSION, VERSION_LATEST); writeBooleanAttribute(out, ATTR_RESTRICT_BACKGROUND, mRestrictBackground); // write all known network policies @@ -1112,6 +1141,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { if (subscriberId != null) { out.attribute(null, ATTR_SUBSCRIBER_ID, subscriberId); } + final String networkId = template.getNetworkId(); + if (networkId != null) { + out.attribute(null, ATTR_NETWORK_ID, networkId); + } writeIntAttribute(out, ATTR_CYCLE_DAY, policy.cycleDay); out.attribute(null, ATTR_CYCLE_TIMEZONE, policy.cycleTimezone); writeLongAttribute(out, ATTR_WARNING_BYTES, policy.warningBytes); @@ -1318,7 +1351,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { policy = findPolicyForNetworkLocked(ident); } - if (policy == null) { + if (policy == null || !policy.hasCycle()) { // missing policy means we can't derive useful quota info return null; } @@ -1340,9 +1373,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } @Override - protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) { + protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) { mContext.enforceCallingOrSelfPermission(DUMP, TAG); + final IndentingPrintWriter fout = new IndentingPrintWriter(writer, " "); + final HashSet<String> argSet = new HashSet<String>(); for (String arg : args) { argSet.add(arg); @@ -1365,31 +1400,36 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { fout.print("Restrict background: "); fout.println(mRestrictBackground); fout.println("Network policies:"); + fout.increaseIndent(); for (NetworkPolicy policy : mNetworkPolicy.values()) { - fout.print(" "); fout.println(policy.toString()); + fout.println(policy.toString()); } + fout.decreaseIndent(); fout.println("Policy for apps:"); + fout.increaseIndent(); 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(appId); fout.print(" policy="); dumpPolicy(fout, policy); fout.println(); } + fout.decreaseIndent(); final SparseBooleanArray knownUids = new SparseBooleanArray(); collectKeys(mUidForeground, knownUids); collectKeys(mUidRules, knownUids); fout.println("Status for known UIDs:"); + fout.increaseIndent(); size = knownUids.size(); for (int i = 0; i < size; i++) { final int uid = knownUids.keyAt(i); - fout.print(" UID="); + fout.print("UID="); fout.print(uid); fout.print(" foreground="); @@ -1410,6 +1450,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { fout.println(); } + fout.decreaseIndent(); } } @@ -1547,7 +1588,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } private Handler.Callback mHandlerCallback = new Handler.Callback() { - /** {@inheritDoc} */ + @Override public boolean handleMessage(Message msg) { switch (msg.what) { case MSG_RULES_CHANGED: { @@ -1697,15 +1738,9 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } } - private String getActiveSubscriberId() { - final TelephonyManager telephony = (TelephonyManager) mContext.getSystemService( - Context.TELEPHONY_SERVICE); - return telephony.getSubscriberId(); - } - private long getTotalBytes(NetworkTemplate template, long start, long end) { try { - return mNetworkStats.getSummaryForNetwork(template, start, end).getTotalBytes(); + return mNetworkStats.getNetworkTotalBytes(template, start, end); } catch (RuntimeException e) { Slog.w(TAG, "problem reading network stats: " + e); return 0; diff --git a/services/java/com/android/server/net/NetworkStatsCollection.java b/services/java/com/android/server/net/NetworkStatsCollection.java index 70038d9..2892a74 100644 --- a/services/java/com/android/server/net/NetworkStatsCollection.java +++ b/services/java/com/android/server/net/NetworkStatsCollection.java @@ -57,8 +57,6 @@ import libcore.io.IoUtils; * {@link NetworkIdentitySet}, UID, set, and tag. Knows how to persist itself. */ public class NetworkStatsCollection implements FileRotator.Reader { - private static final String TAG = "NetworkStatsCollection"; - /** File header magic number: "ANET" */ private static final int FILE_MAGIC = 0x414E4554; @@ -173,7 +171,7 @@ public class NetworkStatsCollection implements FileRotator.Reader { } /** - * Record given {@link NetworkStats.Entry} into this collection. + * Record given {@link android.net.NetworkStats.Entry} into this collection. */ public void recordData(NetworkIdentitySet ident, int uid, int set, int tag, long start, long end, NetworkStats.Entry entry) { @@ -227,7 +225,7 @@ public class NetworkStatsCollection implements FileRotator.Reader { } } - /** {@inheritDoc} */ + @Override public void read(InputStream in) throws IOException { read(new DataInputStream(in)); } @@ -502,7 +500,7 @@ public class NetworkStatsCollection implements FileRotator.Reader { return false; } - /** {@inheritDoc} */ + @Override public int compareTo(Key another) { return Integer.compare(uid, another.uid); } diff --git a/services/java/com/android/server/net/NetworkStatsRecorder.java b/services/java/com/android/server/net/NetworkStatsRecorder.java index 290bd2c..57ad158 100644 --- a/services/java/com/android/server/net/NetworkStatsRecorder.java +++ b/services/java/com/android/server/net/NetworkStatsRecorder.java @@ -221,6 +221,11 @@ public class NetworkStatsRecorder { if (mLastSnapshot != null) { mLastSnapshot = mLastSnapshot.withoutUid(uid); } + + final NetworkStatsCollection complete = mComplete != null ? mComplete.get() : null; + if (complete != null) { + complete.removeUid(uid); + } } /** @@ -235,22 +240,22 @@ public class NetworkStatsRecorder { mCollection = checkNotNull(collection, "missing NetworkStatsCollection"); } - /** {@inheritDoc} */ + @Override public void reset() { // ignored } - /** {@inheritDoc} */ + @Override public void read(InputStream in) throws IOException { mCollection.read(in); } - /** {@inheritDoc} */ + @Override public boolean shouldWrite() { return true; } - /** {@inheritDoc} */ + @Override public void write(OutputStream out) throws IOException { mCollection.write(new DataOutputStream(out)); mCollection.reset(); @@ -270,24 +275,24 @@ public class NetworkStatsRecorder { mUid = uid; } - /** {@inheritDoc} */ + @Override public void reset() { mTemp.reset(); } - /** {@inheritDoc} */ + @Override public void read(InputStream in) throws IOException { mTemp.read(in); mTemp.clearDirty(); mTemp.removeUid(mUid); } - /** {@inheritDoc} */ + @Override public boolean shouldWrite() { return mTemp.isDirty(); } - /** {@inheritDoc} */ + @Override public void write(OutputStream out) throws IOException { mTemp.write(new DataOutputStream(out)); } diff --git a/services/java/com/android/server/net/NetworkStatsService.java b/services/java/com/android/server/net/NetworkStatsService.java index 8796afc..4382a03 100644 --- a/services/java/com/android/server/net/NetworkStatsService.java +++ b/services/java/com/android/server/net/NetworkStatsService.java @@ -34,7 +34,7 @@ import static android.net.NetworkStats.SET_FOREGROUND; import static android.net.NetworkStats.TAG_NONE; import static android.net.NetworkStats.UID_ALL; import static android.net.NetworkTemplate.buildTemplateMobileAll; -import static android.net.NetworkTemplate.buildTemplateWifi; +import static android.net.NetworkTemplate.buildTemplateWifiWildcard; import static android.net.TrafficStats.MB_IN_BYTES; import static android.provider.Settings.Secure.NETSTATS_DEV_BUCKET_DURATION; import static android.provider.Settings.Secure.NETSTATS_DEV_DELETE_AGE; @@ -70,6 +70,7 @@ import android.content.IntentFilter; import android.net.IConnectivityManager; import android.net.INetworkManagementEventObserver; import android.net.INetworkStatsService; +import android.net.INetworkStatsSession; import android.net.LinkProperties; import android.net.NetworkIdentity; import android.net.NetworkInfo; @@ -412,40 +413,75 @@ public class NetworkStatsService extends INetworkStatsService.Stub { } @Override - public NetworkStatsHistory getHistoryForNetwork(NetworkTemplate template, int fields) { - return mDevStatsCached.getHistory(template, UID_ALL, SET_ALL, TAG_NONE, fields); - } + public INetworkStatsSession openSession() { + mContext.enforceCallingOrSelfPermission(READ_NETWORK_USAGE_HISTORY, TAG); - @Override - public NetworkStats getSummaryForNetwork(NetworkTemplate template, long start, long end) { - return mDevStatsCached.getSummary(template, start, end); - } + // return an IBinder which holds strong references to any loaded stats + // for its lifetime; when caller closes only weak references remain. - @Override - public NetworkStatsHistory getHistoryForUid( - NetworkTemplate template, int uid, int set, int tag, int fields) { - // TODO: transition to stats sessions to avoid WeakReferences - if (tag == TAG_NONE) { - return mUidRecorder.getOrLoadCompleteLocked().getHistory( - template, uid, set, tag, fields); - } else { - return mUidTagRecorder.getOrLoadCompleteLocked().getHistory( - template, uid, set, tag, fields); - } + return new INetworkStatsSession.Stub() { + private NetworkStatsCollection mUidComplete; + private NetworkStatsCollection mUidTagComplete; + + private NetworkStatsCollection getUidComplete() { + if (mUidComplete == null) { + mUidComplete = mUidRecorder.getOrLoadCompleteLocked(); + } + return mUidComplete; + } + + private NetworkStatsCollection getUidTagComplete() { + if (mUidTagComplete == null) { + mUidTagComplete = mUidTagRecorder.getOrLoadCompleteLocked(); + } + return mUidTagComplete; + } + + @Override + public NetworkStats getSummaryForNetwork( + NetworkTemplate template, long start, long end) { + return mDevStatsCached.getSummary(template, start, end); + } + + @Override + public NetworkStatsHistory getHistoryForNetwork(NetworkTemplate template, int fields) { + return mDevStatsCached.getHistory(template, UID_ALL, SET_ALL, TAG_NONE, fields); + } + + @Override + public NetworkStats getSummaryForAllUid( + NetworkTemplate template, long start, long end, boolean includeTags) { + final NetworkStats stats = getUidComplete().getSummary(template, start, end); + if (includeTags) { + final NetworkStats tagStats = getUidTagComplete() + .getSummary(template, start, end); + stats.combineAllValues(tagStats); + } + return stats; + } + + @Override + public NetworkStatsHistory getHistoryForUid( + NetworkTemplate template, int uid, int set, int tag, int fields) { + if (tag == TAG_NONE) { + return getUidComplete().getHistory(template, uid, set, tag, fields); + } else { + return getUidTagComplete().getHistory(template, uid, set, tag, fields); + } + } + + @Override + public void close() { + mUidComplete = null; + mUidTagComplete = null; + } + }; } @Override - public NetworkStats getSummaryForAllUid( - NetworkTemplate template, long start, long end, boolean includeTags) { - // TODO: transition to stats sessions to avoid WeakReferences - final NetworkStats stats = mUidRecorder.getOrLoadCompleteLocked().getSummary( - template, start, end); - if (includeTags) { - final NetworkStats tagStats = mUidTagRecorder.getOrLoadCompleteLocked().getSummary( - template, start, end); - stats.combineAllValues(tagStats); - } - return stats; + public long getNetworkTotalBytes(NetworkTemplate template, long start, long end) { + mContext.enforceCallingOrSelfPermission(READ_NETWORK_USAGE_HISTORY, TAG); + return mDevStatsCached.getSummary(template, start, end).getTotalBytes(); } @Override @@ -464,6 +500,9 @@ public class NetworkStatsService extends INetworkStatsService.Stub { Binder.restoreCallingIdentity(token); } + // splice in operation counts + networkLayer.spliceOperationsFrom(mUidOperations); + final NetworkStats dataLayer = new NetworkStats( networkLayer.getElapsedRealtime(), networkLayer.size()); @@ -474,8 +513,6 @@ public class NetworkStatsService extends INetworkStatsService.Stub { dataLayer.combineValues(entry); } - // splice in operation counts - dataLayer.spliceOperationsFrom(mUidOperations); return dataLayer; } @@ -836,7 +873,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { trustedTime); // collect wifi sample - template = buildTemplateWifi(); + template = buildTemplateWifiWildcard(); devTotal = mDevRecorder.getTotalSinceBootLocked(template); xtTotal = new NetworkStats.Entry(); uidTotal = mUidRecorder.getTotalSinceBootLocked(template); @@ -962,7 +999,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { } private Handler.Callback mHandlerCallback = new Handler.Callback() { - /** {@inheritDoc} */ + @Override public boolean handleMessage(Message msg) { switch (msg.what) { case MSG_PERFORM_POLL: { @@ -1001,7 +1038,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { } private class DropBoxNonMonotonicObserver implements NonMonotonicObserver<String> { - /** {@inheritDoc} */ + @Override public void foundNonMonotonic(NetworkStats left, int leftIndex, NetworkStats right, int rightIndex, String cookie) { Log.w(TAG, "found non-monotonic values; saving to dropbox"); @@ -1020,7 +1057,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub { } /** - * Default external settings that read from {@link Settings.Secure}. + * Default external settings that read from + * {@link android.provider.Settings.Secure}. */ private static class DefaultNetworkStatsSettings implements NetworkStatsSettings { private final ContentResolver mResolver; @@ -1038,19 +1076,24 @@ public class NetworkStatsService extends INetworkStatsService.Stub { return Settings.Secure.getInt(mResolver, name, defInt) != 0; } + @Override public long getPollInterval() { return getSecureLong(NETSTATS_POLL_INTERVAL, 30 * MINUTE_IN_MILLIS); } + @Override public long getTimeCacheMaxAge() { return getSecureLong(NETSTATS_TIME_CACHE_MAX_AGE, DAY_IN_MILLIS); } + @Override public long getGlobalAlertBytes() { return getSecureLong(NETSTATS_GLOBAL_ALERT_BYTES, 2 * MB_IN_BYTES); } + @Override public boolean getSampleEnabled() { return getSecureBoolean(NETSTATS_SAMPLE_ENABLED, true); } + @Override public Config getDevConfig() { return new Config(getSecureLong(NETSTATS_DEV_BUCKET_DURATION, HOUR_IN_MILLIS), getSecureLong(NETSTATS_DEV_PERSIST_BYTES, 2 * MB_IN_BYTES), @@ -1058,6 +1101,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { getSecureLong(NETSTATS_DEV_DELETE_AGE, 90 * DAY_IN_MILLIS)); } + @Override public Config getUidConfig() { return new Config(getSecureLong(NETSTATS_UID_BUCKET_DURATION, 2 * HOUR_IN_MILLIS), getSecureLong(NETSTATS_UID_PERSIST_BYTES, 2 * MB_IN_BYTES), @@ -1065,6 +1109,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { getSecureLong(NETSTATS_UID_DELETE_AGE, 90 * DAY_IN_MILLIS)); } + @Override public Config getUidTagConfig() { return new Config(getSecureLong(NETSTATS_UID_BUCKET_DURATION, 2 * HOUR_IN_MILLIS), getSecureLong(NETSTATS_UID_PERSIST_BYTES, 2 * MB_IN_BYTES), diff --git a/services/java/com/android/server/usb/UsbDeviceManager.java b/services/java/com/android/server/usb/UsbDeviceManager.java index 4bea5e4..1bd15f6 100644 --- a/services/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/java/com/android/server/usb/UsbDeviceManager.java @@ -60,6 +60,7 @@ import java.util.LinkedList; import java.util.List; import java.util.HashMap; import java.util.Map; +import java.util.Scanner; /** * UsbDeviceManager manages USB state in device mode. @@ -81,6 +82,8 @@ public class UsbDeviceManager { "/sys/class/android_usb/android0/f_mass_storage/lun/file"; private static final String RNDIS_ETH_ADDR_PATH = "/sys/class/android_usb/android0/f_rndis/ethaddr"; + private static final String AUDIO_SOURCE_PCM_PATH = + "/sys/class/android_usb/android0/f_audio_source/pcm"; private static final int MSG_UPDATE_STATE = 0; private static final int MSG_ENABLE_ADB = 1; @@ -105,6 +108,7 @@ public class UsbDeviceManager { private final boolean mHasUsbAccessory; private boolean mUseUsbNotification; private boolean mAdbEnabled; + private boolean mAudioSourceEnabled; private Map<String, List<Pair<String, String>>> mOemModeMap; private class AdbSettingsObserver extends ContentObserver { @@ -291,6 +295,8 @@ public class UsbDeviceManager { String state = FileUtils.readTextFile(new File(STATE_PATH), 0, null).trim(); updateState(state); mAdbEnabled = containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_ADB); + mAudioSourceEnabled = containsFunction(mCurrentFunctions, + UsbManager.USB_FUNCTION_AUDIO_SOURCE); // Upgrade step for previous versions that used persist.service.adb.enable String value = SystemProperties.get("persist.service.adb.enable", ""); @@ -504,6 +510,28 @@ public class UsbDeviceManager { mContext.sendStickyBroadcast(intent); } + private void updateAudioSourceFunction(boolean enabled) { + // send a sticky broadcast containing current USB state + Intent intent = new Intent(Intent.ACTION_USB_AUDIO_ACCESSORY_PLUG); + intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); + intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); + intent.putExtra("state", (enabled ? 1 : 0)); + if (enabled) { + try { + Scanner scanner = new Scanner(new File(AUDIO_SOURCE_PCM_PATH)); + int card = scanner.nextInt(); + int device = scanner.nextInt(); + intent.putExtra("card", card); + intent.putExtra("device", device); + } catch (FileNotFoundException e) { + Slog.e(TAG, "could not open audio source PCM file", e); + } + } + + mContext.sendStickyBroadcast(intent); + mAudioSourceEnabled = enabled; + } + @Override public void handleMessage(Message msg) { switch (msg.what) { @@ -523,6 +551,11 @@ public class UsbDeviceManager { } if (mBootCompleted) { updateUsbState(); + boolean audioSourceEnabled = containsFunction(mCurrentFunctions, + UsbManager.USB_FUNCTION_AUDIO_SOURCE); + if (audioSourceEnabled != mAudioSourceEnabled) { + updateAudioSourceFunction(audioSourceEnabled); + } } break; case MSG_ENABLE_ADB: @@ -543,6 +576,7 @@ public class UsbDeviceManager { if (mCurrentAccessory != null) { mSettingsManager.accessoryAttached(mCurrentAccessory); } + updateAudioSourceFunction(mAudioSourceEnabled); break; } } diff --git a/services/java/com/android/server/wm/AppWindowAnimator.java b/services/java/com/android/server/wm/AppWindowAnimator.java new file mode 100644 index 0000000..c3b5465 --- /dev/null +++ b/services/java/com/android/server/wm/AppWindowAnimator.java @@ -0,0 +1,301 @@ +// Copyright 2012 Google Inc. All Rights Reserved. + +package com.android.server.wm; + +import android.graphics.Matrix; +import android.util.Slog; +import android.view.Surface; +import android.view.WindowManagerPolicy; +import android.view.animation.Animation; +import android.view.animation.Transformation; + +import java.io.PrintWriter; + +/** + * + */ +public class AppWindowAnimator { + + final AppWindowToken mAppToken; + final WindowManagerService mService; + final WindowAnimator mAnimator; + + boolean animating; + Animation animation; + boolean animInitialized; + boolean hasTransformation; + final Transformation transformation = new Transformation(); + + // Have we been asked to have this token keep the screen frozen? + // Protect with mAnimator. + boolean freezingScreen; + + // Offset to the window of all layers in the token, for use by + // AppWindowToken animations. + int animLayerAdjustment; + + // Special surface for thumbnail animation. + Surface thumbnail; + int thumbnailTransactionSeq; + int thumbnailX; + int thumbnailY; + int thumbnailLayer; + Animation thumbnailAnimation; + final Transformation thumbnailTransformation = new Transformation(); + + public AppWindowAnimator(final WindowManagerService service, final AppWindowToken atoken) { + mService = service; + mAppToken = atoken; + mAnimator = service.mAnimator; + } + + 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(mService.mTransitionAnimationScale); + int zorder = anim.getZAdjustment(); + int adj = 0; + if (zorder == Animation.ZORDER_TOP) { + adj = WindowManagerService.TYPE_LAYER_OFFSET; + } else if (zorder == Animation.ZORDER_BOTTOM) { + adj = -WindowManagerService.TYPE_LAYER_OFFSET; + } + + if (animLayerAdjustment != adj) { + animLayerAdjustment = adj; + updateLayers(); + } + // Start out animation gone if window is gone, or visible if window is visible. + transformation.clear(); + transformation.setAlpha(mAppToken.reportedVisible ? 1 : 0); + hasTransformation = true; + } + + public void setDummyAnimation() { + if (animation == null) { + if (WindowManagerService.localLOGV) Slog.v( + WindowManagerService.TAG, "Setting dummy animation in " + this); + animation = WindowManagerService.sDummyAnimation; + animInitialized = false; + } + } + + public void clearAnimation() { + 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 = mAppToken.allAppWindows.size(); + final int adj = animLayerAdjustment; + thumbnailLayer = -1; + for (int i=0; i<N; i++) { + final WindowState w = mAppToken.allAppWindows.get(i); + final WindowStateAnimator winAnimator = w.mWinAnimator; + winAnimator.mAnimLayer = w.mLayer + adj; + if (winAnimator.mAnimLayer > thumbnailLayer) { + thumbnailLayer = winAnimator.mAnimLayer; + } + if (WindowManagerService.DEBUG_LAYERS) Slog.v(WindowManagerService.TAG, "Updating layer " + w + ": " + + winAnimator.mAnimLayer); + if (w == mService.mInputMethodTarget && !mService.mInputMethodTargetWaitingAnim) { + mService.setInputMethodAnimLayerAdjustment(adj); + } + if (w == mService.mWallpaperTarget && mService.mLowerWallpaperTarget == null) { + mService.setWallpaperAnimLayerAdjustmentLocked(adj); + } + } + } + + private void stepThumbnailAnimation(long currentTime) { + thumbnailTransformation.clear(); + thumbnailAnimation.getTransformation(currentTime, thumbnailTransformation); + thumbnailTransformation.getMatrix().preTranslate(thumbnailX, thumbnailY); + final boolean screenAnimation = mAnimator.mScreenRotationAnimation != null + && mAnimator.mScreenRotationAnimation.isAnimating(); + if (screenAnimation) { + thumbnailTransformation.postCompose( + mAnimator.mScreenRotationAnimation.getEnterTransformation()); + } + // cache often used attributes locally + final float tmpFloats[] = mService.mTmpFloats; + thumbnailTransformation.getMatrix().getValues(tmpFloats); + if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.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) WindowManagerService.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; + } + transformation.clear(); + final boolean more = animation.getTransformation(currentTime, transformation); + if (WindowManagerService.DEBUG_ANIM) Slog.v( + WindowManagerService.TAG, "Stepped animation in " + this + + ": more=" + more + ", xform=" + transformation); + if (!more) { + animation = null; + clearThumbnail(); + if (WindowManagerService.DEBUG_ANIM) Slog.v( + WindowManagerService.TAG, "Finished animation in " + this + + " @ " + currentTime); + } + hasTransformation = more; + return more; + } + + // This must be called while inside a transaction. + boolean stepAnimationLocked(long currentTime, int dw, int dh) { + if (mService.okToDisplay()) { + // We will run animations as long as the display isn't frozen. + + if (animation == WindowManagerService.sDummyAnimation) { + // This guy is going to animate, but not yet. For now count + // it as not animating for purposes of scheduling transactions; + // when it is really time to animate, this will be set to + // a real animation and the next call will execute normally. + return false; + } + + if ((mAppToken.allDrawn || animating || mAppToken.startingDisplayed) + && animation != null) { + if (!animating) { + if (WindowManagerService.DEBUG_ANIM) Slog.v( + WindowManagerService.TAG, "Starting animation in " + this + + " @ " + currentTime + ": dw=" + dw + " dh=" + dh + + " scale=" + mService.mTransitionAnimationScale + + " allDrawn=" + mAppToken.allDrawn + " animating=" + animating); + if (!animInitialized) { + animation.initialize(dw, dh, dw, dh); + } + animation.setStartTime(currentTime); + animating = true; + if (thumbnail != null) { + thumbnail.show(); + thumbnailAnimation.setStartTime(currentTime); + } + } + 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, + // clear it and make sure we run the cleanup code. + animating = true; + animation = null; + } + + hasTransformation = false; + + if (!animating && animation == null) { + return false; + } + + mAnimator.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM; + if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { + mService.debugLayoutRepeats("AppWindowToken", mAnimator.mPendingLayoutChanges); + } + + clearAnimation(); + animating = false; + if (animLayerAdjustment != 0) { + animLayerAdjustment = 0; + updateLayers(); + } + if (mService.mInputMethodTarget != null + && mService.mInputMethodTarget.mAppToken == mAppToken) { + mService.moveInputMethodWindowsIfNeededLocked(true); + } + + if (WindowManagerService.DEBUG_ANIM) Slog.v( + WindowManagerService.TAG, "Animation done in " + this + + ": reportedVisible=" + mAppToken.reportedVisible); + + transformation.clear(); + + final int N = mAppToken.windows.size(); + for (int i=0; i<N; i++) { + mAppToken.windows.get(i).mWinAnimator.finishExit(); + } + mAppToken.updateReportedVisibilityLocked(); + + return false; + } + + boolean showAllWindowsLocked() { + boolean isAnimating = false; + final int NW = mAppToken.allAppWindows.size(); + for (int i=0; i<NW; i++) { + WindowStateAnimator winAnimator = mAppToken.allAppWindows.get(i).mWinAnimator; + if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG, + "performing show on: " + winAnimator); + winAnimator.performShowLocked(); + isAnimating |= winAnimator.isAnimating(); + } + return isAnimating; + } + + void dump(PrintWriter pw, String prefix) { + if (freezingScreen) { + pw.print(prefix); pw.print(" freezingScreen="); pw.println(freezingScreen); + } + if (animating || animation != null) { + pw.print(prefix); pw.print("animating="); pw.print(animating); + pw.print(" animation="); pw.println(animation); + } + if (hasTransformation) { + pw.print(prefix); pw.print("XForm: "); + transformation.printShortString(pw); + pw.println(); + } + if (animLayerAdjustment != 0) { + pw.print(prefix); pw.print("animLayerAdjustment="); pw.println(animLayerAdjustment); + } + 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()); + } + } +} diff --git a/services/java/com/android/server/wm/AppWindowToken.java b/services/java/com/android/server/wm/AppWindowToken.java index 3069b74..bf35154 100644 --- a/services/java/com/android/server/wm/AppWindowToken.java +++ b/services/java/com/android/server/wm/AppWindowToken.java @@ -18,20 +18,16 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; +import com.android.server.input.InputApplicationHandle; 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; import java.io.PrintWriter; import java.util.ArrayList; @@ -47,6 +43,9 @@ class AppWindowToken extends WindowToken { // All of the windows and child windows that are included in this // application token. Note this list is NOT sorted! final ArrayList<WindowState> allAppWindows = new ArrayList<WindowState>(); + final AppWindowAnimator mAppAnimator; + + final WindowAnimator mAnimator; int groupId = -1; boolean appFullscreen; @@ -87,19 +86,6 @@ class AppWindowToken extends WindowToken { // Set to true when the token has been removed from the window mgr. boolean removed; - // Have we been asked to have this token keep the screen frozen? - boolean freezingScreen; - - boolean animating; - Animation animation; - boolean animInitialized; - boolean hasTransformation; - final Transformation transformation = new Transformation(); - - // Offset to the window of all layers in the token, for use by - // AppWindowToken animations. - int animLayerAdjustment; - // Information about an application starting window if displayed. StartingData startingData; WindowState startingWindow; @@ -108,15 +94,6 @@ class AppWindowToken extends WindowToken { 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; @@ -126,79 +103,8 @@ class AppWindowToken extends WindowToken { appWindowToken = this; appToken = _token; mInputApplicationHandle = new InputApplicationHandle(this); - } - - 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(); - int adj = 0; - if (zorder == Animation.ZORDER_TOP) { - adj = WindowManagerService.TYPE_LAYER_OFFSET; - } else if (zorder == Animation.ZORDER_BOTTOM) { - adj = -WindowManagerService.TYPE_LAYER_OFFSET; - } - - if (animLayerAdjustment != adj) { - 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() { - if (animation == null) { - if (WindowManagerService.localLOGV) Slog.v( - WindowManagerService.TAG, "Setting dummy animation in " + this); - animation = WindowManagerService.sDummyAnimation; - animInitialized = false; - } - } - - public void clearAnimation() { - 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++) { - final WindowState w = allAppWindows.get(i); - final WindowStateAnimator winAnimator = w.mWinAnimator; - winAnimator.mAnimLayer = w.mLayer + adj; - if (winAnimator.mAnimLayer > thumbnailLayer) { - thumbnailLayer = winAnimator.mAnimLayer; - } - if (WindowManagerService.DEBUG_LAYERS) Slog.v(WindowManagerService.TAG, "Updating layer " + w + ": " - + winAnimator.mAnimLayer); - if (w == service.mInputMethodTarget && !service.mInputMethodTargetWaitingAnim) { - service.setInputMethodAnimLayerAdjustment(adj); - } - if (w == service.mWallpaperTarget && service.mLowerWallpaperTarget == null) { - service.setWallpaperAnimLayerAdjustmentLocked(adj); - } - } + mAnimator = service.mAnimator; + mAppAnimator = new AppWindowAnimator(_service, this); } void sendAppVisibilityToClients() { @@ -218,154 +124,6 @@ class AppWindowToken extends WindowToken { } } - boolean showAllWindowsLocked() { - boolean isAnimating = false; - final int NW = allAppWindows.size(); - for (int i=0; i<NW; i++) { - WindowStateAnimator winAnimator = allAppWindows.get(i).mWinAnimator; - if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(WindowManagerService.TAG, - "performing show on: " + winAnimator); - winAnimator.performShowLocked(); - isAnimating |= winAnimator.isAnimating(); - } - return isAnimating; - } - - 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) WindowManagerService.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) WindowManagerService.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; - } - transformation.clear(); - final boolean more = animation.getTransformation(currentTime, transformation); - if (WindowManagerService.DEBUG_ANIM) Slog.v( - WindowManagerService.TAG, "Stepped animation in " + this + - ": more=" + more + ", xform=" + transformation); - if (!more) { - animation = null; - clearThumbnail(); - if (WindowManagerService.DEBUG_ANIM) Slog.v( - WindowManagerService.TAG, "Finished animation in " + this + - " @ " + currentTime); - } - hasTransformation = more; - return more; - } - - // This must be called while inside a transaction. - 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) { - // This guy is going to animate, but not yet. For now count - // it as not animating for purposes of scheduling transactions; - // when it is really time to animate, this will be set to - // a real animation and the next call will execute normally. - return false; - } - - if ((allDrawn || animating || startingDisplayed) && animation != null) { - if (!animating) { - if (WindowManagerService.DEBUG_ANIM) Slog.v( - WindowManagerService.TAG, "Starting animation in " + this + - " @ " + currentTime + ": dw=" + dw + " dh=" + dh - + " scale=" + service.mTransitionAnimationScale - + " allDrawn=" + allDrawn + " animating=" + animating); - if (!animInitialized) { - animation.initialize(dw, dh, dw, dh); - } - animation.setStartTime(currentTime); - animating = true; - if (thumbnail != null) { - thumbnail.show(); - thumbnailAnimation.setStartTime(currentTime); - } - } - 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, - // clear it and make sure we run the cleanup code. - animating = true; - animation = null; - } - - hasTransformation = false; - - if (!animating) { - return false; - } - - service.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM; - if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { - service.debugLayoutRepeats("AppWindowToken"); - } - - clearAnimation(); - animating = false; - if (animLayerAdjustment != 0) { - animLayerAdjustment = 0; - updateLayers(); - } - if (service.mInputMethodTarget != null && service.mInputMethodTarget.mAppToken == this) { - service.moveInputMethodWindowsIfNeededLocked(true); - } - - if (WindowManagerService.DEBUG_ANIM) Slog.v( - WindowManagerService.TAG, "Animation done in " + this - + ": reportedVisible=" + reportedVisible); - - transformation.clear(); - - final int N = windows.size(); - for (int i=0; i<N; i++) { - windows.get(i).mWinAnimator.finishExit(); - } - updateReportedVisibilityLocked(); - - return false; - } - void updateReportedVisibilityLocked() { if (appToken == null) { return; @@ -479,9 +237,8 @@ class AppWindowToken extends WindowToken { pw.print(" willBeHidden="); pw.print(willBeHidden); pw.print(" reportedDrawn="); pw.print(reportedDrawn); pw.print(" reportedVisible="); pw.println(reportedVisible); - if (paused || freezingScreen) { - pw.print(prefix); pw.print("paused="); pw.print(paused); - pw.print(" freezingScreen="); pw.println(freezingScreen); + if (paused) { + pw.print(prefix); pw.print("paused="); pw.println(paused); } if (numInterestingWindows != 0 || numDrawnWindows != 0 || inPendingTransaction || allDrawn) { @@ -491,18 +248,6 @@ class AppWindowToken extends WindowToken { pw.print(" inPendingTransaction="); pw.print(inPendingTransaction); pw.print(" allDrawn="); pw.println(allDrawn); } - if (animating || animation != null) { - pw.print(prefix); pw.print("animating="); pw.print(animating); - pw.print(" animation="); pw.println(animation); - } - if (hasTransformation) { - pw.print(prefix); pw.print("XForm: "); - transformation.printShortString(pw); - pw.println(); - } - if (animLayerAdjustment != 0) { - pw.print(prefix); pw.print("animLayerAdjustment="); pw.println(animLayerAdjustment); - } if (startingData != null || removed || firstWindowDrawn) { pw.print(prefix); pw.print("startingData="); pw.print(startingData); pw.print(" removed="); pw.print(removed); @@ -515,15 +260,6 @@ class AppWindowToken extends WindowToken { 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 @@ -537,4 +273,4 @@ class AppWindowToken extends WindowToken { } return stringName; } -}
\ No newline at end of file +} diff --git a/services/java/com/android/server/wm/DimAnimator.java b/services/java/com/android/server/wm/DimAnimator.java index 0051d98..b08c864 100644 --- a/services/java/com/android/server/wm/DimAnimator.java +++ b/services/java/com/android/server/wm/DimAnimator.java @@ -41,14 +41,14 @@ class DimAnimator { DimAnimator (SurfaceSession session) { if (mDimSurface == null) { - if (WindowManagerService.SHOW_TRANSACTIONS || - WindowManagerService.SHOW_SURFACE_ALLOC) Slog.i(WindowManagerService.TAG, - " DIM " + mDimSurface + ": CREATE"); try { mDimSurface = new Surface(session, 0, "DimAnimator", -1, 16, 16, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM); + if (WindowManagerService.SHOW_TRANSACTIONS || + WindowManagerService.SHOW_SURFACE_ALLOC) Slog.i(WindowManagerService.TAG, + " DIM " + mDimSurface + ": CREATE"); mDimSurface.setAlpha(0.0f); } catch (Exception e) { Slog.e(WindowManagerService.TAG, "Exception creating Dim surface", e); @@ -57,12 +57,17 @@ class DimAnimator { } /** - * Show the dim surface. + * Set's the dim surface's layer and update dim parameters that will be used in + * {@link #updateSurface} after all windows are examined. */ - void show(int dw, int dh) { + void updateParameters(final Resources res, final Parameters params, final long currentTime) { + final int dw = params.mDimWidth; + final int dh = params.mDimHeight; + final WindowStateAnimator winAnimator = params.mDimWinAnimator; + final float target = params.mDimTarget; if (!mDimShown) { - if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, " DIM " + mDimSurface + ": SHOW pos=(0,0) (" + - dw + "x" + dh + ")"); + if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, + " DIM " + mDimSurface + ": SHOW pos=(0,0) (" + dw + "x" + dh + ")"); mDimShown = true; try { mLastDimWidth = dw; @@ -78,17 +83,9 @@ class DimAnimator { mLastDimHeight = dh; mDimSurface.setSize(dw, dh); } - } - /** - * Set's the dim surface's layer and update dim parameters that will be used in - * {@link #updateSurface} after all windows are examined. - */ - void updateParameters(Resources res, WindowState w, long currentTime) { - final WindowStateAnimator winAnimator = w.mWinAnimator; mDimSurface.setLayer(winAnimator.mAnimLayer - WindowManagerService.LAYER_OFFSET_DIM); - final float target = w.mExiting ? 0 : w.mAttrs.dimAmount; if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, " DIM " + mDimSurface + ": layer=" + (winAnimator.mAnimLayer-1) + " target=" + target); if (mDimTargetAlpha != target) { @@ -189,4 +186,18 @@ class DimAnimator { pw.print(" delta="); pw.print(mDimDeltaPerMs); pw.print(" lastAnimTime="); pw.println(mLastDimAnimTime); } + + static class Parameters { + final WindowStateAnimator mDimWinAnimator; + final int mDimWidth; + final int mDimHeight; + final float mDimTarget; + Parameters(final WindowStateAnimator dimWinAnimator, final int dimWidth, + final int dimHeight, final float dimTarget) { + mDimWinAnimator = dimWinAnimator; + mDimWidth = dimWidth; + mDimHeight = dimHeight; + mDimTarget = dimTarget; + } + } }
\ No newline at end of file diff --git a/services/java/com/android/server/wm/DimSurface.java b/services/java/com/android/server/wm/DimSurface.java index dc6cc0d..c1dbb36 100644 --- a/services/java/com/android/server/wm/DimSurface.java +++ b/services/java/com/android/server/wm/DimSurface.java @@ -32,14 +32,14 @@ class DimSurface { DimSurface(SurfaceSession session) { if (mDimSurface == null) { - if (WindowManagerService.SHOW_TRANSACTIONS || - WindowManagerService.SHOW_SURFACE_ALLOC) Slog.i(WindowManagerService.TAG, - " DIM " + mDimSurface + ": CREATE"); try { mDimSurface = new Surface(session, 0, "DimSurface", -1, 16, 16, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM); + if (WindowManagerService.SHOW_TRANSACTIONS || + WindowManagerService.SHOW_SURFACE_ALLOC) Slog.i(WindowManagerService.TAG, + " DIM " + mDimSurface + ": CREATE"); mDimSurface.setAlpha(0.0f); } catch (Exception e) { Slog.e(WindowManagerService.TAG, "Exception creating Dim surface", e); diff --git a/services/java/com/android/server/wm/DragState.java b/services/java/com/android/server/wm/DragState.java index a19035a..b2cf3e0 100644 --- a/services/java/com/android/server/wm/DragState.java +++ b/services/java/com/android/server/wm/DragState.java @@ -16,6 +16,8 @@ package com.android.server.wm; +import com.android.server.input.InputApplicationHandle; +import com.android.server.input.InputWindowHandle; import com.android.server.wm.WindowManagerService.DragInputEventReceiver; import com.android.server.wm.WindowManagerService.H; diff --git a/services/java/com/android/server/wm/FakeWindowImpl.java b/services/java/com/android/server/wm/FakeWindowImpl.java index 121ce18..2527f46 100644 --- a/services/java/com/android/server/wm/FakeWindowImpl.java +++ b/services/java/com/android/server/wm/FakeWindowImpl.java @@ -16,6 +16,9 @@ package com.android.server.wm; +import com.android.server.input.InputApplicationHandle; +import com.android.server.input.InputWindowHandle; + import android.os.Looper; import android.os.Process; import android.util.Slog; diff --git a/services/java/com/android/server/wm/InputMonitor.java b/services/java/com/android/server/wm/InputMonitor.java index fb74d27..c28cfa2 100644 --- a/services/java/com/android/server/wm/InputMonitor.java +++ b/services/java/com/android/server/wm/InputMonitor.java @@ -16,6 +16,10 @@ package com.android.server.wm; +import com.android.server.input.InputManagerService; +import com.android.server.input.InputApplicationHandle; +import com.android.server.input.InputWindowHandle; + import android.graphics.Rect; import android.os.RemoteException; import android.util.Log; @@ -27,7 +31,7 @@ import android.view.WindowManager; import java.util.ArrayList; import java.util.Arrays; -final class InputMonitor { +final class InputMonitor implements InputManagerService.Callbacks { private final WindowManagerService mService; // Current window with input focus for keys and other non-touch events. May be null. @@ -93,7 +97,7 @@ final class InputMonitor { } if (appWindowToken == null && inputApplicationHandle != null) { - appWindowToken = inputApplicationHandle.appWindowToken; + appWindowToken = (AppWindowToken)inputApplicationHandle.appWindowToken; if (appWindowToken != null) { Slog.i(WindowManagerService.TAG, "Input event dispatching timed out sending to application " @@ -301,7 +305,14 @@ final class InputMonitor { WindowState windowState = focus != null ? (WindowState) focus.windowState : null; return mService.mPolicy.dispatchUnhandledKey(windowState, event, policyFlags); } - + + /* Callback to get pointer layer. */ + public int getPointerLayer() { + return mService.mPolicy.windowTypeToLayerLw(WindowManager.LayoutParams.TYPE_POINTER) + * WindowManagerService.TYPE_LAYER_MULTIPLIER + + WindowManagerService.TYPE_LAYER_OFFSET; + } + /* Called when the current input focus changes. * Layer assignment is assumed to be complete by the time this is called. */ diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java index 5a104b2..0d64b68 100644 --- a/services/java/com/android/server/wm/WindowAnimator.java +++ b/services/java/com/android/server/wm/WindowAnimator.java @@ -6,6 +6,9 @@ import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static com.android.server.wm.WindowManagerService.LayoutFields.SET_UPDATE_ROTATION; import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_MAY_CHANGE; +import static com.android.server.wm.WindowManagerService.LayoutFields.SET_FORCE_HIDING_CHANGED; + +import static com.android.server.wm.WindowManagerService.H.SET_DIM_PARAMETERS; import android.content.Context; import android.os.SystemClock; @@ -19,9 +22,9 @@ import android.view.animation.Animation; import com.android.internal.policy.impl.PhoneWindowManager; import java.io.PrintWriter; +import java.util.HashSet; /** - * @author cmautner@google.com (Craig Mautner) * Singleton class that carries out the animations and Surface operations in a separate task * on behalf of WindowManagerService. */ @@ -32,6 +35,9 @@ public class WindowAnimator { final Context mContext; final WindowManagerPolicy mPolicy; + HashSet<WindowStateAnimator> mWinAnimators = new HashSet<WindowStateAnimator>(); + HashSet<WindowStateAnimator> mFinished = new HashSet<WindowStateAnimator>(); + boolean mAnimating; boolean mTokenMayBeDrawn; boolean mForceHiding; @@ -67,6 +73,9 @@ public class WindowAnimator { int mBulkUpdateParams = 0; + DimAnimator mDimAnimator = null; + DimAnimator.Parameters mDimParams = null; + WindowAnimator(final WindowManagerService service, final Context context, final WindowManagerPolicy policy) { mService = service; @@ -91,7 +100,8 @@ public class WindowAnimator { if (mService.mWallpaperTarget == target || mService.mLowerWallpaperTarget == target || mService.mUpperWallpaperTarget == target) { - for (int i=0; i<mService.mWindows.size(); i++) { + final int N = mService.mWindows.size(); + for (int i = 0; i < N; i++) { WindowState w = mService.mWindows.get(i); if (w.mIsWallpaper) { target = w; @@ -116,32 +126,34 @@ public class WindowAnimator { 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)) { + final AppWindowAnimator appAnimator = mService.mAppTokens.get(i).mAppAnimator; + final boolean wasAnimating = appAnimator.animation != null + && appAnimator.animation != WindowManagerService.sDummyAnimation; + if (appAnimator.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"); + mService.debugLayoutRepeats("appToken " + appAnimator.mAppToken + " done", + mPendingLayoutChanges); } } } 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)) { + final AppWindowAnimator appAnimator = mService.mExitingAppTokens.get(i).mAppAnimator; + final boolean wasAnimating = appAnimator.animation != null + && appAnimator.animation != WindowManagerService.sDummyAnimation; + if (appAnimator.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"); + mService.debugLayoutRepeats("exiting appToken " + appAnimator.mAppToken + + " done", mPendingLayoutChanges); } } } @@ -163,16 +175,16 @@ public class WindowAnimator { ++mTransactionSequence; for (int i = mService.mWindows.size() - 1; i >= 0; i--) { - WindowState w = mService.mWindows.get(i); - WindowStateAnimator winAnimator = w.mWinAnimator; - final WindowManager.LayoutParams attrs = w.mAttrs; + WindowState win = mService.mWindows.get(i); + WindowStateAnimator winAnimator = win.mWinAnimator; + final int flags = winAnimator.mAttrFlags; if (winAnimator.mSurface != null) { final boolean wasAnimating = winAnimator.mWasAnimating; final boolean nowAnimating = winAnimator.stepAnimationLocked(mCurrentTime); if (WindowManagerService.DEBUG_WALLPAPER) { - Slog.v(TAG, w + ": wasAnimating=" + wasAnimating + + Slog.v(TAG, win + ": wasAnimating=" + wasAnimating + ", nowAnimating=" + nowAnimating); } @@ -181,17 +193,17 @@ public class WindowAnimator { // a detached wallpaper animation. if (nowAnimating) { if (winAnimator.mAnimation != null) { - if ((attrs.flags&FLAG_SHOW_WALLPAPER) != 0 + if ((flags & FLAG_SHOW_WALLPAPER) != 0 && winAnimator.mAnimation.getDetachWallpaper()) { - mDetachedWallpaper = w; + mDetachedWallpaper = win; } - if (winAnimator.mAnimation.getBackgroundColor() != 0) { + final int backgroundColor = winAnimator.mAnimation.getBackgroundColor(); + if (backgroundColor != 0) { if (mWindowAnimationBackground == null || (winAnimator.mAnimLayer < mWindowAnimationBackground.mWinAnimator.mAnimLayer)) { - mWindowAnimationBackground = w; - mWindowAnimationBackgroundColor = - winAnimator.mAnimation.getBackgroundColor(); + mWindowAnimationBackground = win; + mWindowAnimationBackgroundColor = backgroundColor; } } } @@ -201,58 +213,62 @@ public class WindowAnimator { // 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 ((attrs.flags&FLAG_SHOW_WALLPAPER) != 0 - && w.mAppToken.animation.getDetachWallpaper()) { - mDetachedWallpaper = w; + final AppWindowAnimator appAnimator = + win.mAppToken == null ? null : win.mAppToken.mAppAnimator; + if (appAnimator != null && appAnimator.animation != null + && appAnimator.animating) { + if ((flags & FLAG_SHOW_WALLPAPER) != 0 + && appAnimator.animation.getDetachWallpaper()) { + mDetachedWallpaper = win; } - if (w.mAppToken.animation.getBackgroundColor() != 0) { + final int backgroundColor = appAnimator.animation.getBackgroundColor(); + if (backgroundColor != 0) { if (mWindowAnimationBackground == null || (winAnimator.mAnimLayer < mWindowAnimationBackground.mWinAnimator.mAnimLayer)) { - mWindowAnimationBackground = w; - mWindowAnimationBackgroundColor = - w.mAppToken.animation.getBackgroundColor(); + mWindowAnimationBackground = win; + mWindowAnimationBackgroundColor = backgroundColor; } } } - if (wasAnimating && !winAnimator.mAnimating && mService.mWallpaperTarget == w) { + if (wasAnimating && !winAnimator.mAnimating && mService.mWallpaperTarget == win) { mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { - mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 2"); + mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 2", + mPendingLayoutChanges); } } - if (mPolicy.doesForceHide(w, attrs)) { + if (mPolicy.doesForceHide(win, win.mAttrs)) { if (!wasAnimating && nowAnimating) { if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG, "Animation started that could impact force hide: " - + w); - mService.mInnerFields.mWallpaperForceHidingChanged = true; + + win); + mBulkUpdateParams |= SET_FORCE_HIDING_CHANGED; mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { - mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 3"); + mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 3", + mPendingLayoutChanges); } mService.mFocusMayChange = true; - } else if (w.isReadyForDisplay() && winAnimator.mAnimation == null) { + } else if (win.isReadyForDisplay() && winAnimator.mAnimation == null) { mForceHiding = true; } - } else if (mPolicy.canBeForceHidden(w, attrs)) { - boolean changed; + } else if (mPolicy.canBeForceHidden(win, win.mAttrs)) { + final boolean changed; if (mForceHiding) { - changed = w.hideLw(false, false); + changed = win.hideLw(false, false); if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG, - "Now policy hidden: " + w); + "Now policy hidden: " + win); } else { - changed = w.showLw(false, false); + changed = win.showLw(false, false); if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG, - "Now policy shown: " + w); + "Now policy shown: " + win); if (changed) { - if (mService.mInnerFields.mWallpaperForceHidingChanged - && w.isVisibleNow() /*w.isReadyForDisplay()*/) { + if ((mBulkUpdateParams & SET_FORCE_HIDING_CHANGED) != 0 + && win.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 @@ -262,7 +278,7 @@ public class WindowAnimator { winAnimator.setAnimation(a); } } - if (mCurrentFocus == null || mCurrentFocus.mLayer < w.mLayer) { + if (mCurrentFocus == null || mCurrentFocus.mLayer < win.mLayer) { // We are showing on to of the current // focus, so re-evaluate focus to make // sure it is correct. @@ -270,55 +286,54 @@ public class WindowAnimator { } } } - if (changed && (attrs.flags - & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) { + if (changed && (flags & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) { mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { - mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 4"); + mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 4", + mPendingLayoutChanges); } } } } - final AppWindowToken atoken = w.mAppToken; - if (atoken != null && (!atoken.allDrawn || atoken.freezingScreen)) { + final AppWindowToken atoken = win.mAppToken; + if (atoken != null && (!atoken.allDrawn || atoken.mAppAnimator.freezingScreen)) { if (atoken.lastTransactionSequence != mTransactionSequence) { atoken.lastTransactionSequence = mTransactionSequence; atoken.numInterestingWindows = atoken.numDrawnWindows = 0; atoken.startingDisplayed = false; } - if ((w.isOnScreen() || w.mAttrs.type + if ((win.isOnScreen() || winAnimator.mAttrType == WindowManager.LayoutParams.TYPE_BASE_APPLICATION) - && !w.mExiting && !w.mDestroying) { + && !win.mExiting && !win.mDestroying) { if (WindowManagerService.DEBUG_VISIBILITY || WindowManagerService.DEBUG_ORIENTATION) { - Slog.v(TAG, "Eval win " + w + ": isDrawn=" - + w.isDrawnLw() + Slog.v(TAG, "Eval win " + win + ": isDrawn=" + win.isDrawnLw() + ", isAnimating=" + winAnimator.isAnimating()); - if (!w.isDrawnLw()) { + if (!win.isDrawnLw()) { Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurface - + " pv=" + w.mPolicyVisibility + + " pv=" + win.mPolicyVisibility + " mDrawState=" + winAnimator.mDrawState - + " ah=" + w.mAttachedHidden + + " ah=" + win.mAttachedHidden + " th=" + atoken.hiddenRequested + " a=" + winAnimator.mAnimating); } } - if (w != atoken.startingWindow) { - if (!atoken.freezingScreen || !w.mAppFreezing) { + if (win != atoken.startingWindow) { + if (!atoken.mAppAnimator.freezingScreen || !win.mAppFreezing) { atoken.numInterestingWindows++; - if (w.isDrawnLw()) { + if (win.isDrawnLw()) { atoken.numDrawnWindows++; if (WindowManagerService.DEBUG_VISIBILITY || WindowManagerService.DEBUG_ORIENTATION) Slog.v(TAG, "tokenMayBeDrawn: " + atoken - + " freezingScreen=" + atoken.freezingScreen - + " mAppFreezing=" + w.mAppFreezing); + + " freezingScreen=" + atoken.mAppAnimator.freezingScreen + + " mAppFreezing=" + win.mAppFreezing); mTokenMayBeDrawn = true; } } - } else if (w.isDrawnLw()) { + } else if (win.isDrawnLw()) { atoken.startingDisplayed = true; } } @@ -326,17 +341,20 @@ public class WindowAnimator { if (winAnimator.performShowLocked()) { mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM; if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { - mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 5"); + mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 5", + mPendingLayoutChanges); } } } - if (atoken != null && atoken.thumbnail != null) { - if (atoken.thumbnailTransactionSeq != mTransactionSequence) { - atoken.thumbnailTransactionSeq = mTransactionSequence; - atoken.thumbnailLayer = 0; + final AppWindowAnimator appAnimator = + atoken == null ? null : atoken.mAppAnimator; + if (appAnimator != null && appAnimator.thumbnail != null) { + if (appAnimator.thumbnailTransactionSeq != mTransactionSequence) { + appAnimator.thumbnailTransactionSeq = mTransactionSequence; + appAnimator.thumbnailLayer = 0; } - if (atoken.thumbnailLayer < winAnimator.mAnimLayer) { - atoken.thumbnailLayer = winAnimator.mAnimLayer; + if (appAnimator.thumbnailLayer < winAnimator.mAnimLayer) { + appAnimator.thumbnailLayer = winAnimator.mAnimLayer; } } } // end forall windows @@ -348,20 +366,19 @@ public class WindowAnimator { final int NT = mService.mAppTokens.size(); for (int i=0; i<NT; i++) { AppWindowToken wtoken = mService.mAppTokens.get(i); - if (wtoken.freezingScreen) { + if (wtoken.mAppAnimator.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(); + wtoken.mAppAnimator.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; @@ -373,12 +390,13 @@ public class WindowAnimator { wtoken.allDrawn = true; mPendingLayoutChanges |= PhoneWindowManager.FINISH_LAYOUT_REDO_ANIM; if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { - mService.debugLayoutRepeats("testTokenMayBeDrawnLocked"); + mService.debugLayoutRepeats("testTokenMayBeDrawnLocked", + mPendingLayoutChanges); } // We can now show all of the drawn windows! if (!mService.mOpeningApps.contains(wtoken)) { - mAnimating |= wtoken.showAllWindowsLocked(); + mAnimating |= wtoken.mAppAnimator.showAllWindowsLocked(); } } } @@ -419,15 +437,24 @@ public class WindowAnimator { mScreenRotationAnimation.updateSurfaces(); } - final int N = mService.mWindows.size(); - for (int i=N-1; i>=0; i--) { - WindowState w = mService.mWindows.get(i); - w.mWinAnimator.prepareSurfaceLocked(true); + mFinished.clear(); + for (final WindowStateAnimator winAnimator : mWinAnimators) { + if (winAnimator.mSurface == null) { + mFinished.add(winAnimator); + } else { + winAnimator.prepareSurfaceLocked(true); + } + } + for (final WindowStateAnimator winAnimator : mFinished) { + mWinAnimators.remove(winAnimator); } - if (mService.mDimAnimator != null && mService.mDimAnimator.mDimShown) { - mAnimating |= mService.mDimAnimator.updateSurface(mService.mInnerFields.mDimming, - mCurrentTime, !mService.okToDisplay()); + if (mDimParams != null) { + mDimAnimator.updateParameters(mContext.getResources(), mDimParams, mCurrentTime); + } + if (mDimAnimator != null && mDimAnimator.mDimShown) { + mAnimating |= mDimAnimator.updateSurface(mDimParams != null, mCurrentTime, + !mService.okToDisplay()); } if (mService.mBlackFrame != null) { @@ -450,7 +477,7 @@ public class WindowAnimator { } WindowState mCurrentFocus; - void setCurrentFocus(WindowState currentFocus) { + void setCurrentFocus(final WindowState currentFocus) { mCurrentFocus = currentFocus; } @@ -462,6 +489,20 @@ public class WindowAnimator { mInnerDh = appHeight; } + void startDimming(final WindowStateAnimator winAnimator, final float target, + final int width, final int height) { + if (mDimAnimator == null) { + mDimAnimator = new DimAnimator(mService.mFxSession); + } + mService.mH.sendMessage(mService.mH.obtainMessage(SET_DIM_PARAMETERS, + new DimAnimator.Parameters(winAnimator, width, height, target))); + } + + // TODO(cmautner): Move into Handler + void stopDimming() { + mService.mH.sendMessage(mService.mH.obtainMessage(SET_DIM_PARAMETERS, null)); + } + public void dump(PrintWriter pw, String prefix, boolean dumpAll) { if (mWindowDetachedWallpaper != null) { pw.print(" mWindowDetachedWallpaper="); pw.println(mWindowDetachedWallpaper); @@ -470,5 +511,25 @@ public class WindowAnimator { pw.println(" mWindowAnimationBackgroundSurface:"); mWindowAnimationBackgroundSurface.printTo(" ", pw); } + if (mDimAnimator != null) { + pw.println(" mDimAnimator:"); + mDimAnimator.printTo(" ", pw); + } else { + pw.println( " no DimAnimator "); + } + } + + static class SetAnimationParams { + final WindowStateAnimator mWinAnimator; + final Animation mAnimation; + final int mAnimDw; + final int mAnimDh; + public SetAnimationParams(final WindowStateAnimator winAnimator, + final Animation animation, final int animDw, final int animDh) { + mWinAnimator = winAnimator; + mAnimation = animation; + mAnimDw = animDw; + mAnimDh = animDh; + } } } diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index afbc348..a7af8fb 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -44,6 +44,8 @@ import com.android.server.EventLogTags; import com.android.server.PowerManagerService; import com.android.server.Watchdog; import com.android.server.am.BatteryStatsService; +import com.android.server.input.InputFilter; +import com.android.server.input.InputManagerService; import android.Manifest; import android.app.ActivityManagerNative; @@ -149,7 +151,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdog.Monitor, WindowManagerPolicy.WindowManagerFuncs { static final String TAG = "WindowManager"; static final boolean DEBUG = false; - static final boolean DEBUG_ADD_REMOVE = true; + static final boolean DEBUG_ADD_REMOVE = false; static final boolean DEBUG_FOCUS = false; static final boolean DEBUG_ANIM = false; static final boolean DEBUG_LAYOUT = false; @@ -158,7 +160,7 @@ public class WindowManagerService extends IWindowManager.Stub static final boolean DEBUG_INPUT = false; static final boolean DEBUG_INPUT_METHOD = false; static final boolean DEBUG_VISIBILITY = false; - static final boolean DEBUG_WINDOW_MOVEMENT = true; + static final boolean DEBUG_WINDOW_MOVEMENT = false; static final boolean DEBUG_TOKEN_MOVEMENT = false; static final boolean DEBUG_ORIENTATION = false; static final boolean DEBUG_APP_ORIENTATION = false; @@ -171,7 +173,7 @@ public class WindowManagerService extends IWindowManager.Stub 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 DEBUG_LAYOUT_REPEATS = true; static final boolean SHOW_SURFACE_ALLOC = false; static final boolean SHOW_TRANSACTIONS = false; static final boolean SHOW_LIGHT_TRANSACTIONS = false || SHOW_TRANSACTIONS; @@ -243,10 +245,6 @@ public class WindowManagerService extends IWindowManager.Stub */ static final boolean CUSTOM_SCREEN_ROTATION = true; - // Maximum number of milliseconds to wait for input event injection. - // FIXME is this value reasonable? - private static final int INJECTION_TIMEOUT_MILLIS = 30 * 1000; - // Maximum number of milliseconds to wait for input devices to be enumerated before // proceding with safe mode detection. private static final int INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS = 1000; @@ -427,7 +425,6 @@ public class WindowManagerService extends IWindowManager.Stub IInputMethodManager mInputMethodManager; SurfaceSession mFxSession; - DimAnimator mDimAnimator = null; Watermark mWatermark; StrictModeFlash mStrictModeFlash; @@ -577,7 +574,7 @@ public class WindowManagerService extends IWindowManager.Stub float mTransitionAnimationScale = 1.0f; float mAnimatorDurationScale = 1.0f; - final InputManager mInputManager; + final InputManagerService mInputManager; // Who is holding the screen on. Session mHoldingScreenOn; @@ -590,8 +587,10 @@ public class WindowManagerService extends IWindowManager.Stub /** Pulled out of performLayoutAndPlaceSurfacesLockedInner in order to refactor into multiple * methods. */ class LayoutFields { - static final int SET_UPDATE_ROTATION = 1 << 0; - static final int SET_WALLPAPER_MAY_CHANGE = 1 << 1; + static final int SET_UPDATE_ROTATION = 1 << 0; + static final int SET_WALLPAPER_MAY_CHANGE = 1 << 1; + static final int SET_FORCE_HIDING_CHANGED = 1 << 2; + static final int CLEAR_ORIENTATION_CHANGE_COMPLETE = 1 << 3; boolean mWallpaperForceHidingChanged = false; boolean mWallpaperMayChange = false; @@ -843,7 +842,7 @@ public class WindowManagerService extends IWindowManager.Stub "KEEP_SCREEN_ON_FLAG"); mHoldingScreenWakeLock.setReferenceCounted(false); - mInputManager = new InputManager(context, this); + mInputManager = new InputManagerService(context, mInputMonitor); mAnimator = new WindowAnimator(this, context, mPolicy); PolicyThread thr = new PolicyThread(mPolicy, this, context, pm); @@ -864,6 +863,10 @@ public class WindowManagerService extends IWindowManager.Stub Watchdog.getInstance().addMonitor(this); } + public InputManagerService getInputManagerService() { + return mInputManager; + } + @Override public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { @@ -1214,7 +1217,7 @@ public class WindowManagerService extends IWindowManager.Stub AppWindowToken token = curTarget.mAppToken; WindowState highestTarget = null; int highestPos = 0; - if (token.animating || token.animation != null) { + if (token.mAppAnimator.animating || token.mAppAnimator.animation != null) { int pos = localmWindows.indexOf(curTarget); while (pos >= 0) { WindowState win = localmWindows.get(pos); @@ -1274,7 +1277,7 @@ public class WindowManagerService extends IWindowManager.Stub mInputMethodTarget = w; mInputMethodTargetWaitingAnim = false; if (w.mAppToken != null) { - setInputMethodAnimLayerAdjustment(w.mAppToken.animLayerAdjustment); + setInputMethodAnimLayerAdjustment(w.mAppToken.mAppAnimator.animLayerAdjustment); } else { setInputMethodAnimLayerAdjustment(0); } @@ -1537,12 +1540,12 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_WALLPAPER) Slog.v(TAG, "Wallpaper vis: target " + wallpaperTarget + ", obscured=" + (wallpaperTarget != null ? Boolean.toString(wallpaperTarget.mObscured) : "??") + " anim=" + ((wallpaperTarget != null && wallpaperTarget.mAppToken != null) - ? wallpaperTarget.mAppToken.animation : null) + ? wallpaperTarget.mAppToken.mAppAnimator.animation : null) + " upper=" + mUpperWallpaperTarget + " lower=" + mLowerWallpaperTarget); return (wallpaperTarget != null && (!wallpaperTarget.mObscured || (wallpaperTarget.mAppToken != null - && wallpaperTarget.mAppToken.animation != null))) + && wallpaperTarget.mAppToken.mAppAnimator.animation != null))) || mUpperWallpaperTarget != null || mLowerWallpaperTarget != null; } @@ -1582,7 +1585,7 @@ public class WindowManagerService extends IWindowManager.Stub if (w != mAnimator.mWindowDetachedWallpaper && w.mAppToken != null) { // If this window's app token is hidden and not animating, // it is of no interest to us. - if (w.mAppToken.hidden && w.mAppToken.animation == null) { + if (w.mAppToken.hidden && w.mAppToken.mAppAnimator.animation == null) { if (DEBUG_WALLPAPER) Slog.v(TAG, "Skipping not hidden or animating token: " + w); continue; @@ -1597,7 +1600,7 @@ public class WindowManagerService extends IWindowManager.Stub foundW = w; foundI = i; if (w == mWallpaperTarget && ((w.mAppToken != null - && w.mAppToken.animation != null) + && w.mAppToken.mAppAnimator.animation != null) || w.mWinAnimator.mAnimation != null)) { // The current wallpaper target is animating, so we'll // look behind it for another possible target and figure @@ -1656,9 +1659,11 @@ public class WindowManagerService extends IWindowManager.Stub // animating, then we are in our super special mode! if (foundW != null && oldW != null) { boolean oldAnim = oldW.mWinAnimator.mAnimation != null - || (oldW.mAppToken != null && oldW.mAppToken.animation != null); + || (oldW.mAppToken != null + && oldW.mAppToken.mAppAnimator.animation != null); boolean foundAnim = foundW.mWinAnimator.mAnimation != null - || (foundW.mAppToken != null && foundW.mAppToken.animation != null); + || (foundW.mAppToken != null && + foundW.mAppToken.mAppAnimator.animation != null); if (DEBUG_WALLPAPER) { Slog.v(TAG, "New animation: " + foundAnim + " old animation: " + oldAnim); @@ -1711,10 +1716,10 @@ public class WindowManagerService extends IWindowManager.Stub // Is it time to stop animating? boolean lowerAnimating = mLowerWallpaperTarget.mWinAnimator.mAnimation != null || (mLowerWallpaperTarget.mAppToken != null - && mLowerWallpaperTarget.mAppToken.animation != null); + && mLowerWallpaperTarget.mAppToken.mAppAnimator.animation != null); boolean upperAnimating = mUpperWallpaperTarget.mWinAnimator.mAnimation != null || (mUpperWallpaperTarget.mAppToken != null - && mUpperWallpaperTarget.mAppToken.animation != null); + && mUpperWallpaperTarget.mAppToken.mAppAnimator.animation != null); if (!lowerAnimating || !upperAnimating) { if (DEBUG_WALLPAPER) { Slog.v(TAG, "No longer animating wallpaper targets!"); @@ -1736,7 +1741,7 @@ public class WindowManagerService extends IWindowManager.Stub // between two wallpaper targets. mWallpaperAnimLayerAdjustment = (mLowerWallpaperTarget == null && foundW.mAppToken != null) - ? foundW.mAppToken.animLayerAdjustment : 0; + ? foundW.mAppToken.mAppAnimator.animLayerAdjustment : 0; final int maxLayer = mPolicy.getMaxWallpaperLayer() * TYPE_LAYER_MULTIPLIER @@ -2007,6 +2012,7 @@ public class WindowManagerService extends IWindowManager.Stub winAnimator.computeShownFrameLocked(); // No need to lay out the windows - we can just set the wallpaper position // directly. + // TODO(cmautner): Don't move this from here, just lock the WindowAnimator. if (winAnimator.mSurfaceX != wallpaper.mShownFrame.left || winAnimator.mSurfaceY != wallpaper.mShownFrame.top) { Surface.openTransaction(); @@ -2306,7 +2312,7 @@ public class WindowManagerService extends IWindowManager.Stub + " mExiting=" + win.mExiting + " isAnimating=" + win.mWinAnimator.isAnimating() + " app-animation=" - + (win.mAppToken != null ? win.mAppToken.animation : null) + + (win.mAppToken != null ? win.mAppToken.mAppAnimator.animation : null) + " inPendingTransaction=" + (win.mAppToken != null ? win.mAppToken.inPendingTransaction : false) + " mDisplayFrozen=" + mDisplayFrozen); @@ -3174,13 +3180,13 @@ public class WindowManagerService extends IWindowManager.Stub } Slog.v(TAG, "Loaded animation " + a + " for " + wtoken, e); } - wtoken.setAnimation(a, initialized); + wtoken.mAppAnimator.setAnimation(a, initialized); } } else { - wtoken.clearAnimation(); + wtoken.mAppAnimator.clearAnimation(); } - return wtoken.animation != null; + return wtoken.mAppAnimator.animation != null; } // ------------------------------------------------------------- @@ -3325,7 +3331,7 @@ public class WindowManagerService extends IWindowManager.Stub "addAppToken()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); } - + // Get the dispatching timeout here while we are not holding any locks so that it // can be cached by the AppWindowToken. The timeout value is used later by the // input dispatcher in code that does hold locks. If we did not cache the value @@ -3828,14 +3834,16 @@ public class WindowManagerService extends IWindowManager.Stub wtoken.clientHidden = ttoken.clientHidden; wtoken.sendAppVisibilityToClients(); } - if (ttoken.animation != null) { - wtoken.animation = ttoken.animation; - wtoken.animating = ttoken.animating; - wtoken.animLayerAdjustment = ttoken.animLayerAdjustment; - ttoken.animation = null; - ttoken.animLayerAdjustment = 0; - wtoken.updateLayers(); - ttoken.updateLayers(); + final AppWindowAnimator tAppAnimator = ttoken.mAppAnimator; + final AppWindowAnimator wAppAnimator = wtoken.mAppAnimator; + if (tAppAnimator.animation != null) { + wAppAnimator.animation = tAppAnimator.animation; + wAppAnimator.animating = tAppAnimator.animating; + wAppAnimator.animLayerAdjustment = tAppAnimator.animLayerAdjustment; + tAppAnimator.animation = null; + tAppAnimator.animLayerAdjustment = 0; + wAppAnimator.updateLayers(); + tAppAnimator.updateLayers(); } updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES, @@ -3860,18 +3868,20 @@ public class WindowManagerService extends IWindowManager.Stub mH.sendMessageAtFrontOfQueue(m); return; } - if (ttoken.thumbnail != null) { + final AppWindowAnimator tAppAnimator = ttoken.mAppAnimator; + final AppWindowAnimator wAppAnimator = wtoken.mAppAnimator; + if (tAppAnimator.thumbnail != null) { // The old token is animating with a thumbnail, transfer // that to the new token. - if (wtoken.thumbnail != null) { - wtoken.thumbnail.destroy(); + if (wAppAnimator.thumbnail != null) { + wAppAnimator.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; + wAppAnimator.thumbnail = tAppAnimator.thumbnail; + wAppAnimator.thumbnailX = tAppAnimator.thumbnailX; + wAppAnimator.thumbnailY = tAppAnimator.thumbnailY; + wAppAnimator.thumbnailLayer = tAppAnimator.thumbnailLayer; + wAppAnimator.thumbnailAnimation = tAppAnimator.thumbnailAnimation; + tAppAnimator.thumbnail = null; } } } @@ -3961,12 +3971,12 @@ public class WindowManagerService extends IWindowManager.Stub boolean runningAppAnimation = false; if (transit != WindowManagerPolicy.TRANSIT_UNSET) { - if (wtoken.animation == sDummyAnimation) { - wtoken.animation = null; + if (wtoken.mAppAnimator.animation == sDummyAnimation) { + wtoken.mAppAnimator.animation = null; } applyAnimationLocked(wtoken, lp, transit, visible); changed = true; - if (wtoken.animation != null) { + if (wtoken.mAppAnimator.animation != null) { delayed = runningAppAnimation = true; } } @@ -4029,7 +4039,7 @@ public class WindowManagerService extends IWindowManager.Stub } } - if (wtoken.animation != null) { + if (wtoken.mAppAnimator.animation != null) { delayed = true; } @@ -4074,7 +4084,7 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_APP_TRANSITIONS) Slog.v( TAG, "Setting dummy animation on: " + wtoken); - wtoken.setDummyAnimation(); + wtoken.mAppAnimator.setDummyAnimation(); mOpeningApps.remove(wtoken); mClosingApps.remove(wtoken); wtoken.waitingToShow = wtoken.waitingToHide = false; @@ -4124,7 +4134,7 @@ public class WindowManagerService extends IWindowManager.Stub void unsetAppFreezingScreenLocked(AppWindowToken wtoken, boolean unfreezeSurfaceNow, boolean force) { - if (wtoken.freezingScreen) { + if (wtoken.mAppAnimator.freezingScreen) { if (DEBUG_ORIENTATION) Slog.v(TAG, "Clear freezing of " + wtoken + " force=" + force); final int N = wtoken.allAppWindows.size(); @@ -4142,7 +4152,7 @@ public class WindowManagerService extends IWindowManager.Stub } if (force || unfrozeWindows) { if (DEBUG_ORIENTATION) Slog.v(TAG, "No longer freezing: " + wtoken); - wtoken.freezingScreen = false; + wtoken.mAppAnimator.freezingScreen = false; mAppsFreezingScreen--; } if (unfreezeSurfaceNow) { @@ -4165,11 +4175,11 @@ public class WindowManagerService extends IWindowManager.Stub } Slog.i(TAG, "Set freezing of " + wtoken.appToken + ": hidden=" + wtoken.hidden + " freezing=" - + wtoken.freezingScreen, e); + + wtoken.mAppAnimator.freezingScreen, e); } if (!wtoken.hiddenRequested) { - if (!wtoken.freezingScreen) { - wtoken.freezingScreen = true; + if (!wtoken.mAppAnimator.freezingScreen) { + wtoken.mAppAnimator.freezingScreen = true; mAppsFreezingScreen++; if (mAppsFreezingScreen == 1) { startFreezingDisplayLocked(false); @@ -4222,7 +4232,7 @@ public class WindowManagerService extends IWindowManager.Stub } final long origId = Binder.clearCallingIdentity(); if (DEBUG_ORIENTATION) Slog.v(TAG, "Clear freezing of " + token - + ": hidden=" + wtoken.hidden + " freezing=" + wtoken.freezingScreen); + + ": hidden=" + wtoken.hidden + " freezing=" + wtoken.mAppAnimator.freezingScreen); unsetAppFreezingScreenLocked(wtoken, true, force); Binder.restoreCallingIdentity(origId); } @@ -4257,8 +4267,8 @@ public class WindowManagerService extends IWindowManager.Stub } if (DEBUG_APP_TRANSITIONS) Slog.v( TAG, "Removing app " + wtoken + " delayed=" + delayed - + " animation=" + wtoken.animation - + " animating=" + wtoken.animating); + + " animation=" + wtoken.mAppAnimator.animation + + " animating=" + wtoken.mAppAnimator.animating); if (delayed) { // set the token aside because it has an active animation to be finished if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG, @@ -4268,9 +4278,8 @@ public class WindowManagerService extends IWindowManager.Stub // 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; + wtoken.mAppAnimator.clearAnimation(); + wtoken.mAppAnimator.animating = false; } if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG, "removeAppToken: " + wtoken); @@ -4792,95 +4801,26 @@ public class WindowManagerService extends IWindowManager.Stub mAnimatorDurationScale }; } - public int getSwitchState(int sw) { - if (!checkCallingPermission(android.Manifest.permission.READ_INPUT_STATE, - "getSwitchState()")) { - throw new SecurityException("Requires READ_INPUT_STATE permission"); - } - return mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY, sw); - } - - public int getSwitchStateForDevice(int devid, int sw) { - if (!checkCallingPermission(android.Manifest.permission.READ_INPUT_STATE, - "getSwitchStateForDevice()")) { - throw new SecurityException("Requires READ_INPUT_STATE permission"); - } - return mInputManager.getSwitchState(devid, InputDevice.SOURCE_ANY, sw); - } - - public int getScancodeState(int sw) { - if (!checkCallingPermission(android.Manifest.permission.READ_INPUT_STATE, - "getScancodeState()")) { - throw new SecurityException("Requires READ_INPUT_STATE permission"); - } - return mInputManager.getScanCodeState(-1, InputDevice.SOURCE_ANY, sw); - } - - public int getScancodeStateForDevice(int devid, int sw) { - if (!checkCallingPermission(android.Manifest.permission.READ_INPUT_STATE, - "getScancodeStateForDevice()")) { - throw new SecurityException("Requires READ_INPUT_STATE permission"); - } - return mInputManager.getScanCodeState(devid, InputDevice.SOURCE_ANY, sw); - } - - public int getTrackballScancodeState(int sw) { - if (!checkCallingPermission(android.Manifest.permission.READ_INPUT_STATE, - "getTrackballScancodeState()")) { - throw new SecurityException("Requires READ_INPUT_STATE permission"); - } - return mInputManager.getScanCodeState(-1, InputDevice.SOURCE_TRACKBALL, sw); - } - - public int getDPadScancodeState(int sw) { - if (!checkCallingPermission(android.Manifest.permission.READ_INPUT_STATE, - "getDPadScancodeState()")) { - throw new SecurityException("Requires READ_INPUT_STATE permission"); - } - return mInputManager.getScanCodeState(-1, InputDevice.SOURCE_DPAD, sw); - } - - public int getKeycodeState(int sw) { - if (!checkCallingPermission(android.Manifest.permission.READ_INPUT_STATE, - "getKeycodeState()")) { - throw new SecurityException("Requires READ_INPUT_STATE permission"); - } - return mInputManager.getKeyCodeState(-1, InputDevice.SOURCE_ANY, sw); - } - - public int getKeycodeStateForDevice(int devid, int sw) { - if (!checkCallingPermission(android.Manifest.permission.READ_INPUT_STATE, - "getKeycodeStateForDevice()")) { - throw new SecurityException("Requires READ_INPUT_STATE permission"); - } - return mInputManager.getKeyCodeState(devid, InputDevice.SOURCE_ANY, sw); - } - - public int getTrackballKeycodeState(int sw) { - if (!checkCallingPermission(android.Manifest.permission.READ_INPUT_STATE, - "getTrackballKeycodeState()")) { - throw new SecurityException("Requires READ_INPUT_STATE permission"); + // Called by window manager policy. Not exposed externally. + @Override + public int getLidState() { + final int SW_LID = 0x00; + int sw = mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY, SW_LID); + if (sw > 0) { + // Switch state: AKEY_STATE_DOWN or AKEY_STATE_VIRTUAL. + return LID_CLOSED; + } else if (sw == 0) { + // Switch state: AKEY_STATE_UP. + return LID_OPEN; + } else { + // Switch state: AKEY_STATE_UNKNOWN. + return LID_ABSENT; } - return mInputManager.getKeyCodeState(-1, InputDevice.SOURCE_TRACKBALL, sw); - } - - public int getDPadKeycodeState(int sw) { - if (!checkCallingPermission(android.Manifest.permission.READ_INPUT_STATE, - "getDPadKeycodeState()")) { - throw new SecurityException("Requires READ_INPUT_STATE permission"); - } - return mInputManager.getKeyCodeState(-1, InputDevice.SOURCE_DPAD, sw); - } - - public boolean hasKeys(int[] keycodes, boolean[] keyExists) { - return mInputManager.hasKeys(-1, InputDevice.SOURCE_ANY, keycodes, keyExists); } + // Called by window manager policy. Not exposed externally. + @Override public InputChannel monitorInput(String inputChannelName) { - if (!checkCallingPermission(android.Manifest.permission.READ_INPUT_STATE, - "monitorInput()")) { - throw new SecurityException("Requires READ_INPUT_STATE permission"); - } return mInputManager.monitorInput(inputChannelName); } @@ -4888,14 +4828,6 @@ public class WindowManagerService extends IWindowManager.Stub mInputManager.setInputFilter(filter); } - public InputDevice getInputDevice(int deviceId) { - return mInputManager.getInputDevice(deviceId); - } - - public int[] getInputDeviceIds() { - return mInputManager.getInputDeviceIds(); - } - public void enableScreenAfterBoot() { synchronized(mWindowMap) { if (DEBUG_BOOT) { @@ -5052,7 +4984,7 @@ public class WindowManagerService extends IWindowManager.Stub mPolicy.enableScreenAfterBoot(); // Make sure the last requested orientation has been applied. - updateRotationUnchecked(false); + updateRotationUnchecked(false, false); } public void showBootMessage(final CharSequence msg, final boolean always) { @@ -5326,7 +5258,7 @@ public class WindowManagerService extends IWindowManager.Stub mPolicy.setUserRotationMode(WindowManagerPolicy.USER_ROTATION_LOCKED, rotation == -1 ? mRotation : rotation); - updateRotationUnchecked(false); + updateRotationUnchecked(false, false); } /** @@ -5342,7 +5274,7 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_ORIENTATION) Slog.v(TAG, "thawRotation: mRotation=" + mRotation); mPolicy.setUserRotationMode(WindowManagerPolicy.USER_ROTATION_FREE, 777); // rot not used - updateRotationUnchecked(false); + updateRotationUnchecked(false, false); } /** @@ -5352,8 +5284,8 @@ public class WindowManagerService extends IWindowManager.Stub * such that the current rotation might need to be updated, such as when the * device is docked or rotated into a new posture. */ - public void updateRotation(boolean alwaysSendConfiguration) { - updateRotationUnchecked(alwaysSendConfiguration); + public void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout) { + updateRotationUnchecked(alwaysSendConfiguration, forceRelayout); } /** @@ -5383,8 +5315,7 @@ public class WindowManagerService extends IWindowManager.Stub } } - public void updateRotationUnchecked( - boolean alwaysSendConfiguration) { + public void updateRotationUnchecked(boolean alwaysSendConfiguration, boolean forceRelayout) { if(DEBUG_ORIENTATION) Slog.v(TAG, "updateRotationUnchecked(" + "alwaysSendConfiguration=" + alwaysSendConfiguration + ")"); @@ -5392,6 +5323,10 @@ public class WindowManagerService extends IWindowManager.Stub boolean changed; synchronized(mWindowMap) { changed = updateRotationUncheckedLocked(false); + if (!changed || forceRelayout) { + mLayoutNeeded = true; + performLayoutAndPlaceSurfacesLocked(); + } } if (changed || alwaysSendConfiguration) { @@ -6378,164 +6313,6 @@ public class WindowManagerService extends IWindowManager.Stub sendScreenStatusToClients(); } - /** - * Injects a keystroke event into the UI. - * Even when sync is false, this method may block while waiting for current - * input events to be dispatched. - * - * @param ev A motion event describing the keystroke action. (Be sure to use - * {@link SystemClock#uptimeMillis()} as the timebase.) - * @param sync If true, wait for the event to be completed before returning to the caller. - * @return Returns true if event was dispatched, false if it was dropped for any reason - */ - public boolean injectKeyEvent(KeyEvent ev, boolean sync) { - long downTime = ev.getDownTime(); - long eventTime = ev.getEventTime(); - - int action = ev.getAction(); - int code = ev.getKeyCode(); - int repeatCount = ev.getRepeatCount(); - int metaState = ev.getMetaState(); - int deviceId = ev.getDeviceId(); - int scancode = ev.getScanCode(); - int source = ev.getSource(); - int flags = ev.getFlags(); - - if (source == InputDevice.SOURCE_UNKNOWN) { - source = InputDevice.SOURCE_KEYBOARD; - } - - if (eventTime == 0) eventTime = SystemClock.uptimeMillis(); - if (downTime == 0) downTime = eventTime; - - KeyEvent newEvent = new KeyEvent(downTime, eventTime, action, code, repeatCount, metaState, - deviceId, scancode, flags | KeyEvent.FLAG_FROM_SYSTEM, source); - - final int pid = Binder.getCallingPid(); - final int uid = Binder.getCallingUid(); - final long ident = Binder.clearCallingIdentity(); - - final int result = mInputManager.injectInputEvent(newEvent, pid, uid, - sync ? InputManager.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH - : InputManager.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT, - INJECTION_TIMEOUT_MILLIS); - - Binder.restoreCallingIdentity(ident); - return reportInjectionResult(result, pid); - } - - /** - * Inject a pointer (touch) event into the UI. - * Even when sync is false, this method may block while waiting for current - * input events to be dispatched. - * - * @param ev A motion event describing the pointer (touch) action. (As noted in - * {@link MotionEvent#obtain(long, long, int, float, float, int)}, be sure to use - * {@link SystemClock#uptimeMillis()} as the timebase.) - * @param sync If true, wait for the event to be completed before returning to the caller. - * @return Returns true if event was dispatched, false if it was dropped for any reason - */ - public boolean injectPointerEvent(MotionEvent ev, boolean sync) { - final int pid = Binder.getCallingPid(); - final int uid = Binder.getCallingUid(); - final long ident = Binder.clearCallingIdentity(); - - MotionEvent newEvent = MotionEvent.obtain(ev); - if ((newEvent.getSource() & InputDevice.SOURCE_CLASS_POINTER) == 0) { - newEvent.setSource(InputDevice.SOURCE_TOUCHSCREEN); - } - - final int result = mInputManager.injectInputEvent(newEvent, pid, uid, - sync ? InputManager.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH - : InputManager.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT, - INJECTION_TIMEOUT_MILLIS); - - Binder.restoreCallingIdentity(ident); - return reportInjectionResult(result, pid); - } - - /** - * Inject a trackball (navigation device) event into the UI. - * Even when sync is false, this method may block while waiting for current - * input events to be dispatched. - * - * @param ev A motion event describing the trackball action. (As noted in - * {@link MotionEvent#obtain(long, long, int, float, float, int)}, be sure to use - * {@link SystemClock#uptimeMillis()} as the timebase.) - * @param sync If true, wait for the event to be completed before returning to the caller. - * @return Returns true if event was dispatched, false if it was dropped for any reason - */ - public boolean injectTrackballEvent(MotionEvent ev, boolean sync) { - final int pid = Binder.getCallingPid(); - final int uid = Binder.getCallingUid(); - final long ident = Binder.clearCallingIdentity(); - - MotionEvent newEvent = MotionEvent.obtain(ev); - if ((newEvent.getSource() & InputDevice.SOURCE_CLASS_TRACKBALL) == 0) { - newEvent.setSource(InputDevice.SOURCE_TRACKBALL); - } - - final int result = mInputManager.injectInputEvent(newEvent, pid, uid, - sync ? InputManager.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISH - : InputManager.INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT, - INJECTION_TIMEOUT_MILLIS); - - Binder.restoreCallingIdentity(ident); - return reportInjectionResult(result, pid); - } - - /** - * Inject an input event into the UI without waiting for dispatch to commence. - * This variant is useful for fire-and-forget input event injection. It does not - * block any longer than it takes to enqueue the input event. - * - * @param ev An input event. (Be sure to set the input source correctly.) - * @return Returns true if event was dispatched, false if it was dropped for any reason - */ - public boolean injectInputEventNoWait(InputEvent ev) { - final int pid = Binder.getCallingPid(); - final int uid = Binder.getCallingUid(); - final long ident = Binder.clearCallingIdentity(); - - final int result = mInputManager.injectInputEvent(ev, pid, uid, - InputManager.INPUT_EVENT_INJECTION_SYNC_NONE, - INJECTION_TIMEOUT_MILLIS); - - Binder.restoreCallingIdentity(ident); - return reportInjectionResult(result, pid); - } - - private boolean reportInjectionResult(int result, int pid) { - switch (result) { - case InputManager.INPUT_EVENT_INJECTION_PERMISSION_DENIED: - Slog.w(TAG, "Input event injection from pid " + pid + " permission denied."); - throw new SecurityException( - "Injecting to another application requires INJECT_EVENTS permission"); - case InputManager.INPUT_EVENT_INJECTION_SUCCEEDED: - return true; - case InputManager.INPUT_EVENT_INJECTION_TIMED_OUT: - Slog.w(TAG, "Input event injection from pid " + pid + " timed out."); - return false; - case InputManager.INPUT_EVENT_INJECTION_FAILED: - default: - Slog.w(TAG, "Input event injection from pid " + pid + " failed."); - return false; - } - } - - /** - * Temporarily set the pointer speed. Does not save the new setting. - * Used by the settings application. - */ - public void setPointerSpeed(int speed) { - if (!checkCallingPermission(android.Manifest.permission.SET_POINTER_SPEED, - "setPointerSpeed()")) { - throw new SecurityException("Requires SET_POINTER_SPEED permission"); - } - - mInputManager.setPointerSpeed(speed); - } - private WindowState getFocusedWindow() { synchronized (mWindowMap) { return getFocusedWindowLocked(); @@ -6550,11 +6327,29 @@ public class WindowManagerService extends IWindowManager.Stub if (!mInputMonitor.waitForInputDevicesReady( INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS)) { Slog.w(TAG, "Devices still not ready after waiting " - + INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS - + " milliseconds before attempting to detect safe mode."); + + INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS + + " milliseconds before attempting to detect safe mode."); + } + + final int BTN_MOUSE = 0x110; + int menuState = mInputManager.getKeyCodeState(-1, InputDevice.SOURCE_ANY, + KeyEvent.KEYCODE_MENU); + int sState = mInputManager.getKeyCodeState(-1, InputDevice.SOURCE_ANY, KeyEvent.KEYCODE_S); + int dpadState = mInputManager.getKeyCodeState(-1, InputDevice.SOURCE_DPAD, + KeyEvent.KEYCODE_DPAD_CENTER); + int trackballState = mInputManager.getScanCodeState(-1, InputDevice.SOURCE_TRACKBALL, + BTN_MOUSE); + int volumeDownState = mInputManager.getKeyCodeState(-1, InputDevice.SOURCE_ANY, + KeyEvent.KEYCODE_VOLUME_DOWN); + mSafeMode = menuState > 0 || sState > 0 || dpadState > 0 || trackballState > 0 + || volumeDownState > 0; + if (mSafeMode) { + Log.i(TAG, "SAFE MODE ENABLED (menu=" + menuState + " s=" + sState + + " dpad=" + dpadState + " trackball=" + trackballState + ")"); + } else { + Log.i(TAG, "SAFE MODE not enabled"); } - - mSafeMode = mPolicy.detectSafeMode(); + mPolicy.setSafeMode(mSafeMode); return mSafeMode; } @@ -6584,7 +6379,7 @@ public class WindowManagerService extends IWindowManager.Stub mInputManager.setDisplaySize(Display.DEFAULT_DISPLAY, mDisplay.getRawWidth(), mDisplay.getRawHeight(), mDisplay.getRawExternalWidth(), mDisplay.getRawExternalHeight()); - mPolicy.setInitialDisplaySize(mInitialDisplayWidth, mInitialDisplayHeight); + mPolicy.setInitialDisplaySize(mDisplay, mInitialDisplayWidth, mInitialDisplayHeight); } try { @@ -6657,6 +6452,8 @@ public class WindowManagerService extends IWindowManager.Stub public static final int ANIMATOR_WHAT_OFFSET = 100000; public static final int SET_TRANSPARENT_REGION = ANIMATOR_WHAT_OFFSET + 1; public static final int SET_WALLPAPER_OFFSET = ANIMATOR_WHAT_OFFSET + 2; + public static final int SET_DIM_PARAMETERS = ANIMATOR_WHAT_OFFSET + 3; + public static final int SET_MOVE_ANIMATION = ANIMATOR_WHAT_OFFSET + 4; private Session mLastReportedHold; @@ -6980,14 +6777,16 @@ public class WindowManagerService extends IWindowManager.Stub case APP_FREEZE_TIMEOUT: { synchronized (mWindowMap) { - Slog.w(TAG, "App freeze timeout expired."); - int i = mAppTokens.size(); - while (i > 0) { - i--; - AppWindowToken tok = mAppTokens.get(i); - if (tok.freezingScreen) { - Slog.w(TAG, "Force clearing freeze: " + tok); - unsetAppFreezingScreenLocked(tok, true, true); + synchronized (mAnimator) { + Slog.w(TAG, "App freeze timeout expired."); + int i = mAppTokens.size(); + while (i > 0) { + i--; + AppWindowToken tok = mAppTokens.get(i); + if (tok.mAppAnimator.freezingScreen) { + Slog.w(TAG, "Force clearing freeze: " + tok); + unsetAppFreezingScreenLocked(tok, true, true); + } } } } @@ -7069,6 +6868,7 @@ public class WindowManagerService extends IWindowManager.Stub } case BULK_UPDATE_PARAMETERS: { + // Used to send multiple changes from the animation side to the layout side. synchronized (mWindowMap) { // TODO(cmautner): As the number of bits grows, use masks of bit groups to // eliminate unnecessary tests. @@ -7078,6 +6878,12 @@ public class WindowManagerService extends IWindowManager.Stub if ((msg.arg1 & LayoutFields.SET_WALLPAPER_MAY_CHANGE) != 0) { mInnerFields.mWallpaperMayChange = true; } + if ((msg.arg1 & LayoutFields.SET_FORCE_HIDING_CHANGED) != 0) { + mInnerFields.mWallpaperForceHidingChanged = true; + } + if ((msg.arg1 & LayoutFields.CLEAR_ORIENTATION_CHANGE_COMPLETE) != 0) { + mInnerFields.mOrientationChangeComplete = false; + } requestTraversalLocked(); } @@ -7086,22 +6892,39 @@ public class WindowManagerService extends IWindowManager.Stub // Animation messages. Move to Window{State}Animator case SET_TRANSPARENT_REGION: { - // TODO(cmautner): Remove sync. - synchronized (mWindowMap) { - Pair<WindowStateAnimator, Region> pair = + Pair<WindowStateAnimator, Region> pair = (Pair<WindowStateAnimator, Region>) msg.obj; - final WindowStateAnimator winAnimator = pair.first; - winAnimator.setTransparentRegionHint(pair.second); - } + final WindowStateAnimator winAnimator = pair.first; + winAnimator.setTransparentRegionHint(pair.second); + + scheduleAnimationLocked(); break; } case SET_WALLPAPER_OFFSET: { - // TODO(cmautner): Remove sync. - synchronized (mWindowMap) { - final WindowStateAnimator winAnimator = (WindowStateAnimator) msg.obj; - winAnimator.setWallpaperOffset(msg.arg1, msg.arg2); - } + final WindowStateAnimator winAnimator = (WindowStateAnimator) msg.obj; + winAnimator.setWallpaperOffset(msg.arg1, msg.arg2); + + scheduleAnimationLocked(); + break; + } + + case SET_DIM_PARAMETERS: { + mAnimator.mDimParams = (DimAnimator.Parameters) msg.obj; + + scheduleAnimationLocked(); + break; + } + + case SET_MOVE_ANIMATION: { + WindowAnimator.SetAnimationParams params = + (WindowAnimator.SetAnimationParams) msg.obj; + WindowStateAnimator winAnimator = params.mWinAnimator; + winAnimator.setAnimation(params.mAnimation); + winAnimator.mAnimDw = params.mAnimDw; + winAnimator.mAnimDh = params.mAnimDh; + + scheduleAnimationLocked(); break; } } @@ -7281,7 +7104,7 @@ public class WindowManagerService extends IWindowManager.Stub mBaseDisplayWidth = width; mBaseDisplayHeight = height; } - mPolicy.setInitialDisplaySize(mBaseDisplayWidth, mBaseDisplayHeight); + mPolicy.setInitialDisplaySize(mDisplay, mBaseDisplayWidth, mBaseDisplayHeight); mLayoutNeeded = true; @@ -7313,8 +7136,8 @@ public class WindowManagerService extends IWindowManager.Stub } } - public boolean canStatusBarHide() { - return mPolicy.canStatusBarHide(); + public boolean hasSystemNavBar() { + return mPolicy.hasSystemNavBar(); } // ------------------------------------------------------------- @@ -7450,9 +7273,11 @@ public class WindowManagerService extends IWindowManager.Stub w.mLayer = curLayer; } if (w.mTargetAppToken != null) { - w.mWinAnimator.mAnimLayer = w.mLayer + w.mTargetAppToken.animLayerAdjustment; + w.mWinAnimator.mAnimLayer = + w.mLayer + w.mTargetAppToken.mAppAnimator.animLayerAdjustment; } else if (w.mAppToken != null) { - w.mWinAnimator.mAnimLayer = w.mLayer + w.mAppToken.animLayerAdjustment; + w.mWinAnimator.mAnimLayer = + w.mLayer + w.mAppToken.mAppAnimator.animLayerAdjustment; } else { w.mWinAnimator.mAnimLayer = w.mLayer; } @@ -7881,20 +7706,19 @@ public class WindowManagerService extends IWindowManager.Stub AppWindowToken topOpeningApp = null; int topOpeningLayer = 0; + // TODO(cmautner): Move to animation side. 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(); + if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Now opening app" + wtoken); + wtoken.mAppAnimator.clearThumbnail(); wtoken.reportedVisible = false; wtoken.inPendingTransaction = false; - wtoken.animation = null; - setTokenVisibilityLocked(wtoken, animLp, true, - transit, false); + wtoken.mAppAnimator.animation = null; + setTokenVisibilityLocked(wtoken, animLp, true, transit, false); wtoken.updateReportedVisibilityLocked(); wtoken.waitingToShow = false; - mAnimator.mAnimating |= wtoken.showAllWindowsLocked(); + mAnimator.mAnimating |= wtoken.mAppAnimator.showAllWindowsLocked(); if (animLp != null) { int layer = -1; for (int j=0; j<wtoken.windows.size(); j++) { @@ -7914,9 +7738,9 @@ public class WindowManagerService extends IWindowManager.Stub AppWindowToken wtoken = mClosingApps.get(i); if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Now closing app" + wtoken); - wtoken.clearThumbnail(); + wtoken.mAppAnimator.clearThumbnail(); wtoken.inPendingTransaction = false; - wtoken.animation = null; + wtoken.mAppAnimator.animation = null; setTokenVisibilityLocked(wtoken, animLp, false, transit, false); wtoken.updateReportedVisibilityLocked(); @@ -7928,7 +7752,7 @@ public class WindowManagerService extends IWindowManager.Stub } if (mNextAppTransitionThumbnail != null && topOpeningApp != null - && topOpeningApp.animation != null) { + && topOpeningApp.mAppAnimator.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(), @@ -7937,7 +7761,7 @@ public class WindowManagerService extends IWindowManager.Stub Surface surface = new Surface(mFxSession, Process.myPid(), "thumbnail anim", 0, dirty.width(), dirty.height(), PixelFormat.TRANSLUCENT, Surface.HIDDEN); - topOpeningApp.thumbnail = surface; + topOpeningApp.mAppAnimator.thumbnail = surface; if (SHOW_TRANSACTIONS) Slog.i(TAG, " THUMBNAIL " + surface + ": CREATE"); Surface drawSurface = new Surface(); @@ -7946,17 +7770,17 @@ public class WindowManagerService extends IWindowManager.Stub c.drawBitmap(mNextAppTransitionThumbnail, 0, 0, null); drawSurface.unlockCanvasAndPost(c); drawSurface.release(); - topOpeningApp.thumbnailLayer = topOpeningLayer; + topOpeningApp.mAppAnimator.thumbnailLayer = topOpeningLayer; Animation anim = createThumbnailAnimationLocked(transit, true, true); - topOpeningApp.thumbnailAnimation = anim; + topOpeningApp.mAppAnimator.thumbnailAnimation = anim; anim.restrictDuration(MAX_ANIMATION_DURATION); anim.scaleCurrentDuration(mTransitionAnimationScale); - topOpeningApp.thumbnailX = mNextAppTransitionStartX; - topOpeningApp.thumbnailY = mNextAppTransitionStartY; + topOpeningApp.mAppAnimator.thumbnailX = mNextAppTransitionStartX; + topOpeningApp.mAppAnimator.thumbnailY = mNextAppTransitionStartY; } catch (Surface.OutOfResourcesException e) { Slog.e(TAG, "Can't allocate thumbnail surface w=" + dirty.width() + " h=" + dirty.height(), e); - topOpeningApp.clearThumbnail(); + topOpeningApp.mAppAnimator.clearThumbnail(); } } @@ -8038,7 +7862,6 @@ public class WindowManagerService extends IWindowManager.Stub } } mInnerFields.mAdjResult |= adjustWallpaperWindowsLocked(); - mInnerFields.mWallpaperForceHidingChanged = false; if (DEBUG_WALLPAPER) Slog.v(TAG, "****** OLD: " + oldWallpaper + " NEW: " + mWallpaperTarget + " LOWER: " + mLowerWallpaperTarget); @@ -8177,16 +8000,16 @@ public class WindowManagerService extends IWindowManager.Stub if (!mInnerFields.mDimming) { //Slog.i(TAG, "DIM BEHIND: " + w); mInnerFields.mDimming = true; - if (mDimAnimator == null) { - mDimAnimator = new DimAnimator(mFxSession); - } + final int width, height; if (attrs.type == WindowManager.LayoutParams.TYPE_BOOT_PROGRESS) { - mDimAnimator.show(mCurDisplayWidth, mCurDisplayHeight); + width = mCurDisplayWidth; + height = mCurDisplayHeight; } else { - mDimAnimator.show(innerDw, innerDh); + width = innerDw; + height = innerDh; } - mDimAnimator.updateParameters(mContext.getResources(), - w, currentTime); + mAnimator.startDimming(w.mWinAnimator, w.mExiting ? 0 : w.mAttrs.dimAmount, + width, height); } } } @@ -8223,7 +8046,6 @@ public class WindowManagerService extends IWindowManager.Stub mExitingAppTokens.get(i).hasVisible = false; } - mInnerFields.mOrientationChangeComplete = true; mInnerFields.mHoldScreen = null; mInnerFields.mScreenBrightness = -1; mInnerFields.mButtonBrightness = -1; @@ -8252,7 +8074,6 @@ public class WindowManagerService extends IWindowManager.Stub } try { - mInnerFields.mWallpaperForceHidingChanged = false; int repeats = 0; do { @@ -8263,7 +8084,8 @@ public class WindowManagerService extends IWindowManager.Stub break; } - if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("On entry to LockedInner"); + if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("On entry to LockedInner", + mPendingLayoutChanges); if ((mPendingLayoutChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) { if ((adjustWallpaperWindowsLocked()&ADJUST_WALLPAPER_LAYERS_CHANGED) != 0) { @@ -8294,7 +8116,8 @@ public class WindowManagerService extends IWindowManager.Stub // FIRST AND ONE HALF LOOP: Make WindowManagerPolicy think // it is animating. mPendingLayoutChanges = 0; - if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("loop number " + mLayoutRepeatCount); + if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("loop number " + mLayoutRepeatCount, + mPendingLayoutChanges); mPolicy.beginAnimationLw(dw, dh); for (i = mWindows.size() - 1; i >= 0; i--) { WindowState w = mWindows.get(i); @@ -8303,7 +8126,8 @@ public class WindowManagerService extends IWindowManager.Stub } } mPendingLayoutChanges |= mPolicy.finishAnimationLw(); - if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after finishAnimationLw"); + if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after finishAnimationLw", + mPendingLayoutChanges); } while (mPendingLayoutChanges != 0); final boolean someoneLosingFocus = !mLosingFocus.isEmpty(); @@ -8315,8 +8139,6 @@ public class WindowManagerService extends IWindowManager.Stub 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 (someoneLosingFocus && w == mCurrentFocus && w.isDisplayedLw()) { focusDisplayed = true; @@ -8337,6 +8159,9 @@ public class WindowManagerService extends IWindowManager.Stub updateWallpaperVisibilityLocked(); } } + if (!mInnerFields.mDimming && mAnimator.mDimParams != null) { + mAnimator.stopDimming(); + } } catch (RuntimeException e) { Log.wtf(TAG, "Unhandled exception in Window Manager", e); } finally { @@ -8348,7 +8173,8 @@ public class WindowManagerService extends IWindowManager.Stub // to go. if (mAppTransitionReady) { mPendingLayoutChanges |= handleAppTransitionReadyLocked(); - if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after handleAppTransitionReadyLocked"); + if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after handleAppTransitionReadyLocked", + mPendingLayoutChanges); } mInnerFields.mAdjResult = 0; @@ -8361,7 +8187,8 @@ public class WindowManagerService extends IWindowManager.Stub // 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 (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after handleAnimStopAndXitionLock", + mPendingLayoutChanges); } if (mInnerFields.mWallpaperForceHidingChanged && mPendingLayoutChanges == 0 && @@ -8373,9 +8200,10 @@ public class WindowManagerService extends IWindowManager.Stub // hard -- the wallpaper now needs to be shown behind // something that was hidden. mPendingLayoutChanges |= animateAwayWallpaperLocked(); - if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after animateAwayWallpaperLocked"); + if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after animateAwayWallpaperLocked", + mPendingLayoutChanges); } - + mInnerFields.mWallpaperForceHidingChanged = false; if (mInnerFields.mWallpaperMayChange) { if (WindowManagerService.DEBUG_WALLPAPER) Slog.v(TAG, @@ -8405,13 +8233,34 @@ public class WindowManagerService extends IWindowManager.Stub if (mLayoutNeeded) { mPendingLayoutChanges |= PhoneWindowManager.FINISH_LAYOUT_REDO_LAYOUT; - if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("mLayoutNeeded"); + if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("mLayoutNeeded", mPendingLayoutChanges); } final int N = mWindows.size(); for (i=N-1; i>=0; i--) { final WindowState w = mWindows.get(i); final WindowStateAnimator winAnimator = w.mWinAnimator; + + // If the window has moved due to its containing + // content frame changing, then we'd like to animate + // it. + if (w.mHasSurface && 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); + winAnimator.setAnimation(a); + winAnimator.mAnimDw = w.mLastFrame.left - w.mFrame.left; + winAnimator.mAnimDh = w.mLastFrame.top - w.mFrame.top; + } else { + winAnimator.mAnimDw = innerDw; + winAnimator.mAnimDh = innerDh; + } + + //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing"); + w.mContentChanged = false; + // TODO(cmautner): Can this move up to the loop at the end of try/catch above? updateResizingWindows(w); @@ -8426,28 +8275,11 @@ public class WindowManagerService extends IWindowManager.Stub mInnerFields.mWallpaperMayChange = true; mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { - debugLayoutRepeats("updateWindowsAndWallpaperLocked 1"); + debugLayoutRepeats("updateWindowsAndWallpaperLocked 1", + mPendingLayoutChanges); } } } - - // 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); - winAnimator.setAnimation(a); - winAnimator.mAnimDw = w.mLastFrame.left - w.mFrame.left; - winAnimator.mAnimDh = w.mLastFrame.top - w.mFrame.top; - } else { - winAnimator.mAnimDw = innerDw; - winAnimator.mAnimDh = innerDh; - } } } @@ -8455,7 +8287,7 @@ public class WindowManagerService extends IWindowManager.Stub // associated with exiting/removed apps mAnimator.animate(); mPendingLayoutChanges |= mAnimator.mPendingLayoutChanges; - if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after animate()"); + if (DEBUG_LAYOUT_REPEATS) debugLayoutRepeats("after animate()", mPendingLayoutChanges); if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, "<<< CLOSE TRANSACTION performLayoutAndPlaceSurfaces"); @@ -8550,9 +8382,8 @@ public class WindowManagerService extends IWindowManager.Stub // 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; + token.mAppAnimator.clearAnimation(); + token.mAppAnimator.animating = false; if (DEBUG_ADD_REMOVE || DEBUG_TOKEN_MOVEMENT) Slog.v(TAG, "performLayout: App token exiting now removed" + token); mAppTokens.remove(token); @@ -8629,6 +8460,7 @@ public class WindowManagerService extends IWindowManager.Stub !mInnerFields.mUpdateRotation) { checkDrawnWindowsLocked(); } + mInnerFields.mOrientationChangeComplete = true; // Check to see if we are now in a state where the screen should // be enabled, because the window obscured flags have changed. @@ -8745,6 +8577,7 @@ public class WindowManagerService extends IWindowManager.Stub wsa.mSurfaceShown = false; wsa.mSurface = null; ws.mHasSurface = false; + mAnimator.mWinAnimators.remove(wsa); mForceRemoves.add(ws); i--; N--; @@ -8758,6 +8591,7 @@ public class WindowManagerService extends IWindowManager.Stub wsa.mSurfaceShown = false; wsa.mSurface = null; ws.mHasSurface = false; + mAnimator.mWinAnimators.remove(wsa); leakedSurface = true; } } @@ -8797,6 +8631,7 @@ public class WindowManagerService extends IWindowManager.Stub winAnimator.mSurfaceShown = false; winAnimator.mSurface = null; winAnimator.mWin.mHasSurface = false; + mAnimator.mWinAnimators.remove(winAnimator); } try { @@ -8822,7 +8657,7 @@ public class WindowManagerService extends IWindowManager.Stub TAG, "Changing focus from " + mCurrentFocus + " to " + newFocus); final WindowState oldFocus = mCurrentFocus; mCurrentFocus = newFocus; - mAnimator.setCurrentFocus(mCurrentFocus); + mAnimator.setCurrentFocus(newFocus); mLosingFocus.remove(newFocus); int focusChanged = mPolicy.focusChangedLw(oldFocus, newFocus); @@ -8869,12 +8704,11 @@ public class WindowManagerService extends IWindowManager.Stub WindowState result = null; WindowState win; - int i = mWindows.size() - 1; int nextAppIndex = mAppTokens.size()-1; WindowToken nextApp = nextAppIndex >= 0 ? mAppTokens.get(nextAppIndex) : null; - while (i >= 0) { + for (int i = mWindows.size() - 1; i >= 0; i--) { win = mWindows.get(i); if (localLOGV || DEBUG_FOCUS) Slog.v( @@ -8887,7 +8721,6 @@ public class WindowManagerService extends IWindowManager.Stub // If this window's application has been removed, just skip it. if (thisApp != null && thisApp.removed) { - i--; continue; } @@ -8927,8 +8760,6 @@ public class WindowManagerService extends IWindowManager.Stub result = win; break; } - - i--; } return result; @@ -9192,11 +9023,6 @@ public class WindowManagerService extends IWindowManager.Stub mPolicy.lockNow(); } - void dumpInput(FileDescriptor fd, PrintWriter pw, boolean dumpAll) { - pw.println("WINDOW MANAGER INPUT (dumpsys window input)"); - mInputManager.dump(pw); - } - void dumpPolicyLocked(FileDescriptor fd, PrintWriter pw, String[] args, boolean dumpAll) { pw.println("WINDOW MANAGER POLICY STATE (dumpsys window policy)"); mPolicy.dump(" ", fd, pw, args); @@ -9476,12 +9302,6 @@ public class WindowManagerService extends IWindowManager.Stub pw.print(" mSystemBooted="); pw.print(mSystemBooted); pw.print(" mDisplayEnabled="); pw.println(mDisplayEnabled); pw.print(" mLayoutNeeded="); pw.println(mLayoutNeeded); - if (mDimAnimator != null) { - pw.println(" mDimAnimator:"); - mDimAnimator.printTo(" ", pw); - } else { - pw.println( " no DimAnimator "); - } pw.print(" mDisplayFrozen="); pw.print(mDisplayFrozen); pw.print(" mWindowsFreezingScreen="); pw.print(mWindowsFreezingScreen); pw.print(" mAppsFreezingScreen="); pw.print(mAppsFreezingScreen); @@ -9592,7 +9412,6 @@ public class WindowManagerService extends IWindowManager.Stub pw.println("Window manager dump options:"); pw.println(" [-a] [-h] [cmd] ..."); pw.println(" cmd may be one of:"); - pw.println(" i[input]: input subsystem state"); pw.println(" p[policy]: policy state"); pw.println(" s[essions]: active sessions"); pw.println(" t[okens]: token list"); @@ -9613,10 +9432,7 @@ public class WindowManagerService extends IWindowManager.Stub if (opti < args.length) { String cmd = args[opti]; opti++; - if ("input".equals(cmd) || "i".equals(cmd)) { - dumpInput(fd, pw, true); - return; - } else if ("policy".equals(cmd) || "p".equals(cmd)) { + if ("policy".equals(cmd) || "p".equals(cmd)) { synchronized(mWindowMap) { dumpPolicyLocked(fd, pw, args, true); } @@ -9651,8 +9467,6 @@ public class WindowManagerService extends IWindowManager.Stub } } - dumpInput(fd, pw, dumpAll); - synchronized(mWindowMap) { if (dumpAll) { pw.println("-------------------------------------------------------------------------------"); @@ -9691,10 +9505,10 @@ public class WindowManagerService extends IWindowManager.Stub requestTraversalLocked(); } - void debugLayoutRepeats(final String msg) { + void debugLayoutRepeats(final String msg, int pendingLayoutChanges) { if (mLayoutRepeatCount >= LAYOUT_REPEAT_THRESHOLD) { - Slog.v(TAG, "Layouts looping: " + msg); - Slog.v(TAG, "mPendingLayoutChanges = 0x" + Integer.toHexString(mPendingLayoutChanges)); + Slog.v(TAG, "Layouts looping: " + msg + ", mPendingLayoutChanges = 0x" + + Integer.toHexString(pendingLayoutChanges)); } } diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java index b74aa61..4de6425 100644 --- a/services/java/com/android/server/wm/WindowState.java +++ b/services/java/com/android/server/wm/WindowState.java @@ -23,6 +23,8 @@ import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; +import com.android.server.input.InputWindowHandle; + import android.content.Context; import android.content.res.Configuration; import android.graphics.Matrix; @@ -65,6 +67,9 @@ final class WindowState implements WindowManagerPolicy.WindowState { WindowToken mRootToken; AppWindowToken mAppToken; AppWindowToken mTargetAppToken; + + // mAttrs.flags is tested in animation without being locked. If the bits tested are ever + // modified they will need to be locked. final WindowManager.LayoutParams mAttrs = new WindowManager.LayoutParams(); final DeathRecipient mDeathRecipient; final WindowState mAttachedWindow; @@ -621,7 +626,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { } final AppWindowToken atoken = mAppToken; final boolean animating = atoken != null - ? (atoken.animation != null) : false; + ? (atoken.mAppAnimator.animation != null) : false; return mHasSurface && !mDestroying && !mExiting && (atoken == null ? mPolicyVisibility : !atoken.hiddenRequested) && ((!mAttachedHidden && mViewVisibility == View.VISIBLE @@ -637,7 +642,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { public boolean isWinVisibleLw() { final AppWindowToken atoken = mAppToken; return mHasSurface && mPolicyVisibility && !mAttachedHidden - && (atoken == null || !atoken.hiddenRequested || atoken.animating) + && (atoken == null || !atoken.hiddenRequested || atoken.mAppAnimator.animating) && !mExiting && !mDestroying; } @@ -685,7 +690,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { final AppWindowToken atoken = mAppToken; if (atoken != null) { return ((!mAttachedHidden && !atoken.hiddenRequested) - || mWinAnimator.mAnimation != null || atoken.animation != null); + || mWinAnimator.mAnimation != null || atoken.mAppAnimator.animation != null); } return !mAttachedHidden || mWinAnimator.mAnimation != null; } @@ -703,7 +708,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { && ((!mAttachedHidden && mViewVisibility == View.VISIBLE && !mRootToken.hidden) || mWinAnimator.mAnimation != null - || ((mAppToken != null) && (mAppToken.animation != null))); + || ((mAppToken != null) && (mAppToken.mAppAnimator.animation != null))); } /** @@ -746,7 +751,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { return (mAttrs.format == PixelFormat.OPAQUE || mAttrs.type == TYPE_WALLPAPER) && isDrawnLw() && mWinAnimator.mAnimation == null - && (mAppToken == null || mAppToken.animation == null); + && (mAppToken == null || mAppToken.mAppAnimator.animation == null); } /** @@ -867,6 +872,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { return true; } + @Override public boolean hideLw(boolean doAnimation) { return hideLw(doAnimation, true); } @@ -909,6 +915,11 @@ final class WindowState implements WindowManagerPolicy.WindowState { return true; } + @Override + public boolean isAlive() { + return mClient.asBinder().isBinderAlive(); + } + private static void applyInsets(Region outRegion, Rect frame, Rect inset) { outRegion.set( frame.left + inset.left, frame.top + inset.top, @@ -962,8 +973,9 @@ final class WindowState implements WindowManagerPolicy.WindowState { pw.print(prefix); pw.print("mBaseLayer="); pw.print(mBaseLayer); pw.print(" mSubLayer="); pw.print(mSubLayer); pw.print(" mAnimLayer="); pw.print(mLayer); pw.print("+"); - pw.print((mTargetAppToken != null ? mTargetAppToken.animLayerAdjustment - : (mAppToken != null ? mAppToken.animLayerAdjustment : 0))); + pw.print((mTargetAppToken != null ? + mTargetAppToken.mAppAnimator.animLayerAdjustment + : (mAppToken != null ? mAppToken.mAppAnimator.animLayerAdjustment : 0))); pw.print("="); pw.print(mWinAnimator.mAnimLayer); pw.print(" mLastLayer="); pw.println(mWinAnimator.mLastLayer); } diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java index 4979a4c..220f5e0 100644 --- a/services/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/java/com/android/server/wm/WindowStateAnimator.java @@ -5,6 +5,8 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; +import static com.android.server.wm.WindowManagerService.LayoutFields.CLEAR_ORIENTATION_CHANGE_COMPLETE; + import android.content.Context; import android.graphics.Matrix; import android.graphics.PixelFormat; @@ -119,6 +121,9 @@ class WindowStateAnimator { /** Was this window last hidden? */ boolean mLastHidden; + int mAttrFlags; + int mAttrType; + public WindowStateAnimator(final WindowManagerService service, final WindowState win, final WindowState attachedWindow) { mService = service; @@ -128,11 +133,12 @@ class WindowStateAnimator { mSession = win.mSession; mPolicy = mService.mPolicy; mContext = mService.mContext; + mAttrFlags = win.mAttrs.flags; + mAttrType = win.mAttrs.type; } public void setAnimation(Animation anim) { - if (localLOGV) Slog.v( - TAG, "Setting animation in " + this + ": " + anim); + if (localLOGV) Slog.v(TAG, "Setting animation in " + this + ": " + anim); mAnimating = false; mLocalAnimating = false; mAnimation = anim; @@ -160,7 +166,7 @@ class WindowStateAnimator { return mAnimation != null || (attached != null && attached.mWinAnimator.mAnimation != null) || (atoken != null && - (atoken.animation != null + (atoken.mAppAnimator.animation != null || atoken.inPendingTransaction)); } @@ -226,7 +232,7 @@ class WindowStateAnimator { } mHasLocalTransformation = false; if ((!mLocalAnimating || mAnimationIsEntrance) && mWin.mAppToken != null - && mWin.mAppToken.animation != null) { + && mWin.mAppToken.mAppAnimator.animation != null) { // When our app token is animating, we kind-of pretend like // we are as well. Note the mLocalAnimating mAnimationIsEntrance // part of this check means that we will only do this if @@ -313,8 +319,9 @@ class WindowStateAnimator { } finishExit(); - mService.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM; - if (WindowManagerService.DEBUG_LAYOUT_REPEATS) mService.debugLayoutRepeats("WindowState"); + mAnimator.mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM; + if (WindowManagerService.DEBUG_LAYOUT_REPEATS) mService.debugLayoutRepeats( + "WindowStateAnimator", mAnimator.mPendingLayoutChanges); if (mWin.mAppToken != null) { mWin.mAppToken.updateReportedVisibilityLocked(); @@ -450,6 +457,7 @@ class WindowStateAnimator { attrs.getTitle().toString(), 0, w, h, format, flags); mWin.mHasSurface = true; + mAnimator.mWinAnimators.add(this); if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) Slog.i(TAG, " CREATE SURFACE " + mSurface + " IN SESSION " @@ -460,12 +468,14 @@ class WindowStateAnimator { + " / " + this); } catch (Surface.OutOfResourcesException e) { mWin.mHasSurface = false; + mAnimator.mWinAnimators.remove(this); Slog.w(TAG, "OutOfResourcesException creating surface"); mService.reclaimSomeSurfaceMemoryLocked(this, "create", true); mDrawState = NO_SURFACE; return null; } catch (Exception e) { mWin.mHasSurface = false; + mAnimator.mWinAnimators.remove(this); Slog.e(TAG, "Exception creating surface", e); mDrawState = NO_SURFACE; return null; @@ -583,6 +593,7 @@ class WindowStateAnimator { mSurfaceShown = false; mSurface = null; mWin.mHasSurface =false; + mAnimator.mWinAnimators.remove(this); } } @@ -613,9 +624,10 @@ class WindowStateAnimator { Transformation attachedTransformation = (mAttachedWindow != null && mAttachedWindow.mWinAnimator.mHasLocalTransformation) ? mAttachedWindow.mWinAnimator.mTransformation : null; - Transformation appTransformation = - (mWin.mAppToken != null && mWin.mAppToken.hasTransformation) - ? mWin.mAppToken.transformation : null; + final AppWindowAnimator appAnimator = + mWin.mAppToken == null ? null : mWin.mAppToken.mAppAnimator; + Transformation appTransformation = (appAnimator != null && appAnimator.hasTransformation) + ? appAnimator.transformation : null; // Wallpapers are animated based on the "real" window they // are currently targeting. @@ -629,11 +641,13 @@ class WindowStateAnimator { Slog.v(TAG, "WP target attached xform: " + attachedTransformation); } } - if (mService.mWallpaperTarget.mAppToken != null && - mService.mWallpaperTarget.mAppToken.hasTransformation && - mService.mWallpaperTarget.mAppToken.animation != null && - !mService.mWallpaperTarget.mAppToken.animation.getDetachWallpaper()) { - appTransformation = mService.mWallpaperTarget.mAppToken.transformation; + final AppWindowAnimator wpAppAnimator = mService.mWallpaperTarget.mAppToken == null + ? null : mService.mWallpaperTarget.mAppToken.mAppAnimator; + if (wpAppAnimator != null && + wpAppAnimator.hasTransformation && + wpAppAnimator.animation != null && + !wpAppAnimator.animation.getDetachWallpaper()) { + appTransformation = wpAppAnimator.transformation; if (WindowManagerService.DEBUG_WALLPAPER && appTransformation != null) { Slog.v(TAG, "WP target app xform: " + appTransformation); } @@ -916,7 +930,7 @@ class WindowStateAnimator { if (displayed) { if (w.mOrientationChanging) { if (!w.isDrawnLw()) { - mService.mInnerFields.mOrientationChangeComplete = false; + mAnimator.mBulkUpdateParams |= CLEAR_ORIENTATION_CHANGE_COMPLETE; if (DEBUG_ORIENTATION) Slog.v(TAG, "Orientation continue waiting for draw in " + w); } else { @@ -981,7 +995,7 @@ class WindowStateAnimator { + (mWin.mAppToken != null ? mWin.mAppToken.hidden : false) + " animating=" + mAnimating + " tok animating=" - + (mWin.mAppToken != null ? mWin.mAppToken.animating : false)); + + (mWin.mAppToken != null ? mWin.mAppToken.mAppAnimator.animating : false)); if (!showSurfaceRobustlyLocked()) { return false; } diff --git a/services/jni/Android.mk b/services/jni/Android.mk index c02dd36..ac4fd15 100644 --- a/services/jni/Android.mk +++ b/services/jni/Android.mk @@ -4,9 +4,9 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ com_android_server_AlarmManagerService.cpp \ com_android_server_BatteryService.cpp \ - com_android_server_InputApplicationHandle.cpp \ - com_android_server_InputManager.cpp \ - com_android_server_InputWindowHandle.cpp \ + com_android_server_input_InputApplicationHandle.cpp \ + com_android_server_input_InputManagerService.cpp \ + com_android_server_input_InputWindowHandle.cpp \ com_android_server_LightsService.cpp \ com_android_server_PowerManagerService.cpp \ com_android_server_SerialService.cpp \ diff --git a/services/jni/com_android_server_InputApplicationHandle.cpp b/services/jni/com_android_server_input_InputApplicationHandle.cpp index c76ab53..0109430 100644 --- a/services/jni/com_android_server_InputApplicationHandle.cpp +++ b/services/jni/com_android_server_input_InputApplicationHandle.cpp @@ -21,7 +21,7 @@ #include <android_runtime/AndroidRuntime.h> #include <utils/threads.h> -#include "com_android_server_InputApplicationHandle.h" +#include "com_android_server_input_InputApplicationHandle.h" namespace android { @@ -135,12 +135,12 @@ static JNINativeMethod gInputApplicationHandleMethods[] = { LOG_FATAL_IF(! var, "Unable to find field " fieldName); int register_android_server_InputApplicationHandle(JNIEnv* env) { - int res = jniRegisterNativeMethods(env, "com/android/server/wm/InputApplicationHandle", + int res = jniRegisterNativeMethods(env, "com/android/server/input/InputApplicationHandle", gInputApplicationHandleMethods, NELEM(gInputApplicationHandleMethods)); LOG_FATAL_IF(res < 0, "Unable to register native methods."); jclass clazz; - FIND_CLASS(clazz, "com/android/server/wm/InputApplicationHandle"); + FIND_CLASS(clazz, "com/android/server/input/InputApplicationHandle"); GET_FIELD_ID(gInputApplicationHandleClassInfo.ptr, clazz, "ptr", "I"); diff --git a/services/jni/com_android_server_InputApplicationHandle.h b/services/jni/com_android_server_input_InputApplicationHandle.h index 89d48c6..89d48c6 100644 --- a/services/jni/com_android_server_InputApplicationHandle.h +++ b/services/jni/com_android_server_input_InputApplicationHandle.h diff --git a/services/jni/com_android_server_InputManager.cpp b/services/jni/com_android_server_input_InputManagerService.cpp index 5c3e002..c137a78 100644 --- a/services/jni/com_android_server_InputManager.cpp +++ b/services/jni/com_android_server_input_InputManagerService.cpp @@ -46,8 +46,8 @@ #include <android/graphics/GraphicsJNI.h> #include "com_android_server_PowerManagerService.h" -#include "com_android_server_InputApplicationHandle.h" -#include "com_android_server_InputWindowHandle.h" +#include "com_android_server_input_InputApplicationHandle.h" +#include "com_android_server_input_InputWindowHandle.h" namespace android { @@ -77,7 +77,7 @@ static struct { jmethodID getLongPressTimeout; jmethodID getPointerLayer; jmethodID getPointerIcon; -} gCallbacksClassInfo; +} gServiceClassInfo; static struct { jclass clazz; @@ -95,6 +95,7 @@ static struct { jfieldID mId; jfieldID mName; + jfieldID mDescriptor; jfieldID mSources; jfieldID mKeyboardType; jfieldID mKeyCharacterMapFile; @@ -166,7 +167,7 @@ protected: virtual ~NativeInputManager(); public: - NativeInputManager(jobject contextObj, jobject callbacksObj, const sp<Looper>& looper); + NativeInputManager(jobject contextObj, jobject serviceObj, const sp<Looper>& looper); inline sp<InputManager> getInputManager() const { return mInputManager; } @@ -222,7 +223,7 @@ private: sp<InputManager> mInputManager; jobject mContextObj; - jobject mCallbacksObj; + jobject mServiceObj; sp<Looper> mLooper; Mutex mLock; @@ -269,12 +270,12 @@ private: NativeInputManager::NativeInputManager(jobject contextObj, - jobject callbacksObj, const sp<Looper>& looper) : + jobject serviceObj, const sp<Looper>& looper) : mLooper(looper) { JNIEnv* env = jniEnv(); mContextObj = env->NewGlobalRef(contextObj); - mCallbacksObj = env->NewGlobalRef(callbacksObj); + mServiceObj = env->NewGlobalRef(serviceObj); { AutoMutex _l(mLock); @@ -298,7 +299,7 @@ NativeInputManager::~NativeInputManager() { JNIEnv* env = jniEnv(); env->DeleteGlobalRef(mContextObj); - env->DeleteGlobalRef(mCallbacksObj); + env->DeleteGlobalRef(mServiceObj); } void NativeInputManager::dump(String8& dump) { @@ -387,15 +388,15 @@ status_t NativeInputManager::unregisterInputChannel(JNIEnv* env, void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outConfig) { JNIEnv* env = jniEnv(); - jint virtualKeyQuietTime = env->CallIntMethod(mCallbacksObj, - gCallbacksClassInfo.getVirtualKeyQuietTimeMillis); + jint virtualKeyQuietTime = env->CallIntMethod(mServiceObj, + gServiceClassInfo.getVirtualKeyQuietTimeMillis); if (!checkAndClearExceptionFromCallback(env, "getVirtualKeyQuietTimeMillis")) { outConfig->virtualKeyQuietTime = milliseconds_to_nanoseconds(virtualKeyQuietTime); } outConfig->excludedDeviceNames.clear(); - jobjectArray excludedDeviceNames = jobjectArray(env->CallObjectMethod(mCallbacksObj, - gCallbacksClassInfo.getExcludedDeviceNames)); + jobjectArray excludedDeviceNames = jobjectArray(env->CallObjectMethod(mServiceObj, + gServiceClassInfo.getExcludedDeviceNames)); if (!checkAndClearExceptionFromCallback(env, "getExcludedDeviceNames") && excludedDeviceNames) { jsize length = env->GetArrayLength(excludedDeviceNames); for (jsize i = 0; i < length; i++) { @@ -408,14 +409,14 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon env->DeleteLocalRef(excludedDeviceNames); } - jint hoverTapTimeout = env->CallIntMethod(mCallbacksObj, - gCallbacksClassInfo.getHoverTapTimeout); + jint hoverTapTimeout = env->CallIntMethod(mServiceObj, + gServiceClassInfo.getHoverTapTimeout); if (!checkAndClearExceptionFromCallback(env, "getHoverTapTimeout")) { - jint doubleTapTimeout = env->CallIntMethod(mCallbacksObj, - gCallbacksClassInfo.getDoubleTapTimeout); + jint doubleTapTimeout = env->CallIntMethod(mServiceObj, + gServiceClassInfo.getDoubleTapTimeout); if (!checkAndClearExceptionFromCallback(env, "getDoubleTapTimeout")) { - jint longPressTimeout = env->CallIntMethod(mCallbacksObj, - gCallbacksClassInfo.getLongPressTimeout); + jint longPressTimeout = env->CallIntMethod(mServiceObj, + gServiceClassInfo.getLongPressTimeout); if (!checkAndClearExceptionFromCallback(env, "getLongPressTimeout")) { outConfig->pointerGestureTapInterval = milliseconds_to_nanoseconds(hoverTapTimeout); @@ -430,8 +431,8 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon } } - jint hoverTapSlop = env->CallIntMethod(mCallbacksObj, - gCallbacksClassInfo.getHoverTapSlop); + jint hoverTapSlop = env->CallIntMethod(mServiceObj, + gServiceClassInfo.getHoverTapSlop); if (!checkAndClearExceptionFromCallback(env, "getHoverTapSlop")) { outConfig->pointerGestureTapSlop = hoverTapSlop; } @@ -467,8 +468,8 @@ sp<PointerControllerInterface> NativeInputManager::obtainPointerController(int32 controller->setDisplayOrientation(mLocked.displayOrientation); JNIEnv* env = jniEnv(); - jobject pointerIconObj = env->CallObjectMethod(mCallbacksObj, - gCallbacksClassInfo.getPointerIcon); + jobject pointerIconObj = env->CallObjectMethod(mServiceObj, + gServiceClassInfo.getPointerIcon); if (!checkAndClearExceptionFromCallback(env, "getPointerIcon")) { PointerIcon pointerIcon; status_t status = android_view_PointerIcon_load(env, pointerIconObj, @@ -490,7 +491,7 @@ sp<PointerControllerInterface> NativeInputManager::obtainPointerController(int32 void NativeInputManager::ensureSpriteControllerLocked() { if (mLocked.spriteController == NULL) { JNIEnv* env = jniEnv(); - jint layer = env->CallIntMethod(mCallbacksObj, gCallbacksClassInfo.getPointerLayer); + jint layer = env->CallIntMethod(mServiceObj, gServiceClassInfo.getPointerLayer); if (checkAndClearExceptionFromCallback(env, "getPointerLayer")) { layer = -1; } @@ -509,8 +510,9 @@ void NativeInputManager::notifySwitch(nsecs_t when, int32_t switchCode, switch (switchCode) { case SW_LID: - env->CallVoidMethod(mCallbacksObj, gCallbacksClassInfo.notifyLidSwitchChanged, - when, switchValue == 0); + // When switch value is set indicates lid is closed. + env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyLidSwitchChanged, + when, switchValue == 0 /*lidOpen*/); checkAndClearExceptionFromCallback(env, "notifyLidSwitchChanged"); break; } @@ -523,7 +525,7 @@ void NativeInputManager::notifyConfigurationChanged(nsecs_t when) { JNIEnv* env = jniEnv(); - env->CallVoidMethod(mCallbacksObj, gCallbacksClassInfo.notifyConfigurationChanged, when); + env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyConfigurationChanged, when); checkAndClearExceptionFromCallback(env, "notifyConfigurationChanged"); } @@ -540,8 +542,8 @@ nsecs_t NativeInputManager::notifyANR(const sp<InputApplicationHandle>& inputApp jobject inputWindowHandleObj = getInputWindowHandleObjLocalRef(env, inputWindowHandle); - jlong newTimeout = env->CallLongMethod(mCallbacksObj, - gCallbacksClassInfo.notifyANR, inputApplicationHandleObj, inputWindowHandleObj); + jlong newTimeout = env->CallLongMethod(mServiceObj, + gServiceClassInfo.notifyANR, inputApplicationHandleObj, inputWindowHandleObj); if (checkAndClearExceptionFromCallback(env, "notifyANR")) { newTimeout = 0; // abort dispatch } else { @@ -563,7 +565,7 @@ void NativeInputManager::notifyInputChannelBroken(const sp<InputWindowHandle>& i jobject inputWindowHandleObj = getInputWindowHandleObjLocalRef(env, inputWindowHandle); if (inputWindowHandleObj) { - env->CallVoidMethod(mCallbacksObj, gCallbacksClassInfo.notifyInputChannelBroken, + env->CallVoidMethod(mServiceObj, gServiceClassInfo.notifyInputChannelBroken, inputWindowHandleObj); checkAndClearExceptionFromCallback(env, "notifyInputChannelBroken"); @@ -574,14 +576,14 @@ void NativeInputManager::notifyInputChannelBroken(const sp<InputWindowHandle>& i void NativeInputManager::getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) { JNIEnv* env = jniEnv(); - jint keyRepeatTimeout = env->CallIntMethod(mCallbacksObj, - gCallbacksClassInfo.getKeyRepeatTimeout); + jint keyRepeatTimeout = env->CallIntMethod(mServiceObj, + gServiceClassInfo.getKeyRepeatTimeout); if (!checkAndClearExceptionFromCallback(env, "getKeyRepeatTimeout")) { outConfig->keyRepeatTimeout = milliseconds_to_nanoseconds(keyRepeatTimeout); } - jint keyRepeatDelay = env->CallIntMethod(mCallbacksObj, - gCallbacksClassInfo.getKeyRepeatDelay); + jint keyRepeatDelay = env->CallIntMethod(mServiceObj, + gServiceClassInfo.getKeyRepeatDelay); if (!checkAndClearExceptionFromCallback(env, "getKeyRepeatDelay")) { outConfig->keyRepeatDelay = milliseconds_to_nanoseconds(keyRepeatDelay); } @@ -734,7 +736,7 @@ bool NativeInputManager::filterInputEvent(const InputEvent* inputEvent, uint32_t } // The callee is responsible for recycling the event. - jboolean pass = env->CallBooleanMethod(mCallbacksObj, gCallbacksClassInfo.filterInputEvent, + jboolean pass = env->CallBooleanMethod(mServiceObj, gServiceClassInfo.filterInputEvent, inputEventObj, policyFlags); if (checkAndClearExceptionFromCallback(env, "filterInputEvent")) { pass = true; @@ -758,8 +760,8 @@ void NativeInputManager::interceptKeyBeforeQueueing(const KeyEvent* keyEvent, jobject keyEventObj = android_view_KeyEvent_fromNative(env, keyEvent); jint wmActions; if (keyEventObj) { - wmActions = env->CallIntMethod(mCallbacksObj, - gCallbacksClassInfo.interceptKeyBeforeQueueing, + wmActions = env->CallIntMethod(mServiceObj, + gServiceClassInfo.interceptKeyBeforeQueueing, keyEventObj, policyFlags, isScreenOn); if (checkAndClearExceptionFromCallback(env, "interceptKeyBeforeQueueing")) { wmActions = 0; @@ -802,8 +804,8 @@ void NativeInputManager::interceptMotionBeforeQueueing(nsecs_t when, uint32_t& p } } else { JNIEnv* env = jniEnv(); - jint wmActions = env->CallIntMethod(mCallbacksObj, - gCallbacksClassInfo.interceptMotionBeforeQueueingWhenScreenOff, + jint wmActions = env->CallIntMethod(mServiceObj, + gServiceClassInfo.interceptMotionBeforeQueueingWhenScreenOff, policyFlags); if (checkAndClearExceptionFromCallback(env, "interceptMotionBeforeQueueingWhenScreenOff")) { @@ -858,8 +860,8 @@ nsecs_t NativeInputManager::interceptKeyBeforeDispatching( jobject inputWindowHandleObj = getInputWindowHandleObjLocalRef(env, inputWindowHandle); jobject keyEventObj = android_view_KeyEvent_fromNative(env, keyEvent); if (keyEventObj) { - jlong delayMillis = env->CallLongMethod(mCallbacksObj, - gCallbacksClassInfo.interceptKeyBeforeDispatching, + jlong delayMillis = env->CallLongMethod(mServiceObj, + gServiceClassInfo.interceptKeyBeforeDispatching, inputWindowHandleObj, keyEventObj, policyFlags); bool error = checkAndClearExceptionFromCallback(env, "interceptKeyBeforeDispatching"); android_view_KeyEvent_recycle(env, keyEventObj); @@ -891,8 +893,8 @@ bool NativeInputManager::dispatchUnhandledKey(const sp<InputWindowHandle>& input jobject inputWindowHandleObj = getInputWindowHandleObjLocalRef(env, inputWindowHandle); jobject keyEventObj = android_view_KeyEvent_fromNative(env, keyEvent); if (keyEventObj) { - jobject fallbackKeyEventObj = env->CallObjectMethod(mCallbacksObj, - gCallbacksClassInfo.dispatchUnhandledKey, + jobject fallbackKeyEventObj = env->CallObjectMethod(mServiceObj, + gServiceClassInfo.dispatchUnhandledKey, inputWindowHandleObj, keyEventObj, policyFlags); if (checkAndClearExceptionFromCallback(env, "dispatchUnhandledKey")) { fallbackKeyEventObj = NULL; @@ -925,8 +927,8 @@ void NativeInputManager::pokeUserActivity(nsecs_t eventTime, int32_t eventType) bool NativeInputManager::checkInjectEventsPermissionNonReentrant( int32_t injectorPid, int32_t injectorUid) { JNIEnv* env = jniEnv(); - jboolean result = env->CallBooleanMethod(mCallbacksObj, - gCallbacksClassInfo.checkInjectEventsPermission, injectorPid, injectorUid); + jboolean result = env->CallBooleanMethod(mServiceObj, + gServiceClassInfo.checkInjectEventsPermission, injectorPid, injectorUid); if (checkAndClearExceptionFromCallback(env, "checkInjectEventsPermission")) { result = false; } @@ -947,103 +949,76 @@ void NativeInputManager::loadPointerResources(PointerResources* outResources) { // ---------------------------------------------------------------------------- -static sp<NativeInputManager> gNativeInputManager; - -static bool checkInputManagerUnitialized(JNIEnv* env) { - if (gNativeInputManager == NULL) { - ALOGE("Input manager not initialized."); - jniThrowRuntimeException(env, "Input manager not initialized."); - return true; - } - return false; +static jint nativeInit(JNIEnv* env, jclass clazz, + jobject serviceObj, jobject contextObj, jobject messageQueueObj) { + sp<MessageQueue> messageQueue = android_os_MessageQueue_getMessageQueue(env, messageQueueObj); + NativeInputManager* im = new NativeInputManager(contextObj, serviceObj, + messageQueue->getLooper()); + im->incStrong(serviceObj); + return reinterpret_cast<jint>(im); } -static void android_server_InputManager_nativeInit(JNIEnv* env, jclass clazz, - jobject contextObj, jobject callbacksObj, jobject messageQueueObj) { - if (gNativeInputManager == NULL) { - sp<Looper> looper = android_os_MessageQueue_getLooper(env, messageQueueObj); - gNativeInputManager = new NativeInputManager(contextObj, callbacksObj, looper); - } else { - ALOGE("Input manager already initialized."); - jniThrowRuntimeException(env, "Input manager already initialized."); - } -} +static void nativeStart(JNIEnv* env, jclass clazz, jint ptr) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); -static void android_server_InputManager_nativeStart(JNIEnv* env, jclass clazz) { - if (checkInputManagerUnitialized(env)) { - return; - } - - status_t result = gNativeInputManager->getInputManager()->start(); + status_t result = im->getInputManager()->start(); if (result) { jniThrowRuntimeException(env, "Input manager could not be started."); } } -static void android_server_InputManager_nativeSetDisplaySize(JNIEnv* env, jclass clazz, +static void nativeSetDisplaySize(JNIEnv* env, jclass clazz, jint ptr, jint displayId, jint width, jint height, jint externalWidth, jint externalHeight) { - if (checkInputManagerUnitialized(env)) { - return; - } + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); // XXX we could get this from the SurfaceFlinger directly instead of requiring it // to be passed in like this, not sure which is better but leaving it like this // keeps the window manager in direct control of when display transitions propagate down // to the input dispatcher - gNativeInputManager->setDisplaySize(displayId, width, height, externalWidth, externalHeight); + im->setDisplaySize(displayId, width, height, externalWidth, externalHeight); } -static void android_server_InputManager_nativeSetDisplayOrientation(JNIEnv* env, jclass clazz, - jint displayId, jint orientation) { - if (checkInputManagerUnitialized(env)) { - return; - } +static void nativeSetDisplayOrientation(JNIEnv* env, jclass clazz, + jint ptr, jint displayId, jint orientation) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); - gNativeInputManager->setDisplayOrientation(displayId, orientation); + im->setDisplayOrientation(displayId, orientation); } -static jint android_server_InputManager_nativeGetScanCodeState(JNIEnv* env, jclass clazz, - jint deviceId, jint sourceMask, jint scanCode) { - if (checkInputManagerUnitialized(env)) { - return AKEY_STATE_UNKNOWN; - } +static jint nativeGetScanCodeState(JNIEnv* env, jclass clazz, + jint ptr, jint deviceId, jint sourceMask, jint scanCode) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); - return gNativeInputManager->getInputManager()->getReader()->getScanCodeState( + return im->getInputManager()->getReader()->getScanCodeState( deviceId, uint32_t(sourceMask), scanCode); } -static jint android_server_InputManager_nativeGetKeyCodeState(JNIEnv* env, jclass clazz, - jint deviceId, jint sourceMask, jint keyCode) { - if (checkInputManagerUnitialized(env)) { - return AKEY_STATE_UNKNOWN; - } +static jint nativeGetKeyCodeState(JNIEnv* env, jclass clazz, + jint ptr, jint deviceId, jint sourceMask, jint keyCode) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); - return gNativeInputManager->getInputManager()->getReader()->getKeyCodeState( + return im->getInputManager()->getReader()->getKeyCodeState( deviceId, uint32_t(sourceMask), keyCode); } -static jint android_server_InputManager_nativeGetSwitchState(JNIEnv* env, jclass clazz, - jint deviceId, jint sourceMask, jint sw) { - if (checkInputManagerUnitialized(env)) { - return AKEY_STATE_UNKNOWN; - } +static jint nativeGetSwitchState(JNIEnv* env, jclass clazz, + jint ptr, jint deviceId, jint sourceMask, jint sw) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); - return gNativeInputManager->getInputManager()->getReader()->getSwitchState( + return im->getInputManager()->getReader()->getSwitchState( deviceId, uint32_t(sourceMask), sw); } -static jboolean android_server_InputManager_nativeHasKeys(JNIEnv* env, jclass clazz, - jint deviceId, jint sourceMask, jintArray keyCodes, jbooleanArray outFlags) { - if (checkInputManagerUnitialized(env)) { - return JNI_FALSE; - } +static jboolean nativeHasKeys(JNIEnv* env, jclass clazz, + jint ptr, jint deviceId, jint sourceMask, jintArray keyCodes, jbooleanArray outFlags) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); int32_t* codes = env->GetIntArrayElements(keyCodes, NULL); uint8_t* flags = env->GetBooleanArrayElements(outFlags, NULL); jsize numCodes = env->GetArrayLength(keyCodes); jboolean result; if (numCodes == env->GetArrayLength(keyCodes)) { - result = gNativeInputManager->getInputManager()->getReader()->hasKeys( + result = im->getInputManager()->getReader()->hasKeys( deviceId, uint32_t(sourceMask), numCodes, codes, flags); } else { result = JNI_FALSE; @@ -1059,21 +1034,18 @@ static void throwInputChannelNotInitialized(JNIEnv* env) { "inputChannel is not initialized"); } -static void android_server_InputManager_handleInputChannelDisposed(JNIEnv* env, +static void handleInputChannelDisposed(JNIEnv* env, jobject inputChannelObj, const sp<InputChannel>& inputChannel, void* data) { + NativeInputManager* im = static_cast<NativeInputManager*>(data); + ALOGW("Input channel object '%s' was disposed without first being unregistered with " "the input manager!", inputChannel->getName().string()); - - if (gNativeInputManager != NULL) { - gNativeInputManager->unregisterInputChannel(env, inputChannel); - } + im->unregisterInputChannel(env, inputChannel); } -static void android_server_InputManager_nativeRegisterInputChannel(JNIEnv* env, jclass clazz, - jobject inputChannelObj, jobject inputWindowHandleObj, jboolean monitor) { - if (checkInputManagerUnitialized(env)) { - return; - } +static void nativeRegisterInputChannel(JNIEnv* env, jclass clazz, + jint ptr, jobject inputChannelObj, jobject inputWindowHandleObj, jboolean monitor) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); sp<InputChannel> inputChannel = android_view_InputChannel_getInputChannel(env, inputChannelObj); @@ -1085,7 +1057,7 @@ static void android_server_InputManager_nativeRegisterInputChannel(JNIEnv* env, sp<InputWindowHandle> inputWindowHandle = android_server_InputWindowHandle_getHandle(env, inputWindowHandleObj); - status_t status = gNativeInputManager->registerInputChannel( + status_t status = im->registerInputChannel( env, inputChannel, inputWindowHandle, monitor); if (status) { String8 message; @@ -1096,15 +1068,13 @@ static void android_server_InputManager_nativeRegisterInputChannel(JNIEnv* env, if (! monitor) { android_view_InputChannel_setDisposeCallback(env, inputChannelObj, - android_server_InputManager_handleInputChannelDisposed, NULL); + handleInputChannelDisposed, im); } } -static void android_server_InputManager_nativeUnregisterInputChannel(JNIEnv* env, jclass clazz, - jobject inputChannelObj) { - if (checkInputManagerUnitialized(env)) { - return; - } +static void nativeUnregisterInputChannel(JNIEnv* env, jclass clazz, + jint ptr, jobject inputChannelObj) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); sp<InputChannel> inputChannel = android_view_InputChannel_getInputChannel(env, inputChannelObj); @@ -1115,7 +1085,7 @@ static void android_server_InputManager_nativeUnregisterInputChannel(JNIEnv* env android_view_InputChannel_setDisposeCallback(env, inputChannelObj, NULL, NULL); - status_t status = gNativeInputManager->unregisterInputChannel(env, inputChannel); + status_t status = im->unregisterInputChannel(env, inputChannel); if (status && status != BAD_VALUE) { // ignore already unregistered channel String8 message; message.appendFormat("Failed to unregister input channel. status=%d", status); @@ -1123,21 +1093,17 @@ static void android_server_InputManager_nativeUnregisterInputChannel(JNIEnv* env } } -static void android_server_InputManager_nativeSetInputFilterEnabled(JNIEnv* env, jclass clazz, - jboolean enabled) { - if (checkInputManagerUnitialized(env)) { - return; - } +static void nativeSetInputFilterEnabled(JNIEnv* env, jclass clazz, + jint ptr, jboolean enabled) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); - gNativeInputManager->getInputManager()->getDispatcher()->setInputFilterEnabled(enabled); + im->getInputManager()->getDispatcher()->setInputFilterEnabled(enabled); } -static jint android_server_InputManager_nativeInjectInputEvent(JNIEnv* env, jclass clazz, - jobject inputEventObj, jint injectorPid, jint injectorUid, +static jint nativeInjectInputEvent(JNIEnv* env, jclass clazz, + jint ptr, jobject inputEventObj, jint injectorPid, jint injectorUid, jint syncMode, jint timeoutMillis, jint policyFlags) { - if (checkInputManagerUnitialized(env)) { - return INPUT_EVENT_INJECTION_FAILED; - } + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); if (env->IsInstanceOf(inputEventObj, gKeyEventClassInfo.clazz)) { KeyEvent keyEvent; @@ -1147,7 +1113,7 @@ static jint android_server_InputManager_nativeInjectInputEvent(JNIEnv* env, jcla return INPUT_EVENT_INJECTION_FAILED; } - return gNativeInputManager->getInputManager()->getDispatcher()->injectInputEvent( + return im->getInputManager()->getDispatcher()->injectInputEvent( & keyEvent, injectorPid, injectorUid, syncMode, timeoutMillis, uint32_t(policyFlags)); } else if (env->IsInstanceOf(inputEventObj, gMotionEventClassInfo.clazz)) { @@ -1157,7 +1123,7 @@ static jint android_server_InputManager_nativeInjectInputEvent(JNIEnv* env, jcla return INPUT_EVENT_INJECTION_FAILED; } - return gNativeInputManager->getInputManager()->getDispatcher()->injectInputEvent( + return im->getInputManager()->getDispatcher()->injectInputEvent( motionEvent, injectorPid, injectorUid, syncMode, timeoutMillis, uint32_t(policyFlags)); } else { @@ -1166,62 +1132,57 @@ static jint android_server_InputManager_nativeInjectInputEvent(JNIEnv* env, jcla } } -static void android_server_InputManager_nativeSetInputWindows(JNIEnv* env, jclass clazz, - jobjectArray windowHandleObjArray) { - if (checkInputManagerUnitialized(env)) { - return; - } +static void nativeSetInputWindows(JNIEnv* env, jclass clazz, + jint ptr, jobjectArray windowHandleObjArray) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); - gNativeInputManager->setInputWindows(env, windowHandleObjArray); + im->setInputWindows(env, windowHandleObjArray); } -static void android_server_InputManager_nativeSetFocusedApplication(JNIEnv* env, jclass clazz, - jobject applicationHandleObj) { - if (checkInputManagerUnitialized(env)) { - return; - } +static void nativeSetFocusedApplication(JNIEnv* env, jclass clazz, + jint ptr, jobject applicationHandleObj) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); - gNativeInputManager->setFocusedApplication(env, applicationHandleObj); + im->setFocusedApplication(env, applicationHandleObj); } -static void android_server_InputManager_nativeSetInputDispatchMode(JNIEnv* env, - jclass clazz, jboolean enabled, jboolean frozen) { - if (checkInputManagerUnitialized(env)) { - return; - } +static void nativeSetInputDispatchMode(JNIEnv* env, + jclass clazz, jint ptr, jboolean enabled, jboolean frozen) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); - gNativeInputManager->setInputDispatchMode(enabled, frozen); + im->setInputDispatchMode(enabled, frozen); } -static void android_server_InputManager_nativeSetSystemUiVisibility(JNIEnv* env, - jclass clazz, jint visibility) { - if (checkInputManagerUnitialized(env)) { - return; - } +static void nativeSetSystemUiVisibility(JNIEnv* env, + jclass clazz, jint ptr, jint visibility) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); - gNativeInputManager->setSystemUiVisibility(visibility); + im->setSystemUiVisibility(visibility); } -static jobject android_server_InputManager_nativeGetInputDevice(JNIEnv* env, - jclass clazz, jint deviceId) { - if (checkInputManagerUnitialized(env)) { - return NULL; - } +static jobject nativeGetInputDevice(JNIEnv* env, + jclass clazz, jint ptr, jint deviceId) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); InputDeviceInfo deviceInfo; - status_t status = gNativeInputManager->getInputManager()->getReader()->getInputDeviceInfo( + status_t status = im->getInputManager()->getReader()->getInputDeviceInfo( deviceId, & deviceInfo); if (status) { return NULL; } jobject deviceObj = env->NewObject(gInputDeviceClassInfo.clazz, gInputDeviceClassInfo.ctor); - if (! deviceObj) { + if (!deviceObj) { return NULL; } jstring deviceNameObj = env->NewStringUTF(deviceInfo.getName().string()); - if (! deviceNameObj) { + if (!deviceNameObj) { + return NULL; + } + + jstring deviceDescriptorObj = env->NewStringUTF(deviceInfo.getDescriptor().string()); + if (!deviceDescriptorObj) { return NULL; } @@ -1232,6 +1193,7 @@ static jobject android_server_InputManager_nativeGetInputDevice(JNIEnv* env, env->SetIntField(deviceObj, gInputDeviceClassInfo.mId, deviceInfo.getId()); env->SetObjectField(deviceObj, gInputDeviceClassInfo.mName, deviceNameObj); + env->SetObjectField(deviceObj, gInputDeviceClassInfo.mDescriptor, deviceDescriptorObj); env->SetIntField(deviceObj, gInputDeviceClassInfo.mSources, deviceInfo.getSources()); env->SetIntField(deviceObj, gInputDeviceClassInfo.mKeyboardType, deviceInfo.getKeyboardType()); env->SetObjectField(deviceObj, gInputDeviceClassInfo.mKeyCharacterMapFile, fileStr); @@ -1249,14 +1211,12 @@ static jobject android_server_InputManager_nativeGetInputDevice(JNIEnv* env, return deviceObj; } -static jintArray android_server_InputManager_nativeGetInputDeviceIds(JNIEnv* env, - jclass clazz) { - if (checkInputManagerUnitialized(env)) { - return NULL; - } +static jintArray nativeGetInputDeviceIds(JNIEnv* env, + jclass clazz, jint ptr) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); Vector<int> deviceIds; - gNativeInputManager->getInputManager()->getReader()->getInputDeviceIds(deviceIds); + im->getInputManager()->getReader()->getInputDeviceIds(deviceIds); jintArray deviceIdsObj = env->NewIntArray(deviceIds.size()); if (! deviceIdsObj) { @@ -1267,25 +1227,21 @@ static jintArray android_server_InputManager_nativeGetInputDeviceIds(JNIEnv* env return deviceIdsObj; } -static void android_server_InputManager_nativeGetInputConfiguration(JNIEnv* env, - jclass clazz, jobject configObj) { - if (checkInputManagerUnitialized(env)) { - return; - } +static void nativeGetInputConfiguration(JNIEnv* env, + jclass clazz, jint ptr, jobject configObj) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); InputConfiguration config; - gNativeInputManager->getInputManager()->getReader()->getInputConfiguration(& config); + im->getInputManager()->getReader()->getInputConfiguration(& config); env->SetIntField(configObj, gConfigurationClassInfo.touchscreen, config.touchScreen); env->SetIntField(configObj, gConfigurationClassInfo.keyboard, config.keyboard); env->SetIntField(configObj, gConfigurationClassInfo.navigation, config.navigation); } -static jboolean android_server_InputManager_nativeTransferTouchFocus(JNIEnv* env, - jclass clazz, jobject fromChannelObj, jobject toChannelObj) { - if (checkInputManagerUnitialized(env)) { - return false; - } +static jboolean nativeTransferTouchFocus(JNIEnv* env, + jclass clazz, jint ptr, jobject fromChannelObj, jobject toChannelObj) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); sp<InputChannel> fromChannel = android_view_InputChannel_getInputChannel(env, fromChannelObj); @@ -1296,101 +1252,93 @@ static jboolean android_server_InputManager_nativeTransferTouchFocus(JNIEnv* env return false; } - return gNativeInputManager->getInputManager()->getDispatcher()-> + return im->getInputManager()->getDispatcher()-> transferTouchFocus(fromChannel, toChannel); } -static void android_server_InputManager_nativeSetPointerSpeed(JNIEnv* env, - jclass clazz, jint speed) { - if (checkInputManagerUnitialized(env)) { - return; - } +static void nativeSetPointerSpeed(JNIEnv* env, + jclass clazz, jint ptr, jint speed) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); - gNativeInputManager->setPointerSpeed(speed); + im->setPointerSpeed(speed); } -static void android_server_InputManager_nativeSetShowTouches(JNIEnv* env, - jclass clazz, jboolean enabled) { - if (checkInputManagerUnitialized(env)) { - return; - } +static void nativeSetShowTouches(JNIEnv* env, + jclass clazz, jint ptr, jboolean enabled) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); - gNativeInputManager->setShowTouches(enabled); + im->setShowTouches(enabled); } -static jstring android_server_InputManager_nativeDump(JNIEnv* env, jclass clazz) { - if (checkInputManagerUnitialized(env)) { - return NULL; - } +static jstring nativeDump(JNIEnv* env, jclass clazz, jint ptr) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); String8 dump; - gNativeInputManager->dump(dump); + im->dump(dump); return env->NewStringUTF(dump.string()); } -static void android_server_InputManager_nativeMonitor(JNIEnv* env, jclass clazz) { - if (checkInputManagerUnitialized(env)) { - return; - } +static void nativeMonitor(JNIEnv* env, jclass clazz, jint ptr) { + NativeInputManager* im = reinterpret_cast<NativeInputManager*>(ptr); - gNativeInputManager->getInputManager()->getReader()->monitor(); - gNativeInputManager->getInputManager()->getDispatcher()->monitor(); + im->getInputManager()->getReader()->monitor(); + im->getInputManager()->getDispatcher()->monitor(); } // ---------------------------------------------------------------------------- static JNINativeMethod gInputManagerMethods[] = { /* name, signature, funcPtr */ - { "nativeInit", "(Landroid/content/Context;" - "Lcom/android/server/wm/InputManager$Callbacks;Landroid/os/MessageQueue;)V", - (void*) android_server_InputManager_nativeInit }, - { "nativeStart", "()V", - (void*) android_server_InputManager_nativeStart }, - { "nativeSetDisplaySize", "(IIIII)V", - (void*) android_server_InputManager_nativeSetDisplaySize }, - { "nativeSetDisplayOrientation", "(II)V", - (void*) android_server_InputManager_nativeSetDisplayOrientation }, - { "nativeGetScanCodeState", "(III)I", - (void*) android_server_InputManager_nativeGetScanCodeState }, - { "nativeGetKeyCodeState", "(III)I", - (void*) android_server_InputManager_nativeGetKeyCodeState }, - { "nativeGetSwitchState", "(III)I", - (void*) android_server_InputManager_nativeGetSwitchState }, - { "nativeHasKeys", "(II[I[Z)Z", - (void*) android_server_InputManager_nativeHasKeys }, + { "nativeInit", + "(Lcom/android/server/input/InputManagerService;Landroid/content/Context;Landroid/os/MessageQueue;)I", + (void*) nativeInit }, + { "nativeStart", "(I)V", + (void*) nativeStart }, + { "nativeSetDisplaySize", "(IIIIII)V", + (void*) nativeSetDisplaySize }, + { "nativeSetDisplayOrientation", "(III)V", + (void*) nativeSetDisplayOrientation }, + { "nativeGetScanCodeState", "(IIII)I", + (void*) nativeGetScanCodeState }, + { "nativeGetKeyCodeState", "(IIII)I", + (void*) nativeGetKeyCodeState }, + { "nativeGetSwitchState", "(IIII)I", + (void*) nativeGetSwitchState }, + { "nativeHasKeys", "(III[I[Z)Z", + (void*) nativeHasKeys }, { "nativeRegisterInputChannel", - "(Landroid/view/InputChannel;Lcom/android/server/wm/InputWindowHandle;Z)V", - (void*) android_server_InputManager_nativeRegisterInputChannel }, - { "nativeUnregisterInputChannel", "(Landroid/view/InputChannel;)V", - (void*) android_server_InputManager_nativeUnregisterInputChannel }, - { "nativeSetInputFilterEnabled", "(Z)V", - (void*) android_server_InputManager_nativeSetInputFilterEnabled }, - { "nativeInjectInputEvent", "(Landroid/view/InputEvent;IIIII)I", - (void*) android_server_InputManager_nativeInjectInputEvent }, - { "nativeSetInputWindows", "([Lcom/android/server/wm/InputWindowHandle;)V", - (void*) android_server_InputManager_nativeSetInputWindows }, - { "nativeSetFocusedApplication", "(Lcom/android/server/wm/InputApplicationHandle;)V", - (void*) android_server_InputManager_nativeSetFocusedApplication }, - { "nativeSetInputDispatchMode", "(ZZ)V", - (void*) android_server_InputManager_nativeSetInputDispatchMode }, - { "nativeSetSystemUiVisibility", "(I)V", - (void*) android_server_InputManager_nativeSetSystemUiVisibility }, - { "nativeGetInputDevice", "(I)Landroid/view/InputDevice;", - (void*) android_server_InputManager_nativeGetInputDevice }, - { "nativeGetInputDeviceIds", "()[I", - (void*) android_server_InputManager_nativeGetInputDeviceIds }, - { "nativeGetInputConfiguration", "(Landroid/content/res/Configuration;)V", - (void*) android_server_InputManager_nativeGetInputConfiguration }, - { "nativeTransferTouchFocus", "(Landroid/view/InputChannel;Landroid/view/InputChannel;)Z", - (void*) android_server_InputManager_nativeTransferTouchFocus }, - { "nativeSetPointerSpeed", "(I)V", - (void*) android_server_InputManager_nativeSetPointerSpeed }, - { "nativeSetShowTouches", "(Z)V", - (void*) android_server_InputManager_nativeSetShowTouches }, - { "nativeDump", "()Ljava/lang/String;", - (void*) android_server_InputManager_nativeDump }, - { "nativeMonitor", "()V", - (void*) android_server_InputManager_nativeMonitor }, + "(ILandroid/view/InputChannel;Lcom/android/server/input/InputWindowHandle;Z)V", + (void*) nativeRegisterInputChannel }, + { "nativeUnregisterInputChannel", "(ILandroid/view/InputChannel;)V", + (void*) nativeUnregisterInputChannel }, + { "nativeSetInputFilterEnabled", "(IZ)V", + (void*) nativeSetInputFilterEnabled }, + { "nativeInjectInputEvent", "(ILandroid/view/InputEvent;IIIII)I", + (void*) nativeInjectInputEvent }, + { "nativeSetInputWindows", "(I[Lcom/android/server/input/InputWindowHandle;)V", + (void*) nativeSetInputWindows }, + { "nativeSetFocusedApplication", "(ILcom/android/server/input/InputApplicationHandle;)V", + (void*) nativeSetFocusedApplication }, + { "nativeSetInputDispatchMode", "(IZZ)V", + (void*) nativeSetInputDispatchMode }, + { "nativeSetSystemUiVisibility", "(II)V", + (void*) nativeSetSystemUiVisibility }, + { "nativeGetInputDevice", "(II)Landroid/view/InputDevice;", + (void*) nativeGetInputDevice }, + { "nativeGetInputDeviceIds", "(I)[I", + (void*) nativeGetInputDeviceIds }, + { "nativeGetInputConfiguration", "(ILandroid/content/res/Configuration;)V", + (void*) nativeGetInputConfiguration }, + { "nativeTransferTouchFocus", "(ILandroid/view/InputChannel;Landroid/view/InputChannel;)Z", + (void*) nativeTransferTouchFocus }, + { "nativeSetPointerSpeed", "(II)V", + (void*) nativeSetPointerSpeed }, + { "nativeSetShowTouches", "(IZ)V", + (void*) nativeSetShowTouches }, + { "nativeDump", "(I)Ljava/lang/String;", + (void*) nativeDump }, + { "nativeMonitor", "(I)V", + (void*) nativeMonitor }, }; #define FIND_CLASS(var, className) \ @@ -1406,77 +1354,77 @@ static JNINativeMethod gInputManagerMethods[] = { LOG_FATAL_IF(! var, "Unable to find field " fieldName); int register_android_server_InputManager(JNIEnv* env) { - int res = jniRegisterNativeMethods(env, "com/android/server/wm/InputManager", + int res = jniRegisterNativeMethods(env, "com/android/server/input/InputManagerService", gInputManagerMethods, NELEM(gInputManagerMethods)); LOG_FATAL_IF(res < 0, "Unable to register native methods."); // Callbacks jclass clazz; - FIND_CLASS(clazz, "com/android/server/wm/InputManager$Callbacks"); + FIND_CLASS(clazz, "com/android/server/input/InputManagerService"); - GET_METHOD_ID(gCallbacksClassInfo.notifyConfigurationChanged, clazz, + GET_METHOD_ID(gServiceClassInfo.notifyConfigurationChanged, clazz, "notifyConfigurationChanged", "(J)V"); - GET_METHOD_ID(gCallbacksClassInfo.notifyLidSwitchChanged, clazz, + GET_METHOD_ID(gServiceClassInfo.notifyLidSwitchChanged, clazz, "notifyLidSwitchChanged", "(JZ)V"); - GET_METHOD_ID(gCallbacksClassInfo.notifyInputChannelBroken, clazz, - "notifyInputChannelBroken", "(Lcom/android/server/wm/InputWindowHandle;)V"); + GET_METHOD_ID(gServiceClassInfo.notifyInputChannelBroken, clazz, + "notifyInputChannelBroken", "(Lcom/android/server/input/InputWindowHandle;)V"); - GET_METHOD_ID(gCallbacksClassInfo.notifyANR, clazz, + GET_METHOD_ID(gServiceClassInfo.notifyANR, clazz, "notifyANR", - "(Lcom/android/server/wm/InputApplicationHandle;Lcom/android/server/wm/InputWindowHandle;)J"); + "(Lcom/android/server/input/InputApplicationHandle;Lcom/android/server/input/InputWindowHandle;)J"); - GET_METHOD_ID(gCallbacksClassInfo.filterInputEvent, clazz, + GET_METHOD_ID(gServiceClassInfo.filterInputEvent, clazz, "filterInputEvent", "(Landroid/view/InputEvent;I)Z"); - GET_METHOD_ID(gCallbacksClassInfo.interceptKeyBeforeQueueing, clazz, + GET_METHOD_ID(gServiceClassInfo.interceptKeyBeforeQueueing, clazz, "interceptKeyBeforeQueueing", "(Landroid/view/KeyEvent;IZ)I"); - GET_METHOD_ID(gCallbacksClassInfo.interceptMotionBeforeQueueingWhenScreenOff, + GET_METHOD_ID(gServiceClassInfo.interceptMotionBeforeQueueingWhenScreenOff, clazz, "interceptMotionBeforeQueueingWhenScreenOff", "(I)I"); - GET_METHOD_ID(gCallbacksClassInfo.interceptKeyBeforeDispatching, clazz, + GET_METHOD_ID(gServiceClassInfo.interceptKeyBeforeDispatching, clazz, "interceptKeyBeforeDispatching", - "(Lcom/android/server/wm/InputWindowHandle;Landroid/view/KeyEvent;I)J"); + "(Lcom/android/server/input/InputWindowHandle;Landroid/view/KeyEvent;I)J"); - GET_METHOD_ID(gCallbacksClassInfo.dispatchUnhandledKey, clazz, + GET_METHOD_ID(gServiceClassInfo.dispatchUnhandledKey, clazz, "dispatchUnhandledKey", - "(Lcom/android/server/wm/InputWindowHandle;Landroid/view/KeyEvent;I)Landroid/view/KeyEvent;"); + "(Lcom/android/server/input/InputWindowHandle;Landroid/view/KeyEvent;I)Landroid/view/KeyEvent;"); - GET_METHOD_ID(gCallbacksClassInfo.checkInjectEventsPermission, clazz, + GET_METHOD_ID(gServiceClassInfo.checkInjectEventsPermission, clazz, "checkInjectEventsPermission", "(II)Z"); - GET_METHOD_ID(gCallbacksClassInfo.getVirtualKeyQuietTimeMillis, clazz, + GET_METHOD_ID(gServiceClassInfo.getVirtualKeyQuietTimeMillis, clazz, "getVirtualKeyQuietTimeMillis", "()I"); - GET_METHOD_ID(gCallbacksClassInfo.getExcludedDeviceNames, clazz, + GET_METHOD_ID(gServiceClassInfo.getExcludedDeviceNames, clazz, "getExcludedDeviceNames", "()[Ljava/lang/String;"); - GET_METHOD_ID(gCallbacksClassInfo.getKeyRepeatTimeout, clazz, + GET_METHOD_ID(gServiceClassInfo.getKeyRepeatTimeout, clazz, "getKeyRepeatTimeout", "()I"); - GET_METHOD_ID(gCallbacksClassInfo.getKeyRepeatDelay, clazz, + GET_METHOD_ID(gServiceClassInfo.getKeyRepeatDelay, clazz, "getKeyRepeatDelay", "()I"); - GET_METHOD_ID(gCallbacksClassInfo.getHoverTapTimeout, clazz, + GET_METHOD_ID(gServiceClassInfo.getHoverTapTimeout, clazz, "getHoverTapTimeout", "()I"); - GET_METHOD_ID(gCallbacksClassInfo.getHoverTapSlop, clazz, + GET_METHOD_ID(gServiceClassInfo.getHoverTapSlop, clazz, "getHoverTapSlop", "()I"); - GET_METHOD_ID(gCallbacksClassInfo.getDoubleTapTimeout, clazz, + GET_METHOD_ID(gServiceClassInfo.getDoubleTapTimeout, clazz, "getDoubleTapTimeout", "()I"); - GET_METHOD_ID(gCallbacksClassInfo.getLongPressTimeout, clazz, + GET_METHOD_ID(gServiceClassInfo.getLongPressTimeout, clazz, "getLongPressTimeout", "()I"); - GET_METHOD_ID(gCallbacksClassInfo.getPointerLayer, clazz, + GET_METHOD_ID(gServiceClassInfo.getPointerLayer, clazz, "getPointerLayer", "()I"); - GET_METHOD_ID(gCallbacksClassInfo.getPointerIcon, clazz, + GET_METHOD_ID(gServiceClassInfo.getPointerIcon, clazz, "getPointerIcon", "()Landroid/view/PointerIcon;"); // KeyEvent @@ -1484,7 +1432,6 @@ int register_android_server_InputManager(JNIEnv* env) { FIND_CLASS(gKeyEventClassInfo.clazz, "android/view/KeyEvent"); gKeyEventClassInfo.clazz = jclass(env->NewGlobalRef(gKeyEventClassInfo.clazz)); - // MotionEvent FIND_CLASS(gMotionEventClassInfo.clazz, "android/view/MotionEvent"); @@ -1507,6 +1454,9 @@ int register_android_server_InputManager(JNIEnv* env) { GET_FIELD_ID(gInputDeviceClassInfo.mName, gInputDeviceClassInfo.clazz, "mName", "Ljava/lang/String;"); + GET_FIELD_ID(gInputDeviceClassInfo.mDescriptor, gInputDeviceClassInfo.clazz, + "mDescriptor", "Ljava/lang/String;"); + GET_FIELD_ID(gInputDeviceClassInfo.mSources, gInputDeviceClassInfo.clazz, "mSources", "I"); diff --git a/services/jni/com_android_server_InputWindowHandle.cpp b/services/jni/com_android_server_input_InputWindowHandle.cpp index 0607eee..01fb781 100644 --- a/services/jni/com_android_server_InputWindowHandle.cpp +++ b/services/jni/com_android_server_input_InputWindowHandle.cpp @@ -24,8 +24,8 @@ #include <android_view_InputChannel.h> #include <android/graphics/Region.h> -#include "com_android_server_InputWindowHandle.h" -#include "com_android_server_InputApplicationHandle.h" +#include "com_android_server_input_InputWindowHandle.h" +#include "com_android_server_input_InputApplicationHandle.h" namespace android { @@ -218,19 +218,19 @@ static JNINativeMethod gInputWindowHandleMethods[] = { LOG_FATAL_IF(! var, "Unable to find field " fieldName); int register_android_server_InputWindowHandle(JNIEnv* env) { - int res = jniRegisterNativeMethods(env, "com/android/server/wm/InputWindowHandle", + int res = jniRegisterNativeMethods(env, "com/android/server/input/InputWindowHandle", gInputWindowHandleMethods, NELEM(gInputWindowHandleMethods)); LOG_FATAL_IF(res < 0, "Unable to register native methods."); jclass clazz; - FIND_CLASS(clazz, "com/android/server/wm/InputWindowHandle"); + FIND_CLASS(clazz, "com/android/server/input/InputWindowHandle"); GET_FIELD_ID(gInputWindowHandleClassInfo.ptr, clazz, "ptr", "I"); GET_FIELD_ID(gInputWindowHandleClassInfo.inputApplicationHandle, clazz, - "inputApplicationHandle", "Lcom/android/server/wm/InputApplicationHandle;"); + "inputApplicationHandle", "Lcom/android/server/input/InputApplicationHandle;"); GET_FIELD_ID(gInputWindowHandleClassInfo.inputChannel, clazz, "inputChannel", "Landroid/view/InputChannel;"); diff --git a/services/jni/com_android_server_InputWindowHandle.h b/services/jni/com_android_server_input_InputWindowHandle.h index 2cfa17d3..2cfa17d3 100644 --- a/services/jni/com_android_server_InputWindowHandle.h +++ b/services/jni/com_android_server_input_InputWindowHandle.h diff --git a/services/tests/servicestests/AndroidManifest.xml b/services/tests/servicestests/AndroidManifest.xml index 60be35a..cc3c328 100644 --- a/services/tests/servicestests/AndroidManifest.xml +++ b/services/tests/servicestests/AndroidManifest.xml @@ -32,6 +32,7 @@ <uses-permission android:name="android.permission.READ_NETWORK_USAGE_HISTORY" /> <uses-permission android:name="android.permission.MODIFY_NETWORK_ACCOUNTING" /> <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" /> + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <application> <uses-library android:name="android.test.runner" /> diff --git a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java index 88ee867..ba3fd3c 100644 --- a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java @@ -627,8 +627,8 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { // pretend that 512 bytes total have happened stats = new NetworkStats(getElapsedRealtime(), 1) .addIfaceValues(TEST_IFACE, 256L, 2L, 256L, 2L); - expect(mStatsService.getSummaryForNetwork(sTemplateWifi, TIME_FEB_15, TIME_MAR_10)) - .andReturn(stats).atLeastOnce(); + expect(mStatsService.getNetworkTotalBytes(sTemplateWifi, TIME_FEB_15, TIME_MAR_10)) + .andReturn(stats.getTotalBytes()).atLeastOnce(); expectPolicyDataEnable(TYPE_WIFI, true); // TODO: consider making strongly ordered mock @@ -698,8 +698,8 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { { expectCurrentTime(); expect(mConnManager.getAllNetworkState()).andReturn(state).atLeastOnce(); - expect(mStatsService.getSummaryForNetwork(sTemplateWifi, TIME_FEB_15, currentTimeMillis())) - .andReturn(stats).atLeastOnce(); + expect(mStatsService.getNetworkTotalBytes(sTemplateWifi, TIME_FEB_15, currentTimeMillis())) + .andReturn(stats.getTotalBytes()).atLeastOnce(); expectPolicyDataEnable(TYPE_WIFI, true); expectClearNotifications(); @@ -721,8 +721,8 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { { expectCurrentTime(); expect(mConnManager.getAllNetworkState()).andReturn(state).atLeastOnce(); - expect(mStatsService.getSummaryForNetwork(sTemplateWifi, TIME_FEB_15, currentTimeMillis())) - .andReturn(stats).atLeastOnce(); + expect(mStatsService.getNetworkTotalBytes(sTemplateWifi, TIME_FEB_15, currentTimeMillis())) + .andReturn(stats.getTotalBytes()).atLeastOnce(); expectPolicyDataEnable(TYPE_WIFI, true); expectRemoveInterfaceQuota(TEST_IFACE); @@ -744,8 +744,8 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { { expectCurrentTime(); - expect(mStatsService.getSummaryForNetwork(sTemplateWifi, TIME_FEB_15, currentTimeMillis())) - .andReturn(stats).atLeastOnce(); + expect(mStatsService.getNetworkTotalBytes(sTemplateWifi, TIME_FEB_15, currentTimeMillis())) + .andReturn(stats.getTotalBytes()).atLeastOnce(); expectPolicyDataEnable(TYPE_WIFI, true); expectForceUpdate(); @@ -765,8 +765,8 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { { expectCurrentTime(); - expect(mStatsService.getSummaryForNetwork(sTemplateWifi, TIME_FEB_15, currentTimeMillis())) - .andReturn(stats).atLeastOnce(); + expect(mStatsService.getNetworkTotalBytes(sTemplateWifi, TIME_FEB_15, currentTimeMillis())) + .andReturn(stats.getTotalBytes()).atLeastOnce(); expectPolicyDataEnable(TYPE_WIFI, false); expectForceUpdate(); @@ -785,8 +785,8 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { { expectCurrentTime(); expect(mConnManager.getAllNetworkState()).andReturn(state).atLeastOnce(); - expect(mStatsService.getSummaryForNetwork(sTemplateWifi, TIME_FEB_15, currentTimeMillis())) - .andReturn(stats).atLeastOnce(); + expect(mStatsService.getNetworkTotalBytes(sTemplateWifi, TIME_FEB_15, currentTimeMillis())) + .andReturn(stats.getTotalBytes()).atLeastOnce(); expectPolicyDataEnable(TYPE_WIFI, true); // snoozed interface still has high quota so background data is @@ -826,8 +826,8 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { { expectCurrentTime(); expect(mConnManager.getAllNetworkState()).andReturn(state).atLeastOnce(); - expect(mStatsService.getSummaryForNetwork(sTemplateWifi, TIME_FEB_15, currentTimeMillis())) - .andReturn(stats).atLeastOnce(); + expect(mStatsService.getNetworkTotalBytes(sTemplateWifi, TIME_FEB_15, currentTimeMillis())) + .andReturn(stats.getTotalBytes()).atLeastOnce(); expectPolicyDataEnable(TYPE_WIFI, true); expectRemoveInterfaceQuota(TEST_IFACE); @@ -981,7 +981,7 @@ public class NetworkPolicyManagerServiceTest extends AndroidTestCase { } } - /** {@inheritDoc} */ + @Override public boolean queueIdle() { set(null); return false; diff --git a/services/tests/servicestests/src/com/android/server/NetworkStatsServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkStatsServiceTest.java index daf2018..6d9bb29 100644 --- a/services/tests/servicestests/src/com/android/server/NetworkStatsServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/NetworkStatsServiceTest.java @@ -54,6 +54,7 @@ import android.app.PendingIntent; import android.content.Intent; import android.net.IConnectivityManager; import android.net.INetworkManagementEventObserver; +import android.net.INetworkStatsSession; import android.net.LinkProperties; import android.net.NetworkInfo; import android.net.NetworkInfo.DetailedState; @@ -113,6 +114,7 @@ public class NetworkStatsServiceTest extends AndroidTestCase { private IConnectivityManager mConnManager; private NetworkStatsService mService; + private INetworkStatsSession mSession; private INetworkManagementEventObserver mNetworkObserver; @Override @@ -134,6 +136,7 @@ public class NetworkStatsServiceTest extends AndroidTestCase { mService = new NetworkStatsService( mServiceContext, mNetManager, mAlarmManager, mTime, mStatsDir, mSettings); mService.bindConnectivityManager(mConnManager); + mSession = mService.openSession(); mElapsedRealtime = 0L; @@ -172,6 +175,7 @@ public class NetworkStatsServiceTest extends AndroidTestCase { mSettings = null; mConnManager = null; + mSession.close(); mService = null; super.tearDown(); @@ -349,7 +353,7 @@ public class NetworkStatsServiceTest extends AndroidTestCase { mServiceContext.sendBroadcast(new Intent(ACTION_NETWORK_STATS_POLL)); // verify service recorded history - history = mService.getHistoryForNetwork(sTemplateWifi, FIELD_ALL); + history = mSession.getHistoryForNetwork(sTemplateWifi, FIELD_ALL); assertValues(history, Long.MIN_VALUE, Long.MAX_VALUE, 512L, 4L, 512L, 4L, 0); assertEquals(HOUR_IN_MILLIS, history.getBucketDuration()); assertEquals(2, history.size()); @@ -367,7 +371,7 @@ public class NetworkStatsServiceTest extends AndroidTestCase { mServiceContext.sendBroadcast(new Intent(ACTION_NETWORK_STATS_POLL)); // verify identical stats, but spread across 4 buckets now - history = mService.getHistoryForNetwork(sTemplateWifi, FIELD_ALL); + history = mSession.getHistoryForNetwork(sTemplateWifi, FIELD_ALL); assertValues(history, Long.MIN_VALUE, Long.MAX_VALUE, 512L, 4L, 512L, 4L, 0); assertEquals(30 * MINUTE_IN_MILLIS, history.getBucketDuration()); assertEquals(4, history.size()); @@ -652,7 +656,7 @@ public class NetworkStatsServiceTest extends AndroidTestCase { mServiceContext.sendBroadcast(new Intent(ACTION_NETWORK_STATS_POLL)); // first verify entire history present - NetworkStats stats = mService.getSummaryForAllUid( + NetworkStats stats = mSession.getSummaryForAllUid( sTemplateWifi, Long.MIN_VALUE, Long.MAX_VALUE, true); assertEquals(3, stats.size()); assertValues(stats, IFACE_ALL, UID_RED, SET_DEFAULT, TAG_NONE, 50L, 5L, 50L, 5L, 1); @@ -661,7 +665,7 @@ public class NetworkStatsServiceTest extends AndroidTestCase { // now verify that recent history only contains one uid final long currentTime = currentTimeMillis(); - stats = mService.getSummaryForAllUid( + stats = mSession.getSummaryForAllUid( sTemplateWifi, currentTime - HOUR_IN_MILLIS, currentTime, true); assertEquals(1, stats.size()); assertValues(stats, IFACE_ALL, UID_BLUE, SET_DEFAULT, TAG_NONE, 1024L, 8L, 512L, 4L, 0); @@ -723,7 +727,7 @@ public class NetworkStatsServiceTest extends AndroidTestCase { assertUidTotal(sTemplateWifi, UID_RED, 160L, 4L, 160L, 4L, 2); // verify entire history present - final NetworkStats stats = mService.getSummaryForAllUid( + final NetworkStats stats = mSession.getSummaryForAllUid( sTemplateWifi, Long.MIN_VALUE, Long.MAX_VALUE, true); assertEquals(4, stats.size()); assertValues(stats, IFACE_ALL, UID_RED, SET_DEFAULT, TAG_NONE, 128L, 2L, 128L, 2L, 1); @@ -775,20 +779,20 @@ public class NetworkStatsServiceTest extends AndroidTestCase { } private void assertNetworkTotal(NetworkTemplate template, long rxBytes, long rxPackets, - long txBytes, long txPackets, int operations) { - final NetworkStatsHistory history = mService.getHistoryForNetwork(template, FIELD_ALL); + long txBytes, long txPackets, int operations) throws Exception { + final NetworkStatsHistory history = mSession.getHistoryForNetwork(template, FIELD_ALL); assertValues(history, Long.MIN_VALUE, Long.MAX_VALUE, rxBytes, rxPackets, txBytes, txPackets, operations); } private void assertUidTotal(NetworkTemplate template, int uid, long rxBytes, long rxPackets, - long txBytes, long txPackets, int operations) { + long txBytes, long txPackets, int operations) throws Exception { assertUidTotal(template, uid, SET_ALL, rxBytes, rxPackets, txBytes, txPackets, operations); } private void assertUidTotal(NetworkTemplate template, int uid, int set, long rxBytes, - long rxPackets, long txBytes, long txPackets, int operations) { - final NetworkStatsHistory history = mService.getHistoryForUid( + long rxPackets, long txBytes, long txPackets, int operations) throws Exception { + final NetworkStatsHistory history = mSession.getHistoryForUid( template, uid, set, TAG_NONE, FIELD_ALL); assertValues(history, Long.MIN_VALUE, Long.MAX_VALUE, rxBytes, rxPackets, txBytes, txPackets, operations); diff --git a/services/tests/servicestests/src/com/android/server/net/NetworkStatsCollectionTest.java b/services/tests/servicestests/src/com/android/server/net/NetworkStatsCollectionTest.java index 7f05f56..e40f166 100644 --- a/services/tests/servicestests/src/com/android/server/net/NetworkStatsCollectionTest.java +++ b/services/tests/servicestests/src/com/android/server/net/NetworkStatsCollectionTest.java @@ -20,8 +20,6 @@ import static android.net.NetworkTemplate.buildTemplateMobileAll; import static android.text.format.DateUtils.MINUTE_IN_MILLIS; import android.content.res.Resources; -import android.net.ConnectivityManager; -import android.net.NetworkIdentity; import android.net.NetworkStats; import android.net.NetworkTemplate; import android.test.AndroidTestCase; @@ -145,12 +143,6 @@ public class NetworkStatsCollectionTest extends AndroidTestCase { } } - public static NetworkIdentitySet buildWifiIdent() { - final NetworkIdentitySet set = new NetworkIdentitySet(); - set.add(new NetworkIdentity(ConnectivityManager.TYPE_WIFI, 0, null, false)); - return set; - } - private static void assertSummaryTotal(NetworkStatsCollection collection, NetworkTemplate template, long rxBytes, long rxPackets, long txBytes, long txPackets) { final NetworkStats.Entry entry = collection.getSummary( diff --git a/telephony/java/android/telephony/CdmaCellIdentity.java b/telephony/java/android/telephony/CdmaCellIdentity.java new file mode 100644 index 0000000..5b8454f --- /dev/null +++ b/telephony/java/android/telephony/CdmaCellIdentity.java @@ -0,0 +1,164 @@ +/* + * 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.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * CellIdentity is to represent a unique CDMA cell + * + * @hide pending API review + */ +public final class CdmaCellIdentity extends CellIdentity implements Parcelable { + // Network Id 0..65535 + private final int mNetworkId; + // CDMA System Id 0..32767 + private final int mSystemId; + // Base Station Id 0..65535 + private final int mBasestationId; + /** + * Longitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0. + * It is represented in units of 0.25 seconds and ranges from -2592000 + * to 2592000, both values inclusive (corresponding to a range of -180 + * to +180 degrees). + */ + private final int mLongitude; + /** + * Latitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0. + * It is represented in units of 0.25 seconds and ranges from -1296000 + * to 1296000, both values inclusive (corresponding to a range of -90 + * to +90 degrees). + */ + private final int mLatitude; + + /** + * public constructor + * @param nid Network Id 0..65535 + * @param sid CDMA System Id 0..32767 + * @param bid Base Station Id 0..65535 + * @param lon Longitude is a decimal number ranges from -2592000 + * to 2592000 + * @param lat Latitude is a decimal number ranges from -1296000 + * to 1296000 + * @param attr is comma separated “key=value” attribute pairs. + */ + public CdmaCellIdentity (int nid, int sid, + int bid, int lon, int lat, String attr) { + super(CELLID_TYPE_CDMA, attr); + mNetworkId = nid; + mSystemId = sid; + mBasestationId = bid; + mLongitude = lon; + mLatitude = lat; + } + + private CdmaCellIdentity(Parcel in) { + super(in); + mNetworkId = in.readInt(); + mSystemId = in.readInt(); + mBasestationId = in.readInt(); + mLongitude = in.readInt(); + mLatitude = in.readInt(); + } + + CdmaCellIdentity(CdmaCellIdentity cid) { + super(cid); + mNetworkId = cid.mNetworkId; + mSystemId = cid.mSystemId; + mBasestationId = cid.mBasestationId; + mLongitude = cid.mLongitude; + mLatitude = cid.mLatitude; + } + + /** + * @return Network Id 0..65535 + */ + public int getNetworkId() { + return mNetworkId; + } + + /** + * @return System Id 0..32767 + */ + public int getSystemId() { + return mSystemId; + } + + /** + * @return Base Station Id 0..65535 + */ + public int getBasestationId() { + return mBasestationId; + } + + /** + * @return Base station longitude, which is a decimal number as + * specified in 3GPP2 C.S0005-A v6.0. It is represented in units + * of 0.25 seconds and ranges from -2592000 to 2592000, both + * values inclusive (corresponding to a range of -180 + * to +180 degrees). + */ + public int getLongitude() { + return mLongitude; + } + + /** + * @return Base station + */ + /** + * @return Base station latitude, which is a decimal number as + * specified in 3GPP2 C.S0005-A v6.0. It is represented in units + * of 0.25 seconds and ranges from -1296000 to 1296000, both + * values inclusive (corresponding to a range of -90 + * to +90 degrees). + */ + public int getLatitude() { + return mLatitude; + } + + /** Implement the Parcelable interface {@hide} */ + @Override + public int describeContents() { + return 0; + } + + /** Implement the Parcelable interface {@hide} */ + @Override + public void writeToParcel(Parcel dest, int flags) { + super.writeToParcel(dest, flags); + dest.writeInt(mNetworkId); + dest.writeInt(mSystemId); + dest.writeInt(mBasestationId); + dest.writeInt(mLongitude); + dest.writeInt(mLatitude); + } + + /** Implement the Parcelable interface {@hide} */ + public static final Creator<CdmaCellIdentity> CREATOR = + new Creator<CdmaCellIdentity>() { + @Override + public CdmaCellIdentity createFromParcel(Parcel in) { + return new CdmaCellIdentity(in); + } + + @Override + public CdmaCellIdentity[] newArray(int size) { + return new CdmaCellIdentity[size]; + } + }; +} diff --git a/telephony/java/android/telephony/CellIdentity.java b/telephony/java/android/telephony/CellIdentity.java new file mode 100644 index 0000000..65c220f --- /dev/null +++ b/telephony/java/android/telephony/CellIdentity.java @@ -0,0 +1,89 @@ +/* + * 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.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * CellIdentity is to represent ONE unique cell in the world + * it contains all levels of info to identity country, carrier, etc. + * + * @hide pending API review + */ +public abstract class CellIdentity implements Parcelable { + + // Cell is a GSM Cell {@link GsmCellIdentity} + public static final int CELLID_TYPE_GSM = 1; + // Cell is a CMDA Cell {@link CdmaCellIdentity} + public static final int CELLID_TYPE_CDMA = 2; + // Cell is a LTE Cell {@link LteCellIdentity} + public static final int CELLID_TYPE_LTE = 3; + + private int mCellIdType; + private String mCellIdAttributes; + + protected CellIdentity(int type, String attr) { + this.mCellIdType = type; + this.mCellIdAttributes = new String(attr); + } + + protected CellIdentity(Parcel in) { + this.mCellIdType = in.readInt(); + this.mCellIdAttributes = new String(in.readString()); + } + + protected CellIdentity(CellIdentity cid) { + this.mCellIdType = cid.mCellIdType; + this.mCellIdAttributes = new String(cid.mCellIdAttributes); + } + + /** + * @return Cell Identity type as one of CELLID_TYPE_XXXX + */ + public int getCellIdType() { + return mCellIdType; + } + + + /** + * @return Cell identity attribute pairs + * Comma separated “key=value” pairs. + * key := must must an single alpha-numeric word + * value := “quoted value string” + * + * Current list of keys and values: + * type = fixed | mobile + */ + public String getCellIdAttributes() { + return mCellIdAttributes; + } + + + /** Implement the Parcelable interface {@hide} */ + @Override + public int describeContents() { + return 0; + } + + /** Implement the Parcelable interface {@hide} */ + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(mCellIdType); + dest.writeString(mCellIdAttributes); + } +} diff --git a/telephony/java/android/telephony/CellInfo.aidl b/telephony/java/android/telephony/CellInfo.aidl new file mode 100644 index 0000000..8bbb0b4 --- /dev/null +++ b/telephony/java/android/telephony/CellInfo.aidl @@ -0,0 +1,20 @@ +/* +** +** Copyright 2007, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +package android.telephony; + +parcelable CellInfo;
\ No newline at end of file diff --git a/telephony/java/android/telephony/CellInfo.java b/telephony/java/android/telephony/CellInfo.java new file mode 100644 index 0000000..9bea30c --- /dev/null +++ b/telephony/java/android/telephony/CellInfo.java @@ -0,0 +1,218 @@ +/* + * 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.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * Represent one snapshot observation of one cell info + * which contains the time of observation. + * + * @hide Pending API review + */ +public final class CellInfo implements Parcelable { + // Type to distinguish where time stamp gets recorded. + public static final int CELL_INFO_TIMESTAMP_TYPE_UNKNOWN = 0; + public static final int CELL_INFO_TIMESTAMP_TYPE_ANTENNA = 1; + public static final int CELL_INFO_TIMESTAMP_TYPE_MODEM = 2; + public static final int CELL_INFO_TIMESTAMP_TYPE_OEM_RIL = 3; + public static final int CELL_INFO_TIMESTAMP_TYPE_JAVA_RIL = 4; + + // Observation time stamped as type in nanoseconds since boot + private final long mTimeStamp; + // Where time stamp gets recorded. + // Value of CELL_INFO_TIMESTAMP_TYPE_XXXX + private final int mTimeStampType; + + private final boolean mRegistered; + + private final SignalStrength mStrength; + private final long mTimingAdvance; + + private final int mCellIdentityType; + private final CellIdentity mCellIdentity; + + /** + * Public constructor + * @param timeStampType is one of CELL_INFO_TIMESTAMP_TYPE_XXXX + * @param timeStamp is observation time in nanoseconds since boot + * @param timingAdv is observed timing advance + * @param registered is true when register to this cellIdentity + * @param strength is observed signal strength + * @param cellIdentity is observed mobile cell + */ + public CellInfo(int timeStampType, long timeStamp, long timingAdv, + boolean registered, SignalStrength strength, + CellIdentity cellIdentity) { + + if (timeStampType < CELL_INFO_TIMESTAMP_TYPE_UNKNOWN || + timeStampType > CELL_INFO_TIMESTAMP_TYPE_JAVA_RIL) { + mTimeStampType = CELL_INFO_TIMESTAMP_TYPE_UNKNOWN; + } else { + mTimeStampType = timeStampType; + } + + mRegistered = registered; + mTimeStamp = timeStamp; + mTimingAdvance = timingAdv; + mStrength = new SignalStrength(strength); + + mCellIdentityType = cellIdentity.getCellIdType(); + // TODO: make defense copy + mCellIdentity = cellIdentity; + } + + public CellInfo(CellInfo ci) { + this.mTimeStampType = ci.mTimeStampType; + this.mRegistered = ci.mRegistered; + this.mTimeStamp = ci.mTimeStamp; + this.mTimingAdvance = ci.mTimingAdvance; + this.mCellIdentityType = ci.mCellIdentityType; + this.mStrength = new SignalStrength(ci.mStrength); + switch(mCellIdentityType) { + case CellIdentity.CELLID_TYPE_GSM: + mCellIdentity = new GsmCellIdentity((GsmCellIdentity)ci.mCellIdentity); + break; + default: + mCellIdentity = null; + } + } + + private CellInfo(Parcel in) { + mTimeStampType = in.readInt(); + mRegistered = (in.readInt() == 1) ? true : false; + mTimeStamp = in.readLong(); + mTimingAdvance = in.readLong(); + mCellIdentityType = in.readInt(); + mStrength = SignalStrength.CREATOR.createFromParcel(in); + switch(mCellIdentityType) { + case CellIdentity.CELLID_TYPE_GSM: + mCellIdentity = GsmCellIdentity.CREATOR.createFromParcel(in); + break; + default: + mCellIdentity = null; + } + } + + /** + * @return the observation time in nanoseconds since boot + */ + public long getTimeStamp() { + return mTimeStamp; + } + + /** + * @return Where time stamp gets recorded. + * one of CELL_INFO_TIMESTAMP_TYPE_XXXX + */ + public int getTimeStampType() { + return mTimeStampType; + } + + /** + * @return true when register to this cellIdentity + */ + public boolean isRegistered() { + return mRegistered; + } + + /** + * @return observed timing advance + */ + public long getTimingAdvance() { + return mTimingAdvance; + } + + /** + * @return observed signal strength + */ + public SignalStrength getSignalStrength() { + // make a defense copy + return new SignalStrength(mStrength); + } + + /** + * @return observed cell identity + */ + public CellIdentity getCellIdentity() { + // TODO: make a defense copy + return mCellIdentity; + } + + @Override + public String toString() { + StringBuffer sb = new StringBuffer(); + + sb.append("TimeStampType: "); + switch(mTimeStampType) { + case 1: + sb.append("antenna"); + break; + case 2: + sb.append("modem"); + break; + case 3: + sb.append("oem_ril"); + break; + case 4: + sb.append("java_ril"); + break; + default: + sb.append("unknown"); + } + sb.append(", TimeStamp: ").append(mTimeStamp).append(" ns"); + sb.append(", Registered: ").append(mRegistered ? "YES" : "NO"); + sb.append(", TimingAdvance: ").append(mTimingAdvance); + sb.append(", Strength : " + mStrength); + sb.append(", Cell Iden: " + mCellIdentity); + + return sb.toString(); + } + + /** Implement the Parcelable interface {@hide} */ + @Override + public int describeContents() { + return 0; + } + + /** Implement the Parcelable interface {@hide} */ + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(mTimeStampType); + dest.writeInt(mRegistered ? 1 : 0); + dest.writeLong(mTimeStamp); + dest.writeLong(mTimingAdvance); + dest.writeInt(mCellIdentityType); + mStrength.writeToParcel(dest, flags); + mCellIdentity.writeToParcel(dest, flags); + } + + /** Implement the Parcelable interface {@hide} */ + public static final Creator<CellInfo> CREATOR = + new Creator<CellInfo>() { + @Override + public CellInfo createFromParcel(Parcel in) { + return new CellInfo(in); + } + + @Override + public CellInfo[] newArray(int size) { + return new CellInfo[size]; + } + }; +} diff --git a/telephony/java/android/telephony/GsmCellIdentity.java b/telephony/java/android/telephony/GsmCellIdentity.java new file mode 100644 index 0000000..159cb52 --- /dev/null +++ b/telephony/java/android/telephony/GsmCellIdentity.java @@ -0,0 +1,148 @@ +/* + * 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.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * CellIdentity to represent a unique GSM or UMTS cell + * + * @hide pending API review + */ +public final class GsmCellIdentity extends CellIdentity implements Parcelable { + + // 3-digit Mobile Country Code, 0..999 + private final int mMcc; + // 2 or 3-digit Mobile Network Code, 0..999 + private final int mMnc; + // 16-bit Location Area Code, 0..65535 + private final int mLac; + // 16-bit GSM Cell Identity described in TS 27.007, 0..65535 + // 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455 + private final int mCid; + // 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511 + private final int mPsc; + + /** + * public constructor + * @param mcc 3-digit Mobile Country Code, 0..999 + * @param mnc 2 or 3-digit Mobile Network Code, 0..999 + * @param lac 16-bit Location Area Code, 0..65535 + * @param cid 16-bit GSM Cell Identity or 28-bit UMTS Cell Identity + * @param psc 9-bit UMTS Primary Scrambling Code + * @param attr is comma separated “key=value” attribute pairs. + */ + public GsmCellIdentity (int mcc, int mnc, + int lac, int cid, int psc, String attr) { + super(CELLID_TYPE_GSM, attr); + mMcc = mcc; + mMnc = mnc; + mLac = lac; + mCid = cid; + mPsc = psc; + } + + private GsmCellIdentity(Parcel in) { + super(in); + mMcc = in.readInt(); + mMnc = in.readInt(); + mLac = in.readInt(); + mCid = in.readInt(); + mPsc = in.readInt(); + } + + GsmCellIdentity(GsmCellIdentity cid) { + super(cid); + mMcc = cid.mMcc; + mMnc = cid.mMnc; + mLac = cid.mLac; + mCid = cid.mCid; + mPsc = cid.mPsc; + } + + /** + * @return 3-digit Mobile Country Code, 0..999 + */ + public int getMcc() { + return mMcc; + } + + /** + * @return 2 or 3-digit Mobile Network Code, 0..999 + */ + public int getMnc() { + return mMnc; + } + + /** + * @return 16-bit Location Area Code, 0..65535 + */ + public int getLac() { + return mLac; + } + + /** + * @return CID + * Either 16-bit GSM Cell Identity described + * in TS 27.007, 0..65535 + * or 28-bit UMTS Cell Identity described + * in TS 25.331, 0..268435455 + */ + public int getCid() { + return mCid; + } + + /** + * @return 9-bit UMTS Primary Scrambling Code described in + * TS 25.331, 0..511 + */ + public int getPsc() { + return mPsc; + } + + /** Implement the Parcelable interface {@hide} */ + @Override + public int describeContents() { + return 0; + } + + /** Implement the Parcelable interface {@hide} */ + @Override + public void writeToParcel(Parcel dest, int flags) { + super.writeToParcel(dest, flags); + dest.writeInt(mMcc); + dest.writeInt(mMnc); + dest.writeInt(mLac); + dest.writeInt(mCid); + dest.writeInt(mPsc); + } + + /** Implement the Parcelable interface {@hide} */ + public static final Creator<GsmCellIdentity> CREATOR = + new Creator<GsmCellIdentity>() { + @Override + public GsmCellIdentity createFromParcel(Parcel in) { + return new GsmCellIdentity(in); + } + + @Override + public GsmCellIdentity[] newArray(int size) { + return new GsmCellIdentity[size]; + } + }; +} diff --git a/telephony/java/android/telephony/LteCellIdentity.java b/telephony/java/android/telephony/LteCellIdentity.java new file mode 100644 index 0000000..396922e --- /dev/null +++ b/telephony/java/android/telephony/LteCellIdentity.java @@ -0,0 +1,142 @@ +/* + * 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.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * CellIdentity is to represent a unique LTE cell + * + * @hide pending API review + */ +public final class LteCellIdentity extends CellIdentity implements Parcelable { + + // 3-digit Mobile Country Code, 0..999 + private final int mMcc; + // 2 or 3-digit Mobile Network Code, 0..999 + private final int mMnc; + // 28-bit cell identity + private final int mCi; + // physical cell id 0..503 + private final int mPci; + // 16-bit tracking area code + private final int mTac; + + /** + * + * @param mcc 3-digit Mobile Country Code, 0..999 + * @param mnc 2 or 3-digit Mobile Network Code, 0..999 + * @param ci 28-bit Cell Identity + * @param pci Physical Cell Id 0..503 + * @param tac 16-bit Tracking Area Code + * @param attr is comma separated “key=value” attribute pairs. + */ + public LteCellIdentity (int mcc, int mnc, + int ci, int pci, int tac, String attr) { + super(CELLID_TYPE_CDMA, attr); + mMcc = mcc; + mMnc = mnc; + mCi = ci; + mPci = pci; + mTac = tac; + } + + private LteCellIdentity(Parcel in) { + super(in); + mMcc = in.readInt(); + mMnc = in.readInt(); + mCi = in.readInt(); + mPci = in.readInt(); + mTac = in.readInt(); + } + + LteCellIdentity(LteCellIdentity cid) { + super(cid); + mMcc = cid.mMcc; + mMnc = cid.mMnc; + mCi = cid.mCi; + mPci = cid.mPci; + mTac = cid.mTac; + } + + /** + * @return 3-digit Mobile Country Code, 0..999 + */ + public int getMcc() { + return mMcc; + } + + /** + * @return 2 or 3-digit Mobile Network Code, 0..999 + */ + public int getMnc() { + return mMnc; + } + + /** + * @return 28-bit Cell Identity + */ + public int getCi() { + return mCi; + } + + /** + * @return Physical Cell Id 0..503 + */ + public int getPci() { + return mPci; + } + + /** + * @return 16-bit Tracking Area Code + */ + public int getTac() { + return mTac; + } + + /** Implement the Parcelable interface {@hide} */ + @Override + public int describeContents() { + return 0; + } + + /** Implement the Parcelable interface {@hide} */ + @Override + public void writeToParcel(Parcel dest, int flags) { + super.writeToParcel(dest, flags); + dest.writeInt(mMcc); + dest.writeInt(mMnc); + dest.writeInt(mCi); + dest.writeInt(mPci); + dest.writeInt(mTac); + } + + /** Implement the Parcelable interface {@hide} */ + public static final Creator<LteCellIdentity> CREATOR = + new Creator<LteCellIdentity>() { + @Override + public LteCellIdentity createFromParcel(Parcel in) { + return new LteCellIdentity(in); + } + + @Override + public LteCellIdentity[] newArray(int size) { + return new LteCellIdentity[size]; + } + }; +} diff --git a/telephony/java/android/telephony/NeighboringCellInfo.aidl b/telephony/java/android/telephony/NeighboringCellInfo.aidl index c464332..8588970 100644 --- a/telephony/java/android/telephony/NeighboringCellInfo.aidl +++ b/telephony/java/android/telephony/NeighboringCellInfo.aidl @@ -1,4 +1,4 @@ -/* //device/java/android/android/content/Intent.aidl +/* ** ** Copyright 2007, The Android Open Source Project ** diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java index eda9b71..698206c 100644 --- a/telephony/java/android/telephony/PhoneStateListener.java +++ b/telephony/java/android/telephony/PhoneStateListener.java @@ -22,6 +22,7 @@ import android.os.Message; import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.telephony.CellLocation; +import android.telephony.CellInfo; import android.util.Log; import com.android.internal.telephony.IPhoneStateListener; @@ -156,6 +157,14 @@ public class PhoneStateListener { */ public static final int LISTEN_OTASP_CHANGED = 0x00000200; + /** + * Listen for changes to observed cell info. + * + * @see #onCellInfoChanged + * @hide pending API review + */ + public static final int LISTEN_CELL_INFO = 0x00000400; + public PhoneStateListener() { } @@ -276,6 +285,20 @@ public class PhoneStateListener { } /** + * Callback invoked when a observed cell info gets changed. + * + * A notification should be sent when: + * 1. a cell is newly-observed. + * 2. a observed cell is not visible. + * 3. any of the cell info of a observed cell has changed. + * + * @hide pending API review + */ + public void onCellInfoChanged(CellInfo cellInfo) { + // default implementation empty + } + + /** * The callback methods need to be called on the handler thread where * this object was created. If the binder did that for us it'd be nice. */ @@ -323,6 +346,10 @@ public class PhoneStateListener { public void onOtaspChanged(int otaspMode) { Message.obtain(mHandler, LISTEN_OTASP_CHANGED, otaspMode, 0).sendToTarget(); } + + public void onCellInfoChanged(CellInfo cellInfo) { + Message.obtain(mHandler, LISTEN_CELL_INFO, 0, 0).sendToTarget(); + } }; Handler mHandler = new Handler() { @@ -360,6 +387,8 @@ public class PhoneStateListener { case LISTEN_OTASP_CHANGED: PhoneStateListener.this.onOtaspChanged(msg.arg1); break; + case LISTEN_CELL_INFO: + PhoneStateListener.this.onCellInfoChanged((CellInfo)msg.obj); } } }; diff --git a/telephony/java/android/telephony/ServiceState.aidl b/telephony/java/android/telephony/ServiceState.aidl index 8522889..830e2cbf 100644 --- a/telephony/java/android/telephony/ServiceState.aidl +++ b/telephony/java/android/telephony/ServiceState.aidl @@ -1,4 +1,4 @@ -/* //device/java/android/android/content/Intent.aidl +/* ** ** Copyright 2007, The Android Open Source Project ** diff --git a/telephony/java/android/telephony/SignalStrength.aidl b/telephony/java/android/telephony/SignalStrength.aidl index c25411e..e988c5f 100644 --- a/telephony/java/android/telephony/SignalStrength.aidl +++ b/telephony/java/android/telephony/SignalStrength.aidl @@ -1,4 +1,4 @@ -/* //device/java/android/android/content/Intent.aidl +/* ** ** Copyright (C) 2009 Qualcomm Innovation Center, Inc. All Rights Reserved. ** Copyright (C) 2009 The Android Open Source Project diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index db78e2e..bc50906 100755 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -23,7 +23,6 @@ import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; -import android.util.Log; import com.android.internal.telephony.IPhoneSubInfo; import com.android.internal.telephony.ITelephony; @@ -85,6 +84,10 @@ public class TelephonyManager { return sInstance; } + /** {@hide} */ + public static TelephonyManager from(Context context) { + return (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); + } // // Broadcast Intent actions @@ -1138,4 +1141,24 @@ public class TelephonyManager { return sContext.getResources().getBoolean( com.android.internal.R.bool.config_sms_capable); } + + /** + * Returns all observed cell information of the device. + * + * @return List of CellInfo or null if info unavailable. + * + * <p>Requires Permission: + * (@link android.Manifest.permission#ACCESS_COARSE_UPDATES} + * + * @hide pending API review + */ + public List<CellInfo> getAllCellInfo() { + try { + return getITelephony().getAllCellInfo(); + } catch (RemoteException ex) { + return null; + } catch (NullPointerException ex) { + return null; + } + } } diff --git a/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java b/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java index f769157..eb78a53 100644 --- a/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java +++ b/telephony/java/com/android/internal/telephony/DefaultPhoneNotifier.java @@ -21,6 +21,7 @@ import android.net.LinkProperties; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; +import android.telephony.CellInfo; import android.telephony.ServiceState; import android.telephony.TelephonyManager; import android.util.Log; @@ -156,6 +157,14 @@ public class DefaultPhoneNotifier implements PhoneNotifier { } } + public void notifyCellInfo(Phone sender, CellInfo cellInfo) { + try { + mRegistry.notifyCellInfo(cellInfo); + } catch (RemoteException ex) { + + } + } + public void notifyOtaspChanged(Phone sender, int otaspMode) { try { mRegistry.notifyOtaspChanged(otaspMode); diff --git a/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl b/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl index 082c097..d6a1edd 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl @@ -19,6 +19,7 @@ package com.android.internal.telephony; import android.os.Bundle; import android.telephony.ServiceState; import android.telephony.SignalStrength; +import android.telephony.CellInfo; oneway interface IPhoneStateListener { void onServiceStateChanged(in ServiceState serviceState); @@ -33,5 +34,6 @@ oneway interface IPhoneStateListener { void onDataActivity(int direction); void onSignalStrengthsChanged(in SignalStrength signalStrength); void onOtaspChanged(in int otaspMode); + void onCellInfoChanged(in CellInfo cellInfo); } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 19441cd..12a7286 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -19,6 +19,7 @@ package com.android.internal.telephony; import android.os.Bundle; import java.util.List; import android.telephony.NeighboringCellInfo; +import android.telephony.CellInfo; /** * Interface used to interact with the phone. Mostly this is used by the @@ -278,5 +279,10 @@ interface ITelephony { * or {@link PHone#LTE_ON_CDMA_TRUE} */ int getLteOnCdmaMode(); + + /** + * Returns the all observed cell information of the device. + */ + List<CellInfo> getAllCellInfo(); } diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl index 1f19282..3c9a99b 100644 --- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl @@ -22,6 +22,7 @@ import android.net.LinkCapabilities; import android.os.Bundle; import android.telephony.ServiceState; import android.telephony.SignalStrength; +import android.telephony.CellInfo; import com.android.internal.telephony.IPhoneStateListener; interface ITelephonyRegistry { @@ -39,4 +40,5 @@ interface ITelephonyRegistry { void notifyDataConnectionFailed(String reason, String apnType); void notifyCellLocation(in Bundle cellLocation); void notifyOtaspChanged(in int otaspMode); + void notifyCellInfo(in CellInfo cellInfo); } diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java index 2139917..92024cd 100644 --- a/telephony/java/com/android/internal/telephony/IccCard.java +++ b/telephony/java/com/android/internal/telephony/IccCard.java @@ -580,7 +580,9 @@ public class IccCard { mHandler.sendMessage(mHandler.obtainMessage(EVENT_CARD_ADDED, null)); } - if (oldState != State.READY && newState == State.READY) { + // Call onReady only when SIM or RUIM card becomes ready (not NV) + if (oldState != State.READY && newState == State.READY && + (is3gpp || isSubscriptionFromIccCard)) { mIccFileHandler.setAid(getAid()); mIccRecords.onReady(); } diff --git a/telephony/java/com/android/internal/telephony/PhoneNotifier.java b/telephony/java/com/android/internal/telephony/PhoneNotifier.java index 28a8d22..1076870 100644 --- a/telephony/java/com/android/internal/telephony/PhoneNotifier.java +++ b/telephony/java/com/android/internal/telephony/PhoneNotifier.java @@ -16,6 +16,8 @@ package com.android.internal.telephony; +import android.telephony.CellInfo; + /** * {@hide} */ @@ -42,4 +44,7 @@ public interface PhoneNotifier { public void notifyDataActivity(Phone sender); public void notifyOtaspChanged(Phone sender, int otaspMode); + + // TODO - trigger notifyCellInfo from ServiceStateTracker + public void notifyCellInfo(Phone sender, CellInfo cellInfo); } diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java index ed0081b..9f6ec71 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java +++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java @@ -205,6 +205,8 @@ public class CDMAPhone extends PhoneBase { // Sets operator numeric property by retrieving from build-time system property String operatorNumeric = SystemProperties.get(PROPERTY_CDMA_HOME_OPERATOR_NUMERIC); + log("CDMAPhone: init set 'gsm.sim.operator.numeric' to operator='" + + operatorNumeric + "'"); setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, operatorNumeric); // Sets iso country property by retrieving from build-time system property diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java index 3855515..2fefa3f 100755 --- a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java +++ b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java @@ -329,11 +329,11 @@ public final class RuimRecords extends IccRecords { @Override protected void onAllRecordsLoaded() { - log("RuimRecords: record load complete"); - // Further records that can be inserted are Operator/OEM dependent String operator = getRUIMOperatorNumeric(); + log("RuimRecords: onAllRecordsLoaded set 'gsm.sim.operator.numeric' to operator='" + + operator + "'"); SystemProperties.set(PROPERTY_ICC_OPERATOR_NUMERIC, operator); if (mImsi != null) { diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java index b88af2c..80988fd 100755 --- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java +++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java @@ -228,6 +228,7 @@ public class SIMRecords extends IccRecords { adnCache.reset(); + log("SIMRecords: onRadioOffOrNotAvailable set 'gsm.sim.operator.numeric' to operator=null"); SystemProperties.set(PROPERTY_ICC_OPERATOR_NUMERIC, null); SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, null); SystemProperties.set(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, null); @@ -1254,12 +1255,12 @@ public class SIMRecords extends IccRecords { } protected void onAllRecordsLoaded() { - log("record load complete"); - String operator = getOperatorNumeric(); // Some fields require more than one SIM record to set + log("SIMRecords: onAllRecordsLoaded set 'gsm.sim.operator.numeric' to operator='" + + operator + "'"); SystemProperties.set(PROPERTY_ICC_OPERATOR_NUMERIC, operator); if (imsi != null) { diff --git a/telephony/tests/telephonytests/src/com/android/internal/telephony/TestPhoneNotifier.java b/telephony/tests/telephonytests/src/com/android/internal/telephony/TestPhoneNotifier.java index 7bbe696..cb67a93 100644 --- a/telephony/tests/telephonytests/src/com/android/internal/telephony/TestPhoneNotifier.java +++ b/telephony/tests/telephonytests/src/com/android/internal/telephony/TestPhoneNotifier.java @@ -17,6 +17,7 @@ package com.android.internal.telephony; import com.android.internal.telephony.Phone; +import android.telephony.CellInfo; /** * Stub class used for unit tests @@ -59,4 +60,7 @@ public class TestPhoneNotifier implements PhoneNotifier { public void notifyOtaspChanged(Phone sender, int otaspMode) { } + + public void notifyCellInfo(Phone sender, CellInfo cellInfo) { + } } diff --git a/test-runner/src/android/test/AndroidTestRunner.java b/test-runner/src/android/test/AndroidTestRunner.java index fc9832c..30876d0 100644 --- a/test-runner/src/android/test/AndroidTestRunner.java +++ b/test-runner/src/android/test/AndroidTestRunner.java @@ -28,6 +28,7 @@ import junit.framework.TestResult; import junit.framework.TestSuite; import junit.runner.BaseTestRunner; +import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.List; @@ -91,15 +92,35 @@ public class AndroidTestRunner extends BaseTestRunner { private TestCase buildSingleTestMethod(Class testClass, String testMethodName) { try { - TestCase testCase = (TestCase) testClass.newInstance(); + Constructor c = testClass.getConstructor(); + return newSingleTestMethod(testClass, testMethodName, c); + } catch (NoSuchMethodException e) { + } + + try { + Constructor c = testClass.getConstructor(String.class); + return newSingleTestMethod(testClass, testMethodName, c, testMethodName); + } catch (NoSuchMethodException e) { + } + + return null; + } + + private TestCase newSingleTestMethod(Class testClass, String testMethodName, + Constructor constructor, Object... args) { + try { + TestCase testCase = (TestCase) constructor.newInstance(args); testCase.setName(testMethodName); return testCase; } catch (IllegalAccessException e) { runFailed("Could not access test class. Class: " + testClass.getName()); } catch (InstantiationException e) { runFailed("Could not instantiate test class. Class: " + testClass.getName()); + } catch (IllegalArgumentException e) { + runFailed("Illegal argument passed to constructor. Class: " + testClass.getName()); + } catch (InvocationTargetException e) { + runFailed("Constructor thew an exception. Class: " + testClass.getName()); } - return null; } diff --git a/tests/BiDiTests/res/layout/textview_alignment_ltr.xml b/tests/BiDiTests/res/layout/textview_alignment_ltr.xml new file mode 100644 index 0000000..0e1adba --- /dev/null +++ b/tests/BiDiTests/res/layout/textview_alignment_ltr.xml @@ -0,0 +1,578 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/textview_alignment_ltr" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:layoutDirection="ltr"> + + <TableLayout android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + <TableRow> + <TextView android:text="(unspecified)" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity (default)" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity left" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:gravity="left" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:gravity="left" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity right" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:gravity="right" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:gravity="right" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity start" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:gravity="start" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:gravity="start" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity end" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:gravity="end" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:gravity="end" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity center" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:gravity="center" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:gravity="center" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity center_horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:gravity="center_horizontal" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:gravity="center_horizontal" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="center" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="center" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="center" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="textStart" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="textStart" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="textStart" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="textEnd" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="textEnd" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="textEnd" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="viewStart" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="viewStart" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="viewStart" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="viewEnd" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="viewEnd" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="viewEnd" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow android:textAlignment="gravity" + android:gravity="center_horizontal"> + + <TextView android:text="inherit gravity (default)" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow android:textAlignment="center"> + + <TextView android:text="inherit gravity center" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow android:textAlignment="textStart"> + + <TextView android:text="inherit textStart" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow android:textAlignment="textEnd"> + + <TextView android:text="inherit textEnd" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow android:textAlignment="viewStart"> + + <TextView android:text="inherit viewStart" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow android:textAlignment="viewEnd"> + + <TextView android:text="inherit viewEnd" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + </TableLayout> + +</FrameLayout> diff --git a/tests/BiDiTests/res/layout/textview_alignment_rtl.xml b/tests/BiDiTests/res/layout/textview_alignment_rtl.xml new file mode 100644 index 0000000..12a90d5 --- /dev/null +++ b/tests/BiDiTests/res/layout/textview_alignment_rtl.xml @@ -0,0 +1,578 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/textview_alignment_rtl" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:layoutDirection="rtl"> + + <TableLayout android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + <TableRow> + <TextView android:text="(unspecified)" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity (default)" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity left" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:gravity="left" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:gravity="left" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity right" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:gravity="right" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:gravity="right" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity start" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:gravity="start" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:gravity="start" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity end" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:gravity="end" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:gravity="end" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity center" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:gravity="center" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:gravity="center" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="gravity center_horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="gravity" + android:gravity="center_horizontal" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="gravity" + android:gravity="center_horizontal" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="center" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="center" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="center" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="textStart" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="textStart" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="textStart" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="textEnd" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="textEnd" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="textEnd" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="viewStart" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="viewStart" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="viewStart" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow> + <TextView android:text="viewEnd" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="viewEnd" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="viewEnd" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow android:textAlignment="gravity" + android:gravity="center_horizontal"> + + <TextView android:text="inherit gravity (default)" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow android:textAlignment="center"> + + <TextView android:text="inherit gravity center" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow android:textAlignment="textStart"> + + <TextView android:text="inherit textStart" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow android:textAlignment="textEnd"> + + <TextView android:text="inherit textEnd" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow android:textAlignment="viewStart"> + + <TextView android:text="inherit viewStart" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + <TableRow android:textAlignment="viewEnd"> + + <TextView android:text="inherit viewEnd" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:typeface="serif" + android:layout_marginRight="7dip" + android:layout_marginLeft="7dip" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/textview_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + <TextView android:layout_height="wrap_content" + android:layout_width="200dip" + android:textSize="24dip" + android:text="@string/hebrew_text" + android:textAlignment="inherit" + android:layout_marginLeft="7dip" + android:layout_marginRight="7dip" + android:background="#444444" + /> + </TableRow> + + </TableLayout> + +</FrameLayout> diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java index c5a1235..209597e 100644 --- a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java @@ -104,6 +104,16 @@ public class BiDiTestActivity extends Activity { addItem(result, "Canvas", BiDiTestCanvas.class, R.id.canvas); addItem(result, "Canvas2", BiDiTestCanvas2.class, R.id.canvas2); + addItem(result, "TextView LTR", BiDiTestTextViewLtr.class, R.id.textview_ltr); + addItem(result, "TextView RTL", BiDiTestTextViewRtl.class, R.id.textview_rtl); + addItem(result, "TextView LOC", BiDiTestTextViewLocale.class, R.id.textview_locale); + + addItem(result, "TextDirection LTR", BiDiTestTextViewDirectionLtr.class, R.id.textview_direction_ltr); + addItem(result, "TextDirection RTL", BiDiTestTextViewDirectionRtl.class, R.id.textview_direction_rtl); + + addItem(result, "TextAlignment LTR", BiDiTestTextViewAlignmentLtr.class, R.id.textview_alignment_ltr); + addItem(result, "TextAlignment RTL", BiDiTestTextViewAlignmentRtl.class, R.id.textview_alignment_rtl); + addItem(result, "Linear LTR", BiDiTestLinearLayoutLtr.class, R.id.linear_layout_ltr); addItem(result, "Linear RTL", BiDiTestLinearLayoutRtl.class, R.id.linear_layout_rtl); addItem(result, "Linear LOC", BiDiTestLinearLayoutLocale.class, R.id.linear_layout_locale); @@ -134,15 +144,9 @@ public class BiDiTestActivity extends Activity { addItem(result, "Margin MIXED", BiDiTestViewGroupMarginMixed.class, R.id.view_group_margin_mixed); - addItem(result, "TextView LTR", BiDiTestTextViewLtr.class, R.id.textview_ltr); - addItem(result, "TextView RTL", BiDiTestTextViewRtl.class, R.id.textview_rtl); - addItem(result, "TextView LOC", BiDiTestTextViewLocale.class, R.id.textview_locale); - - addItem(result, "TextDirection LTR", BiDiTestTextViewDirectionLtr.class, R.id.textview_direction_ltr); - addItem(result, "TextDirection RTL", BiDiTestTextViewDirectionRtl.class, R.id.textview_direction_rtl); - addItem(result, "TextView Drawables LTR", BiDiTestTextViewDrawablesLtr.class, R.id.textview_drawables_ltr); addItem(result, "TextView Drawables RTL", BiDiTestTextViewDrawablesRtl.class, R.id.textview_drawables_rtl); + addItem(result, "Gallery LTR", BiDiTestGalleryLtr.class, R.id.gallery_ltr); addItem(result, "Gallery RTL", BiDiTestGalleryRtl.class, R.id.gallery_rtl); diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestTextViewAlignmentLtr.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTextViewAlignmentLtr.java new file mode 100644 index 0000000..5ea5d81 --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestTextViewAlignmentLtr.java @@ -0,0 +1,31 @@ +/* + * 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.bidi; + +import android.app.Fragment; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +public class BiDiTestTextViewAlignmentLtr extends Fragment { + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + return inflater.inflate(R.layout.textview_alignment_ltr, container, false); + } +} diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestTextViewAlignmentRtl.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTextViewAlignmentRtl.java new file mode 100644 index 0000000..fcc7a5d --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestTextViewAlignmentRtl.java @@ -0,0 +1,31 @@ +/* + * 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.bidi; + +import android.app.Fragment; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +public class BiDiTestTextViewAlignmentRtl extends Fragment { + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + return inflater.inflate(R.layout.textview_alignment_rtl, container, false); + } +} diff --git a/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java b/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java index a13c0c9..919e2b3 100644 --- a/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java +++ b/tests/DataIdleTest/src/com/android/tests/dataidle/DataIdleTest.java @@ -17,15 +17,16 @@ package com.android.tests.dataidle; import android.content.Context; import android.net.INetworkStatsService; +import android.net.INetworkStatsSession; +import android.net.NetworkStats; import android.net.NetworkStats.Entry; import android.net.NetworkTemplate; -import android.net.NetworkStats; +import android.net.TrafficStats; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; import android.telephony.TelephonyManager; import android.test.InstrumentationTestCase; -import android.test.InstrumentationTestRunner; import android.util.Log; /** @@ -52,7 +53,7 @@ public class DataIdleTest extends InstrumentationTestCase { * Test that dumps all the data usage metrics for wifi to instrumentation out. */ public void testWifiIdle() { - NetworkTemplate template = NetworkTemplate.buildTemplateWifi(); + NetworkTemplate template = NetworkTemplate.buildTemplateWifiWildcard(); fetchStats(template); } @@ -71,13 +72,17 @@ public class DataIdleTest extends InstrumentationTestCase { * @param template {link {@link NetworkTemplate} to match. */ private void fetchStats(NetworkTemplate template) { + INetworkStatsSession session = null; try { mStatsService.forceUpdate(); - NetworkStats stats = mStatsService.getSummaryForAllUid(template, Long.MIN_VALUE, - Long.MAX_VALUE, false); + session = mStatsService.openSession(); + final NetworkStats stats = session.getSummaryForAllUid( + template, Long.MIN_VALUE, Long.MAX_VALUE, false); reportStats(stats); } catch (RemoteException e) { Log.w(LOG_TAG, "Failed to fetch network stats."); + } finally { + TrafficStats.closeQuietly(session); } } diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml index ceda610..3775f9f 100644 --- a/tests/HwAccelerationTest/AndroidManifest.xml +++ b/tests/HwAccelerationTest/AndroidManifest.xml @@ -42,6 +42,15 @@ </activity> <activity + android:name="DatePickerActivity" + android:label="_DatePicker"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + + <activity android:name="ClipRegionActivity" android:label="_ClipRegion"> <intent-filter> diff --git a/tests/HwAccelerationTest/res/layout/date_picker.xml b/tests/HwAccelerationTest/res/layout/date_picker.xml new file mode 100644 index 0000000..742a03b --- /dev/null +++ b/tests/HwAccelerationTest/res/layout/date_picker.xml @@ -0,0 +1,83 @@ +<?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. +*/ +--> + +<!-- Layout of date picker--> + +<!-- The width of this container is manually set a little bigger than the one of the children + contained in it. This helps to prevent rounding errors when toggling the "Show year" option --> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_gravity="center_horizontal" + android:layout_width="270dip" + android:layout_height="wrap_content"> + + <CheckBox + android:id="@+id/yearToggle" + android:text="Provide a year" + android:paddingTop="5dip" + android:paddingBottom="5dip" + android:textAppearance="?android:attr/textAppearanceLarge" + android:layout_gravity="center_horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content"/> + <!-- Warning: everything within the parent is removed and re-ordered depending + on the date format selected by the user. --> + <LinearLayout + android:id="@+id/parent" + android:orientation="horizontal" + android:layout_gravity="center_horizontal" + android:animateLayoutChanges="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + <!-- Month --> + <NumberPicker + android:id="@+id/month" + android:layout_width="80dip" + android:layout_height="wrap_content" + android:layout_marginLeft="1dip" + android:layout_marginRight="1dip" + android:focusable="true" + android:focusableInTouchMode="true" + /> + + <!-- Day --> + <NumberPicker + android:id="@+id/day" + android:layout_width="80dip" + android:layout_height="wrap_content" + android:layout_marginLeft="1dip" + android:layout_marginRight="1dip" + android:focusable="true" + android:focusableInTouchMode="true" + /> + + <!-- Year --> + <NumberPicker + android:id="@+id/year" + android:layout_width="95dip" + android:layout_height="wrap_content" + android:layout_marginLeft="1dip" + android:layout_marginRight="1dip" + android:focusable="true" + android:focusableInTouchMode="true" + /> + </LinearLayout> +</LinearLayout> diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/DatePicker.java b/tests/HwAccelerationTest/src/com/android/test/hwui/DatePicker.java new file mode 100644 index 0000000..db247e3 --- /dev/null +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/DatePicker.java @@ -0,0 +1,474 @@ +/* + * 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.test.hwui; + +import android.annotation.Widget; +import android.content.Context; +import android.content.res.TypedArray; +import android.os.Parcel; +import android.os.Parcelable; +import android.text.format.DateFormat; +import android.util.AttributeSet; +import android.util.SparseArray; +import android.view.ContextThemeWrapper; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.FrameLayout; +import android.widget.LinearLayout; +import android.widget.NumberPicker; + +import java.text.DateFormatSymbols; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +/** + * A view for selecting a month / year / day based on a calendar like layout. + * + * <p>See the <a href="{@docRoot}resources/tutorials/views/hello-datepicker.html">Date Picker + * tutorial</a>.</p> + * + * For a dialog using this view, see {@link android.app.DatePickerDialog}. + */ +@Widget +public class DatePicker extends FrameLayout { + + private static final int DEFAULT_START_YEAR = 1900; + private static final int DEFAULT_END_YEAR = 2100; + + /* UI Components */ + private final CheckBox mYearToggle; + private final NumberPicker mDayPicker; + private final NumberPicker mMonthPicker; + private final NumberPicker mYearPicker; + + /** + * How we notify users the date has changed. + */ + private OnDateChangedListener mOnDateChangedListener; + + private int mDay; + private int mMonth; + private int mYear; + private boolean mYearOptional = true; + private boolean mHasYear; + + /** + * The callback used to indicate the user changes the date. + */ + public interface OnDateChangedListener { + + /** + * @param view The view associated with this listener. + * @param year The year that was set. + * @param monthOfYear The month that was set (0-11) for compatibility + * with {@link java.util.Calendar}. + * @param dayOfMonth The day of the month that was set. + */ + void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth); + } + + public DatePicker(Context context) { + this(context, null); + } + + public DatePicker(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + @SuppressWarnings("deprecation") + public DatePicker(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + + ContextThemeWrapper themed = new ContextThemeWrapper(context, + com.android.internal.R.style.Theme_Holo_Light_Dialog_Alert); + LayoutInflater inflater = (LayoutInflater) themed.getSystemService( + Context.LAYOUT_INFLATER_SERVICE); + inflater.inflate(R.layout.date_picker, this, true); + + mDayPicker = (NumberPicker) findViewById(R.id.day); + mDayPicker.setFormatter(NumberPicker.TWO_DIGIT_FORMATTER); + mDayPicker.setOnLongPressUpdateInterval(100); + mDayPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { + public void onValueChange(NumberPicker picker, int oldVal, int newVal) { + mDay = newVal; + notifyDateChanged(); + } + }); + mMonthPicker = (NumberPicker) findViewById(R.id.month); + mMonthPicker.setFormatter(NumberPicker.TWO_DIGIT_FORMATTER); + DateFormatSymbols dfs = new DateFormatSymbols(); + String[] months = dfs.getShortMonths(); + + /* + * If the user is in a locale where the month names are numeric, + * use just the number instead of the "month" character for + * consistency with the other fields. + */ + if (months[0].startsWith("1")) { + for (int i = 0; i < months.length; i++) { + months[i] = String.valueOf(i + 1); + } + mMonthPicker.setMinValue(1); + mMonthPicker.setMaxValue(12); + } else { + mMonthPicker.setMinValue(1); + mMonthPicker.setMaxValue(12); + mMonthPicker.setDisplayedValues(months); + } + + mMonthPicker.setOnLongPressUpdateInterval(200); + mMonthPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { + public void onValueChange(NumberPicker picker, int oldVal, int newVal) { + + /* We display the month 1-12 but store it 0-11 so always + * subtract by one to ensure our internal state is always 0-11 + */ + mMonth = newVal - 1; + // Adjust max day of the month + adjustMaxDay(); + notifyDateChanged(); + updateDaySpinner(); + } + }); + mYearPicker = (NumberPicker) findViewById(R.id.year); + mYearPicker.setOnLongPressUpdateInterval(100); + mYearPicker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() { + public void onValueChange(NumberPicker picker, int oldVal, int newVal) { + mYear = newVal; + // Adjust max day for leap years if needed + adjustMaxDay(); + notifyDateChanged(); + updateDaySpinner(); + } + }); + + mYearToggle = (CheckBox) findViewById(R.id.yearToggle); + mYearToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + mHasYear = isChecked; + adjustMaxDay(); + notifyDateChanged(); + updateSpinners(); + } + }); + + // attributes + TypedArray a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.DatePicker); + + int mStartYear = + a.getInt(com.android.internal.R.styleable.DatePicker_startYear, DEFAULT_START_YEAR); + int mEndYear = + a.getInt(com.android.internal.R.styleable.DatePicker_endYear, DEFAULT_END_YEAR); + mYearPicker.setMinValue(mStartYear); + mYearPicker.setMaxValue(mEndYear); + + a.recycle(); + + // initialize to current date + Calendar cal = Calendar.getInstance(); + init(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), null); + + // re-order the number pickers to match the current date format + reorderPickers(months); + + if (!isEnabled()) { + setEnabled(false); + } + } + + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + mDayPicker.setEnabled(enabled); + mMonthPicker.setEnabled(enabled); + mYearPicker.setEnabled(enabled); + } + + private void reorderPickers(String[] months) { + java.text.DateFormat format; + String order; + + /* + * If the user is in a locale where the medium date format is + * still numeric (Japanese and Czech, for example), respect + * the date format order setting. Otherwise, use the order + * that the locale says is appropriate for a spelled-out date. + */ + + if (months[0].startsWith("1")) { + format = DateFormat.getDateFormat(getContext()); + } else { + format = DateFormat.getMediumDateFormat(getContext()); + } + + if (format instanceof SimpleDateFormat) { + order = ((SimpleDateFormat) format).toPattern(); + } else { + // Shouldn't happen, but just in case. + order = new String(DateFormat.getDateFormatOrder(getContext())); + } + + /* Remove the 3 pickers from their parent and then add them back in the + * required order. + */ + LinearLayout parent = (LinearLayout) findViewById(R.id.parent); + parent.removeAllViews(); + + boolean quoted = false; + boolean didDay = false, didMonth = false, didYear = false; + + for (int i = 0; i < order.length(); i++) { + char c = order.charAt(i); + + if (c == '\'') { + quoted = !quoted; + } + + if (!quoted) { + if (c == DateFormat.DATE && !didDay) { + parent.addView(mDayPicker); + didDay = true; + } else if ((c == DateFormat.MONTH || c == 'L') && !didMonth) { + parent.addView(mMonthPicker); + didMonth = true; + } else if (c == DateFormat.YEAR && !didYear) { + parent.addView (mYearPicker); + didYear = true; + } + } + } + + // Shouldn't happen, but just in case. + if (!didMonth) { + parent.addView(mMonthPicker); + } + if (!didDay) { + parent.addView(mDayPicker); + } + if (!didYear) { + parent.addView(mYearPicker); + } + } + + public void updateDate(int year, int monthOfYear, int dayOfMonth) { + if (mYear != year || mMonth != monthOfYear || mDay != dayOfMonth) { + mYear = (mYearOptional && year == 0) ? getCurrentYear() : year; + mMonth = monthOfYear; + mDay = dayOfMonth; + updateSpinners(); + reorderPickers(new DateFormatSymbols().getShortMonths()); + notifyDateChanged(); + } + } + + private static int getCurrentYear() { + return Calendar.getInstance().get(Calendar.YEAR); + } + + private static class SavedState extends BaseSavedState { + + private final int mYear; + private final int mMonth; + private final int mDay; + private final boolean mHasYear; + private final boolean mYearOptional; + + /** + * Constructor called from {@link DatePicker#onSaveInstanceState()} + */ + private SavedState(Parcelable superState, int year, int month, int day, boolean hasYear, + boolean yearOptional) { + super(superState); + mYear = year; + mMonth = month; + mDay = day; + mHasYear = hasYear; + mYearOptional = yearOptional; + } + + /** + * Constructor called from {@link #CREATOR} + */ + private SavedState(Parcel in) { + super(in); + mYear = in.readInt(); + mMonth = in.readInt(); + mDay = in.readInt(); + mHasYear = in.readInt() != 0; + mYearOptional = in.readInt() != 0; + } + + public int getYear() { + return mYear; + } + + public int getMonth() { + return mMonth; + } + + public int getDay() { + return mDay; + } + + public boolean hasYear() { + return mHasYear; + } + + public boolean isYearOptional() { + return mYearOptional; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + super.writeToParcel(dest, flags); + dest.writeInt(mYear); + dest.writeInt(mMonth); + dest.writeInt(mDay); + dest.writeInt(mHasYear ? 1 : 0); + dest.writeInt(mYearOptional ? 1 : 0); + } + + @SuppressWarnings("unused") + public static final Parcelable.Creator<SavedState> CREATOR = + new Creator<SavedState>() { + + public SavedState createFromParcel(Parcel in) { + return new SavedState(in); + } + + public SavedState[] newArray(int size) { + return new SavedState[size]; + } + }; + } + + + /** + * Override so we are in complete control of save / restore for this widget. + */ + @Override + protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container) { + dispatchThawSelfOnly(container); + } + + @Override + protected Parcelable onSaveInstanceState() { + Parcelable superState = super.onSaveInstanceState(); + + return new SavedState(superState, mYear, mMonth, mDay, mHasYear, mYearOptional); + } + + @Override + protected void onRestoreInstanceState(Parcelable state) { + SavedState ss = (SavedState) state; + super.onRestoreInstanceState(ss.getSuperState()); + mYear = ss.getYear(); + mMonth = ss.getMonth(); + mDay = ss.getDay(); + mHasYear = ss.hasYear(); + mYearOptional = ss.isYearOptional(); + updateSpinners(); + } + + /** + * Initialize the state. + * @param year The initial year. + * @param monthOfYear The initial month. + * @param dayOfMonth The initial day of the month. + * @param onDateChangedListener How user is notified date is changed by user, can be null. + */ + public void init(int year, int monthOfYear, int dayOfMonth, + OnDateChangedListener onDateChangedListener) { + init(year, monthOfYear, dayOfMonth, false, onDateChangedListener); + } + + /** + * Initialize the state. + * @param year The initial year or 0 if no year has been specified + * @param monthOfYear The initial month. + * @param dayOfMonth The initial day of the month. + * @param yearOptional True if the user can toggle the year + * @param onDateChangedListener How user is notified date is changed by user, can be null. + */ + public void init(int year, int monthOfYear, int dayOfMonth, boolean yearOptional, + OnDateChangedListener onDateChangedListener) { + mYear = (yearOptional && year == 0) ? getCurrentYear() : year; + mMonth = monthOfYear; + mDay = dayOfMonth; + mYearOptional = yearOptional; + mHasYear = !yearOptional || (year != 0); + mOnDateChangedListener = onDateChangedListener; + updateSpinners(); + } + + private void updateSpinners() { + updateDaySpinner(); + mYearToggle.setChecked(mHasYear); + mYearToggle.setVisibility(mYearOptional ? View.VISIBLE : View.GONE); + mYearPicker.setValue(mYear); + mYearPicker.setVisibility(mHasYear ? View.VISIBLE : View.GONE); + + /* The month display uses 1-12 but our internal state stores it + * 0-11 so add one when setting the display. + */ + mMonthPicker.setValue(mMonth + 1); + } + + private void updateDaySpinner() { + Calendar cal = Calendar.getInstance(); + // if year was not set, use 2000 as it was a leap year + cal.set(mHasYear ? mYear : 2000, mMonth, 1); + int max = cal.getActualMaximum(Calendar.DAY_OF_MONTH); + mDayPicker.setMinValue(1); + mDayPicker.setMaxValue(max); + mDayPicker.setValue(mDay); + } + + public int getYear() { + return (mYearOptional && !mHasYear) ? 0 : mYear; + } + + public int getMonth() { + return mMonth; + } + + public int getDayOfMonth() { + return mDay; + } + + private void adjustMaxDay(){ + Calendar cal = Calendar.getInstance(); + // if year was not set, use 2000 as it was a leap year + cal.set(Calendar.YEAR, mHasYear ? mYear : 2000); + cal.set(Calendar.MONTH, mMonth); + int max = cal.getActualMaximum(Calendar.DAY_OF_MONTH); + if (mDay > max) { + mDay = max; + } + } + + private void notifyDateChanged() { + if (mOnDateChangedListener != null) { + int year = (mYearOptional && !mHasYear) ? 0 : mYear; + mOnDateChangedListener.onDateChanged(DatePicker.this, year, mMonth, mDay); + } + } +} diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/DatePickerActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/DatePickerActivity.java new file mode 100644 index 0000000..5482ee2 --- /dev/null +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/DatePickerActivity.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +package com.android.test.hwui; + +import android.app.Activity; +import android.graphics.drawable.ColorDrawable; +import android.os.Bundle; + +@SuppressWarnings({"UnusedDeclaration"}) +public class DatePickerActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + DatePicker picker = new DatePicker(this); + picker.init(2012, 3, 3, true, new DatePicker.OnDateChangedListener() { + @Override + public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) { + } + }); + setContentView(picker); + getWindow().setBackgroundDrawable(new ColorDrawable(0xffffffff)); + } +} diff --git a/tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java b/tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java index 87baf76..7c03313 100644 --- a/tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java +++ b/tests/TileBenchmark/src/com/test/tilebenchmark/ProfiledWebView.java @@ -23,7 +23,6 @@ import android.util.Log; import android.webkit.WebSettingsClassic; import android.webkit.WebView; import android.webkit.WebViewClassic; -import android.widget.Toast; import java.util.ArrayList; @@ -72,10 +71,7 @@ public class ProfiledWebView extends WebView implements WebViewClassic.PageSwapD mContext = c; } - /** Show a toast from the web page */ public void animationComplete() { - Toast.makeText(mContext, "Animation complete!", Toast.LENGTH_SHORT).show(); - //Log.d(LOGTAG, "anim complete"); mAnimationTime = System.currentTimeMillis(); } } diff --git a/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java b/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java index c3ac22c..1f6279c 100644 --- a/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java +++ b/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java @@ -255,41 +255,6 @@ public class WindowManagerPermissionTests extends TestCase { } @SmallTest - public void testINJECT_EVENTS() { - try { - mWm.injectKeyEvent(new KeyEvent(0, 0), false); - fail("IWindowManager.injectKeyEvent did not throw SecurityException as" - + " expected"); - } catch (SecurityException e) { - // expected - } catch (RemoteException e) { - fail("Unexpected remote exception"); - } - - try { - mWm.injectPointerEvent(MotionEvent.obtain(0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0), false); - fail("IWindowManager.injectPointerEvent did not throw SecurityException as" - + " expected"); - } catch (SecurityException e) { - // expected - } catch (RemoteException e) { - fail("Unexpected remote exception"); - } - - try { - mWm.injectTrackballEvent(MotionEvent.obtain(0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0), false); - fail("IWindowManager.injectTrackballEvent did not throw SecurityException as" - + " expected"); - } catch (SecurityException e) { - // expected - } catch (RemoteException e) { - fail("Unexpected remote exception"); - } - } - - @SmallTest public void testDISABLE_KEYGUARD() { Binder token = new Binder(); try { @@ -347,73 +312,9 @@ public class WindowManagerPermissionTests extends TestCase { } @SmallTest - public void testREAD_INPUT_STATE() { - try { - mWm.getSwitchState(0); - fail("IWindowManager.getSwitchState did not throw SecurityException as" - + " expected"); - } catch (SecurityException e) { - // expected - } catch (RemoteException e) { - fail("Unexpected remote exception"); - } - - try { - mWm.getSwitchStateForDevice(0, 0); - fail("IWindowManager.getSwitchStateForDevice did not throw SecurityException as" - + " expected"); - } catch (SecurityException e) { - // expected - } catch (RemoteException e) { - fail("Unexpected remote exception"); - } - - try { - mWm.getScancodeState(0); - fail("IWindowManager.getScancodeState did not throw SecurityException as" - + " expected"); - } catch (SecurityException e) { - // expected - } catch (RemoteException e) { - fail("Unexpected remote exception"); - } - - try { - mWm.getScancodeStateForDevice(0, 0); - fail("IWindowManager.getScancodeStateForDevice did not throw SecurityException as" - + " expected"); - } catch (SecurityException e) { - // expected - } catch (RemoteException e) { - fail("Unexpected remote exception"); - } - - try { - mWm.getKeycodeState(0); - fail("IWindowManager.getKeycodeState did not throw SecurityException as" - + " expected"); - } catch (SecurityException e) { - // expected - } catch (RemoteException e) { - fail("Unexpected remote exception"); - } - - try { - mWm.getKeycodeStateForDevice(0, 0); - fail("IWindowManager.getKeycodeStateForDevice did not throw SecurityException as" - + " expected"); - } catch (SecurityException e) { - // expected - } catch (RemoteException e) { - fail("Unexpected remote exception"); - } - } - - @SmallTest public void testSET_ORIENTATION() { try { - mWm.updateRotation(true); - mWm.getSwitchState(0); + mWm.updateRotation(true, false); fail("IWindowManager.updateRotation did not throw SecurityException as" + " expected"); } catch (SecurityException e) { @@ -424,7 +325,6 @@ public class WindowManagerPermissionTests extends TestCase { try { mWm.freezeRotation(-1); - mWm.getSwitchState(0); fail("IWindowManager.freezeRotation did not throw SecurityException as" + " expected"); } catch (SecurityException e) { @@ -435,7 +335,6 @@ public class WindowManagerPermissionTests extends TestCase { try { mWm.thawRotation(); - mWm.getSwitchState(0); fail("IWindowManager.thawRotation did not throw SecurityException as" + " expected"); } catch (SecurityException e) { diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index 198fce4..689aa8e 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -639,6 +639,12 @@ int doDump(Bundle* bundle) // If an app requests write storage, they will also get read storage. bool hasReadExternalStoragePermission = false; + // Implement transition to read and write call log. + bool hasReadContactsPermission = false; + bool hasWriteContactsPermission = false; + bool hasReadCallLogPermission = false; + bool hasWriteCallLogPermission = false; + // This next group of variables is used to implement a group of // backward-compatibility heuristics necessitated by the addition of // some new uses-feature constants in 2.1 and 2.2. In most cases, the @@ -1006,6 +1012,14 @@ int doDump(Bundle* bundle) hasReadExternalStoragePermission = true; } else if (name == "android.permission.READ_PHONE_STATE") { hasReadPhoneStatePermission = true; + } else if (name == "android.permission.READ_CONTACTS") { + hasReadContactsPermission = true; + } else if (name == "android.permission.WRITE_CONTACTS") { + hasWriteContactsPermission = true; + } else if (name == "android.permission.READ_CALL_LOG") { + hasReadCallLogPermission = true; + } else if (name == "android.permission.WRITE_CALL_LOG") { + hasWriteCallLogPermission = true; } printf("uses-permission:'%s'\n", name.string()); } else { @@ -1181,6 +1195,16 @@ int doDump(Bundle* bundle) printf("uses-permission:'android.permission.READ_EXTERNAL_STORAGE'\n"); } + // Pre-JellyBean call log permission compatibility. + if (targetSdk < 16) { + if (!hasReadCallLogPermission && hasReadContactsPermission) { + printf("uses-permission:'android.permission.READ_CALL_LOG'\n"); + } + if (!hasWriteCallLogPermission && hasWriteContactsPermission) { + printf("uses-permission:'android.permission.WRITE_CALL_LOG'\n"); + } + } + /* The following blocks handle printing "inferred" uses-features, based * on whether related features or permissions are used by the app. * Note that the various spec*Feature variables denote whether the diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp index 2b9b056..9de685a 100644 --- a/tools/aapt/Images.cpp +++ b/tools/aapt/Images.cpp @@ -57,6 +57,13 @@ struct image_info bool is9Patch; Res_png_9patch info9Patch; + // Layout padding, if relevant + bool haveLayoutBounds; + int32_t layoutBoundsLeft; + int32_t layoutBoundsTop; + int32_t layoutBoundsRight; + int32_t layoutBoundsBottom; + png_uint_32 allocHeight; png_bytepp allocRows; }; @@ -129,33 +136,62 @@ static void read_png(const char* imageName, &interlace_type, &compression_type, NULL); } -static bool is_tick(png_bytep p, bool transparent, const char** outError) +#define COLOR_TRANSPARENT 0 +#define COLOR_WHITE 0xFFFFFFFF +#define COLOR_TICK 0xFF000000 +#define COLOR_LAYOUT_BOUNDS_TICK 0xFF0000FF + +enum { + TICK_TYPE_NONE, + TICK_TYPE_TICK, + TICK_TYPE_LAYOUT_BOUNDS, + TICK_TYPE_BOTH +}; + +static int tick_type(png_bytep p, bool transparent, const char** outError) { + png_uint_32 color = p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); + if (transparent) { if (p[3] == 0) { - return false; + return TICK_TYPE_NONE; + } + if (color == COLOR_LAYOUT_BOUNDS_TICK) { + return TICK_TYPE_LAYOUT_BOUNDS; } + if (color == COLOR_TICK) { + return TICK_TYPE_TICK; + } + + // Error cases if (p[3] != 0xff) { *outError = "Frame pixels must be either solid or transparent (not intermediate alphas)"; - return false; + return TICK_TYPE_NONE; } if (p[0] != 0 || p[1] != 0 || p[2] != 0) { - *outError = "Ticks in transparent frame must be black"; + *outError = "Ticks in transparent frame must be black or red"; } - return true; + return TICK_TYPE_TICK; } if (p[3] != 0xFF) { *outError = "White frame must be a solid color (no alpha)"; } - if (p[0] == 0xFF && p[1] == 0xFF && p[2] == 0xFF) { - return false; + if (color == COLOR_WHITE) { + return TICK_TYPE_NONE; + } + if (color == COLOR_TICK) { + return TICK_TYPE_TICK; } + if (color == COLOR_LAYOUT_BOUNDS_TICK) { + return TICK_TYPE_LAYOUT_BOUNDS; + } + if (p[0] != 0 || p[1] != 0 || p[2] != 0) { - *outError = "Ticks in white frame must be black"; - return false; + *outError = "Ticks in white frame must be black or red"; + return TICK_TYPE_NONE; } - return true; + return TICK_TYPE_TICK; } enum { @@ -175,7 +211,7 @@ static status_t get_horizontal_ticks( bool found = false; for (i=1; i<width-1; i++) { - if (is_tick(row+i*4, transparent, outError)) { + if (TICK_TYPE_TICK == tick_type(row+i*4, transparent, outError)) { if (state == TICK_START || (state == TICK_OUTSIDE_1 && multipleAllowed)) { *outLeft = i-1; @@ -224,7 +260,7 @@ static status_t get_vertical_ticks( bool found = false; for (i=1; i<height-1; i++) { - if (is_tick(rows[i]+offset, transparent, outError)) { + if (TICK_TYPE_TICK == tick_type(rows[i]+offset, transparent, outError)) { if (state == TICK_START || (state == TICK_OUTSIDE_1 && multipleAllowed)) { *outTop = i-1; @@ -262,6 +298,83 @@ static status_t get_vertical_ticks( return NO_ERROR; } +static status_t get_horizontal_layout_bounds_ticks( + png_bytep row, int width, bool transparent, bool required, + int32_t* outLeft, int32_t* outRight, const char** outError) +{ + int i; + *outLeft = *outRight = 0; + + // Look for left tick + if (TICK_TYPE_LAYOUT_BOUNDS == tick_type(row + 4, transparent, outError)) { + // Starting with a layout padding tick + i = 1; + while (i < width - 1) { + (*outLeft)++; + i++; + int tick = tick_type(row + i * 4, transparent, outError); + if (tick != TICK_TYPE_LAYOUT_BOUNDS) { + break; + } + } + } + + // Look for right tick + if (TICK_TYPE_LAYOUT_BOUNDS == tick_type(row + (width - 2) * 4, transparent, outError)) { + // Ending with a layout padding tick + i = width - 2; + while (i > 1) { + (*outRight)++; + i--; + int tick = tick_type(row+i*4, transparent, outError); + if (tick != TICK_TYPE_LAYOUT_BOUNDS) { + break; + } + } + } + + return NO_ERROR; +} + +static status_t get_vertical_layout_bounds_ticks( + png_bytepp rows, int offset, int height, bool transparent, bool required, + int32_t* outTop, int32_t* outBottom, const char** outError) +{ + int i; + *outTop = *outBottom = 0; + + // Look for top tick + if (TICK_TYPE_LAYOUT_BOUNDS == tick_type(rows[1] + offset, transparent, outError)) { + // Starting with a layout padding tick + i = 1; + while (i < height - 1) { + (*outTop)++; + i++; + int tick = tick_type(rows[i] + offset, transparent, outError); + if (tick != TICK_TYPE_LAYOUT_BOUNDS) { + break; + } + } + } + + // Look for bottom tick + if (TICK_TYPE_LAYOUT_BOUNDS == tick_type(rows[height - 2] + offset, transparent, outError)) { + // Ending with a layout padding tick + i = height - 2; + while (i > 1) { + (*outBottom)++; + i--; + int tick = tick_type(rows[i] + offset, transparent, outError); + if (tick != TICK_TYPE_LAYOUT_BOUNDS) { + break; + } + } + } + + return NO_ERROR; +} + + static uint32_t get_color( png_bytepp rows, int left, int top, int right, int bottom) { @@ -353,6 +466,9 @@ static status_t do_9patch(const char* imageName, image_info* image) image->info9Patch.paddingLeft = image->info9Patch.paddingRight = image->info9Patch.paddingTop = image->info9Patch.paddingBottom = -1; + image->layoutBoundsLeft = image->layoutBoundsRight = + image->layoutBoundsTop = image->layoutBoundsBottom = 0; + png_bytep p = image->rows[0]; bool transparent = p[3] == 0; bool hasColor = false; @@ -408,6 +524,25 @@ static status_t do_9patch(const char* imageName, image_info* image) goto getout; } + // Find left and right of layout padding... + get_horizontal_layout_bounds_ticks(image->rows[H-1], W, transparent, false, + &image->layoutBoundsLeft, + &image->layoutBoundsRight, &errorMsg); + + get_vertical_layout_bounds_ticks(image->rows, (W-1)*4, H, transparent, false, + &image->layoutBoundsTop, + &image->layoutBoundsBottom, &errorMsg); + + image->haveLayoutBounds = image->layoutBoundsLeft != 0 + || image->layoutBoundsRight != 0 + || image->layoutBoundsTop != 0 + || image->layoutBoundsBottom != 0; + + if (image->haveLayoutBounds) { + NOISY(printf("layoutBounds=%d %d %d %d\n", image->layoutBoundsLeft, image->layoutBoundsTop, + image->layoutBoundsRight, image->layoutBoundsBottom)); + } + // Copy patch data into image image->info9Patch.numXDivs = numXDivs; image->info9Patch.numYDivs = numYDivs; @@ -845,8 +980,9 @@ static void write_png(const char* imageName, int bit_depth, interlace_type, compression_type; int i; - png_unknown_chunk unknowns[1]; + png_unknown_chunk unknowns[2]; unknowns[0].data = NULL; + unknowns[1].data = NULL; png_bytepp outRows = (png_bytepp) malloc((int) imageInfo.height * png_sizeof(png_bytep)); if (outRows == (png_bytepp) 0) { @@ -916,23 +1052,42 @@ static void write_png(const char* imageName, } if (imageInfo.is9Patch) { + int chunk_count = 1 + (imageInfo.haveLayoutBounds ? 1 : 0); + int p_index = imageInfo.haveLayoutBounds ? 1 : 0; + int b_index = 0; + png_byte *chunk_names = imageInfo.haveLayoutBounds + ? (png_byte*)"npLb\0npTc\0" + : (png_byte*)"npTc"; NOISY(printf("Adding 9-patch info...\n")); - strcpy((char*)unknowns[0].name, "npTc"); - unknowns[0].data = (png_byte*)imageInfo.info9Patch.serialize(); - unknowns[0].size = imageInfo.info9Patch.serializedSize(); + strcpy((char*)unknowns[p_index].name, "npTc"); + unknowns[p_index].data = (png_byte*)imageInfo.info9Patch.serialize(); + unknowns[p_index].size = imageInfo.info9Patch.serializedSize(); // TODO: remove the check below when everything works - checkNinePatchSerialization(&imageInfo.info9Patch, unknowns[0].data); + checkNinePatchSerialization(&imageInfo.info9Patch, unknowns[p_index].data); + + if (imageInfo.haveLayoutBounds) { + int chunk_size = sizeof(png_uint_32) * 4; + strcpy((char*)unknowns[b_index].name, "npLb"); + unknowns[b_index].data = (png_byte*) calloc(chunk_size, 1); + memcpy(unknowns[b_index].data, &imageInfo.layoutBoundsLeft, chunk_size); + unknowns[b_index].size = chunk_size; + } + png_set_keep_unknown_chunks(write_ptr, PNG_HANDLE_CHUNK_ALWAYS, - (png_byte*)"npTc", 1); - png_set_unknown_chunks(write_ptr, write_info, unknowns, 1); + chunk_names, chunk_count); + png_set_unknown_chunks(write_ptr, write_info, unknowns, chunk_count); // XXX I can't get this to work without forcibly changing // the location to what I want... which apparently is supposed // to be a private API, but everything else I have tried results // in the location being set to what I -last- wrote so I never // get written. :p png_set_unknown_chunk_location(write_ptr, write_info, 0, PNG_HAVE_PLTE); + if (imageInfo.haveLayoutBounds) { + png_set_unknown_chunk_location(write_ptr, write_info, 1, PNG_HAVE_PLTE); + } } + png_write_info(write_ptr, write_info); png_bytepp rows; @@ -954,6 +1109,7 @@ static void write_png(const char* imageName, } free(outRows); free(unknowns[0].data); + free(unknowns[1].data); png_get_IHDR(write_ptr, write_info, &width, &height, &bit_depth, &color_type, &interlace_type, diff --git a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java index eadec02..b76b8cf 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java @@ -524,7 +524,8 @@ public final class Bitmap_Delegate { int nativeInt = sManager.addNewDelegate(delegate); // and create/return a new Bitmap with it - return new Bitmap(nativeInt, null /* buffer */, isMutable, null /*ninePatchChunk*/, density); + return new Bitmap(nativeInt, null /* buffer */, isMutable, null /*ninePatchChunk*/, + density); } /** 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 8b1d41a..e6c9351 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 @@ -88,7 +88,7 @@ public class BridgeWindowManager implements IWindowManager { // ---- unused implementation of IWindowManager ---- @Override - public boolean canStatusBarHide() throws RemoteException { + public boolean hasSystemNavBar() throws RemoteException { // TODO Auto-generated method stub return false; } @@ -161,92 +161,11 @@ public class BridgeWindowManager implements IWindowManager { } @Override - public int getDPadKeycodeState(int arg0) throws RemoteException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getDPadScancodeState(int arg0) throws RemoteException { - // TODO Auto-generated method stub - return 0; - } - - - @Override - public InputDevice getInputDevice(int arg0) throws RemoteException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int[] getInputDeviceIds() throws RemoteException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getKeycodeState(int arg0) throws RemoteException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getKeycodeStateForDevice(int arg0, int arg1) throws RemoteException { - // TODO Auto-generated method stub - return 0; - } - - - @Override public int getPendingAppTransition() throws RemoteException { // TODO Auto-generated method stub return 0; } - - @Override - public int getScancodeState(int arg0) throws RemoteException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getScancodeStateForDevice(int arg0, int arg1) throws RemoteException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getSwitchState(int arg0) throws RemoteException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getSwitchStateForDevice(int arg0, int arg1) throws RemoteException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getTrackballKeycodeState(int arg0) throws RemoteException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getTrackballScancodeState(int arg0) throws RemoteException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public boolean hasKeys(int[] arg0, boolean[] arg1) throws RemoteException { - // TODO Auto-generated method stub - return false; - } - @Override public boolean inKeyguardRestrictedInputMode() throws RemoteException { // TODO Auto-generated method stub @@ -254,30 +173,6 @@ public class BridgeWindowManager implements IWindowManager { } @Override - public boolean injectInputEventNoWait(InputEvent arg0) throws RemoteException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean injectKeyEvent(KeyEvent arg0, boolean arg1) throws RemoteException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean injectPointerEvent(MotionEvent arg0, boolean arg1) throws RemoteException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean injectTrackballEvent(MotionEvent arg0, boolean arg1) throws RemoteException { - // TODO Auto-generated method stub - return false; - } - - @Override public boolean inputMethodClientHasFocus(IInputMethodClient arg0) throws RemoteException { // TODO Auto-generated method stub return false; @@ -302,12 +197,6 @@ public class BridgeWindowManager implements IWindowManager { } @Override - public InputChannel monitorInput(String arg0) throws RemoteException { - // TODO Auto-generated method stub - return null; - } - - @Override public void moveAppToken(int arg0, IBinder arg1) throws RemoteException { // TODO Auto-generated method stub @@ -462,15 +351,8 @@ public class BridgeWindowManager implements IWindowManager { } @Override - public void setPointerSpeed(int arg0) throws RemoteException { + public void updateRotation(boolean arg0, boolean arg1) throws RemoteException { // TODO Auto-generated method stub - - } - - @Override - public void updateRotation(boolean arg0) throws RemoteException { - // TODO Auto-generated method stub - } @Override diff --git a/voip/java/com/android/server/sip/SipService.java b/voip/java/com/android/server/sip/SipService.java index 97afc81..a477fd1 100644 --- a/voip/java/com/android/server/sip/SipService.java +++ b/voip/java/com/android/server/sip/SipService.java @@ -453,9 +453,8 @@ public final class SipService extends ISipService.Stub { public SipSessionGroupExt(SipProfile localProfile, PendingIntent incomingCallPendingIntent, ISipSessionListener listener) throws SipException { - String password = localProfile.getPassword(); - SipProfile p = duplicate(localProfile); - mSipGroup = createSipSessionGroup(mLocalIp, p, password); + mSipGroup = new SipSessionGroup(duplicate(localProfile), + localProfile.getPassword(), mTimer, mMyWakeLock); mIncomingCallPendingIntent = incomingCallPendingIntent; mAutoRegistration.setListener(listener); } @@ -478,27 +477,6 @@ public final class SipService extends ISipService.Stub { mSipGroup.setWakeupTimer(timer); } - // network connectivity is tricky because network can be disconnected - // at any instant so need to deal with exceptions carefully even when - // you think you are connected - private SipSessionGroup createSipSessionGroup(String localIp, - SipProfile localProfile, String password) throws SipException { - try { - return new SipSessionGroup(localIp, localProfile, password, - mTimer, mMyWakeLock); - } catch (IOException e) { - // network disconnected - Log.w(TAG, "createSipSessionGroup(): network disconnected?"); - if (localIp != null) { - return createSipSessionGroup(null, localProfile, password); - } else { - // recursive - Log.wtf(TAG, "impossible! recursive!"); - throw new RuntimeException("createSipSessionGroup"); - } - } - } - private SipProfile duplicate(SipProfile p) { try { return new SipProfile.Builder(p).setPassword("*").build(); @@ -530,7 +508,7 @@ public final class SipService extends ISipService.Stub { throws SipException { mSipGroup.onConnectivityChanged(); if (connected) { - resetGroup(mLocalIp); + mSipGroup.reset(); if (mOpenedToReceiveCalls) openToReceiveCalls(); } else { // close mSipGroup but remember mOpenedToReceiveCalls @@ -541,22 +519,6 @@ public final class SipService extends ISipService.Stub { } } - private void resetGroup(String localIp) throws SipException { - try { - mSipGroup.reset(localIp); - } catch (IOException e) { - // network disconnected - Log.w(TAG, "resetGroup(): network disconnected?"); - if (localIp != null) { - resetGroup(null); // reset w/o local IP - } else { - // recursive - Log.wtf(TAG, "impossible!"); - throw new RuntimeException("resetGroup"); - } - } - } - public void close() { mOpenedToReceiveCalls = false; mSipGroup.close(); diff --git a/voip/java/com/android/server/sip/SipSessionGroup.java b/voip/java/com/android/server/sip/SipSessionGroup.java index 877a0a4..6acd456 100644 --- a/voip/java/com/android/server/sip/SipSessionGroup.java +++ b/voip/java/com/android/server/sip/SipSessionGroup.java @@ -40,6 +40,7 @@ import android.util.Log; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.DatagramSocket; +import java.net.InetAddress; import java.net.UnknownHostException; import java.text.ParseException; import java.util.Collection; @@ -47,13 +48,11 @@ import java.util.EventObject; import java.util.HashMap; import java.util.Map; import java.util.Properties; -import java.util.TooManyListenersException; import javax.sip.ClientTransaction; import javax.sip.Dialog; import javax.sip.DialogTerminatedEvent; import javax.sip.IOExceptionEvent; -import javax.sip.InvalidArgumentException; import javax.sip.ListeningPoint; import javax.sip.ObjectInUseException; import javax.sip.RequestEvent; @@ -132,18 +131,17 @@ class SipSessionGroup implements SipListener { private int mExternalPort; /** - * @param myself the local profile with password crossed out + * @param profile the local profile with password crossed out * @param password the password of the profile * @throws IOException if cannot assign requested address */ - public SipSessionGroup(String localIp, SipProfile myself, String password, - SipWakeupTimer timer, SipWakeLock wakeLock) throws SipException, - IOException { - mLocalProfile = myself; + public SipSessionGroup(SipProfile profile, String password, + SipWakeupTimer timer, SipWakeLock wakeLock) throws SipException { + mLocalProfile = profile; mPassword = password; mWakeupTimer = timer; mWakeLock = wakeLock; - reset(localIp); + reset(); } // TODO: remove this method once SipWakeupTimer can better handle variety @@ -152,43 +150,64 @@ class SipSessionGroup implements SipListener { mWakeupTimer = timer; } - synchronized void reset(String localIp) throws SipException, IOException { - mLocalIp = localIp; - if (localIp == null) return; - - SipProfile myself = mLocalProfile; - SipFactory sipFactory = SipFactory.getInstance(); + synchronized void reset() throws SipException { Properties properties = new Properties(); + + String protocol = mLocalProfile.getProtocol(); + int port = mLocalProfile.getPort(); + String server = mLocalProfile.getProxyAddress(); + + if (!TextUtils.isEmpty(server)) { + properties.setProperty("javax.sip.OUTBOUND_PROXY", + server + ':' + port + '/' + protocol); + } else { + server = mLocalProfile.getSipDomain(); + } + if (server.startsWith("[") && server.endsWith("]")) { + server = server.substring(1, server.length() - 1); + } + + String local = null; + try { + for (InetAddress remote : InetAddress.getAllByName(server)) { + DatagramSocket socket = new DatagramSocket(); + socket.connect(remote, port); + if (socket.isConnected()) { + local = socket.getLocalAddress().getHostAddress(); + port = socket.getLocalPort(); + socket.close(); + break; + } + socket.close(); + } + } catch (Exception e) { + // ignore. + } + if (local == null) { + // We are unable to reach the server. Just bail out. + return; + } + + close(); + mLocalIp = local; + properties.setProperty("javax.sip.STACK_NAME", getStackName()); properties.setProperty( "gov.nist.javax.sip.THREAD_POOL_SIZE", THREAD_POOL_SIZE); - String outboundProxy = myself.getProxyAddress(); - if (!TextUtils.isEmpty(outboundProxy)) { - Log.v(TAG, "outboundProxy is " + outboundProxy); - properties.setProperty("javax.sip.OUTBOUND_PROXY", outboundProxy - + ":" + myself.getPort() + "/" + myself.getProtocol()); - } - SipStack stack = mSipStack = sipFactory.createSipStack(properties); - + mSipStack = SipFactory.getInstance().createSipStack(properties); try { - SipProvider provider = stack.createSipProvider( - stack.createListeningPoint(localIp, allocateLocalPort(), - myself.getProtocol())); + SipProvider provider = mSipStack.createSipProvider( + mSipStack.createListeningPoint(local, port, protocol)); provider.addSipListener(this); - mSipHelper = new SipHelper(stack, provider); - } catch (InvalidArgumentException e) { - throw new IOException(e.getMessage()); - } catch (TooManyListenersException e) { - // must never happen - throw new SipException("SipSessionGroup constructor", e); + mSipHelper = new SipHelper(mSipStack, provider); + } catch (SipException e) { + throw e; + } catch (Exception e) { + throw new SipException("failed to initialize SIP stack", e); } - Log.d(TAG, " start stack for " + myself.getUriString()); - stack.start(); - - mCallReceiverSession = null; - mSessionMap.clear(); - resetExternalAddress(); + Log.d(TAG, " start stack for " + mLocalProfile.getUriString()); + mSipStack.start(); } synchronized void onConnectivityChanged() { @@ -234,6 +253,7 @@ class SipSessionGroup implements SipListener { mSipStack = null; mSipHelper = null; } + resetExternalAddress(); } public synchronized boolean isClosed() { @@ -257,17 +277,6 @@ class SipSessionGroup implements SipListener { return (isClosed() ? null : new SipSessionImpl(listener)); } - private static int allocateLocalPort() throws SipException { - try { - DatagramSocket s = new DatagramSocket(); - int localPort = s.getLocalPort(); - s.close(); - return localPort; - } catch (IOException e) { - throw new SipException("allocateLocalPort()", e); - } - } - synchronized boolean containsSession(String callId) { return mSessionMap.containsKey(callId); } diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java index 2fc6c20..c7f6bf0 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java @@ -380,6 +380,7 @@ public class WifiP2pManager { mHandler = new P2pHandler(looper); mChannelListener = l; } + private final static int INVALID_LISTENER_KEY = 0; private ChannelListener mChannelListener; private HashMap<Integer, Object> mListenerMap = new HashMap<Integer, Object>(); private Object mListenerMapLock = new Object(); @@ -450,16 +451,19 @@ public class WifiP2pManager { } int putListener(Object listener) { - if (listener == null) return 0; + if (listener == null) return INVALID_LISTENER_KEY; int key; synchronized (mListenerMapLock) { - key = mListenerKey++; + do { + key = mListenerKey++; + } while (key == INVALID_LISTENER_KEY); mListenerMap.put(key, listener); } return key; } Object getListener(int key) { + if (key == INVALID_LISTENER_KEY) return null; synchronized (mListenerMapLock) { return mListenerMap.remove(key); } |
