mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 11:05:59 +00:00
Add getOrganizationName workaround (#174)
Disable user operation shortcuts when user removed Fix crash when getting password complexity (#178) Update dependencies
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.bintianqi.owndroid
|
||||
|
||||
import android.accounts.Account
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.ActivityOptions
|
||||
import android.app.Application
|
||||
import android.app.KeyguardManager
|
||||
@@ -521,12 +522,21 @@ class MyViewModel(application: Application): AndroidViewModel(application) {
|
||||
false
|
||||
}
|
||||
}
|
||||
@SuppressLint("PrivateApi")
|
||||
@RequiresApi(24)
|
||||
fun getOrgName(): String {
|
||||
return try {
|
||||
DPM.getOrganizationName(DAR)?.toString() ?: ""
|
||||
} catch (_: Exception) {
|
||||
""
|
||||
try {
|
||||
val method = DevicePolicyManager::class.java.getDeclaredMethod(
|
||||
"getDeviceOwnerOrganizationName"
|
||||
)
|
||||
method.isAccessible = true
|
||||
(method.invoke(DPM) as CharSequence).toString()
|
||||
} catch (_: Exception) {
|
||||
""
|
||||
}
|
||||
}
|
||||
}
|
||||
@RequiresApi(24)
|
||||
|
||||
Reference in New Issue
Block a user