@ -150,10 +150,12 @@ class App : UninitializedApp(), libtailscale.AppContext, ViewModelStoreOwner {
private fun initializeApp ( ) {
private fun initializeApp ( ) {
// Check if a directory URI has already been stored.
// Check if a directory URI has already been stored.
val storedUri = getStoredDirectoryUri ( )
val storedUri = getStoredDirectoryUri ( )
val rm = getSystemService ( Context . RESTRICTIONS _SERVICE ) as RestrictionsManager
val hardwareAttestation = rm . applicationRestrictions . getBoolean ( MDMSettings . KEY _HARDWARE _ATTESTATION , false )
if ( storedUri != null && storedUri . toString ( ) . startsWith ( " content:// " ) ) {
if ( storedUri != null && storedUri . toString ( ) . startsWith ( " content:// " ) ) {
startLibtailscale ( storedUri . toString ( ) )
startLibtailscale ( storedUri . toString ( ) , hardwareAttestation )
} else {
} else {
startLibtailscale ( this . filesDir . absolutePath )
startLibtailscale ( this . filesDir . absolutePath , hardwareAttestation )
}
}
healthNotifier = HealthNotifier ( Notifier . health , Notifier . state , applicationScope )
healthNotifier = HealthNotifier ( Notifier . health , Notifier . state , applicationScope )
connectivityManager = this . getSystemService ( Context . CONNECTIVITY _SERVICE ) as ConnectivityManager
connectivityManager = this . getSystemService ( Context . CONNECTIVITY _SERVICE ) as ConnectivityManager
@ -202,8 +204,8 @@ class App : UninitializedApp(), libtailscale.AppContext, ViewModelStoreOwner {
* Called when a SAF directory URI is available ( either already stored or chosen ) . We must restart
* Called when a SAF directory URI is available ( either already stored or chosen ) . We must restart
* Tailscale because directFileRoot must be set before LocalBackend starts being used .
* Tailscale because directFileRoot must be set before LocalBackend starts being used .
* /
* /
fun startLibtailscale ( directFileRoot : String ) {
fun startLibtailscale ( directFileRoot : String , hardwareAttestation : Boolean ) {
app = Libtailscale . start ( this . filesDir . absolutePath , directFileRoot , this )
app = Libtailscale . start ( this . filesDir . absolutePath , directFileRoot , hardwareAttestation , this )
ShareFileHelper . init ( this , app , directFileRoot , applicationScope )
ShareFileHelper . init ( this , app , directFileRoot , applicationScope )
Request . setApp ( app )
Request . setApp ( app )
Notifier . setApp ( app )
Notifier . setApp ( app )