Skip to content

Commit

Permalink
Remove support for Android API < 23 in DebugOverlayController
Browse files Browse the repository at this point in the history
Summary:
Since minsdk version was increased to 23, we are deleting code using Android APIs < 23 for class DebugOverlayController

chnagelog: [Android][Breaking] Remove support for Android API < 23 in DebugOverlayController

Differential Revision: D48545520

fbshipit-source-id: 3f69e2703acb4fbd3935ca44680634d1ce452f27
  • Loading branch information
mdvacca authored and facebook-github-bot committed Sep 26, 2023
1 parent f4dbb73 commit 18ca878
Showing 1 changed file with 18 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import android.content.pm.PackageManager;
import android.graphics.PixelFormat;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.view.WindowManager;
import android.widget.FrameLayout;
Expand All @@ -31,33 +30,29 @@
/* package */ class DebugOverlayController {

public static void requestPermission(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// Get permission to show debug overlay in dev builds.
if (!Settings.canDrawOverlays(context)) {
Intent intent =
new Intent(
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + context.getPackageName()));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
FLog.w(
ReactConstants.TAG,
"Overlay permissions needs to be granted in order for react native apps to run in dev mode");
if (canHandleIntent(context, intent)) {
context.startActivity(intent);
}
// Get permission to show debug overlay in dev builds.
if (!Settings.canDrawOverlays(context)) {
Intent intent =
new Intent(
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + context.getPackageName()));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
FLog.w(
ReactConstants.TAG,
"Overlay permissions needs to be granted in order for react native apps to run in dev mode");
if (canHandleIntent(context, intent)) {
context.startActivity(intent);
}
}
}

private static boolean permissionCheck(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// Get permission to show debug overlay in dev builds.
if (!Settings.canDrawOverlays(context)) {
// overlay permission not yet granted
return false;
} else {
return true;
}
// Get permission to show debug overlay in dev builds.
if (!Settings.canDrawOverlays(context)) {
// overlay permission not yet granted
return false;
} else {
return true;
}
// on pre-M devices permission needs to be specified in manifest
return hasPermission(context, Manifest.permission.SYSTEM_ALERT_WINDOW);
Expand Down

0 comments on commit 18ca878

Please sign in to comment.