mirror of
https://github.com/basti564/Oculess.git
synced 2024-11-22 10:12:31 +01:00
v1.2
- Added ability to remove accounts - Added ability to disable updates bytecode target: 1.8 -> 11 gradle version: 6.5 -> 6.9 kotlin version: 1.3.72 -> 1.5.31
This commit is contained in:
parent
8b83d2da5b
commit
998cce9210
@ -1,22 +1,6 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value>
|
||||
<package name="java.util" alias="false" withSubpackages="false" />
|
||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||
<value>
|
||||
<package name="" alias="false" withSubpackages="true" />
|
||||
<package name="java" alias="false" withSubpackages="true" />
|
||||
<package name="javax" alias="false" withSubpackages="true" />
|
||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||
<package name="" alias="true" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="1.8" />
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
10
.idea/runConfigurations.xml
Normal file
10
.idea/runConfigurations.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -11,8 +11,8 @@ android {
|
||||
applicationId "com.bos.oculess"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 30
|
||||
versionCode 2
|
||||
versionName "1.1"
|
||||
versionCode 3
|
||||
versionName "1.2"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -35,11 +35,11 @@ android {
|
||||
dependencies {
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation 'androidx.core:core-ktx:1.3.2'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.core:core-ktx:1.6.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
}
|
@ -5,13 +5,13 @@
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "com.bos.oculess",
|
||||
"variantName": "processReleaseResources",
|
||||
"variantName": "release",
|
||||
"elements": [
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"versionCode": 2,
|
||||
"versionName": "1.1",
|
||||
"versionCode": 3,
|
||||
"versionName": "1.2",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
]
|
||||
|
@ -23,8 +23,6 @@
|
||||
android:resource="@xml/device_admin" />
|
||||
</receiver>
|
||||
|
||||
<activity android:name=".TelemetryActivity" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.oculus.supportedDevices"
|
||||
android:value="quest|quest2" />
|
||||
|
@ -3,10 +3,10 @@ package com.bos.oculess
|
||||
import android.app.admin.DevicePolicyManager
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.view.WindowManager
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
@ -20,6 +20,7 @@ class MainActivity : AppCompatActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
val updaterName = "com.oculus.updater"
|
||||
val telemetryApps = arrayOf(
|
||||
"com.oculus.unifiedtelemetry",
|
||||
"com.oculus.gatekeeperservice",
|
||||
@ -29,13 +30,20 @@ class MainActivity : AppCompatActivity() {
|
||||
"com.oculus.appsafety"
|
||||
)
|
||||
|
||||
val viewAdminsBtn = findViewById<Button>(R.id.viewAdminsBtn)
|
||||
val isEnabledText = findViewById<TextView>(R.id.isEnabledText)
|
||||
|
||||
val viewAdminsBtn = findViewById<Button>(R.id.viewAdminsBtn)
|
||||
val viewAccountsBtn = findViewById<Button>(R.id.viewAccountsBtn)
|
||||
val viewOtaBtn = findViewById<Button>(R.id.viewOtaBtn)
|
||||
val viewTelemetryBtn = findViewById<Button>(R.id.viewTelemetryBtn)
|
||||
|
||||
val dpm = getSystemService(Context.DEVICE_POLICY_SERVICE) as DevicePolicyManager
|
||||
|
||||
val deviceAdminReceiverComponentName = ComponentName(
|
||||
applicationContext,
|
||||
DevAdminReceiver::class.java
|
||||
)
|
||||
|
||||
fixedRateTimer("timer", false, 0L, 1000) {
|
||||
this@MainActivity.runOnUiThread {
|
||||
if (dpm.isAdminActive(
|
||||
@ -53,13 +61,25 @@ class MainActivity : AppCompatActivity() {
|
||||
isEnabledText.text = getString(R.string.is_disabled)
|
||||
viewAdminsBtn.text = getString(R.string.enable_companion)
|
||||
}
|
||||
if (dpm.isDeviceOwnerApp(packageName)) {
|
||||
if (dpm.isApplicationHidden(
|
||||
deviceAdminReceiverComponentName, updaterName
|
||||
)) {
|
||||
viewOtaBtn.text = getString(R.string.enable_ota)
|
||||
}
|
||||
else {
|
||||
viewOtaBtn.text = getString(R.string.disable_ota)
|
||||
}
|
||||
} else {
|
||||
viewOtaBtn.text = getString(R.string.disable_ota)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewAdminsBtn.setOnClickListener {
|
||||
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
|
||||
builder.setTitle(getString(R.string.title))
|
||||
builder.setMessage(getString(R.string.message))
|
||||
builder.setMessage(getString(R.string.message0))
|
||||
builder.setPositiveButton(
|
||||
getString(R.string.ok)
|
||||
) { _, _ ->
|
||||
@ -101,6 +121,57 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
}
|
||||
|
||||
viewAccountsBtn.setOnClickListener {
|
||||
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
|
||||
builder.setTitle(getString(R.string.title))
|
||||
builder.setMessage(getString(R.string.message1))
|
||||
builder.setPositiveButton(
|
||||
getString(R.string.ok)
|
||||
) { _, _ ->
|
||||
startActivity(
|
||||
Intent(Settings.ACTION_SYNC_SETTINGS)
|
||||
)
|
||||
}
|
||||
builder.setNegativeButton(
|
||||
getString(R.string.cancel)
|
||||
) { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
val alertDialog: AlertDialog = builder.create()
|
||||
|
||||
alertDialog.show()
|
||||
alertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
||||
}
|
||||
|
||||
viewOtaBtn.setOnClickListener {
|
||||
if (dpm.isDeviceOwnerApp(packageName)) {
|
||||
if (!dpm.isApplicationHidden(
|
||||
deviceAdminReceiverComponentName, updaterName
|
||||
)
|
||||
) {
|
||||
dpm.setApplicationHidden(
|
||||
deviceAdminReceiverComponentName, updaterName, true
|
||||
)
|
||||
} else {
|
||||
dpm.setApplicationHidden(
|
||||
deviceAdminReceiverComponentName, updaterName, false
|
||||
)
|
||||
}
|
||||
} else {
|
||||
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
|
||||
builder.setTitle(getString(R.string.title))
|
||||
builder.setMessage(getString(R.string.message2))
|
||||
builder.setPositiveButton(
|
||||
getString(R.string.ok)
|
||||
) { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
val alertDialog: AlertDialog = builder.create()
|
||||
alertDialog.show()
|
||||
alertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
|
||||
}
|
||||
}
|
||||
|
||||
viewTelemetryBtn.setOnClickListener {
|
||||
if (dpm.isDeviceOwnerApp(packageName)) {
|
||||
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
|
||||
@ -111,10 +182,7 @@ class MainActivity : AppCompatActivity() {
|
||||
) { _, _ ->
|
||||
telemetryApps.forEach {
|
||||
dpm.setApplicationHidden(
|
||||
ComponentName(
|
||||
applicationContext,
|
||||
DevAdminReceiver::class.java
|
||||
), it, true
|
||||
deviceAdminReceiverComponentName, it, true
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -123,10 +191,7 @@ class MainActivity : AppCompatActivity() {
|
||||
) { _, _ ->
|
||||
telemetryApps.forEach {
|
||||
dpm.setApplicationHidden(
|
||||
ComponentName(
|
||||
applicationContext,
|
||||
DevAdminReceiver::class.java
|
||||
), it, false
|
||||
deviceAdminReceiverComponentName, it, false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,17 @@
|
||||
tools:context=".MainActivity">
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/viewOtaBtn"
|
||||
android:layout_width="217dp"
|
||||
android:layout_height="87dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/disable_ota"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.494"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewAccountsBtn" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/viewTelemetryBtn"
|
||||
android:layout_width="217dp"
|
||||
@ -14,30 +25,44 @@
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/telemetry"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.499"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewAdminsBtn" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/viewAdminsBtn"
|
||||
android:layout_width="217dp"
|
||||
android:layout_height="87dp"
|
||||
android:text="@string/disable_companion"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewOtaBtn" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/isEnabledText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="placeholder"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@+id/viewAdminsBtn"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.498"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/viewAdminsBtn"
|
||||
android:layout_width="217dp"
|
||||
android:layout_height="87dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="@string/disable_companion"
|
||||
app:layout_constraintBottom_toTopOf="@+id/viewAccountsBtn"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.494"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/viewAccountsBtn"
|
||||
android:layout_width="217dp"
|
||||
android:layout_height="87dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:text="@string/remove_accounts"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.494"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.362" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,17 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Oculess</string>
|
||||
<string name="disable_companion">BEGLEITER DEAKTIVIEREN</string>
|
||||
<string name="enable_companion">BEGLEITER AKTIVIEREN</string>
|
||||
<string name="title">Wichtige Information</string>
|
||||
<string name="ok">Ok</string>
|
||||
<string name="cancel">Abbrechen</string>
|
||||
<string name="message">Bitte starten Sie nach dem ersten Mal neu!\nWiederholen Sie den Schritt nach jedem Neustart!</string>
|
||||
<string name="message2">Der Geräte Besitzer wurde nicht festgelegt!</string>
|
||||
<string name="message3">Wie möchten sie fortfahren?</string>
|
||||
|
||||
<string name="is_disabled">Oculus Begleit-Server ist deaktiviert!</string>
|
||||
<string name="is_enabled">Oculus Begleit-Server ist aktiviert!</string>
|
||||
|
||||
<string name="disable_companion">BEGLEITER DEAKTIVIEREN</string>
|
||||
<string name="enable_companion">BEGLEITER AKTIVIEREN</string>
|
||||
<string name="remove_accounts">ACCOUNTS ENTFERNEN</string>
|
||||
<string name="disable_ota">UPDATES DEAKTIVIEREN</string>
|
||||
<string name="enable_ota">UPDATES AKTIVIEREN</string>
|
||||
<string name="telemetry">TELEMETRIE</string>
|
||||
|
||||
<string name="title">Wichtige Information</string>
|
||||
<string name="message0">Bitte starten Sie nach dem ersten Mal neu!\nWiederholen Sie den Schritt nach jedem Neustart!</string>
|
||||
<string name="message1">Bitte entfernen Sie *alle* Accounts auf ihrem Gerät!\nWiederholen Sie den Schritt nach jedem Neustart!</string>
|
||||
<string name="message2">Der Geräte Besitzer wurde nicht festgelegt!</string>
|
||||
<string name="message3">Wie möchten sie fortfahren?</string>
|
||||
<string name="ok">Ok</string>
|
||||
<string name="cancel">Abbrechen</string>
|
||||
<string name="disable">Telemetrie Deaktivieren</string>
|
||||
<string name="enable">Telemetrie Aktivieren</string>
|
||||
</resources>
|
@ -1,16 +1,21 @@
|
||||
<resources>
|
||||
<string name="app_name">Oculess</string>
|
||||
|
||||
<string name="is_enabled">Oculus Companion Server is enabled!</string>
|
||||
<string name="disable_companion">DISABLE COMPANION</string>
|
||||
<string name="is_disabled">Oculus Companion Server is disabled!</string>
|
||||
<string name="is_enabled">Oculus Companion Server is enabled!</string>
|
||||
|
||||
<string name="disable_companion">DISABLE COMPANION</string>
|
||||
<string name="enable_companion">ENABLE COMPANION</string>
|
||||
<string name="remove_accounts">REMOVE ACCOUNTS</string>
|
||||
<string name="disable_ota">DISABLE UPDATES</string>
|
||||
<string name="enable_ota">ENABLE UPDATES</string>
|
||||
<string name="telemetry">TELEMETRY</string>
|
||||
|
||||
<string name="title">Important Info</string>
|
||||
<string name="message">Please restart after the first time!\nRepeat this step after every restart!</string>
|
||||
<string name="message0">Please restart after the first time!\nRepeat this step after every restart!</string>
|
||||
<string name="message1">Please remove *all* the accounts on your Device!\nRepeat this step after every restart!</string>
|
||||
<string name="message2">Device Owner has not been set!</string>
|
||||
<string name="message3">What would you like to do?</string>
|
||||
<string name="telemetry">TELEMETRY</string>
|
||||
<string name="ok">Ok</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="disable">Disable Telemetry</string>
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
ext.kotlin_version = "1.3.72"
|
||||
ext.kotlin_version = "1.5.31"
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:4.1.1"
|
||||
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
|
||||
|
Loading…
Reference in New Issue
Block a user