Merge "Changing minimum supported Launcher version to 26" into ub-launcher3-master
This commit is contained in:
committed by
Android (Google) Code Review
commit
cb89edcbcc
+3
-3
@@ -48,7 +48,7 @@ LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/ --proto_path=$(LOCAL_PA
|
||||
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java
|
||||
|
||||
LOCAL_SDK_VERSION := current
|
||||
LOCAL_MIN_SDK_VERSION := 21
|
||||
LOCAL_MIN_SDK_VERSION := 26
|
||||
LOCAL_MODULE := Launcher3CommonDepsLib
|
||||
LOCAL_PRIVILEGED_MODULE := true
|
||||
LOCAL_MANIFEST_FILE := AndroidManifest-common.xml
|
||||
@@ -77,7 +77,7 @@ LOCAL_PROGUARD_FLAG_FILES := proguard.flags
|
||||
LOCAL_PROGUARD_ENABLED := disabled
|
||||
|
||||
LOCAL_SDK_VERSION := current
|
||||
LOCAL_MIN_SDK_VERSION := 21
|
||||
LOCAL_MIN_SDK_VERSION := 26
|
||||
LOCAL_PACKAGE_NAME := Launcher3
|
||||
LOCAL_PRIVILEGED_MODULE := true
|
||||
LOCAL_SYSTEM_EXT_MODULE := true
|
||||
@@ -108,7 +108,7 @@ LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/go/res
|
||||
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
|
||||
|
||||
LOCAL_SDK_VERSION := current
|
||||
LOCAL_MIN_SDK_VERSION := 21
|
||||
LOCAL_MIN_SDK_VERSION := 26
|
||||
LOCAL_PACKAGE_NAME := Launcher3Go
|
||||
LOCAL_PRIVILEGED_MODULE := true
|
||||
LOCAL_SYSTEM_EXT_MODULE := true
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
at compile time. Note that the components defined in AndroidManifest.xml are also required,
|
||||
with some minor changed based on the derivative app.
|
||||
-->
|
||||
<permission
|
||||
android:name="com.android.launcher.permission.INSTALL_SHORTCUT"
|
||||
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
|
||||
android:protectionLevel="dangerous"
|
||||
android:label="@string/permlab_install_shortcut"
|
||||
android:description="@string/permdesc_install_shortcut" />
|
||||
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||
@@ -79,17 +73,6 @@
|
||||
android:restoreAnyVersion="true"
|
||||
android:supportsRtl="true" >
|
||||
|
||||
<!-- Intent received used to install shortcuts from other applications -->
|
||||
<receiver
|
||||
android:name="com.android.launcher3.InstallShortcutReceiver"
|
||||
android:permission="com.android.launcher.permission.INSTALL_SHORTCUT"
|
||||
android:exported="true"
|
||||
android:enabled="@bool/enable_install_shortcut_api" >
|
||||
<intent-filter>
|
||||
<action android:name="com.android.launcher.action.INSTALL_SHORTCUT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- Intent received when a session is committed -->
|
||||
<receiver
|
||||
android:name="com.android.launcher3.SessionCommitReceiver"
|
||||
@@ -116,7 +99,6 @@
|
||||
<service
|
||||
android:name="com.android.launcher3.notification.NotificationListener"
|
||||
android:label="@string/notification_dots_service_title"
|
||||
android:enabled="@bool/notification_dots_enabled"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
|
||||
<intent-filter>
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.launcher3">
|
||||
<uses-sdk android:targetSdkVersion="29" android:minSdkVersion="25"/>
|
||||
<uses-sdk android:targetSdkVersion="29" android:minSdkVersion="26"/>
|
||||
<!--
|
||||
Manifest entries specific to Launcher3. This is merged with AndroidManifest-common.xml.
|
||||
Refer comments around specific entries on how to extend individual components.
|
||||
|
||||
@@ -45,7 +45,6 @@ import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -55,7 +54,6 @@ import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
@@ -94,7 +92,6 @@ import com.android.systemui.shared.system.WindowManagerWrapper;
|
||||
* {@link LauncherAppTransitionManager} with Quickstep-specific app transitions for launching from
|
||||
* home and/or all-apps. Not used for 3p launchers.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
@SuppressWarnings("unused")
|
||||
public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTransitionManager
|
||||
implements OnDeviceProfileChangeListener {
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright 2017, 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.
|
||||
*/
|
||||
-->
|
||||
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="2166"
|
||||
android:repeatCount="5">
|
||||
<propertyValuesHolder
|
||||
android:propertyName="progress"
|
||||
android:valueType="floatType">
|
||||
<keyframe
|
||||
android:fraction="0"
|
||||
android:value="1f" />
|
||||
<keyframe
|
||||
android:fraction="0.246"
|
||||
android:value="1f" />
|
||||
<keyframe
|
||||
android:fraction=".423"
|
||||
android:interpolator="@interpolator/disco_bounce"
|
||||
android:value="0.9738f" />
|
||||
<keyframe
|
||||
android:fraction="0.754"
|
||||
android:interpolator="@interpolator/disco_bounce"
|
||||
android:value="1f" />
|
||||
<keyframe
|
||||
android:fraction="1"
|
||||
android:value="1f" />
|
||||
</propertyValuesHolder>
|
||||
</objectAnimator>
|
||||
@@ -16,20 +16,28 @@
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:ordering="sequentially">
|
||||
<objectAnimator
|
||||
android:duration="166"
|
||||
android:interpolator="@interpolator/disco_bounce"
|
||||
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="2166"
|
||||
android:repeatCount="5">
|
||||
<propertyValuesHolder
|
||||
android:propertyName="progress"
|
||||
android:startOffset="750"
|
||||
android:valueFrom="1f"
|
||||
android:valueTo="0.9438f"
|
||||
android:valueType="floatType" />
|
||||
<objectAnimator
|
||||
android:duration="500"
|
||||
android:interpolator="@interpolator/disco_bounce"
|
||||
android:propertyName="progress"
|
||||
android:valueTo="1f"
|
||||
android:valueType="floatType" />
|
||||
</set>
|
||||
android:valueType="floatType">
|
||||
<keyframe
|
||||
android:fraction="0"
|
||||
android:value="1f" />
|
||||
<keyframe
|
||||
android:fraction="0.246"
|
||||
android:value="1f" />
|
||||
<keyframe
|
||||
android:fraction=".423"
|
||||
android:interpolator="@interpolator/disco_bounce"
|
||||
android:value="0.9738f" />
|
||||
<keyframe
|
||||
android:fraction="0.754"
|
||||
android:interpolator="@interpolator/disco_bounce"
|
||||
android:value="1f" />
|
||||
<keyframe
|
||||
android:fraction="1"
|
||||
android:value="1f" />
|
||||
</propertyValuesHolder>
|
||||
</objectAnimator>
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2017 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.
|
||||
-->
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="?attr/popupColorSecondary"/>
|
||||
<foreground android:drawable="?attr/popupColorSecondary"/>
|
||||
</adaptive-icon>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2017 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.
|
||||
-->
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/icon_background" />
|
||||
<foreground>
|
||||
<bitmap android:src="@mipmap/ic_launcher_home_foreground"/>
|
||||
</foreground>
|
||||
</adaptive-icon>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 The Android Open Source Project
|
||||
<!--
|
||||
Copyright (C) 2017 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.
|
||||
@@ -13,10 +14,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="?attr/popupColorSecondary" />
|
||||
<size
|
||||
android:height="32dp"
|
||||
android:width="32dp" />
|
||||
</shape>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="?attr/popupColorSecondary"/>
|
||||
<foreground android:drawable="?attr/popupColorSecondary"/>
|
||||
</adaptive-icon>
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<bitmap
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@mipmap/ic_launcher_home" />
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/icon_background" />
|
||||
<foreground>
|
||||
<bitmap android:src="@mipmap/ic_launcher_home_foreground"/>
|
||||
</foreground>
|
||||
</adaptive-icon>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 236 B |
Binary file not shown.
|
Before Width: | Height: | Size: 216 B |
Binary file not shown.
|
Before Width: | Height: | Size: 235 B |
Binary file not shown.
|
Before Width: | Height: | Size: 266 B |
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<style name="AppItemActivityTheme" parent="@android:style/Theme.DeviceDefault.Light.Dialog.Alert">
|
||||
<item name="widgetsTheme">@style/WidgetContainerTheme</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/* Copyright 2017, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<bool name="notification_dots_enabled">true</bool>
|
||||
|
||||
<bool name="enable_install_shortcut_api">false</bool>
|
||||
</resources>
|
||||
@@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<!-- Theme for the widget container. -->
|
||||
<style name="WidgetContainerTheme" parent="@android:style/Theme.DeviceDefault.Settings">
|
||||
<item name="android:colorPrimaryDark">#E8EAED</item>
|
||||
<item name="android:textColorSecondary">?android:attr/textColorPrimary</item>
|
||||
<item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
|
||||
</style>
|
||||
<style name="WidgetContainerTheme.Dark" parent="AppTheme.Dark">
|
||||
<item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
|
||||
<item name="android:colorPrimaryDark">#616161</item> <!-- Gray 700 -->
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/* Copyright 2017, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<bool name="notification_dots_enabled">false</bool>
|
||||
|
||||
<bool name="enable_install_shortcut_api">true</bool>
|
||||
</resources>
|
||||
@@ -35,9 +35,6 @@
|
||||
|
||||
<color name="icon_background">#E0E0E0</color> <!-- Gray 300 -->
|
||||
|
||||
<color name="all_apps_bg_hand_fill">#E5E5E5</color>
|
||||
<color name="all_apps_bg_hand_fill_dark">#9AA0A6</color>
|
||||
|
||||
<color name="gesture_tutorial_ripple_color">#A0C2F9</color> <!-- Light Blue -->
|
||||
<color name="gesture_tutorial_fake_task_view_color">#6DA1FF</color> <!-- Light Blue -->
|
||||
<color name="gesture_tutorial_action_button_label_color">#FFFFFFFF</color>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2017 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<drawable name="ic_setup_shadow">@drawable/ic_setting</drawable>
|
||||
<drawable name="ic_remove_shadow">@drawable/ic_remove_no_shadow</drawable>
|
||||
<drawable name="ic_uninstall_shadow">@drawable/ic_uninstall_no_shadow</drawable>
|
||||
<drawable name="ic_block_shadow">@drawable/ic_block_no_shadow</drawable>
|
||||
</resources>
|
||||
@@ -143,7 +143,7 @@
|
||||
<style name="AppTheme.Dark.DarkMainColor" parent="@style/LauncherTheme.Dark.DarkMainColor" />
|
||||
<style name="AppTheme.Dark.DarkText" parent="@style/LauncherTheme.Dark.DarkText" />
|
||||
|
||||
<style name="AppItemActivityTheme" parent="@android:style/Theme.Material.Light.Dialog.Alert">
|
||||
<style name="AppItemActivityTheme" parent="@android:style/Theme.DeviceDefault.Light.Dialog.Alert">
|
||||
<item name="widgetsTheme">@style/WidgetContainerTheme</item>
|
||||
</style>
|
||||
|
||||
@@ -171,14 +171,16 @@
|
||||
<item name="android:textColorSecondary">?attr/workspaceTextColor</item>
|
||||
</style>
|
||||
|
||||
<!-- Theme for the widget container. Overridden on API 26. -->
|
||||
<!-- Theme for the widget container. -->
|
||||
<style name="WidgetContainerTheme" parent="@android:style/Theme.DeviceDefault.Settings">
|
||||
<item name="android:colorEdgeEffect">?android:attr/textColorSecondaryInverse</item>
|
||||
<item name="android:textColorPrimary">?android:attr/textColorPrimaryInverse</item>
|
||||
<item name="android:textColorSecondary">?android:attr/textColorSecondaryInverse</item>
|
||||
<item name="android:colorPrimaryDark">#E8EAED</item>
|
||||
<item name="android:textColorSecondary">?android:attr/textColorPrimary</item>
|
||||
<item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
|
||||
</style>
|
||||
<style name="WidgetContainerTheme.Dark" parent="AppTheme.Dark">
|
||||
<item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
|
||||
<item name="android:colorPrimaryDark">#616161</item> <!-- Gray 700 -->
|
||||
</style>
|
||||
|
||||
<style name="WidgetContainerTheme.Dark" />
|
||||
|
||||
<style name="FastScrollerPopup" parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle">
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import static android.animation.ValueAnimator.areAnimatorsEnabled;
|
||||
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
|
||||
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
|
||||
|
||||
@@ -126,7 +127,7 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
|
||||
}
|
||||
|
||||
public final void close(boolean animate) {
|
||||
animate &= Utilities.areAnimationsEnabled(getContext());
|
||||
animate &= areAnimatorsEnabled();
|
||||
if (mIsOpen) {
|
||||
BaseActivity.fromContext(getContext()).getUserEventDispatcher()
|
||||
.resetElapsedContainerMillis("container closed");
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import static android.animation.ValueAnimator.areAnimatorsEnabled;
|
||||
|
||||
import static com.android.launcher3.anim.Interpolators.DEACCEL_1_5;
|
||||
|
||||
import android.animation.Animator;
|
||||
@@ -2009,7 +2011,7 @@ public class CellLayout extends ViewGroup {
|
||||
// Animations are disabled in power save mode, causing the repeated animation to jump
|
||||
// spastically between beginning and end states. Since this looks bad, we don't repeat
|
||||
// the animation in power save mode.
|
||||
if (Utilities.areAnimationsEnabled(getContext())) {
|
||||
if (areAnimatorsEnabled()) {
|
||||
va.setRepeatMode(ValueAnimator.REVERSE);
|
||||
va.setRepeatCount(ValueAnimator.INFINITE);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -69,7 +68,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
public class InstallShortcutReceiver {
|
||||
|
||||
public static final int FLAG_ACTIVITY_PAUSED = 1;
|
||||
public static final int FLAG_LOADER_RUNNING = 2;
|
||||
@@ -82,9 +81,6 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "InstallShortcutReceiver";
|
||||
private static final boolean DBG = false;
|
||||
|
||||
private static final String ACTION_INSTALL_SHORTCUT =
|
||||
"com.android.launcher.action.INSTALL_SHORTCUT";
|
||||
|
||||
private static final String LAUNCH_INTENT_KEY = "intent.launch";
|
||||
private static final String NAME_KEY = "name";
|
||||
private static final String ICON_KEY = "icon";
|
||||
@@ -188,25 +184,6 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
sp.edit().putStringSet(APPS_PENDING_INSTALL, newStrings).apply();
|
||||
}
|
||||
|
||||
public void onReceive(Context context, Intent data) {
|
||||
if (!ACTION_INSTALL_SHORTCUT.equals(data.getAction())) {
|
||||
return;
|
||||
}
|
||||
PendingInstallShortcutInfo info = createPendingInfo(context, data);
|
||||
if (info != null) {
|
||||
if (!info.isLauncherActivity()) {
|
||||
// Since its a custom shortcut, verify that it is safe to launch.
|
||||
if (!new PackageManagerHelper(context).hasPermissionForActivity(
|
||||
info.launchIntent, null)) {
|
||||
// Target cannot be launched, or requires some special permission to launch
|
||||
Log.e(TAG, "Ignoring malicious intent " + info.launchIntent.toUri(0));
|
||||
return;
|
||||
}
|
||||
}
|
||||
queuePendingShortcutInfo(info, context);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true is the extra is either null or is of type {@param type}
|
||||
*/
|
||||
@@ -251,6 +228,10 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
queuePendingShortcutInfo(new PendingInstallShortcutInfo(info, widgetId, context), context);
|
||||
}
|
||||
|
||||
public static void queueApplication(LauncherActivityInfo info, Context context) {
|
||||
queuePendingShortcutInfo(new PendingInstallShortcutInfo(info, context), context);
|
||||
}
|
||||
|
||||
public static void queueApplication(Intent data, UserHandle user, Context context) {
|
||||
queuePendingShortcutInfo(new PendingInstallShortcutInfo(data, context, user),
|
||||
context);
|
||||
|
||||
@@ -1196,11 +1196,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
||||
int[] cellXY = mTmpAddItemCellCoordinates;
|
||||
CellLayout layout = getCellLayout(container, screenId);
|
||||
|
||||
WorkspaceItemInfo info = null;
|
||||
if (Utilities.ATLEAST_OREO) {
|
||||
info = PinRequestHelper.createWorkspaceItemFromPinItemRequest(
|
||||
WorkspaceItemInfo info = PinRequestHelper.createWorkspaceItemFromPinItemRequest(
|
||||
this, PinRequestHelper.getPinItemRequest(data), 0);
|
||||
}
|
||||
|
||||
if (info == null) {
|
||||
// Legacy shortcuts are only supported for primary profile.
|
||||
|
||||
@@ -109,15 +109,11 @@ public class LauncherAppState {
|
||||
mInstallSessionTracker = InstallSessionHelper.INSTANCE.get(context)
|
||||
.registerInstallTracker(mModel, MODEL_EXECUTOR);
|
||||
|
||||
if (!mContext.getResources().getBoolean(R.bool.notification_dots_enabled)) {
|
||||
mNotificationDotsObserver = null;
|
||||
} else {
|
||||
// Register an observer to rebind the notification listener when dots are re-enabled.
|
||||
mNotificationDotsObserver =
|
||||
newNotificationSettingsObserver(mContext, this::onNotificationSettingsChanged);
|
||||
mNotificationDotsObserver.register();
|
||||
mNotificationDotsObserver.dispatchOnChange();
|
||||
}
|
||||
// Register an observer to rebind the notification listener when dots are re-enabled.
|
||||
mNotificationDotsObserver =
|
||||
newNotificationSettingsObserver(mContext, this::onNotificationSettingsChanged);
|
||||
mNotificationDotsObserver.register();
|
||||
mNotificationDotsObserver.dispatchOnChange();
|
||||
}
|
||||
|
||||
public LauncherAppState(Context context, @Nullable String iconCacheFileName) {
|
||||
|
||||
@@ -872,7 +872,6 @@ public class LauncherProvider extends ContentProvider {
|
||||
* Removes widgets which are registered to the Launcher's host, but are not present
|
||||
* in our model.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
public void removeGhostWidgets(SQLiteDatabase db) {
|
||||
// Get all existing widget ids.
|
||||
final AppWidgetHost host = newLauncherWidgetHost();
|
||||
|
||||
@@ -38,7 +38,6 @@ public class MainProcessInitializer implements ResourceBasedOverride {
|
||||
protected void init(Context context) {
|
||||
FileLog.setDir(context.getApplicationContext().getFilesDir());
|
||||
FeatureFlags.initialize(context);
|
||||
SessionCommitReceiver.applyDefaultUserPrefs(context);
|
||||
IconShape.init(context);
|
||||
|
||||
if (BitmapCreationCheck.ENABLED) {
|
||||
|
||||
@@ -195,9 +195,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
mMinFlingVelocity = (int) (MIN_FLING_VELOCITY * density);
|
||||
mMinSnapVelocity = (int) (MIN_SNAP_VELOCITY * density);
|
||||
|
||||
if (Utilities.ATLEAST_OREO) {
|
||||
setDefaultFocusHighlightEnabled(false);
|
||||
}
|
||||
setDefaultFocusHighlightEnabled(false);
|
||||
}
|
||||
|
||||
protected void setDefaultInterpolator(Interpolator interpolator) {
|
||||
|
||||
@@ -16,55 +16,32 @@
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.pm.InstallSessionHelper.getUserHandle;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.LauncherActivityInfo;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.PackageInstaller;
|
||||
import android.content.pm.PackageInstaller.SessionInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.launcher3.pm.InstallSessionHelper;
|
||||
import com.android.launcher3.util.Executors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* BroadcastReceiver to handle session commit intent.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
public class SessionCommitReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "SessionCommitReceiver";
|
||||
|
||||
// The content provider for the add to home screen setting. It should be of the format:
|
||||
// <package name>.addtohomescreen
|
||||
private static final String MARKER_PROVIDER_PREFIX = ".addtohomescreen";
|
||||
|
||||
// Preference key for automatically adding icon to homescreen.
|
||||
public static final String ADD_ICON_PREFERENCE_KEY = "pref_add_icon_to_home";
|
||||
public static final String ADD_ICON_PREFERENCE_INITIALIZED_KEY =
|
||||
"pref_add_icon_to_home_initialized";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (!isEnabled(context) || !Utilities.ATLEAST_OREO) {
|
||||
if (!isEnabled(context)) {
|
||||
// User has decided to not add icons on homescreen.
|
||||
return;
|
||||
}
|
||||
@@ -89,16 +66,6 @@ public class SessionCommitReceiver extends BroadcastReceiver {
|
||||
queueAppIconAddition(context, info.getAppPackageName(), user);
|
||||
}
|
||||
|
||||
public static void queuePromiseAppIconAddition(Context context, SessionInfo sessionInfo) {
|
||||
String packageName = sessionInfo.getAppPackageName();
|
||||
if (context.getSystemService(LauncherApps.class)
|
||||
.getActivityList(packageName, getUserHandle(sessionInfo)).isEmpty()) {
|
||||
// Ensure application isn't already installed.
|
||||
queueAppIconAddition(context, packageName, sessionInfo.getAppLabel(),
|
||||
sessionInfo.getAppIcon(), getUserHandle(sessionInfo));
|
||||
}
|
||||
}
|
||||
|
||||
public static void queueAppIconAddition(Context context, String packageName, UserHandle user) {
|
||||
List<LauncherActivityInfo> activities = context.getSystemService(LauncherApps.class)
|
||||
.getActivityList(packageName, user);
|
||||
@@ -106,85 +73,11 @@ public class SessionCommitReceiver extends BroadcastReceiver {
|
||||
// no activity found
|
||||
return;
|
||||
}
|
||||
queueAppIconAddition(context, packageName, activities.get(0).getLabel(), null, user);
|
||||
}
|
||||
|
||||
private static void queueAppIconAddition(Context context, String packageName,
|
||||
CharSequence label, Bitmap icon, UserHandle user) {
|
||||
Intent data = new Intent();
|
||||
data.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent().setComponent(
|
||||
new ComponentName(packageName, "")).setPackage(packageName));
|
||||
data.putExtra(Intent.EXTRA_SHORTCUT_NAME, label);
|
||||
data.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
|
||||
|
||||
InstallShortcutReceiver.queueApplication(data, user, context);
|
||||
InstallShortcutReceiver.queueApplication(activities.get(0), context);
|
||||
}
|
||||
|
||||
public static boolean isEnabled(Context context) {
|
||||
return Utilities.getPrefs(context).getBoolean(ADD_ICON_PREFERENCE_KEY, true);
|
||||
}
|
||||
|
||||
public static void applyDefaultUserPrefs(final Context context) {
|
||||
if (!Utilities.ATLEAST_OREO) {
|
||||
return;
|
||||
}
|
||||
SharedPreferences prefs = Utilities.getPrefs(context);
|
||||
if (prefs.getAll().isEmpty()) {
|
||||
// This logic assumes that the code is the first thing that is executed (before any
|
||||
// shared preference is written).
|
||||
// TODO: Move this logic to DB upgrade once we have proper support for db downgrade
|
||||
// If it is a fresh start, just apply the default value. We use prefs.isEmpty() to infer
|
||||
// a fresh start as put preferences always contain some values corresponding to current
|
||||
// grid.
|
||||
prefs.edit().putBoolean(ADD_ICON_PREFERENCE_KEY, true).apply();
|
||||
} else if (!prefs.contains(ADD_ICON_PREFERENCE_INITIALIZED_KEY)) {
|
||||
new PrefInitTask(context).executeOnExecutor(Executors.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
||||
private static class PrefInitTask extends AsyncTask<Void, Void, Void> {
|
||||
private final Context mContext;
|
||||
|
||||
PrefInitTask(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
boolean addIconToHomeScreenEnabled = readValueFromMarketApp();
|
||||
Utilities.getPrefs(mContext).edit()
|
||||
.putBoolean(ADD_ICON_PREFERENCE_KEY, addIconToHomeScreenEnabled)
|
||||
.putBoolean(ADD_ICON_PREFERENCE_INITIALIZED_KEY, true)
|
||||
.apply();
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean readValueFromMarketApp() {
|
||||
// Get the marget package
|
||||
ResolveInfo ri = mContext.getPackageManager().resolveActivity(
|
||||
new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_APP_MARKET),
|
||||
PackageManager.MATCH_DEFAULT_ONLY | PackageManager.MATCH_SYSTEM_ONLY);
|
||||
if (ri == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Cursor c = null;
|
||||
try {
|
||||
c = mContext.getContentResolver().query(
|
||||
Uri.parse("content://" + ri.activityInfo.packageName
|
||||
+ MARKER_PROVIDER_PREFIX),
|
||||
null, null, null, null);
|
||||
if (c.moveToNext()) {
|
||||
return c.getInt(c.getColumnIndexOrThrow(Settings.NameValueTable.VALUE)) != 0;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "Error reading add to homescreen preference", e);
|
||||
} finally {
|
||||
if (c != null) {
|
||||
c.close();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_ICON_BADGED;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Person;
|
||||
@@ -48,7 +47,6 @@ import android.os.Build;
|
||||
import android.os.DeadObjectException;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.PowerManager;
|
||||
import android.os.TransactionTooLargeException;
|
||||
import android.provider.Settings;
|
||||
import android.text.Spannable;
|
||||
@@ -65,7 +63,6 @@ import android.view.animation.Interpolator;
|
||||
|
||||
import androidx.core.os.BuildCompat;
|
||||
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
|
||||
import com.android.launcher3.graphics.GridOptionsProvider;
|
||||
import com.android.launcher3.graphics.TintedDrawableSpan;
|
||||
@@ -113,12 +110,6 @@ public final class Utilities {
|
||||
public static final boolean ATLEAST_P =
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.P;
|
||||
|
||||
public static final boolean ATLEAST_OREO_MR1 =
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1;
|
||||
|
||||
public static final boolean ATLEAST_OREO =
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
|
||||
|
||||
/**
|
||||
* Set on a motion event dispatched from the nav bar. See {@link MotionEvent#setEdgeFlags(int)}.
|
||||
*/
|
||||
@@ -494,21 +485,6 @@ public final class Utilities {
|
||||
LauncherFiles.DEVICE_PREFERENCES_KEY, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link SharedPreferences} that backs {@link FeatureFlags}
|
||||
*/
|
||||
public static SharedPreferences getFeatureFlagsPrefs(Context context) {
|
||||
// Use application context for shared preferences, so that we use a single cached instance
|
||||
return context.getApplicationContext().getSharedPreferences(
|
||||
FeatureFlags.FLAGS_PREF_NAME, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
public static boolean areAnimationsEnabled(Context context) {
|
||||
return ATLEAST_OREO
|
||||
? ValueAnimator.areAnimatorsEnabled()
|
||||
: !context.getSystemService(PowerManager.class).isPowerSaveMode();
|
||||
}
|
||||
|
||||
public static boolean isWallpaperAllowed(Context context) {
|
||||
return context.getSystemService(WallpaperManager.class).isSetWallpaperAllowed();
|
||||
}
|
||||
|
||||
@@ -187,9 +187,6 @@ public class DragView extends View implements StateListener<LauncherState> {
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
public void setItemInfo(final ItemInfo info) {
|
||||
if (!Utilities.ATLEAST_OREO) {
|
||||
return;
|
||||
}
|
||||
if (info.itemType != LauncherSettings.Favorites.ITEM_TYPE_APPLICATION &&
|
||||
info.itemType != LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT &&
|
||||
info.itemType != LauncherSettings.Favorites.ITEM_TYPE_FOLDER) {
|
||||
|
||||
@@ -43,8 +43,9 @@ import android.util.Xml;
|
||||
import android.view.View;
|
||||
import android.view.ViewOutlineProvider;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
|
||||
import com.android.launcher3.icons.GraphicsUtils;
|
||||
import com.android.launcher3.icons.IconNormalizer;
|
||||
@@ -59,8 +60,6 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Abstract representation of the shape of an icon shape
|
||||
*/
|
||||
@@ -381,9 +380,6 @@ public abstract class IconShape {
|
||||
* Initializes the shape which is closest to the {@link AdaptiveIconDrawable}
|
||||
*/
|
||||
public static void init(Context context) {
|
||||
if (!Utilities.ATLEAST_OREO) {
|
||||
return;
|
||||
}
|
||||
pickBestShape(context);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.util.Log;
|
||||
@@ -32,8 +31,6 @@ import android.util.Log;
|
||||
import com.android.launcher3.InstallShortcutReceiver;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.SessionCommitReceiver;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.icons.BitmapInfo;
|
||||
import com.android.launcher3.icons.IconCache;
|
||||
@@ -108,11 +105,6 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
|
||||
appsList.removePackage(packages[i], mUser);
|
||||
}
|
||||
appsList.addPackage(context, packages[i], mUser);
|
||||
|
||||
// Automatically add homescreen icon for work profile apps for below O device.
|
||||
if (!Utilities.ATLEAST_OREO && !Process.myUserHandle().equals(mUser)) {
|
||||
SessionCommitReceiver.queueAppIconAddition(context, packages[i], mUser);
|
||||
}
|
||||
}
|
||||
flagOp = FlagOp.removeFlag(WorkspaceItemInfo.FLAG_DISABLED_NOT_AVAILABLE);
|
||||
break;
|
||||
@@ -331,7 +323,7 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
|
||||
InstallShortcutReceiver.removeFromInstallQueue(context, removedPackages, mUser);
|
||||
}
|
||||
|
||||
if (Utilities.ATLEAST_OREO && mOp == OP_ADD) {
|
||||
if (mOp == OP_ADD) {
|
||||
// Load widgets for the new package. Changes due to app updates are handled through
|
||||
// AppWidgetHost events, this is just to initialize the long-press options.
|
||||
for (int i = 0; i < N; i++) {
|
||||
|
||||
@@ -138,8 +138,7 @@ public class AppInfo extends ItemInfoWithIcon {
|
||||
info.runtimeStatusFlags |= (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0
|
||||
? FLAG_SYSTEM_NO : FLAG_SYSTEM_YES;
|
||||
|
||||
if (Utilities.ATLEAST_OREO
|
||||
&& appInfo.targetSdkVersion >= Build.VERSION_CODES.O
|
||||
if (appInfo.targetSdkVersion >= Build.VERSION_CODES.O
|
||||
&& Process.myUserHandle().equals(lai.getUser())) {
|
||||
// The icon for a non-primary user is badged, hence it's not exactly an adaptive icon.
|
||||
info.runtimeStatusFlags |= FLAG_ADAPTIVE_ICON;
|
||||
|
||||
@@ -18,7 +18,9 @@ package com.android.launcher3.pm;
|
||||
|
||||
import static com.android.launcher3.Utilities.getPrefs;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.PackageInstaller;
|
||||
@@ -32,6 +34,7 @@ import android.text.TextUtils;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.android.launcher3.InstallShortcutReceiver;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.SessionCommitReceiver;
|
||||
import com.android.launcher3.Utilities;
|
||||
@@ -167,7 +170,7 @@ public class InstallSessionHelper {
|
||||
* Attempt to restore workspace layout if the session is triggered due to device restore.
|
||||
*/
|
||||
public boolean restoreDbIfApplicable(@NonNull final SessionInfo info) {
|
||||
if (!Utilities.ATLEAST_OREO || !FeatureFlags.ENABLE_DATABASE_RESTORE.get()) {
|
||||
if (!FeatureFlags.ENABLE_DATABASE_RESTORE.get()) {
|
||||
return false;
|
||||
}
|
||||
if (isRestore(info)) {
|
||||
@@ -203,7 +206,7 @@ public class InstallSessionHelper {
|
||||
* - A promise icon for the session has not already been created
|
||||
*/
|
||||
void tryQueuePromiseAppIcon(PackageInstaller.SessionInfo sessionInfo) {
|
||||
if (Utilities.ATLEAST_OREO && FeatureFlags.PROMISE_APPS_NEW_INSTALLS.get()
|
||||
if (FeatureFlags.PROMISE_APPS_NEW_INSTALLS.get()
|
||||
&& SessionCommitReceiver.isEnabled(mAppContext)
|
||||
&& verify(sessionInfo) != null
|
||||
&& sessionInfo.getInstallReason() == PackageManager.INSTALL_REASON_USER
|
||||
@@ -212,7 +215,21 @@ public class InstallSessionHelper {
|
||||
&& !mPromiseIconIds.contains(sessionInfo.getSessionId())
|
||||
&& new PackageManagerHelper(mAppContext).getApplicationInfo(
|
||||
sessionInfo.getAppPackageName(), getUserHandle(sessionInfo), 0) == null) {
|
||||
SessionCommitReceiver.queuePromiseAppIconAddition(mAppContext, sessionInfo);
|
||||
|
||||
String packageName = sessionInfo.getAppPackageName();
|
||||
if (mAppContext.getSystemService(LauncherApps.class)
|
||||
.getActivityList(packageName, getUserHandle(sessionInfo)).isEmpty()) {
|
||||
// Ensure application isn't already installed.
|
||||
Intent data = new Intent();
|
||||
data.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent().setComponent(
|
||||
new ComponentName(packageName, "")).setPackage(packageName));
|
||||
data.putExtra(Intent.EXTRA_SHORTCUT_NAME, sessionInfo.getAppLabel());
|
||||
data.putExtra(Intent.EXTRA_SHORTCUT_ICON, sessionInfo.getAppIcon());
|
||||
|
||||
InstallShortcutReceiver.queueApplication(data, getUserHandle(sessionInfo),
|
||||
mAppContext);
|
||||
}
|
||||
|
||||
mPromiseIconIds.add(sessionInfo.getSessionId());
|
||||
updatePromiseIconPrefs();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.LauncherActivityInfo;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Process;
|
||||
@@ -39,13 +38,13 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.icons.ComponentWithLabelAndIcon;
|
||||
import com.android.launcher3.icons.IconCache;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -175,37 +174,23 @@ public abstract class ShortcutConfigActivityInfo implements ComponentWithLabelAn
|
||||
List<ShortcutConfigActivityInfo> result = new ArrayList<>();
|
||||
UserHandle myUser = Process.myUserHandle();
|
||||
|
||||
if (Utilities.ATLEAST_OREO) {
|
||||
final List<UserHandle> users;
|
||||
final String packageName;
|
||||
if (packageUser == null) {
|
||||
users = UserCache.INSTANCE.get(context).getUserProfiles();
|
||||
packageName = null;
|
||||
} else {
|
||||
users = new ArrayList<>(1);
|
||||
users.add(packageUser.mUser);
|
||||
packageName = packageUser.mPackageName;
|
||||
}
|
||||
LauncherApps launcherApps = context.getSystemService(LauncherApps.class);
|
||||
for (UserHandle user : users) {
|
||||
boolean ignoreTargetSdk = myUser.equals(user);
|
||||
for (LauncherActivityInfo activityInfo :
|
||||
launcherApps.getShortcutConfigActivityList(packageName, user)) {
|
||||
if (ignoreTargetSdk || activityInfo.getApplicationInfo().targetSdkVersion
|
||||
>= Build.VERSION_CODES.O) {
|
||||
result.add(new ShortcutConfigActivityInfoVO(activityInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
final List<UserHandle> users;
|
||||
final String packageName;
|
||||
if (packageUser == null) {
|
||||
users = UserCache.INSTANCE.get(context).getUserProfiles();
|
||||
packageName = null;
|
||||
} else {
|
||||
if (packageUser == null || packageUser.mUser.equals(myUser)) {
|
||||
Intent intent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
|
||||
if (packageUser != null) {
|
||||
intent.setPackage(packageUser.mPackageName);
|
||||
}
|
||||
for (ResolveInfo info :
|
||||
context.getPackageManager().queryIntentActivities(intent, 0)) {
|
||||
result.add(new ShortcutConfigActivityInfoVL(info.activityInfo));
|
||||
users = Collections.singletonList(packageUser.mUser);
|
||||
packageName = packageUser.mPackageName;
|
||||
}
|
||||
LauncherApps launcherApps = context.getSystemService(LauncherApps.class);
|
||||
for (UserHandle user : users) {
|
||||
boolean ignoreTargetSdk = myUser.equals(user);
|
||||
for (LauncherActivityInfo activityInfo :
|
||||
launcherApps.getShortcutConfigActivityList(packageName, user)) {
|
||||
if (ignoreTargetSdk || activityInfo.getApplicationInfo().targetSdkVersion
|
||||
>= Build.VERSION_CODES.O) {
|
||||
result.add(new ShortcutConfigActivityInfoVO(activityInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ import com.android.launcher3.DropTarget;
|
||||
import com.android.launcher3.DropTarget.DragObject;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
|
||||
import com.android.launcher3.accessibility.ShortcutMenuAccessibilityDelegate;
|
||||
import com.android.launcher3.dot.DotInfo;
|
||||
@@ -400,9 +399,7 @@ public class PopupContainerWithArrow<T extends BaseDraggingActivity> extends Arr
|
||||
} else if (view instanceof ImageView) {
|
||||
// Only the system shortcut icon shows on a gray background header.
|
||||
info.setIconAndContentDescriptionFor((ImageView) view);
|
||||
if (Utilities.ATLEAST_OREO) {
|
||||
view.setTooltipText(view.getContentDescription());
|
||||
}
|
||||
view.setTooltipText(view.getContentDescription());
|
||||
}
|
||||
view.setTag(info);
|
||||
view.setOnClickListener(info);
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.launcher3.settings;
|
||||
|
||||
import static androidx.core.view.accessibility.AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS;
|
||||
|
||||
import static com.android.launcher3.SessionCommitReceiver.ADD_ICON_PREFERENCE_KEY;
|
||||
import static com.android.launcher3.states.RotationHelper.ALLOW_ROTATION_PREFERENCE_KEY;
|
||||
import static com.android.launcher3.states.RotationHelper.getAllowRotationDefaultValue;
|
||||
import static com.android.launcher3.util.SecureSettingsObserver.newNotificationSettingsObserver;
|
||||
@@ -172,11 +171,6 @@ public class SettingsActivity extends FragmentActivity
|
||||
protected boolean initPreference(Preference preference) {
|
||||
switch (preference.getKey()) {
|
||||
case NOTIFICATION_DOTS_PREFERENCE_KEY:
|
||||
if (!Utilities.ATLEAST_OREO ||
|
||||
!getResources().getBoolean(R.bool.notification_dots_enabled)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Listen to system notification dot settings while this UI is active.
|
||||
mNotificationDotsObserver = newNotificationSettingsObserver(
|
||||
getActivity(), (NotificationDotsPreference) preference);
|
||||
@@ -188,9 +182,6 @@ public class SettingsActivity extends FragmentActivity
|
||||
mNotificationDotsObserver.dispatchOnChange();
|
||||
return true;
|
||||
|
||||
case ADD_ICON_PREFERENCE_KEY:
|
||||
return Utilities.ATLEAST_OREO;
|
||||
|
||||
case ALLOW_ROTATION_PREFERENCE_KEY:
|
||||
if (getResources().getBoolean(R.bool.allow_rotation)) {
|
||||
// Launcher supports rotation by default. No need to show this setting.
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.launcher3.statemanager;
|
||||
|
||||
import static android.animation.ValueAnimator.areAnimatorsEnabled;
|
||||
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_COMPONENTS;
|
||||
|
||||
import android.animation.Animator;
|
||||
@@ -26,7 +28,6 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
@@ -179,7 +180,7 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> {
|
||||
|
||||
private void goToState(STATE_TYPE state, boolean animated, long delay,
|
||||
final Runnable onCompleteRunnable) {
|
||||
animated &= Utilities.areAnimationsEnabled(mActivity);
|
||||
animated &= areAnimatorsEnabled();
|
||||
if (mActivity.isInState(state)) {
|
||||
if (mConfig.currentAnimation == null) {
|
||||
// Run any queued runnable
|
||||
|
||||
@@ -513,15 +513,7 @@ public abstract class AbstractStateChangeTouchController
|
||||
if (mAtomicAnim == null) {
|
||||
return 0;
|
||||
}
|
||||
if (Utilities.ATLEAST_OREO) {
|
||||
return mAtomicAnim.getTotalDuration() - mAtomicAnim.getCurrentPlayTime();
|
||||
} else {
|
||||
long remainingDuration = 0;
|
||||
for (Animator anim : mAtomicAnim.getChildAnimations()) {
|
||||
remainingDuration = Math.max(remainingDuration, anim.getDuration());
|
||||
}
|
||||
return remainingDuration;
|
||||
}
|
||||
return mAtomicAnim.getTotalDuration() - mAtomicAnim.getCurrentPlayTime();
|
||||
}
|
||||
|
||||
protected void updateSwipeCompleteAnimation(ValueAnimator animator, long expectedDuration,
|
||||
|
||||
@@ -37,7 +37,6 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PatternMatcher;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -46,7 +45,6 @@ import android.widget.Toast;
|
||||
|
||||
import com.android.launcher3.PendingAddItemInfo;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
@@ -96,36 +94,12 @@ public class PackageManagerHelper {
|
||||
* Returns the application info for the provided package or null
|
||||
*/
|
||||
public ApplicationInfo getApplicationInfo(String packageName, UserHandle user, int flags) {
|
||||
if (Utilities.ATLEAST_OREO) {
|
||||
try {
|
||||
ApplicationInfo info = mLauncherApps.getApplicationInfo(packageName, flags, user);
|
||||
return (info.flags & ApplicationInfo.FLAG_INSTALLED) == 0 || !info.enabled
|
||||
? null : info;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
final boolean isPrimaryUser = Process.myUserHandle().equals(user);
|
||||
if (!isPrimaryUser && (flags == 0)) {
|
||||
// We are looking for an installed app on a secondary profile. Prior to O, the only
|
||||
// entry point for work profiles is through the LauncherActivity.
|
||||
List<LauncherActivityInfo> activityList =
|
||||
mLauncherApps.getActivityList(packageName, user);
|
||||
return activityList.size() > 0 ? activityList.get(0).getApplicationInfo() : null;
|
||||
}
|
||||
try {
|
||||
ApplicationInfo info = mPm.getApplicationInfo(packageName, flags);
|
||||
// There is no way to check if the app is installed for managed profile. But for
|
||||
// primary profile, we can still have this check.
|
||||
if (isPrimaryUser && ((info.flags & ApplicationInfo.FLAG_INSTALLED) == 0)
|
||||
|| !info.enabled) {
|
||||
return null;
|
||||
}
|
||||
return info;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// Package not found
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
ApplicationInfo info = mLauncherApps.getApplicationInfo(packageName, flags, user);
|
||||
return (info.flags & ApplicationInfo.FLAG_INSTALLED) == 0 || !info.enabled
|
||||
? null : info;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,6 @@ package com.android.launcher3.util;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
@@ -78,12 +76,10 @@ public class SystemUiController {
|
||||
}
|
||||
|
||||
private int getSysUiVisibilityFlags(int stateFlag, int currentVisibility) {
|
||||
if (Utilities.ATLEAST_OREO) {
|
||||
if ((stateFlag & FLAG_LIGHT_NAV) != 0) {
|
||||
currentVisibility |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
} else if ((stateFlag & FLAG_DARK_NAV) != 0) {
|
||||
currentVisibility &= ~(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
if ((stateFlag & FLAG_LIGHT_NAV) != 0) {
|
||||
currentVisibility |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
} else if ((stateFlag & FLAG_DARK_NAV) != 0) {
|
||||
currentVisibility &= ~(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
|
||||
if ((stateFlag & FLAG_LIGHT_STATUS) != 0) {
|
||||
|
||||
@@ -256,7 +256,6 @@ public class FloatingIconView extends FrameLayout implements
|
||||
Drawable drawable = null;
|
||||
Drawable badge = null;
|
||||
boolean supportsAdaptiveIcons = ADAPTIVE_ICON_WINDOW_ANIM.get()
|
||||
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& !info.isDisabled(); // Use original icon for disabled icons.
|
||||
Drawable btvIcon = originalView instanceof BubbleTextView
|
||||
? ((BubbleTextView) originalView).getIcon() : null;
|
||||
@@ -383,8 +382,7 @@ public class FloatingIconView extends FrameLayout implements
|
||||
@WorkerThread
|
||||
@SuppressWarnings("WrongThread")
|
||||
private static int getOffsetForIconBounds(Launcher l, Drawable drawable, RectF position) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O
|
||||
|| !(drawable instanceof AdaptiveIconDrawable)
|
||||
if (!(drawable instanceof AdaptiveIconDrawable)
|
||||
|| (drawable instanceof FolderAdaptiveIcon)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -80,9 +80,7 @@ public class LauncherAppWidgetHostView extends NavigableAppWidgetHostView
|
||||
setAccessibilityDelegate(mLauncher.getAccessibilityDelegate());
|
||||
setBackgroundResource(R.drawable.widget_internal_focus_bg);
|
||||
|
||||
if (Utilities.ATLEAST_OREO) {
|
||||
setExecutor(Executors.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
setExecutor(Executors.THREAD_POOL_EXECUTOR);
|
||||
if (Utilities.ATLEAST_Q && Themes.getAttrBoolean(mLauncher, R.attr.isWorkspaceDarkText)) {
|
||||
setOnLightBackground(true);
|
||||
}
|
||||
|
||||
@@ -23,13 +23,11 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.LauncherAppWidgetProviderInfo;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.model.WidgetsModel;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.pm.UserCache;
|
||||
@@ -84,22 +82,8 @@ public class WidgetManagerHelper {
|
||||
return allWidgetsSteam(mContext).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if (Utilities.ATLEAST_OREO) {
|
||||
return mAppWidgetManager.getInstalledProvidersForPackage(
|
||||
packageUser.mPackageName, packageUser.mUser);
|
||||
}
|
||||
|
||||
String pkg = packageUser.mPackageName;
|
||||
return Stream.concat(
|
||||
// Only get providers for the given package/user.
|
||||
mAppWidgetManager.getInstalledProvidersForProfile(packageUser.mUser)
|
||||
.stream()
|
||||
.filter(w -> w.provider.equals(pkg)),
|
||||
Process.myUserHandle().equals(packageUser.mUser)
|
||||
&& mContext.getPackageName().equals(pkg)
|
||||
? CustomWidgetManager.INSTANCE.get(mContext).stream()
|
||||
: Stream.empty())
|
||||
.collect(Collectors.toList());
|
||||
return mAppWidgetManager.getInstalledProvidersForPackage(
|
||||
packageUser.mPackageName, packageUser.mUser);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-3
@@ -17,8 +17,7 @@
|
||||
package com.android.launcher3.uioverrides.dynamicui;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -32,7 +31,7 @@ public abstract class WallpaperManagerCompat {
|
||||
if (sInstance == null) {
|
||||
context = context.getApplicationContext();
|
||||
|
||||
if (Utilities.ATLEAST_OREO_MR1) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
try {
|
||||
sInstance = new WallpaperManagerCompatVOMR1(context);
|
||||
} catch (Throwable e) {
|
||||
|
||||
@@ -30,7 +30,6 @@ import androidx.test.filters.LargeTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.Workspace.ItemOperator;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
@@ -126,9 +125,6 @@ public class RequestPinItemTest extends AbstractLauncherUiTest {
|
||||
|
||||
private void runTest(String activityMethod, boolean isWidget, ItemOperator itemMatcher,
|
||||
Intent... commandIntents) throws Throwable {
|
||||
if (!Utilities.ATLEAST_OREO) {
|
||||
return;
|
||||
}
|
||||
clearHomescreen();
|
||||
mDevice.pressHome();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user