Compare commits
No commits in common. "5e2ca3f57513cec203a0f2b42bc901cba4110ae4" and "019abe5a0cb37768bf1c47ed312852f97a780643" have entirely different histories.
5e2ca3f575
...
019abe5a0c
3 changed files with 2 additions and 27 deletions
|
@ -16,8 +16,8 @@ android {
|
||||||
applicationId "net.typeblog.shelter"
|
applicationId "net.typeblog.shelter"
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdkVersion 33
|
targetSdkVersion 33
|
||||||
versionCode 21
|
versionCode 20
|
||||||
versionName "1.8-dev1"
|
versionName "1.7"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"
|
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"
|
||||||
tools:ignore="ProtectedPermissions" />
|
tools:ignore="ProtectedPermissions" />
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
|
||||||
|
|
||||||
<!-- For querying apps on Android R and later -->
|
<!-- For querying apps on Android R and later -->
|
||||||
<queries>
|
<queries>
|
||||||
|
|
|
@ -24,7 +24,6 @@ import android.widget.Toast;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
|
|
||||||
import net.typeblog.shelter.R;
|
import net.typeblog.shelter.R;
|
||||||
import net.typeblog.shelter.ShelterApplication;
|
import net.typeblog.shelter.ShelterApplication;
|
||||||
|
@ -89,7 +88,6 @@ public class DummyActivity extends Activity {
|
||||||
|
|
||||||
private static final int REQUEST_INSTALL_PACKAGE = 1;
|
private static final int REQUEST_INSTALL_PACKAGE = 1;
|
||||||
private static final int REQUEST_PERMISSION_EXTERNAL_STORAGE= 2;
|
private static final int REQUEST_PERMISSION_EXTERNAL_STORAGE= 2;
|
||||||
private static final int REQUEST_PERMISSION_POST_NOTIFICATIONS = 3;
|
|
||||||
|
|
||||||
// A state variable to record the last time DummyActivity was informed that someone
|
// A state variable to record the last time DummyActivity was informed that someone
|
||||||
// in the same process needs to call an action without signature
|
// in the same process needs to call an action without signature
|
||||||
|
@ -132,25 +130,8 @@ public class DummyActivity extends Activity {
|
||||||
Utility.enforceWorkProfilePolicies(this);
|
Utility.enforceWorkProfilePolicies(this);
|
||||||
Utility.enforceUserRestrictions(this);
|
Utility.enforceUserRestrictions(this);
|
||||||
SettingsManager.getInstance().applyAll();
|
SettingsManager.getInstance().applyAll();
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
||||||
// We pretty much only send notifications to keep the process inside work profile alive
|
|
||||||
// as such, only request the notification permission from inside the profile
|
|
||||||
// This will ideally be shown and done when finalizing the profile (since it will go
|
|
||||||
// through this activity)
|
|
||||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS)
|
|
||||||
!= PackageManager.PERMISSION_GRANTED) {
|
|
||||||
requestPermissions(new String[]{Manifest.permission.POST_NOTIFICATIONS}, REQUEST_PERMISSION_POST_NOTIFICATIONS);
|
|
||||||
// Continue once the request has been completed (see onRequestPermissionResult)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init() {
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
|
||||||
// First check if we have a registered request from the same process
|
// First check if we have a registered request from the same process
|
||||||
|
@ -236,11 +217,6 @@ public class DummyActivity extends Activity {
|
||||||
} else {
|
} else {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
} else if (requestCode == REQUEST_PERMISSION_POST_NOTIFICATIONS) {
|
|
||||||
// Regardless of the result, continue initialization
|
|
||||||
// This is fine because most functionalities will work anyway; it will just be a bit buggy
|
|
||||||
// and unreliable.
|
|
||||||
init();
|
|
||||||
} else {
|
} else {
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue