清空記錄
歷史記錄
取消
清空記錄
歷史記錄
本文適用于觸覺智能所有支持Android11系統(tǒng)的開發(fā)板設(shè)置APP開機(jī)自啟和隱藏導(dǎo)航欄/狀態(tài)欄。觸覺智能的Purple Pi OH鴻蒙開源主板,是華為Laval官方社區(qū)主薦的一款鴻蒙開發(fā)主板。
該主板主要針對學(xué)生黨,極客,工程師,極大降低了開源鴻蒙開發(fā)者的入門門檻,具有以下幾點(diǎn)優(yōu)勢:
支持開源鴻蒙/Linux /Andriod 11/麒麟,兼容樹莓派 ;
四核A55,最高1.8G主頻,Mali G52-2EE GPU ;
支持OpenGL/CL/Vulkan/1T NPU/8M ISP ;
支持TensorFlow/MXNet/PyTorch/ Caffe ;
支持1*千兆以太網(wǎng)、3*USB2.0、1*USB3.0、3*UART、2*SPI、2*I2C、28*GPIO、1*MIPI DSI、1*HDMI ;
支持OpenHarmony3.2/4.0/4.1版本,開放SDK源代碼 ;
活躍的開發(fā)者社區(qū), 更多牛人在線技術(shù)支持 ;
超小尺寸,極致性價(jià)比,只需249元 ;
修改文件:
frameworks\base\core\java\com\android\internal\app\ResolverActivity.java
--- a/frameworks/base/core/java/com/android/internal/app/ResolverActivity.java
+++ b/frameworks/base/core/java/com/android/internal/app/ResolverActivity.java
@@ -101,6 +101,10 @@ import java.util.List;
import java.util.Objects;
import java.util.Set;
+import java.util.concurrent.Executor;
+import java.util.function.Consumer;
+import android.os.SystemProperties;
+import android.app.role.RoleManager;
/**
* This activity is displayed when the system attempts to start an Intent for
@@ -341,6 +345,18 @@ public class ResolverActivity extends Activity implements
protected void onCreate(Bundle savedInstanceState, Intent intent,
CharSequence title, int defaultTitleRes, Intent[] initialIntents,
List
rList, boolean supportsAlwaysUseOption) { +
+ //by Lyle,220923
+ String LauncherPkg = SystemProperties.get("persist.sys.def_launherpag");
+ if(LauncherPkg!=null/* && !isDefaultLauncher(this,LauncherPkg)*/){
+ Log.v("defaultLauncher","-----found default launcher pkg:"+LauncherPkg);
+ setDefaltLauncher(this,LauncherPkg);
+ startDefaultLauncher(this,LauncherPkg);
+ finish();
+ return;
+ }
+ //end
+
setTheme(appliedThemeResId());
super.onCreate(savedInstanceState);
@@ -433,6 +449,47 @@ public class ResolverActivity extends Activity implements
intent.getAction() + ":" + intent.getType() + ":"
+ (categories != null ? Arrays.toString(categories.toArray()) : ""));
}
+
+
+ public void setDefaltLauncher(Context context, String packageName) {//by Lyle,220923
+ String roleName = "android.app.role.HOME";
+ boolean add = true;
+ int flags = 0;
+ UserHandle user = android.os.Process.myUserHandle();
+
+ RoleManager roleManager = context.getSystemService(RoleManager.class);
+ Executor executor = context.getMainExecutor();
+ Consumer< Boolean > callback = successful -> {
+ if (successful) {
+ Log.v("defaultLauncher","set Defalt Launcher successful" );
+ } else {
+ Log.v("defaultLauncher","set Defalt Launcher failed ");
+ }
+ };
+ roleManager.addRoleHolderAsUser(roleName, packageName, flags, user, executor, callback);
+ }
+
+ public void startDefaultLauncher(Context context, String packageName) {
+ Intent intent = new Intent();
+ PackageManager pm = context.getPackageManager();
+ intent = pm.getLaunchIntentForPackage(packageName);
+ if (intent != null)
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ try {
+ context.startActivity(intent);
+ } catch (Exception e) {
+ Log.v("defaultLauncher","start Default Launcher failed,not find package:"+packageName );
+ }
+ }
+
+ public boolean isDefaultLauncher(Context context,String launcherPkg){
+ Intent intent = new Intent(Intent.ACTION_MAIN);
+ intent.addCategory(Intent.CATEGORY_HOME);
+ ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
+ String currentHomePackage = resolveInfo.activityInfo.packageName;
+ Log.v("defaultLauncher","-currentHomePackage:"+currentHomePackage);
+ return launcherPkg.equals(currentHomePackage);
+ }
private boolean isIntentPicker() {
return getClass().equals(ResolverActivity.class);
device/rockchip/rk356x/rk3566_r/preinstall_del/目錄下
(沒有preinstall_del目錄就手動創(chuàng)建一個(gè)即可),并添加以下文件:
Android.mk
xxx.apk(APP)
preinstall.mk
Android.mk文件內(nèi)容:
include $(call all-subdir-makefiles)
preinstall.mk文件內(nèi)容:
PRODUCT_PACKAGES += neu
注意:
neu為APP名字,例如neu.apk。
該目錄也是APK的預(yù)安裝目錄,如果有新的APK要預(yù)安裝,可把APK拷貝到preinstall_del/目錄下,并且把APK名字添加到preinstall.mk文件即可。
--- a/device/rockchip/rk356x/rk3566_r/rk3566_r.mk+++ b/device/rockchip/rk356x/rk3566_r/rk3566_r.mk@@ -46,4 +46,5 @@ PRODUCT_PROPERTY_OVERRIDES += persist.bt.power.down=true PRODUCT_PROPERTY_OVERRIDES += persist.sys.timezone=Asia/Shanghai PRODUCT_PROPERTY_OVERRIDES += ro.vendor.hdmirotationlock=true #PRODUCT_PROPERTY_OVERRIDES += vendor.hwc.device.primary=HDMI-A-1PRODUCT_PROPERTY_OVERRIDES += vendor.hwc.device.primary=DSI+PRODUCT_PROPERTY_OVERRIDES += persist.sys.def_launherpag=com.mdptech.neuronappandroidhu
包名命令行方式查看:pm list package -3,修改后 make 編譯源碼即可。
修改文件:
frameworks/base/packages/SystemUI/res/layout/navigation_bar.xml
--- a/frameworks/base/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/frameworks/base/packages/SystemUI/res/layout/navigation_bar.xml
@@ -22,6 +22,7 @@
xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
+ android:visibility="gone"
android:background="@drawable/system_bar_background">
@@ -42,6 +43,7 @@
android:id="@+id/navigation_inflater"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:visibility="gone"/>
修改文件:
frameworks/base/packages/SystemUI/res/layout/status_bar.xml
--- a/frameworks/base/packages/SystemUI/res/layout/status_bar.xml+++ b/frameworks/base/packages/SystemUI/res/layout/status_bar.xml@@ -26,6 +26,7 @@ android:id="@+id/status_bar" android:orientation="vertical" android:focusable="false"+ android:visibility="gone" android:descendantFocusability="afterDescendants" android:accessibilityPaneTitle="@string/status_bar" >
修改后重新make編譯即可。
Purple Pi OH 購買鏈接
瑞芯微RK3566樹莓派開源鴻蒙開發(fā)板PurplePiOH安卓Linux AI編程-淘寶網(wǎng) (taobao.com)
Purple Pi OH已過XTS兼容性認(rèn)證
END