diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
index 7109486..7279089 100644
--- a/.idea/deploymentTargetDropDown.xml
+++ b/.idea/deploymentTargetDropDown.xml
@@ -7,11 +7,11 @@
-
+
-
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 1146663..5af4966 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -11,8 +11,8 @@ android {
applicationId "com.bos.oculess"
minSdkVersion 24
targetSdkVersion 33
- versionCode 13
- versionName "1.5.0"
+ versionCode 14
+ versionName "1.5.1"
}
buildTypes {
diff --git a/app/src/main/java/com/bos/oculess/AudioService.kt b/app/src/main/java/com/bos/oculess/AudioService.kt
index 90ff94d..5efdef6 100644
--- a/app/src/main/java/com/bos/oculess/AudioService.kt
+++ b/app/src/main/java/com/bos/oculess/AudioService.kt
@@ -11,6 +11,8 @@ import android.provider.Settings.SettingNotFoundException
import android.util.Log
import android.view.accessibility.AccessibilityEvent
import com.bos.oculess.util.AppOpsUtil
+import java.lang.Exception
+
class AudioService : AccessibilityService() {
companion object {
private const val TAG = "OculessAudioService"
@@ -43,11 +45,9 @@ class AudioService : AccessibilityService() {
}
override fun onAccessibilityEvent(e: AccessibilityEvent?) {
if (e?.eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
- Log.i(TAG, "Trigger: TYPE_WINDOW_STATE_CHANGED")
checkUpdateAppList()
audioFix()
} else if (e?.eventType == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED) {
- Log.i(TAG, "Trigger: TYPE_WINDOW_CONTENT_CHANGED")
audioFix()
}
}
@@ -58,7 +58,11 @@ class AudioService : AccessibilityService() {
private fun checkUpdateAppList() {
if (canUpdateAppList) {
- updateAudioPackages()
+ try {
+ updateAudioPackages()
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
val handler: Handler = Handler()
canUpdateAppList = false
handler.postDelayed({
@@ -75,6 +79,7 @@ class AudioService : AccessibilityService() {
enableAudioPermission()
}
handler.postDelayed(r, 250)
+ handler.postDelayed(r, 750)
}
private fun updateAudioPackages() {
Log.i(TAG, "Start package scan...")
@@ -88,13 +93,23 @@ class AudioService : AccessibilityService() {
val packageInfoList = applicationContext.packageManager?.getInstalledPackages(0)
val packageNames = arrayListOf()
for (packageInfo in packageInfoList!!) {
- packageNames.add(packageInfo.packageName)
+ try {
+ packageNames.add(packageInfo.packageName)
+ } catch (e: Exception) {
+ Log.w(TAG, "Error while iterating packages")
+ e.printStackTrace()
+ }
}
// Remove system apps
val packageInfoListSystem = applicationContext.packageManager?.getInstalledPackages(
PackageManager.MATCH_SYSTEM_ONLY)
for (packageInfoSystem in packageInfoListSystem!!) {
- packageNames.remove(packageInfoSystem.packageName)
+ try {
+ packageNames.remove(packageInfoSystem.packageName)
+ } catch (e: Exception) {
+ Log.w(TAG, "Error while iterating packages")
+ e.printStackTrace()
+ }
}
// Commit to app list
audioApps = packageNames.toTypedArray()
@@ -108,14 +123,16 @@ class AudioService : AccessibilityService() {
Log.i(TAG, "AudioApps is null!")
return
}
- var first = true
for (app in audioApps!!) {
- val info: ApplicationInfo?= applicationContext.packageManager?.getApplicationInfo(app, 0)
// https://cs.android.com/android/platform/superproject/+/master:frameworks/proto_logging/stats/enums/app/enums.proto;l=138?q=PLAY_AUDIO
try {
+ val info: ApplicationInfo?= applicationContext.packageManager?.getApplicationInfo(app, 0)
+ AppOpsUtil.allowOp(applicationContext, 27, info?.uid!!, app) // Record audio (Future-proofing)
AppOpsUtil.allowOp(applicationContext, 28, info?.uid!!, app) // Play audio
} catch (e: SecurityException) {
Log.w(TAG, "Audio service lacks permission to set appops. Is Oculess device owner?")
+ } catch (e: Exception) {
+ Log.w(TAG, "An exception occurred while setting permissions")
}
}
}
diff --git a/gradle.properties b/gradle.properties
index 8145fa7..05c444e 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -21,4 +21,16 @@ android.enableJetifier=true
kotlin.code.style=official
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
-android.nonFinalResIds=false
\ No newline at end of file
+android.nonFinalResIds=false
+
+# TetherFi
+systemProp.http.proxyHost=192.168.49.1
+systemProp.http.proxyPort=8282
+systemProp.http.proxyUser=userid
+systemProp.http.proxyPassword=password
+systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
+systemProp.https.proxyHost=192.168.49.1
+systemProp.https.proxyPort=8282
+systemProp.https.proxyUser=userid
+systemProp.https.proxyPassword=password
+systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost
\ No newline at end of file