Merge "Prevent the creation of Shorcuts with null intents (issue 5629292)" into ics-mr1
diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml
index 1b48b8b..742788b 100644
--- a/res/values-da/strings.xml
+++ b/res/values-da/strings.xml
@@ -63,7 +63,7 @@
<string name="menu_manage_apps" msgid="2308685199463588895">"Administrer apps"</string>
<string name="menu_wallpaper" msgid="5837429080911269832">"Tapet"</string>
<string name="menu_search" msgid="4826514464423239041">"Søg"</string>
- <string name="menu_notifications" msgid="6424587053194766192">"Meddelelser"</string>
+ <string name="menu_notifications" msgid="6424587053194766192">"Underretninger"</string>
<string name="menu_settings" msgid="3946232973327980394">"Systemindstillinger"</string>
<string name="menu_help" msgid="4901160661634590633">"Hjælp"</string>
<string name="cab_menu_delete_app" msgid="4089398025537640349">"Afinstaller appen"</string>
diff --git a/res/values-sw-sw600dp/strings.xml b/res/values-sw-sw600dp/strings.xml
index d65f8de..20b6c86 100644
--- a/res/values-sw-sw600dp/strings.xml
+++ b/res/values-sw-sw600dp/strings.xml
@@ -19,7 +19,7 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="wallpaper_dialog_title" msgid="6395005465873616423">"Chagua pazia"</string>
- <string name="wallpaper_chooser_empty" msgid="5909737215399452696">"Hakuna pazia zinazopatikana"</string>
+ <string name="wallpaper_dialog_title" msgid="6395005465873616423">"Chagua mandhari"</string>
+ <string name="wallpaper_chooser_empty" msgid="5909737215399452696">"Hakuna mandhari zinazopatikana"</string>
<string name="wallpaper_cancel" msgid="1110492200533814461">"Ghairi"</string>
</resources>
diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml
index 053ce2e..df786fb 100644
--- a/res/values-sw/strings.xml
+++ b/res/values-sw/strings.xml
@@ -23,8 +23,8 @@
<string name="uid_name" msgid="3371120195364560632">"Programu Kuu za Android"</string>
<string name="folder_name" msgid="8551881338202938211"></string>
<string name="chooser_wallpaper" msgid="6063168087625352235">"Chagua mandhari kutoka"</string>
- <string name="wallpaper_instructions" msgid="4215640646180727542">"Weka pazia"</string>
- <string name="pick_wallpaper" msgid="5630222540525626723">"Taswira"</string>
+ <string name="wallpaper_instructions" msgid="4215640646180727542">"Weka mandhari"</string>
+ <string name="pick_wallpaper" msgid="5630222540525626723">"Mandhari"</string>
<string name="activity_not_found" msgid="217823393239365967">"Programu haijasakinishwa."</string>
<string name="widgets_tab_label" msgid="9145860100000983599">"Wijeti"</string>
<string name="long_press_widget_to_add" msgid="7395697462851217506">"Gusa & ushikilie ili kuteua wijeti."</string>
@@ -39,7 +39,7 @@
<string name="group_applications" msgid="2103752818818161976">"Prog"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Njia za mkato"</string>
<string name="group_widgets" msgid="6704978494073105844">"Wijeti"</string>
- <string name="group_wallpapers" msgid="1568191644272224858">"Pazia"</string>
+ <string name="group_wallpapers" msgid="1568191644272224858">"Mandhari"</string>
<string name="out_of_space" msgid="8365249326091984698">"Hakuna nafasi katika skrini hii ya nyumbani."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"Wijeti hii ni kubwa zaidi kwa hotseat."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Njia ya mkato ya \"<xliff:g id="NAME">%s</xliff:g>\" imeundwa."</string>
@@ -61,7 +61,7 @@
<string name="delete_zone_label_all_apps_system_app" msgid="3683920959591819044">"Sanidua sasisho"</string>
<string name="menu_add" msgid="3065046628354640854">"Ongeza"</string>
<string name="menu_manage_apps" msgid="2308685199463588895">"Dhibiti programu"</string>
- <string name="menu_wallpaper" msgid="5837429080911269832">"Pazia"</string>
+ <string name="menu_wallpaper" msgid="5837429080911269832">"Mandhari"</string>
<string name="menu_search" msgid="4826514464423239041">"Tafuta"</string>
<string name="menu_notifications" msgid="6424587053194766192">"Arifa"</string>
<string name="menu_settings" msgid="3946232973327980394">"Mipangilio ya mfumo"</string>
@@ -88,13 +88,13 @@
<string name="workspace_scroll_format" msgid="7911126267695001437">"Nafasi ya kazi %1$d ya %2$d"</string>
<string name="apps_customize_apps_scroll_format" msgid="5494241912377704885">"Ukurasa wa programu %1$d ya %2$d"</string>
<string name="apps_customize_widgets_scroll_format" msgid="5383009742241717437">"Ukurasa wa wijeti %1$d ya %2$d"</string>
- <string name="workspace_cling_title" msgid="738396473989890567">"Jifanyie ujihisi nyumbani"</string>
- <string name="workspace_cling_move_item" msgid="791013895761065070">"Unaweza kuweka prog zako uzipendazo hapa."</string>
- <string name="workspace_cling_open_all_apps" msgid="2459977609848572588">"Kuangalia prog zako zote, gusa durara."</string>
- <string name="all_apps_cling_title" msgid="2559734712581447107">"Chagua baadhi"</string>
- <string name="all_apps_cling_add_item" msgid="5665035103260318891">"Ili kuongeza programu kwa skrini yako ya Nyumbani, gusa & ishikilie."</string>
- <string name="folder_cling_title" msgid="4308949882377840953">"Panga prog zako na folda"</string>
- <string name="folder_cling_move_item" msgid="270598675060435169">"Kuhamisha prog, gusa na; uishikilie."</string>
+ <string name="workspace_cling_title" msgid="738396473989890567">"Jisikie huru"</string>
+ <string name="workspace_cling_move_item" msgid="791013895761065070">"Unaweza kuweka programu unazozipenda zaidi hapa."</string>
+ <string name="workspace_cling_open_all_apps" msgid="2459977609848572588">"Kutazama programu zako zote, gusa duara."</string>
+ <string name="all_apps_cling_title" msgid="2559734712581447107">"Chagua programu kadhaa"</string>
+ <string name="all_apps_cling_add_item" msgid="5665035103260318891">"Ili kuongeza programu kwa skrini yako ya Nyumbani, iguse na uishikilie."</string>
+ <string name="folder_cling_title" msgid="4308949882377840953">"Panga programu zako na folda"</string>
+ <string name="folder_cling_move_item" msgid="270598675060435169">"Kuhamisha programu, gusa na; uishikilie."</string>
<string name="folder_cling_create_folder" msgid="8352867485656129478">"Kuunda folda mpya katika skrini yako ya nyumbani, rundika programu moja juu ya nyingine."</string>
<string name="cling_dismiss" msgid="2780907108735868381">"Sawa"</string>
<string name="folder_opened" msgid="4129072635480822768">"Folda imefunguliwa,%1$d na %2$d"</string>
diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml
index 164f1e1..73896b4 100644
--- a/res/values-vi/strings.xml
+++ b/res/values-vi/strings.xml
@@ -43,7 +43,7 @@
<string name="out_of_space" msgid="8365249326091984698">"Không còn khoảng trống trên Màn hình chính này."</string>
<string name="invalid_hotseat_item" msgid="6545340627805449250">"Tiện ích này quá lớn cho điểm giới hạn."</string>
<string name="shortcut_installed" msgid="7071557296331322355">"Lối tắt \"<xliff:g id="NAME">%s</xliff:g>\" đã được tạo."</string>
- <string name="shortcut_uninstalled" msgid="2129499669449749995">"Lối tắt \"<xliff:g id="NAME">%s</xliff:g>\" đã bị xoá."</string>
+ <string name="shortcut_uninstalled" msgid="2129499669449749995">"Lối tắt \"<xliff:g id="NAME">%s</xliff:g>\" đã bị xóa."</string>
<string name="shortcut_duplicate" msgid="4757756326465060694">"Lối tắt \"<xliff:g id="NAME">%s</xliff:g>\" đã tồn tại."</string>
<string name="title_select_shortcut" msgid="2858897527672831763">"Chọn lối tắt"</string>
<string name="title_select_application" msgid="1793455815754848652">"Chọn ứng dụng"</string>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 0189d6c..ca02e1e 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -393,15 +393,17 @@
mWidgetSpacingLayout.measure(widthSpec, heightSpec);
mContentWidth = mWidgetSpacingLayout.getContentWidth();
+ AppsCustomizeTabHost host = (AppsCustomizeTabHost) getTabHost();
+ final boolean hostIsTransitioning = host.isTransitioning();
+
// Restore the page
int page = getPageForComponent(mSaveInstanceStateItemIndex);
- invalidatePageData(Math.max(0, page));
+ invalidatePageData(Math.max(0, page), hostIsTransitioning);
// Show All Apps cling if we are finished transitioning, otherwise, we will try again when
// the transition completes in AppsCustomizeTabHost (otherwise the wrong offsets will be
// returned while animating)
- AppsCustomizeTabHost host = (AppsCustomizeTabHost) getTabHost();
- if (!host.isTransitioning()) {
+ if (!hostIsTransitioning) {
post(new Runnable() {
@Override
public void run() {
@@ -662,6 +664,18 @@
cancelAllTasks();
}
+ public void clearAllWidgetPages() {
+ cancelAllTasks();
+ int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ View v = getPageAt(i);
+ if (v instanceof PagedViewGridLayout) {
+ ((PagedViewGridLayout) v).removeAllViewsOnPage();
+ mDirtyPageContent.set(i, true);
+ }
+ }
+ }
+
private void cancelAllTasks() {
// Clean up all the async tasks
Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 778d6bc..2963240 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -366,6 +366,11 @@
}
mContent.setVisibility(VISIBLE);
+ if (!toWorkspace) {
+ // Make sure the current page is loaded (we start loading the side pages after the
+ // transition to prevent slowing down the animation)
+ mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage(), true);
+ }
if (animated && !delayLauncherTransitionUntilLayout) {
enableAndBuildHardwareLayer();
}
@@ -391,6 +396,9 @@
// Dismiss the workspace cling and show the all apps cling (if not already shown)
l.dismissWorkspaceCling(null);
mAppsCustomizePane.showAllAppsCling();
+ // Make sure adjacent pages are loaded (we wait until after the transition to
+ // prevent slowing down the animation)
+ mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage());
if (!LauncherApplication.isScreenLarge()) {
mAppsCustomizePane.hideScrollingIndicator(false);
@@ -398,6 +406,23 @@
}
}
+ public void onResume() {
+ if (getVisibility() == VISIBLE) {
+ mContent.setVisibility(VISIBLE);
+ // We unload the widget previews when the UI is hidden, so need to reload pages
+ // Load the current page synchronously, and the neighboring pages asynchronously
+ mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage(), true);
+ mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage());
+ }
+ }
+
+ public void onTrimMemory() {
+ mContent.setVisibility(GONE);
+ // Clear the widget pages of all their subviews - this will trigger the widget previews
+ // to delete their bitmaps
+ mAppsCustomizePane.clearAllWidgetPages();
+ }
+
boolean isTransitioning() {
return mInTransition;
}
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index a6757d7..fdde4d5 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -156,6 +156,7 @@
super.onFinishInflate();
mContent = (CellLayout) findViewById(R.id.folder_content);
mContent.setGridSize(0, 0);
+ mContent.getChildrenLayout().setMotionEventSplittingEnabled(false);
mFolderName = (FolderEditText) findViewById(R.id.folder_name);
mFolderName.setFolder(this);
mFolderName.setOnFocusChangeListener(this);
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index e489e46..809b0b9 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -36,6 +36,7 @@
import android.content.BroadcastReceiver;
import android.content.ClipData;
import android.content.ClipDescription;
+import android.content.ComponentCallbacks2;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
@@ -563,6 +564,7 @@
// When we resume Launcher, a different Activity might be responsible for the app
// market intent, so refresh the icon
updateAppMarketIcon();
+ mAppsCustomizeTabHost.onResume();
if (!mWorkspaceLoading) {
final ViewTreeObserver observer = mWorkspace.getViewTreeObserver();
final Workspace workspace = mWorkspace;
@@ -2400,6 +2402,14 @@
}
}
+ @Override
+ public void onTrimMemory(int level) {
+ super.onTrimMemory(level);
+ if (level == ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
+ mAppsCustomizeTabHost.onTrimMemory();
+ }
+ }
+
void showWorkspace(boolean animated) {
Resources res = getResources();
int stagger = res.getInteger(R.integer.config_appsCustomizeWorkspaceAnimationStagger);
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 2f66537..3f5652e 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -61,8 +61,6 @@
// the min drag distance for a fling to register, to prevent random page shifts
private static final int MIN_LENGTH_FOR_FLING = 25;
- // The min drag distance to trigger a page shift (regardless of velocity)
- private static final int MIN_LENGTH_FOR_MOVE = 200;
private static final int PAGE_SNAP_ANIMATION_DURATION = 550;
protected static final float NANOTIME_DIV = 1000000000.0f;
@@ -72,6 +70,8 @@
private static final int MINIMUM_SNAP_VELOCITY = 2200;
private static final int MIN_FLING_VELOCITY = 250;
private static final float RETURN_TO_ORIGINAL_PAGE_THRESHOLD = 0.33f;
+ // The page is moved more than halfway, automatically move to the next page on touch up.
+ private static final float SIGNIFICANT_MOVE_THRESHOLD = 0.4f;
// the velocity at which a fling gesture will cause us to snap to the next page
protected int mSnapVelocity = 500;
@@ -143,7 +143,7 @@
private PageSwitchListener mPageSwitchListener;
- private ArrayList<Boolean> mDirtyPageContent;
+ protected ArrayList<Boolean> mDirtyPageContent;
// choice modes
protected static final int CHOICE_MODE_NONE = 0;
@@ -1205,24 +1205,25 @@
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
int velocityX = (int) velocityTracker.getXVelocity(activePointerId);
final int deltaX = (int) (x - mDownMotionX);
- boolean isSignificantMove = Math.abs(deltaX) > MIN_LENGTH_FOR_MOVE;
+ final int pageWidth = getScaledMeasuredWidth(getPageAt(mCurrentPage));
+ boolean isSignificantMove = Math.abs(deltaX) > pageWidth *
+ SIGNIFICANT_MOVE_THRESHOLD;
final int snapVelocity = mSnapVelocity;
mTotalMotionX += Math.abs(mLastMotionX + mLastMotionXRemainder - x);
+ boolean isFling = mTotalMotionX > MIN_LENGTH_FOR_FLING &&
+ Math.abs(velocityX) > snapVelocity;
+
// In the case that the page is moved far to one direction and then is flung
// in the opposite direction, we use a threshold to determine whether we should
// just return to the starting page, or if we should skip one further.
boolean returnToOriginalPage = false;
- final int pageWidth = getScaledMeasuredWidth(getPageAt(mCurrentPage));
if (Math.abs(deltaX) > pageWidth * RETURN_TO_ORIGINAL_PAGE_THRESHOLD &&
- Math.signum(velocityX) != Math.signum(deltaX)) {
+ Math.signum(velocityX) != Math.signum(deltaX) && isFling) {
returnToOriginalPage = true;
}
- boolean isFling = mTotalMotionX > MIN_LENGTH_FOR_FLING &&
- Math.abs(velocityX) > snapVelocity;
-
int finalPage;
// We give flings precedence over large moves, which is why we short-circuit our
// test for a large move if a fling has been registered. That is, a large
diff --git a/src/com/android/launcher2/PagedViewGridLayout.java b/src/com/android/launcher2/PagedViewGridLayout.java
index 5c32e09..b1b6215 100644
--- a/src/com/android/launcher2/PagedViewGridLayout.java
+++ b/src/com/android/launcher2/PagedViewGridLayout.java
@@ -68,6 +68,12 @@
heightMeasureSpec);
}
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mOnLayoutListener = null;
+ }
+
public void setOnLayoutListener(Runnable r) {
mOnLayoutListener = r;
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 3f74fd9..02a81a7 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -57,6 +57,7 @@
import android.view.DragEvent;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
@@ -1280,21 +1281,34 @@
return (mBackground != null && mBackgroundAlpha > 0.0f && mDrawBackground);
}
- @Override
- protected void dispatchDraw(Canvas canvas) {
+ public void scrollTo (int x, int y) {
+ super.scrollTo(x, y);
+ syncChildrenLayersEnabledOnVisiblePages();
+ }
+
+ // This method just applies the value mChildrenLayersEnabled to all the pages that
+ // will be rendered on the next frame.
+ // We do this because calling setChildrenLayersEnabled on a view that's not
+ // visible/rendered causes slowdowns on some graphics cards
+ private void syncChildrenLayersEnabledOnVisiblePages() {
if (mChildrenLayersEnabled) {
getVisiblePages(mTempVisiblePagesRange);
final int leftScreen = mTempVisiblePagesRange[0];
final int rightScreen = mTempVisiblePagesRange[1];
if (leftScreen != -1 && rightScreen != -1) {
- // calling setChildrenLayersEnabled on a view that's not visible/rendered
- // causes slowdowns on some graphics cards, so we set it here to be sure
- // it's only called when it's safe (ie when the view will be rendered)
for (int i = leftScreen; i <= rightScreen; i++) {
- ((ViewGroup)getPageAt(i)).setChildrenLayersEnabled(true);
+ ViewGroup page = (ViewGroup) getPageAt(i);
+ if (page.getVisibility() == VISIBLE &&
+ page.getAlpha() > ViewConfiguration.ALPHA_THRESHOLD) {
+ ((ViewGroup)getPageAt(i)).setChildrenLayersEnabled(true);
+ }
}
}
}
+ }
+
+ @Override
+ protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (mInScrollArea && !LauncherApplication.isScreenLarge()) {
@@ -1723,6 +1737,7 @@
b * mNewBackgroundAlphaMultipliers[i]);
cl.setFastAlpha(a * mOldAlphas[i] + b * mNewAlphas[i]);
}
+ syncChildrenLayersEnabledOnVisiblePages();
}
});
@@ -1760,6 +1775,7 @@
// Fade the background gradient away
animateBackgroundGradient(0f, true);
}
+ syncChildrenLayersEnabledOnVisiblePages();
}
/**
@@ -2347,6 +2363,7 @@
mDragTargetLayout.onDragExit();
}
mLastDragOverView = null;
+ mSpringLoadedDragController.cancel();
if (!mIsPageMoving) {
hideOutlines();