Merge pull request #319 from chirayudesai/restore-dialer
Allow launching restore through a dialer code
This commit is contained in:
commit
92d1f4d5f5
2 changed files with 45 additions and 0 deletions
|
@ -50,6 +50,16 @@
|
|||
<!-- Used to authenticate saving a new recovery code -->
|
||||
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
||||
|
||||
<!-- Permission used to open settings -->
|
||||
<permission
|
||||
android:name="com.stevesoltys.seedvault.OPEN_SETTINGS"
|
||||
android:protectionLevel="system|signature" />
|
||||
|
||||
<!-- Permission used to open backup gui -->
|
||||
<permission
|
||||
android:name="com.stevesoltys.seedvault.RESTORE_BACKUP"
|
||||
android:protectionLevel="system|signature" />
|
||||
|
||||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="false"
|
||||
|
@ -62,6 +72,7 @@
|
|||
|
||||
<activity
|
||||
android:name=".settings.SettingsActivity"
|
||||
android:permission="com.stevesoltys.seedvault.OPEN_SETTINGS"
|
||||
android:exported="true" />
|
||||
|
||||
<activity
|
||||
|
@ -80,6 +91,7 @@
|
|||
|
||||
<activity
|
||||
android:name=".restore.RestoreActivity"
|
||||
android:permission="com.stevesoltys.seedvault.RESTORE_BACKUP"
|
||||
android:exported="true"
|
||||
android:label="@string/restore_title"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
|
@ -116,6 +128,15 @@
|
|||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:name=".SecretCodeReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.telephony.action.SECRET_CODE" />
|
||||
<!-- *#*#RESTORE#*#* -->
|
||||
<data android:scheme="android_secret_code" android:host="7378673" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- Used to start actual BackupService depending on scheduling criteria -->
|
||||
<service
|
||||
android:name=".storage.StorageBackupJobService"
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.stevesoltys.seedvault
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
import android.util.Log
|
||||
import com.stevesoltys.seedvault.restore.RestoreActivity
|
||||
|
||||
private val TAG = BroadcastReceiver::class.java.simpleName
|
||||
private val RESTORE_SECRET_CODE = "7378673"
|
||||
|
||||
class SecretCodeReceiver : BroadcastReceiver() {
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val host = intent.data.host
|
||||
if (!RESTORE_SECRET_CODE.equals(host)) return
|
||||
Log.d(TAG, "Restore secret code received.")
|
||||
val i = Intent(context, RestoreActivity::class.java).apply {
|
||||
flags = FLAG_ACTIVITY_NEW_TASK
|
||||
}
|
||||
context.startActivity(i)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue