Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fynngodau committed Sep 22, 2024
1 parent f257e83 commit 1887759
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
7 changes: 5 additions & 2 deletions vending-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
<uses-permission android:name="com.google.android.gms.permission.READ_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

<uses-permission android:name="android.permission.INSTALL_PACKAGES"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.DELETE_PACKAGES"
tools:ignore="ProtectedPermissions" />

<uses-permission
android:name="android.permission.USE_CREDENTIALS"
android:maxSdkVersion="22" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.util.Log
import org.microg.vending.ui.VendingActivity

Expand All @@ -15,17 +16,20 @@ class WorkAccountChangedReceiver : BroadcastReceiver() {
val accountManager = AccountManager.get(context)
val hasWorkAccounts = accountManager.getAccountsByType("com.google.work").isNotEmpty()

Log.d(TAG, "setting VendingActivity state to enabled = $hasWorkAccounts")

val componentName = ComponentName(
context,
VendingActivity::class.java
)
context.packageManager.setComponentEnabledSetting(
componentName,
if (hasWorkAccounts) PackageManager.COMPONENT_ENABLED_STATE_ENABLED else PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
0
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Log.d(TAG, "setting VendingActivity state to enabled = $hasWorkAccounts")

val componentName = ComponentName(
context,
VendingActivity::class.java
)
context.packageManager.setComponentEnabledSetting(
componentName,
if (hasWorkAccounts) PackageManager.COMPONENT_ENABLED_STATE_ENABLED else PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
0
)
}
}

companion object {
Expand Down

0 comments on commit 1887759

Please sign in to comment.