Skip to content

Commit

Permalink
Merge pull request #131 from GuoXiCheng/dev
Browse files Browse the repository at this point in the history
add system apps filter to whitelist
  • Loading branch information
GuoXiCheng committed Feb 6, 2024
2 parents 4cbcc8e + 8553b70 commit e516db1
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- release
env:
LATEST_VERSION: "2.0.0"
LATEST_VERSION: "2.1.0"

jobs:
build-and-deploy:
Expand Down
Binary file added apk/SKIP-v2.1.0.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
minSdk 24
targetSdk 32
versionCode 1
versionName "2.0.0"
versionName "2.1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/android/skip/BaseActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const val WHITELIST_DOT = "whitelist."

const val SKIP_PERMIT_NOTICE = "SKIP_PERMIT_NOTICE"

const val SKIP_INCLUDE_SYSTEM_APPS = "SKIP_INCLUDE_SYSTEM_APPS"

val themeTypeState: MutableState<Int> by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
mutableStateOf(DataStoreUtils.getSyncData(SKIP_APP_THEME, Configuration.UI_MODE_NIGHT_NO))
}
Expand Down
21 changes: 21 additions & 0 deletions app/src/main/java/com/android/skip/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,30 @@ fun SettingsActivityInterface(onBackClick: () -> Unit) {
)
}

val checkIncludeSystemApps = remember {
mutableStateOf(
DataStoreUtils.getSyncData(
SKIP_INCLUDE_SYSTEM_APPS, false
)
)
}

ScaffoldPage(
barTitle = stringResource(id = R.string.settings),
onBackClick = onBackClick, content = {
FlatButton(content = {
RowContent(
stringResource(id = R.string.settings_include_system_apps_title),
stringResource(id = R.string.settings_include_system_apps_subtitle),
{ ResourceIcon(iconResource = R.drawable.app_registration) },
checkIncludeSystemApps.value,
{
checkIncludeSystemApps.value = it
DataStoreUtils.putSyncData(SKIP_INCLUDE_SYSTEM_APPS, it)
}
)
})

FlatButton(
content = {
RowContent(
Expand Down
13 changes: 9 additions & 4 deletions app/src/main/java/com/android/skip/WhitelistActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,17 @@ fun WhitelistInterface(onBackClick: () -> Unit) {

LaunchedEffect(Unit) {
scope.launch(Dispatchers.IO) {
val installedApps =
var installedApps =
packageManager.getInstalledApplications(PackageManager.GET_META_DATA)
val nonSystemApps = installedApps.filter {
(it.flags and ApplicationInfo.FLAG_SYSTEM) == 0

// 是否过滤掉系统应用
if (!DataStoreUtils.getSyncData(SKIP_INCLUDE_SYSTEM_APPS, false)) {
installedApps = installedApps.filter {
(it.flags and ApplicationInfo.FLAG_SYSTEM) == 0
}
}
val apps = nonSystemApps.map { app ->

val apps = installedApps.map { app ->
AppInfo(
appName = app.loadLabel(packageManager).toString(),
packageName = app.packageName,
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<string name="settings_sync_config_subtitle">打开应用时自动获取并更新配置文件</string>
<string name="settings_permit_notice_title">允许通知</string>
<string name="settings_permit_notice_subtitle">是否允许发送「跳过」通知</string>
<string name="settings_include_system_apps_title">列出系统应用</string>
<string name="settings_include_system_apps_subtitle">应用白名单中是否包含系统应用</string>

<string name="alive">应用保活</string>
<string name="alive_power_saving_title">省电策略</string>
Expand Down

0 comments on commit e516db1

Please sign in to comment.