Fixed crashes on android 8

This commit is contained in:
MrSluffy
2024-12-27 15:46:16 +08:00
parent 4667f30028
commit 99b65be3c2
4 changed files with 17 additions and 5 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="system_accent1_100">@android:color/transparent</color>
<color name="accent_primary_device_default">@android:color/transparent</color>
<color name="overview_foreground_scrim_color">@android:color/black</color>
</resources>

View File

@@ -117,7 +117,7 @@ public class QuickstepModelDelegate extends ModelDelegate {
private final InvariantDeviceProfile mIDP;
private final AppEventProducer mAppEventProducer;
private final StatsManager mStatsManager;
private StatsManager mStatsManager;
protected boolean mActive = false;
@@ -127,7 +127,11 @@ public class QuickstepModelDelegate extends ModelDelegate {
mIDP = InvariantDeviceProfile.INSTANCE.get(context);
StatsLogCompatManager.LOGS_CONSUMER.add(mAppEventProducer);
mStatsManager = context.getSystemService(StatsManager.class);
try {
mStatsManager = context.getSystemService(StatsManager.class);
} catch (Throwable e) {
Log.e(TAG, "Failed to get StatsManager", e);
}
}
@CallSuper
@@ -300,7 +304,7 @@ public class QuickstepModelDelegate extends ModelDelegate {
return StatsManager.PULL_SUCCESS;
});
Log.d(TAG, "Successfully registered for launcher snapshot logging!");
} catch (RuntimeException e) {
} catch (Throwable e) {
Log.e(TAG, "Failed to register launcher snapshot logging callback with StatsManager",
e);
}
@@ -342,7 +346,7 @@ public class QuickstepModelDelegate extends ModelDelegate {
if (mIsPrimaryInstance && mStatsManager != null && LawnchairQuickstepCompat.ATLEAST_R) {
try {
mStatsManager.clearPullAtomCallback(SysUiStatsLog.LAUNCHER_LAYOUT_SNAPSHOT);
} catch (RuntimeException e) {
} catch (Throwable e) {
Log.e(TAG, "Failed to unregister snapshot logging callback with StatsManager", e);
}
}

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="overview_foreground_scrim_color">@android:color/black</color>/color>
<color name="overview_foreground_scrim_color">@android:color/black</color>
</resources>

View File

@@ -15,6 +15,7 @@ import android.os.UserHandle;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.Utilities;
import com.android.launcher3.icons.ComponentWithLabelAndIcon;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
@@ -205,6 +206,7 @@ public class LauncherAppWidgetProviderInfo extends AppWidgetProviderInfo
}
public int getWidgetFeatures() {
if (!Utilities.ATLEAST_P) return 0;
return widgetFeatures;
}