Skip to content

Commit

Permalink
Resolve an issue with OPPO being slow AF
Browse files Browse the repository at this point in the history
  • Loading branch information
AbandonedCart committed Dec 5, 2023
1 parent 5e87b4f commit 38a222e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 37 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
compileSdk 34
minSdk 30
targetSdk 34
versionName "2.5.8"
versionName "2.5.9"
versionCode = versionName.replace(".","").toInteger()

vectorDrawables {
Expand Down Expand Up @@ -107,15 +107,15 @@ android {
}

dependencies {
implementation 'androidx.activity:activity-ktx:1.8.0'
implementation 'androidx.activity:activity-ktx:1.8.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.fragment:fragment-ktx:1.6.2'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.window:window-java:1.1.0'
implementation 'androidx.window:window-java:1.2.0'

implementation 'com.android.billingclient:billing:6.0.1'
implementation 'com.android.billingclient:billing:6.1.0'

implementation 'com.github.8bitdream:AndroidFastScroll:4cb96477d5'

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,14 @@
</intent-filter>
</receiver>
<service android:name=".OnBroadcastService"
android:process=":SamSprung"
android:exported="true"
android:permission="android.permission.FOREGROUND_SERVICE"
android:foregroundServiceType="specialUse">
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE" android:value="Cover screen launcher in background"/>
</service>
<service android:name=".drawer.AppDisplayListener"
android:process=":SamSprung"
android:exported="true"
android:permission="android.permission.FOREGROUND_SERVICE"
android:foregroundServiceType="specialUse"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -844,40 +844,46 @@ class CoverPreferences : AppCompatActivity() {
R.string.options_dismiss, (dismissBar.progress * 10).toString()
)

val packageRetriever = PackageRetriever(this)
val packages = packageRetriever.getPackageList()
for (installed in packages) {
if (installed.resolvePackageName == "apps.ijp.coveros") {
val compatDialog = AlertDialog.Builder(this)
.setMessage(getString(R.string.incompatibility_warning))
.setPositiveButton(R.string.button_uninstall) { dialog, _ ->
try {
startActivity(Intent(Intent.ACTION_DELETE).setData(
Uri.parse("package:apps.ijp.coveros")
))
dialog.dismiss()
} catch (ignored: Exception) { }
CoroutineScope(Dispatchers.IO).launch {
val packageRetriever = PackageRetriever(this@CoverPreferences)
val packages = packageRetriever.getPackageList()
for (installed in packages) {
if (installed.resolvePackageName == "apps.ijp.coveros") {
withContext(Dispatchers.Main) {
val compatDialog = AlertDialog.Builder(this@CoverPreferences)
.setMessage(getString(R.string.incompatibility_warning))
.setPositiveButton(R.string.button_uninstall) { dialog, _ ->
try {
startActivity(Intent(Intent.ACTION_DELETE).setData(
Uri.parse("package:apps.ijp.coveros")
))
dialog.dismiss()
} catch (ignored: Exception) { }
}
.setNegativeButton(R.string.button_disable) { dialog, _ ->
startActivity(Intent(
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:apps.ijp.coveros")
))
dialog.dismiss()
}.create()
compatDialog.setCancelable(false)
compatDialog.show()
}
.setNegativeButton(R.string.button_disable) { dialog, _ ->
startActivity(Intent(
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:apps.ijp.coveros")
))
dialog.dismiss()
}.create()
compatDialog.setCancelable(false)
compatDialog.show()
}
}
}
val unlisted = packageRetriever.getHiddenPackages()
val unlisted = packageRetriever.getHiddenPackages()

hiddenList = findViewById<RecyclerView>(R.id.app_toggle_list).apply {
layoutManager = LinearLayoutManager(this@CoverPreferences)
addItemDecoration(DividerItemDecoration(
this@CoverPreferences, DividerItemDecoration.VERTICAL
))
adapter = FilteredAppsAdapter(packageManager, packages, unlisted, prefs)
FastScrollerBuilder(this).build().setPadding(0, (-4).toPx,0,0)
withContext(Dispatchers.Main) {
hiddenList = findViewById<RecyclerView>(R.id.app_toggle_list).apply {
layoutManager = LinearLayoutManager(this@CoverPreferences)
addItemDecoration(DividerItemDecoration(
this@CoverPreferences, DividerItemDecoration.VERTICAL
))
adapter = FilteredAppsAdapter(packageManager, packages, unlisted, prefs)
FastScrollerBuilder(this).build().setPadding(0, (-4).toPx,0,0)
}
}
}

findViewById<View>(R.id.list_divider).setOnTouchListener { v: View, event: MotionEvent ->
Expand Down Expand Up @@ -1100,7 +1106,7 @@ class CoverPreferences : AppCompatActivity() {
private val usageLauncher = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()) {
val packageRetriever = PackageRetriever(this)
CoroutineScope(Dispatchers.IO).launch(Dispatchers.IO) {
CoroutineScope(Dispatchers.IO).launch {
val packages = packageRetriever.getPackageList()
val unlisted = packageRetriever.getHiddenPackages()
withContext(Dispatchers.Main) {
Expand Down Expand Up @@ -1200,7 +1206,6 @@ class CoverPreferences : AppCompatActivity() {
return false
}

@Suppress("deprecation")
private fun hasKeyboardInstalled(): Boolean {
return try {
packageManager.getPackageInfo(BuildConfig.APPLICATION_ID + ".ime", 0)
Expand Down

0 comments on commit 38a222e

Please sign in to comment.