Retiring some feature flags

Change-Id: I80a00ecaec0785ce2ba6a5f14a54c8a76f555d43
This commit is contained in:
Sunny Goyal committed 2018-07-10 13:52:17 -07:00
1 parent 17b7d36594
commit 36b54228fc
27 files changed
+41 -215

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

-21
View File
@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@drawable/ic_allapps_pressed" />
<item android:state_pressed="true" android:drawable="@drawable/ic_allapps_pressed" />
<item android:drawable="@drawable/ic_allapps" />
</selector>
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<TextView style="@style/BaseIcon" />
-1
View File
@@ -16,7 +16,6 @@
<resources>
<!-- All Apps -->
<dimen name="all_apps_button_scale_down">8dp</dimen>
<dimen name="all_apps_empty_search_message_top_offset">64dp</dimen>
<dimen name="all_apps_empty_search_bg_top_offset">180dp</dimen>
-1
View File
@@ -76,7 +76,6 @@
<dimen name="fastscroll_end_margin">-26dp</dimen>
<!-- All Apps -->
<dimen name="all_apps_button_scale_down">0dp</dimen>
<dimen name="all_apps_search_bar_field_height">48dp</dimen>
<dimen name="all_apps_search_bar_bottom_padding">30dp</dimen>
<dimen name="all_apps_empty_search_message_top_offset">40dp</dimen>
+9 -2
View File
@@ -16,7 +16,7 @@
<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3">
<!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
<!-- Dialer, Messaging, [All Apps], Browser, Camera -->
<!-- Dialer, Messaging, [Maps/Music], Browser, Camera -->
<resolve
launcher:container="-101"
launcher:screen="0"
@@ -39,7 +39,14 @@
<favorite launcher:uri="mmsto:" />
</resolve>
<!-- All Apps -->
<resolve
launcher:container="-101"
launcher:screen="2"
launcher:x="2"
launcher:y="0" >
<favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MAPS;end" />
<favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MUSIC;end" />
</resolve>
<resolve
launcher:container="-101"
+8 -2
View File
@@ -16,7 +16,7 @@
<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3">
<!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
<!-- Messaging, Email, Browser, [All Apps], Music, Gallery, Camera -->
<!-- Messaging, Email, Browser, Maps, Music, Gallery, Camera -->
<resolve
launcher:container="-101"
launcher:screen="0"
@@ -48,7 +48,13 @@
<favorite launcher:uri="http://www.example.com/" />
</resolve>
<!-- All Apps -->
<resolve
launcher:container="-101"
launcher:screen="3"
launcher:x="3"
launcher:y="0" >
<favorite launcher:uri="#Intent;action=android.intent.action.MAIN;category=android.intent.category.APP_MAPS;end" />
</resolve>
<favorite
launcher:container="-101"
@@ -28,7 +28,6 @@ import android.content.res.XmlResourceParser;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Process;
@@ -37,16 +36,18 @@ import android.util.ArrayMap;
import android.util.Log;
import android.util.Pair;
import android.util.Patterns;
import com.android.launcher3.LauncherProvider.SqlArguments;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.LauncherIcons;
import com.android.launcher3.util.Thunk;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Locale;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/**
* Layout parsing code for auto installs layout
@@ -230,9 +231,7 @@ public class AutoInstallsLayout {
if (HOTSEAT_CONTAINER_NAME.equals(getAttributeValue(parser, ATTR_CONTAINER))) {
out[0] = Favorites.CONTAINER_HOTSEAT;
// Hack: hotseat items are stored using screen ids
long rank = Long.parseLong(getAttributeValue(parser, ATTR_RANK));
out[1] = (FeatureFlags.NO_ALL_APPS_ICON || rank < mIdp.getAllAppsButtonRank())
? rank : (rank + 1);
out[1] = Long.parseLong(getAttributeValue(parser, ATTR_RANK));
} else {
out[0] = Favorites.CONTAINER_DESKTOP;
out[1] = Long.parseLong(getAttributeValue(parser, ATTR_SCREEN));
-47
View File
@@ -16,26 +16,18 @@
package com.android.launcher3;
import static com.android.launcher3.LauncherState.ALL_APPS;
import android.content.Context;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.UserEventDispatcher.LogContainerProvider;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
public class Hotseat extends FrameLayout implements LogContainerProvider, Insettable {
@@ -92,45 +84,6 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett
} else {
mContent.setGridSize(idp.numHotseatIcons, 1);
}
if (!FeatureFlags.NO_ALL_APPS_ICON) {
// Add the Apps button
Context context = getContext();
DeviceProfile grid = mLauncher.getDeviceProfile();
int allAppsButtonRank = grid.inv.getAllAppsButtonRank();
LayoutInflater inflater = LayoutInflater.from(context);
TextView allAppsButton = (TextView)
inflater.inflate(R.layout.all_apps_button, mContent, false);
Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon);
d.setBounds(0, 0, grid.iconSizePx, grid.iconSizePx);
int scaleDownPx = getResources().getDimensionPixelSize(R.dimen.all_apps_button_scale_down);
Rect bounds = d.getBounds();
d.setBounds(bounds.left, bounds.top + scaleDownPx / 2, bounds.right - scaleDownPx,
bounds.bottom - scaleDownPx / 2);
allAppsButton.setCompoundDrawables(null, d, null, null);
allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
if (mLauncher != null) {
allAppsButton.setOnClickListener((v) -> {
if (!mLauncher.isInState(ALL_APPS)) {
mLauncher.getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
ControlType.ALL_APPS_BUTTON);
mLauncher.getStateManager().goToState(ALL_APPS);
}
});
allAppsButton.setOnFocusChangeListener(mLauncher.mFocusHandler);
}
// Note: We do this to ensure that the hotseat is always laid out in the orientation of
// the hotseat in order regardless of which orientation they were added
int x = getCellXFromOrder(allAppsButtonRank);
int y = getCellYFromOrder(allAppsButtonRank);
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x, y, 1, 1);
lp.canReorder = false;
mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true);
}
}
@Override
@@ -28,7 +28,6 @@ import android.util.Xml;
import android.view.Display;
import android.view.WindowManager;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.ConfigMonitor;
import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.launcher3.util.Thunk;
@@ -314,17 +313,6 @@ public class InvariantDeviceProfile {
return this;
}
public int getAllAppsButtonRank() {
if (FeatureFlags.IS_DOGFOOD_BUILD && FeatureFlags.NO_ALL_APPS_ICON) {
throw new IllegalAccessError("Accessing all apps rank when all-apps is disabled");
}
return numHotseatIcons / 2;
}
public boolean isAllAppsButtonRank(int rank) {
return rank == getAllAppsButtonRank();
}
public DeviceProfile getDeviceProfile(Context context) {
return context.getResources().getConfiguration().orientation
== Configuration.ORIENTATION_LANDSCAPE ? landscapeProfile : portraitProfile;
+2 -16
View File
@@ -2019,22 +2019,8 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
}
public void onNoCellFound(View dropTargetLayout) {
if (mLauncher.isHotseatLayout(dropTargetLayout)) {
Hotseat hotseat = mLauncher.getHotseat();
boolean droppedOnAllAppsIcon = !FeatureFlags.NO_ALL_APPS_ICON
&& mTargetCell != null && !mLauncher.getDeviceProfile().inv.isAllAppsButtonRank(
hotseat.getOrderInHotseat(mTargetCell[0], mTargetCell[1]));
if (!droppedOnAllAppsIcon) {
// Only show message when hotseat is full and drop target was not AllApps button
showOutOfSpaceMessage(true);
}
} else {
showOutOfSpaceMessage(false);
}
}
private void showOutOfSpaceMessage(boolean isHotseatLayout) {
int strId = (isHotseatLayout ? R.string.hotseat_out_of_space : R.string.out_of_space);
int strId = mLauncher.isHotseatLayout(dropTargetLayout)
? R.string.hotseat_out_of_space : R.string.out_of_space;
Toast.makeText(mLauncher, mLauncher.getString(strId), Toast.LENGTH_SHORT).show();
}
@@ -31,12 +31,8 @@ abstract class BaseFlags {
public static final boolean IS_DOGFOOD_BUILD = false;
public static final String AUTHORITY = "com.android.launcher3.settings".intern();
// When enabled allows to use any point on the fast scrollbar to start dragging.
public static final boolean LAUNCHER3_DIRECT_SCROLL = true;
// When enabled the promise icon is visible in all apps while installation an app.
public static final boolean LAUNCHER3_PROMISE_APPS_IN_ALL_APPS = false;
// When enabled allows use of spring motions on the icons.
public static final boolean LAUNCHER3_SPRING_ICONS = true;
// Feature flag to enable moving the QSB on the 0th screen of the workspace.
public static final boolean QSB_ON_FIRST_SCREEN = true;
@@ -16,6 +16,8 @@
package com.android.launcher3.dragndrop;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_ICON_BADGED;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.FloatArrayEvaluator;
@@ -57,8 +59,6 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.ShortcutConfigActivityInfo;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.IconNormalizer;
import com.android.launcher3.graphics.LauncherIcons;
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.shortcuts.ShortcutInfoCompat;
@@ -70,8 +70,6 @@ import com.android.launcher3.widget.PendingAddShortcutInfo;
import java.util.Arrays;
import java.util.List;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_ICON_BADGED;
public class DragView extends View {
private static final ColorMatrix sTempMatrix1 = new ColorMatrix();
private static final ColorMatrix sTempMatrix2 = new ColorMatrix();
@@ -198,7 +196,7 @@ public class DragView extends View {
*/
@TargetApi(Build.VERSION_CODES.O)
public void setItemInfo(final ItemInfo info) {
if (!(FeatureFlags.LAUNCHER3_SPRING_ICONS && Utilities.ATLEAST_OREO)) {
if (!Utilities.ATLEAST_OREO) {
return;
}
if (info.itemType != LauncherSettings.Favorites.ITEM_TYPE_APPLICATION &&
@@ -138,10 +138,7 @@ public class GridSizeMigrationTask {
*/
protected boolean migrateHotseat() throws Exception {
ArrayList<DbEntry> items = loadHotseatEntries();
int requiredCount = FeatureFlags.NO_ALL_APPS_ICON ? mDestHotseatSize : mDestHotseatSize - 1;
while (items.size() > requiredCount) {
while (items.size() > mDestHotseatSize) {
// Pick the center item by default.
DbEntry toRemove = items.get(items.size() / 2);
@@ -171,9 +168,6 @@ public class GridSizeMigrationTask {
}
newScreenId++;
if (!FeatureFlags.NO_ALL_APPS_ICON && mIdp.isAllAppsButtonRank(newScreenId)) {
newScreenId++;
}
}
return applyOperations();
@@ -24,7 +24,6 @@ import android.content.Intent.ShortcutIconResource;
import android.content.pm.LauncherActivityInfo;
import android.database.Cursor;
import android.database.CursorWrapper;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.UserHandle;
import android.provider.BaseColumns;
@@ -387,15 +386,6 @@ public class LoaderCursor extends CursorWrapper {
protected boolean checkItemPlacement(ItemInfo item, ArrayList<Long> workspaceScreens) {
long containerIndex = item.screenId;
if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
// Return early if we detect that an item is under the hotseat button
if (!FeatureFlags.NO_ALL_APPS_ICON &&
mIDP.isAllAppsButtonRank((int) item.screenId)) {
Log.e(TAG, "Error loading shortcut into hotseat " + item
+ " into position (" + item.screenId + ":" + item.cellX + ","
+ item.cellY + ") occupied by all apps");
return false;
}
final GridOccupancy hotseatOccupancy =
occupied.get((long) LauncherSettings.Favorites.CONTAINER_HOTSEAT);
@@ -308,9 +308,6 @@ public class ImportDataTask {
LongArrayMap<Object> hotseatItems = GridSizeMigrationTask.removeBrokenHotseatItems(mContext);
int myHotseatCount = LauncherAppState.getIDP(mContext).numHotseatIcons;
if (!FeatureFlags.NO_ALL_APPS_ICON) {
myHotseatCount--;
}
if (hotseatItems.size() < myHotseatCount) {
// Insufficient hotseat items. Add a few more.
HotseatParserCallback parserCallback = new HotseatParserCallback(
+1 -28
View File
@@ -201,10 +201,6 @@ public class FocusLogic {
ViewGroup hotseatParent = hotseatLayout.getShortcutsAndWidgets();
boolean isHotseatHorizontal = !dp.isVerticalBarLayout();
boolean moreIconsInHotseatThanWorkspace = !FeatureFlags.NO_ALL_APPS_ICON &&
(isHotseatHorizontal
? hotseatLayout.getCountX() > iconLayout.getCountX()
: hotseatLayout.getCountY() > iconLayout.getCountY());
int m, n;
if (isHotseatHorizontal) {
@@ -215,19 +211,7 @@ public class FocusLogic {
n = hotseatLayout.getCountY();
}
int[][] matrix = createFullMatrix(m, n);
if (moreIconsInHotseatThanWorkspace) {
int allappsiconRank = dp.inv.getAllAppsButtonRank();
if (isHotseatHorizontal) {
for (int j = 0; j < n; j++) {
matrix[allappsiconRank][j] = ALL_APPS_COLUMN;
}
} else {
for (int j = 0; j < m; j++) {
matrix[j][allappsiconRank] = ALL_APPS_COLUMN;
}
}
}
// Iterate thru the children of the workspace.
// Iterate through the children of the workspace.
for (int i = 0; i < iconParent.getChildCount(); i++) {
View cell = iconParent.getChildAt(i);
if (!cell.isFocusable()) {
@@ -235,17 +219,6 @@ public class FocusLogic {
}
int cx = ((CellLayout.LayoutParams) cell.getLayoutParams()).cellX;
int cy = ((CellLayout.LayoutParams) cell.getLayoutParams()).cellY;
if (moreIconsInHotseatThanWorkspace) {
int allappsiconRank = dp.inv.getAllAppsButtonRank();
if (isHotseatHorizontal && cx >= allappsiconRank) {
// Add 1 to account for the All Apps button.
cx++;
}
if (!isHotseatHorizontal && cy >= allappsiconRank) {
// Add 1 to account for the All Apps button.
cy++;
}
}
matrix[cx][cy] = i;
}
@@ -224,8 +224,7 @@ public class RecyclerViewFastScroller extends View {
}
if (isNearThumb(x, y)) {
mTouchOffsetY = mDownY - mThumbOffsetY;
} else if (FeatureFlags.LAUNCHER3_DIRECT_SCROLL
&& mRv.supportsFastScrolling()
} else if (mRv.supportsFastScrolling()
&& isNearScrollBar(mDownX)) {
calcTouchOffsetAndPrepToFastScroll(mDownY, mLastY);
updateFastScrollSectionNameAndThumbOffset(mLastY, y);
@@ -16,7 +16,6 @@ import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherProvider;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.GridSizeMigrationTask.MultiStepMigrationTask;
import com.android.launcher3.util.TestLauncherProvider;
@@ -87,13 +86,8 @@ public class GridSizeMigrationTaskTest {
mIdp.numHotseatIcons = 3;
new GridSizeMigrationTask(mContext, mIdp, mValidPackages, 5, 3)
.migrateHotseat();
if (FeatureFlags.NO_ALL_APPS_ICON) {
// First item is dropped as it has the least weight.
verifyHotseat(hotseatItems[1], hotseatItems[3], hotseatItems[4]);
} else {
// First & last items are dropped as they have the least weight.
verifyHotseat(hotseatItems[1], -1, hotseatItems[3]);
}
// First item is dropped as it has the least weight.
verifyHotseat(hotseatItems[1], hotseatItems[3], hotseatItems[4]);
}
@Test
@@ -109,13 +103,8 @@ public class GridSizeMigrationTaskTest {
mIdp.numHotseatIcons = 3;
new GridSizeMigrationTask(mContext, mIdp, mValidPackages, 5, 3)
.migrateHotseat();
if (FeatureFlags.NO_ALL_APPS_ICON) {
// First item is dropped as it has the least weight.
verifyHotseat(hotseatItems[1], hotseatItems[3], hotseatItems[4]);
} else {
// First & third items are dropped as they have the least weight.
verifyHotseat(hotseatItems[1], -1, hotseatItems[4]);
}
// First item is dropped as it has the least weight.
verifyHotseat(hotseatItems[1], hotseatItems[3], hotseatItems[4]);
}
private void verifyHotseat(long... sortedIds) {
@@ -43,13 +43,11 @@ import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.R;
import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.testcomponent.AppWidgetNoConfig;
import com.android.launcher3.testcomponent.AppWidgetWithConfig;
import org.junit.Before;
import java.util.Locale;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -101,19 +99,12 @@ public abstract class AbstractLauncherUiTest {
*/
protected UiObject2 openAllApps() {
mDevice.waitForIdle();
if (FeatureFlags.NO_ALL_APPS_ICON) {
UiObject2 hotseat = mDevice.wait(
Until.findObject(getSelectorForId(R.id.hotseat)), 2500);
Point start = hotseat.getVisibleCenter();
int endY = (int) (mDevice.getDisplayHeight() * 0.1f);
// 100 px/step
mDevice.swipe(start.x, start.y, start.x, endY, (start.y - endY) / 100);
} else {
mDevice.wait(Until.findObject(
By.desc(mTargetContext.getString(R.string.all_apps_button_label))),
DEFAULT_UI_TIMEOUT).click();
}
UiObject2 hotseat = mDevice.wait(
Until.findObject(getSelectorForId(R.id.hotseat)), 2500);
Point start = hotseat.getVisibleCenter();
int endY = (int) (mDevice.getDisplayHeight() * 0.1f);
// 100 px/step
mDevice.swipe(start.x, start.y, start.x, endY, (start.y - endY) / 100);
return findViewById(R.id.apps_list_view);
}