Android5.1-s5p6818平台绕过launcher2/3直接启动定制应用

为满足项目需求,本文介绍了如何在Android 5.1 s5p6818平台上绕过launcher2/3,开机直接启动定制应用。首先需将应用编译为系统应用,通过修改`core.mk`文件。接着,理解launcher启动原理,通过移除launcher的HOME类别并在定制应用中添加该类别,实现开机直接启动定制应用。
摘要由CSDN通过智能技术生成


根据项目需要,直接在平台上面开机进入定制应用,不需要进入launcher的桌面然后点击加载到桌面上的各个应用了。

首先要将自己的应用作为系统应用编译要在路径:~/build/target/product/core.mk文件当中增加自己的系统应用名称,如图示:


不同的平台和Android版本可能所在位置不一样,但一般都在这几个文件之内:

\alps\build\target\product\generic.mk  
\alps\build\target\product\generic_no_telephony.mk  

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是 IconShapeOverride.java 的源代码: ```java package com.android.launcher3.graphics; import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.graphics.Path; import android.graphics.Rect; import android.os.Build; import android.util.Log; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.launcher3.Utilities; import com.android.launcher3.icons.GraphicsUtils; import com.android.launcher3.icons.IconProvider; import com.android.launcher3.icons.ShapeData; import com.android.launcher3.util.MainThreadInitializedObject; import com.android.launcher3.util.ResourceBasedOverride; /** * Provides custom icon shapes based on user preferences. */ public class IconShapeOverride extends ResourceBasedOverride { public static final String KEY_PREFERENCE = "pref_override_icon_shape"; private static final String TAG = "IconShapeOverride"; private final IconProvider mIconProvider; public IconShapeOverride(Context context) { this(context, IconProvider.INSTANCE); } @VisibleForTesting public IconShapeOverride(Context context, IconProvider iconProvider) { super(context, KEY_PREFERENCE); mIconProvider = iconProvider; } /** * @return the current shape path, or null if not defined. */ @Nullable public ShapeData getShape() { String pathString = getStringValue(); if (pathString == null) { return null; } try { return ShapeData.parse(pathString); } catch (IllegalArgumentException e) { Log.e(TAG, "Unable to parse shape", e); return null; } } /** * @return the current shape path as a {@link Path} instance, or null if not defined. */ @Nullable public Path getShapePath() { ShapeData data = getShape(); return data != null ? data.getPath() : null; } /** * @return the current shape path bounds, or null if not defined. */ @Nullable public Rect getShapeBounds() { ShapeData data = getShape(); return data != null ? data.getBounds() : null; } /** * Returns the shape path for the given context, or null if none is specified. */ public static Path getShapePath(Resources res, SharedPreferences prefs) { IconShapeOverride override = new IconShapeOverride(res); override.setSharedPreferences(prefs); return override.getShapePath(); } /** * Tests whether the current shape is a circle, by checking if all corners of the shape are at * the same distance from the center. */ public boolean isShapeCircle() { Path shape = getShapePath(); if (shape == null) { return false; } Rect bounds = getShapeBounds(); if (bounds == null) { return false; } Rect outBounds = new Rect(); shape.computeBounds(outBounds, true); float centerX = bounds.exactCenterX(); float centerY = bounds.exactCenterY(); float radius = Math.max(centerX - bounds.left, centerY - bounds.top); float maxDeviation = 0; float[] radii = new float[9]; shape.approximate(1f, radii); for (int i = 0; i < radii.length; i += 2) { float deviation = Math.abs(radii[i] - radius); if (deviation > maxDeviation) { maxDeviation = deviation; } } return maxDeviation < GraphicsUtils.EPSILON; } /** * Updates the default icon shape, if the user has not overridden it. */ public static void updateDefaultShape(Context context) { SharedPreferences prefs = Utilities.getPrefs(context); if (prefs.contains(KEY_PREFERENCE)) { return; } IconShapeOverride override = new IconShapeOverride(context); Path path = override.getDefaultShape(); if (path != null) { prefs.edit().putString(KEY_PREFERENCE, ShapeData.toString(path)).apply(); } } /** * @return the default shape path for the current device. */ @Nullable public Path getDefaultShape() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { return IconShape.applyMaskIfNeeded(mIconProvider.getDeviceProfile(), mIconProvider.getIconMask()); } return null; } @Override protected void onValueChanged() { super.onValueChanged(); mIconProvider.clearCaches(); } } ``` 该类提供了自定义应用图标的形状的功能,它会根据用户的偏好设置提供自定义图标形状。其中包含了获取、设置、更新默认图标形状等方法。此外,还包含一些辅助方法,如测试当前形状是否为圆形。在 Android Oreo 及以上版本中,会调用 IconShape 类提供的方法来获取默认图标形状。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值