-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
288 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: "Validate Gradle Wrapper" | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
validation: | ||
name: "Validation" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: gradle/wrapper-validation-action@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ | |
|
||
## Reporting a Vulnerability | ||
|
||
Contact: mailto:[email protected] | ||
Contact: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package me.lucky.duress | ||
|
||
import android.app.admin.DevicePolicyManager | ||
import android.content.ComponentName | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Build | ||
|
||
class DeviceAdminManager(private val ctx: Context) { | ||
private val dpm = ctx.getSystemService(DevicePolicyManager::class.java) | ||
private val deviceAdmin by lazy { ComponentName(ctx, DeviceAdminReceiver::class.java) } | ||
|
||
fun remove() = dpm?.removeActiveAdmin(deviceAdmin) | ||
fun isActive() = dpm?.isAdminActive(deviceAdmin) ?: false | ||
|
||
fun wipeData() { | ||
var flags = 0 | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) | ||
flags = flags.or(DevicePolicyManager.WIPE_SILENTLY) | ||
dpm?.wipeData(flags) | ||
} | ||
|
||
fun makeRequestIntent() = | ||
Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN) | ||
.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, deviceAdmin) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package me.lucky.duress | ||
|
||
import android.app.admin.DeviceAdminReceiver | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.widget.Toast | ||
|
||
class DeviceAdminReceiver : DeviceAdminReceiver() { | ||
override fun onDisabled(context: Context, intent: Intent) { | ||
super.onDisabled(context, intent) | ||
val prefs = Preferences(context) | ||
if (prefs.isEnabled && prefs.mode == Mode.WIPE.value) | ||
Toast.makeText(context, R.string.service_unavailable_popup, Toast.LENGTH_SHORT).show() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.