Skip to content

Commit

Permalink
v40 fix for opening settings
Browse files Browse the repository at this point in the history
  • Loading branch information
basti564 committed May 25, 2022
1 parent faa14ff commit 1b03724
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "com.bos.oculess"
minSdkVersion 23
targetSdkVersion 30
versionCode 9
versionName "1.3.3"
versionCode 10
versionName "1.3.4"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
15 changes: 13 additions & 2 deletions app/src/main/java/com/bos/oculess/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import com.android.volley.Request
import com.android.volley.toolbox.StringRequest
import com.android.volley.toolbox.Volley
import com.bos.oculess.util.AppOpsUtil
import org.json.JSONException
import org.json.JSONObject
import org.json.JSONTokener
import kotlin.concurrent.fixedRateTimer
Expand Down Expand Up @@ -128,6 +127,10 @@ class MainActivity : AppCompatActivity() {
viewAdminsBtn.text = getString(R.string.enable_companion)
}
if (dpm.isDeviceOwnerApp(packageName)) {
viewOtaBtn.isEnabled = true
viewTelemetryBtn.isEnabled = true
viewPermissionsBtn.isEnabled = true

if (dpm.isApplicationHidden(
deviceAdminReceiverComponentName, updaterName
)) {
Expand All @@ -138,6 +141,9 @@ class MainActivity : AppCompatActivity() {
}
} else {
viewOtaBtn.text = getString(R.string.disable_ota)
viewOtaBtn.isEnabled = false
viewTelemetryBtn.isEnabled = false
viewPermissionsBtn.isEnabled = false
}
}
}
Expand Down Expand Up @@ -217,14 +223,19 @@ class MainActivity : AppCompatActivity() {
}

viewAccountsBtn.setOnClickListener {
val intentSettings = Intent()
intentSettings.setPackage("com.android.settings")
intentSettings.addCategory(Intent.CATEGORY_LAUNCHER)

val builder: AlertDialog.Builder = AlertDialog.Builder(this)
builder.setTitle(getString(R.string.title0))
builder.setMessage(getString(R.string.message1))
builder.setPositiveButton(
getString(R.string.ok)
) { _, _ ->
startActivity(
Intent(Settings.ACTION_SYNC_SETTINGS)
//Intent(Settings.ACTION_SYNC_SETTINGS) // not working in v40 due to a broken redirect from aosp settings to the oem settings app
intentSettings
)
}
builder.setNegativeButton(
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-de-rDE/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<string name="title0">Wichtige Information</string>
<string name="title1">Telemetrie Status</string>
<string name="message0">HINWEIS: Stellen stellen sie ihr System Design auf hell, sonst wird der Text nicht angezeigt\nBitte starten Sie nach dem ersten Mal neu!\nWiederholen Sie diesen Schritt nach jedem Neustart!</string>
<string name="message1">Bitte entfernen Sie *alle* Accounts auf ihrem Gerät!\nDies ist voruebergehent und wird nache einem Neustart zurueckgesetzt!</string>
<string name="message1">Bitte gehe zu Accounts und entfernen Sie *alle* Konten auf ihrem Gerät!\nDies ist voruebergehent und wird nach einem Neustart zurueckgesetzt!</string>
<string name="message2">Der Geräte Besitzer wurde nicht festgelegt!\nBitte folge dem Tutorial auf Github</string>
<string name="message3">Wie möchten sie fortfahren?</string>
<string name="ok">OK</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<string name="title0">Important Info</string>
<string name="title1">Telemetry Status</string>
<string name="message0">NOTE: Set light theme, or else text will be white on white\nPlease restart after the first time!\nRepeat this step after every restart!</string>
<string name="message1">Please remove *all* the accounts on your Device!\nThis is temporary and does not persist a reboot!</string>
<string name="message1">Please go to Accounts and remove *all* the accounts on your Device!\nThis is temporary and does not persist a reboot!</string>
<string name="message2">Device Owner has not been set!\nPlease follow the tutorial on GitHub</string>
<string name="message3">What would you like to do?</string>
<string name="ok">OK</string>
Expand Down

0 comments on commit 1b03724

Please sign in to comment.