@@ -72,7 +72,7 @@ public PreferenceHeader(@NonNull Context context, @Nullable AttributeSet attrs,
7272
7373 private void init (Context context ) {
7474 setLayoutResource (R .layout .preference_header );
75- if (!isScopeGet && !isScopeGetFailed ) if (getWhoAmI ().equals ("root" )) getScope ();
75+ if (!isScopeGet && !isScopeGetFailed ) if (getWhoAmI ().equals ("root" )) getScope (context );
7676 if (isUninstall (context )) {
7777 mUninstallApp .add (" - " + getTitle () + " (" + getSummary () + ")" );
7878 setVisible (false );
@@ -104,16 +104,17 @@ private boolean isHidden(Context context) {
104104 }
105105
106106 @ SuppressLint ("Range" )
107- private void getScope () {
107+ private void getScope (Context context ) {
108+ String cachePath = context .getCacheDir ().toString ();
108109 int userId = getCurrentUserId ();
109110 SQLiteDatabase db = null ;
110111 Cursor cursor = null ;
111112
112113 try {
113- rootExecCmd ("mkdir -p /data/local/tmp/HyperCeiler/cache/ && cp -r /data/adb/lspd/config /data/local/tmp/HyperCeiler/cache/ && chmod -R 777 /data/local/tmp/HyperCeiler/cache /config" );
114+ rootExecCmd ("cp -r /data/adb/lspd/config " + cachePath + " && chmod -R 777 " + cachePath + " /config" );
114115
115- String dbPath = "/data/local/tmp/HyperCeiler/cache /config/modules_config.db" ;
116- db = SQLiteDatabase .openDatabase (dbPath , null , SQLiteDatabase .OPEN_READWRITE );
116+ String dbPath = cachePath + " /config/modules_config.db" ;
117+ db = SQLiteDatabase .openDatabase (dbPath , null , SQLiteDatabase .OPEN_READONLY );
117118
118119 if (isDatabaseLocked (db )) {
119120 AndroidLogUtils .logW ("PreferenceHeader" , "Database locked, skip get scope." );
0 commit comments