From d0a660cf229a919b1c72e82ff9d408bee58c9210 Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Tue, 4 Aug 2020 16:22:40 -0700 Subject: [PATCH] AOSP/Launcher3 - Update language to comply with Android's inclusive language guidance. DO NOT MERGE Fixed check-style errors. These files are AOSP specific files and they don't exist in the internal code. See https://source.android.com/setup/contribute/respectful-code for reference BUG=161896447 Test: m and Launcher3Tests $ find out -name "Launcher*.apk" -print -exec ls -l {} \; out/target/product/bonito/testcases/Launcher3Tests/arm64/Launcher3Tests.apk -rw-r----- 1 rtenneti primarygroup 947525 Aug 4 16:22 out/target/product/bonito/testcases/Launcher3Tests/arm64/Launcher3Tests.apk out/target/product/bonito/system_ext/priv-app/Launcher3QuickStep/Launcher3QuickStep.apk -rw-r----- 1 rtenneti primarygroup 9249956 Aug 4 16:20 out/target/product/bonito/system_ext/priv-app/Launcher3QuickStep/Launcher3QuickStep.apk Change-Id: I428eaa50ada96567a3b583eca1aa8ee2d8b85e6b --- .../launcher3/icons/cache/BaseIconCache.java | 2 +- .../quickstep/RecentsAnimationWrapper.java | 6 +- .../android/quickstep/TaskSystemShortcut.java | 17 +++--- .../model/BaseGridChangesTestCase.java | 4 +- .../android/launcher3/WorkspaceItemInfo.java | 2 +- .../launcher3/model/LoaderCursorTest.java | 55 ++++++++++--------- .../launcher3/provider/RestoreDbTaskTest.java | 9 +-- 7 files changed, 50 insertions(+), 45 deletions(-) diff --git a/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java b/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java index a886c0aa09..5cde547ad4 100644 --- a/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java +++ b/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java @@ -104,7 +104,7 @@ public abstract class BaseIconCache { if (inMemoryCache) { mCache = new HashMap<>(INITIAL_ICON_CACHE_CAPACITY); } else { - // Use a dummy cache + // Use a placeholder cache mCache = new AbstractMap() { @Override public Set> entrySet() { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java index c4d3fa03aa..784c9564f8 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java @@ -161,9 +161,9 @@ public class RecentsAnimationWrapper { private void disableInputProxy() { if (mInputConsumer != null && mTouchInProgress) { long now = SystemClock.uptimeMillis(); - MotionEvent dummyCancel = MotionEvent.obtain(now, now, ACTION_CANCEL, 0, 0, 0); - mInputConsumer.onMotionEvent(dummyCancel); - dummyCancel.recycle(); + MotionEvent tempCancel = MotionEvent.obtain(now, now, ACTION_CANCEL, 0, 0, 0); + mInputConsumer.onMotionEvent(tempCancel); + tempCancel.recycle(); } mInputConsumerController.setInputListener(null); } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java index 1af0db07d8..51e869e27c 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java @@ -17,6 +17,7 @@ package com.android.quickstep; import static android.view.Display.DEFAULT_DISPLAY; + import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP; import android.app.Activity; @@ -85,19 +86,19 @@ public class TaskSystemShortcut extends SystemShortcut public View.OnClickListener getOnClickListener(BaseDraggingActivity activity, TaskView view) { Task task = view.getTask(); - WorkspaceItemInfo dummyInfo = new WorkspaceItemInfo(); - dummyInfo.intent = new Intent(); + WorkspaceItemInfo stubItemInfo = new WorkspaceItemInfo(); + stubItemInfo.intent = new Intent(); ComponentName component = task.getTopComponent(); - dummyInfo.intent.setComponent(component); - dummyInfo.user = UserHandle.of(task.key.userId); - dummyInfo.title = TaskUtils.getTitle(activity, task); + stubItemInfo.intent.setComponent(component); + stubItemInfo.user = UserHandle.of(task.key.userId); + stubItemInfo.title = TaskUtils.getTitle(activity, task); - return getOnClickListenerForTask(activity, task, dummyInfo); + return getOnClickListenerForTask(activity, task, stubItemInfo); } protected View.OnClickListener getOnClickListenerForTask( - BaseDraggingActivity activity, Task task, ItemInfo dummyInfo) { - return mSystemShortcut.getOnClickListener(activity, dummyInfo); + BaseDraggingActivity activity, Task task, ItemInfo stubItemInfo) { + return mSystemShortcut.getOnClickListener(activity, stubItemInfo); } public static class AppInfo extends TaskSystemShortcut { diff --git a/robolectric_tests/src/com/android/launcher3/model/BaseGridChangesTestCase.java b/robolectric_tests/src/com/android/launcher3/model/BaseGridChangesTestCase.java index 07834fcd0b..c25df81fe4 100644 --- a/robolectric_tests/src/com/android/launcher3/model/BaseGridChangesTestCase.java +++ b/robolectric_tests/src/com/android/launcher3/model/BaseGridChangesTestCase.java @@ -42,7 +42,7 @@ public abstract class BaseGridChangesTestCase { } /** - * Adds a dummy item in the DB. + * Adds a mock item in the DB. * @param type {@link #APP_ICON} or {@link #SHORTCUT} or >= 2 for * folder (where the type represents the number of items in the folder). */ @@ -82,7 +82,7 @@ public abstract class BaseGridChangesTestCase { } /** - * Initializes the DB with dummy elements to represent the provided grid structure. + * Initializes the DB with mock elements to represent the provided grid structure. * @param typeArray A 3d array of item types. {@see #addItem(int, long, long, int, int)} for * type definitions. The first dimension represents the screens and the next * two represent the workspace grid. diff --git a/src/com/android/launcher3/WorkspaceItemInfo.java b/src/com/android/launcher3/WorkspaceItemInfo.java index 23795c5c0e..82fc600deb 100644 --- a/src/com/android/launcher3/WorkspaceItemInfo.java +++ b/src/com/android/launcher3/WorkspaceItemInfo.java @@ -214,7 +214,7 @@ public class WorkspaceItemInfo extends ItemInfoWithIcon { if (cn == null && (itemType == Favorites.ITEM_TYPE_SHORTCUT || hasStatusFlag(FLAG_SUPPORTS_WEB_UI|FLAG_AUTOINSTALL_ICON|FLAG_RESTORED_ICON))) { // Legacy shortcuts and promise icons with web UI may not have a componentName but just - // a packageName. In that case create a dummy componentName instead of adding additional + // a packageName. In that case create a empty componentName instead of adding additional // check everywhere. String pkg = intent.getPackage(); return pkg == null ? null : new ComponentName(pkg, IconCache.EMPTY_CLASS_NAME); diff --git a/tests/src/com/android/launcher3/model/LoaderCursorTest.java b/tests/src/com/android/launcher3/model/LoaderCursorTest.java index 64df8e0e95..b13468da94 100644 --- a/tests/src/com/android/launcher3/model/LoaderCursorTest.java +++ b/tests/src/com/android/launcher3/model/LoaderCursorTest.java @@ -1,29 +1,5 @@ package com.android.launcher3.model; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.database.MatrixCursor; -import android.graphics.Bitmap; -import android.os.Process; -import androidx.test.InstrumentationRegistry; -import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; - -import com.android.launcher3.WorkspaceItemInfo; -import com.android.launcher3.icons.IconCache; -import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.ItemInfo; -import com.android.launcher3.LauncherAppState; -import com.android.launcher3.compat.LauncherAppsCompat; -import com.android.launcher3.icons.BitmapInfo; -import com.android.launcher3.util.PackageManagerHelper; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import static com.android.launcher3.LauncherSettings.Favorites.INTENT; import static com.android.launcher3.LauncherSettings.Favorites.CELLX; import static com.android.launcher3.LauncherSettings.Favorites.CELLY; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER; @@ -32,6 +8,7 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT import static com.android.launcher3.LauncherSettings.Favorites.ICON; import static com.android.launcher3.LauncherSettings.Favorites.ICON_PACKAGE; import static com.android.launcher3.LauncherSettings.Favorites.ICON_RESOURCE; +import static com.android.launcher3.LauncherSettings.Favorites.INTENT; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT; @@ -40,15 +17,41 @@ import static com.android.launcher3.LauncherSettings.Favorites.RESTORED; import static com.android.launcher3.LauncherSettings.Favorites.SCREEN; import static com.android.launcher3.LauncherSettings.Favorites.TITLE; import static com.android.launcher3.LauncherSettings.Favorites._ID; + import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; + import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.database.MatrixCursor; +import android.graphics.Bitmap; +import android.os.Process; + +import androidx.test.InstrumentationRegistry; +import androidx.test.filters.SmallTest; +import androidx.test.runner.AndroidJUnit4; + +import com.android.launcher3.InvariantDeviceProfile; +import com.android.launcher3.ItemInfo; +import com.android.launcher3.LauncherAppState; +import com.android.launcher3.WorkspaceItemInfo; +import com.android.launcher3.compat.LauncherAppsCompat; +import com.android.launcher3.icons.BitmapInfo; +import com.android.launcher3.icons.IconCache; +import com.android.launcher3.util.PackageManagerHelper; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + /** * Tests for {@link LoaderCursor} */ @@ -100,7 +103,7 @@ public class LoaderCursorTest { public void getAppShortcutInfo_dontAllowMissing_invalidComponent() { initCursor(ITEM_TYPE_APPLICATION, ""); assertTrue(mLoaderCursor.moveToNext()); - ComponentName cn = new ComponentName(mContext.getPackageName(), "dummy-do"); + ComponentName cn = new ComponentName(mContext.getPackageName(), "placeholder-do"); assertNull(mLoaderCursor.getAppShortcutInfo( new Intent().setComponent(cn), false /* allowMissingTarget */, true)); } @@ -123,7 +126,7 @@ public class LoaderCursorTest { initCursor(ITEM_TYPE_APPLICATION, ""); assertTrue(mLoaderCursor.moveToNext()); - ComponentName cn = new ComponentName(mContext.getPackageName(), "dummy-do"); + ComponentName cn = new ComponentName(mContext.getPackageName(), "placeholder-do"); WorkspaceItemInfo info = mLoaderCursor.getAppShortcutInfo( new Intent().setComponent(cn), true /* allowMissingTarget */, true); assertNotNull(info); diff --git a/tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java b/tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java index 6fa8d62a17..856db55b90 100644 --- a/tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java +++ b/tests/src/com/android/launcher3/provider/RestoreDbTaskTest.java @@ -1,8 +1,11 @@ package com.android.launcher3.provider; +import static org.junit.Assert.assertEquals; + import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; + import androidx.test.InstrumentationRegistry; import androidx.test.filters.MediumTest; import androidx.test.runner.AndroidJUnit4; @@ -13,8 +16,6 @@ import com.android.launcher3.LauncherSettings.Favorites; import org.junit.Test; import org.junit.runner.RunWith; -import static org.junit.Assert.assertEquals; - /** * Tests for {@link RestoreDbTask} */ @@ -31,7 +32,7 @@ public class RestoreDbTaskTest { @Test public void testMigrateProfileId() throws Exception { SQLiteDatabase db = new MyDatabaseHelper(42).getWritableDatabase(); - // Add some dummy data + // Add some mock data for (int i = 0; i < 5; i++) { ContentValues values = new ContentValues(); values.put(Favorites._ID, i); @@ -51,7 +52,7 @@ public class RestoreDbTaskTest { @Test public void testChangeDefaultColumn() throws Exception { SQLiteDatabase db = new MyDatabaseHelper(42).getWritableDatabase(); - // Add some dummy data + // Add some mock data for (int i = 0; i < 5; i++) { ContentValues values = new ContentValues(); values.put(Favorites._ID, i);