added option to disable telemetry

This commit is contained in:
basti564 2021-04-08 17:36:32 +02:00
parent a49236955f
commit 1de2570cbf
12 changed files with 330 additions and 26 deletions

View File

@ -0,0 +1,139 @@
<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">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -1,4 +1,21 @@
# Oculess
### Removes account requirements from Oculus Quest devices
Follow this tutorial on how to use the app: https://basti564.github.io/blog/Quest-Account-Logout
## Features
- Remove Oculus / FaceBook account
- Disable telemetry
## Tutorial
### Remove Account
1. Click on "DISABLE COMPANION"
2. Click "OK"
3. Choose “Companion Server” from the List
4. Click “Deactivate this device admin app”
5. Restart your Quest
### Disable Telemetry
```diff
!Warning! You won't be able to remove this app without a factory reset after running the following command
```
1. Run this command ```adb shell dpm set-device-owner com.bos.oculess/.DevAdminReceiver```
2. Click on "DISABLE TELEMETRY" in the app

View File

@ -11,8 +11,8 @@ android {
applicationId "com.bos.oculess"
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName "1.0"
versionCode 2
versionName "1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -10,8 +10,8 @@
{
"type": "SINGLE",
"filters": [],
"versionCode": 1,
"versionName": "1.0",
"versionCode": 2,
"versionName": "1.1",
"outputFile": "app-release.apk"
}
]

View File

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bos.oculess">
<uses-feature android:glEsVersion="0x00030001" />
<application
android:allowBackup="true"
@ -10,11 +10,28 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Oculess" >
android:theme="@style/Theme.Oculess">
<receiver
android:name=".DevAdminReceiver"
android:label="@string/app_name"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/device_admin" />
</receiver>
<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2" />
<activity android:name=".TelemetryActivity" />
<activity android:name=".MainActivity" android:launchMode="singleTask">
<meta-data
android:name="com.oculus.supportedDevices"
android:value="quest|quest2" />
<activity
android:name=".MainActivity"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -22,5 +39,5 @@
</intent-filter>
</activity>
</application>
<uses-feature android:glEsVersion="0x00030001" />
</manifest>

View File

@ -0,0 +1,16 @@
package com.bos.oculess
import android.app.admin.DeviceAdminReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import android.widget.Toast
class DevAdminReceiver : DeviceAdminReceiver() {
private val TAG = "DeviceAdminReceiver"
override fun onEnabled(context: Context, intent: Intent) {
super.onEnabled(context, intent)
Log.d(TAG, "Device Owner Enabled")
Toast.makeText(context, "Device Owner Enabled", Toast.LENGTH_LONG).show()
}
}

View File

@ -5,9 +5,7 @@ import android.content.ComponentName
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
import android.graphics.Color
import android.net.Uri
import android.os.Bundle
import android.view.WindowManager
import android.widget.Button
@ -22,19 +20,35 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val telemetryApps = arrayOf(
"com.oculus.unifiedtelemetry",
"com.oculus.gatekeeperservice",
"com.oculus.notification_proxy",
"com.oculus.bugreporter",
"com.oculus.os.logcollector",
"com.oculus.appsafety"
)
val viewAdminsBtn = findViewById<Button>(R.id.viewAdminsBtn)
val isEnabledText = findViewById<TextView>(R.id.isEnabledText)
val viewTelemetryBtn = findViewById<Button>(R.id.viewTelemetryBtn)
val dpm = getSystemService(Context.DEVICE_POLICY_SERVICE) as DevicePolicyManager
fixedRateTimer("timer", false, 0L, 1000) {
this@MainActivity.runOnUiThread {
if (dpm.isAdminActive(ComponentName("com.oculus.companion.server", "com.oculus.companion.server.CompanionDeviceAdmin\$CompanionDeviceAdminReceiver"))){
if (dpm.isAdminActive(
ComponentName(
"com.oculus.companion.server",
"com.oculus.companion.server.CompanionDeviceAdmin\$CompanionDeviceAdminReceiver"
)
)
) {
isEnabledText.setTextColor(Color.GREEN)
isEnabledText.text = getString(R.string.is_enabled)
viewAdminsBtn.text = getString(R.string.disable_companion)
}
else {
} else {
isEnabledText.setTextColor(Color.RED)
isEnabledText.text = getString(R.string.is_disabled)
viewAdminsBtn.text = getString(R.string.enable_companion)
@ -46,22 +60,92 @@ class MainActivity : AppCompatActivity() {
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
builder.setTitle(getString(R.string.title))
builder.setMessage(getString(R.string.message))
builder.setPositiveButton(getString(R.string.ok), DialogInterface.OnClickListener { _, _ ->
startActivity(Intent().setComponent(ComponentName("com.android.settings", "com.android.settings.DeviceAdminSettings")))
})
builder.setNegativeButton(getString(R.string.cancel), DialogInterface.OnClickListener { dialog, _ ->
builder.setPositiveButton(
getString(R.string.ok)
) { _, _ ->
startActivity(
Intent().setComponent(
ComponentName(
"com.android.settings",
"com.android.settings.DeviceAdminSettings"
)
)
)
}
builder.setNegativeButton(
getString(R.string.cancel)
) { dialog, _ ->
dialog.dismiss()
})
}
val alertDialog: AlertDialog = builder.create()
if (dpm.isAdminActive(ComponentName("com.oculus.companion.server", "com.oculus.companion.server.CompanionDeviceAdmin\$CompanionDeviceAdminReceiver"))){
if (dpm.isAdminActive(
ComponentName(
"com.oculus.companion.server",
"com.oculus.companion.server.CompanionDeviceAdmin\$CompanionDeviceAdminReceiver"
)
)
) {
alertDialog.show()
alertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
}
else {
startActivity(Intent().setComponent(ComponentName("com.android.settings", "com.android.settings.DeviceAdminSettings")))
} else {
startActivity(
Intent().setComponent(
ComponentName(
"com.android.settings",
"com.android.settings.DeviceAdminSettings"
)
)
)
}
}
viewTelemetryBtn.setOnClickListener {
if (dpm.isDeviceOwnerApp(packageName)) {
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
builder.setTitle(getString(R.string.app_name))
builder.setMessage(getString(R.string.message3))
builder.setPositiveButton(
getString(R.string.disable)
) { _, _ ->
telemetryApps.forEach {
dpm.setApplicationHidden(
ComponentName(
applicationContext,
DevAdminReceiver::class.java
), it, true
)
}
}
builder.setNegativeButton(
getString(R.string.enable)
) { _, _ ->
telemetryApps.forEach {
dpm.setApplicationHidden(
ComponentName(
applicationContext,
DevAdminReceiver::class.java
), it, false
)
}
}
val alertDialog: AlertDialog = builder.create()
alertDialog.show()
alertDialog.window!!.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
} 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)
}
}
}
}

View File

@ -7,11 +7,22 @@
tools:context=".MainActivity">
<Button
android:id="@+id/viewTelemetryBtn"
android:layout_width="217dp"
android:layout_height="87dp"
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="DISABLE COMPANION"
android:text="@string/disable_companion"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"

View File

@ -7,6 +7,11 @@
<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="telemetry">TELEMETRIE</string>
<string name="disable">Telemetrie Deaktivieren</string>
<string name="enable">Telemetrie Aktivieren</string>
</resources>

View File

@ -8,6 +8,11 @@
<string name="title">Important Info</string>
<string name="message">Please restart after the first time!\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>
<string name="enable">Enable Telemetry</string>
</resources>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
</uses-policies>
</device-admin>