.
This commit is contained in:
@@ -286,6 +286,17 @@ public class FUAActivity extends AppCompatActivity {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
// settings app
|
||||
try {
|
||||
Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS);
|
||||
ActivityInfo settingsInfo = settingsIntent.resolveActivityInfo(getPackageManager(), 0);
|
||||
if (settingsInfo != null && settingsInfo.packageName != null){
|
||||
appsName.remove(settingsInfo.packageName);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
mySharedPref.setArrayList("APP_LIST", appsName);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,10 @@ public class MySharedPref {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void removeKey(String key){
|
||||
appSharedPrefs.edit().remove(key).apply();
|
||||
}
|
||||
|
||||
public Set<String> getArrayList(String key) {
|
||||
return appSharedPrefs.getStringSet(key, null);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.app.simplitend.appblocking;
|
||||
import android.accessibilityservice.AccessibilityService;
|
||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
@@ -44,8 +45,7 @@ public class TopAppDetectionService extends AccessibilityService {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
String appName;
|
||||
try {
|
||||
String[] split_name = packageName.split("\\.");
|
||||
appName = split_name[split_name.length-1].toUpperCase();
|
||||
appName = getPackageManager().getApplicationLabel(getPackageManager().getApplicationInfo(packageName, PackageManager.GET_META_DATA)).toString();
|
||||
}catch (Exception e){
|
||||
appName = "This app";
|
||||
}
|
||||
|
||||
@@ -580,11 +580,7 @@ public abstract class AppUtil {
|
||||
|
||||
// app block list clear
|
||||
MySharedPref mySharedPref = new MySharedPref(context);
|
||||
Set<String> appList = mySharedPref.getArrayList("APP_LIST");
|
||||
if (appList != null) {
|
||||
appList.clear();
|
||||
mySharedPref.setArrayList("APP_LIST", appList);
|
||||
}
|
||||
mySharedPref.removeKey("APP_LIST");
|
||||
|
||||
// removing contact listing
|
||||
setWhiteListedContacts(context, null);
|
||||
|
||||
Reference in New Issue
Block a user