cancelToast();
ToastInterface toast;
- if(BuildConfig.APPLICATION_ID.equals(BuildConfig.ANDROIDX86_APPLICATION_ID))
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1
+ || BuildConfig.APPLICATION_ID.equals(BuildConfig.ANDROIDX86_APPLICATION_ID))
toast = new ToastFrameworkImpl(context, message, length);
else
toast = new ToastCompatImpl(context, message, length);
SharedPreferences pref = getSharedPreferences(context);
FreeformHackHelper helper = FreeformHackHelper.getInstance();
- boolean specialLaunch = isOPreview() && FreeformHackHelper.getInstance().isInFreeformWorkspace()
+ boolean specialLaunch = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
+ && FreeformHackHelper.getInstance().isInFreeformWorkspace()
&& MenuHelper.getInstance().isContextMenuOpen();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
if(FreeformHackHelper.getInstance().isInFreeformWorkspace()
- && Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1
- && !isOPreview())
+ && Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1)
intent.addFlags(Intent.FLAG_ACTIVITY_TASK_ON_HOME);
if(launchedFromTaskbar) {
context.startActivity(intent, bundle);
} catch (ActivityNotFoundException e) {
launchAndroidForWork(context, intent.getComponent(), bundle, userId);
- } catch (IllegalArgumentException e) { /* Gracefully fail */ }
+ } catch (IllegalArgumentException | SecurityException e) { /* Gracefully fail */ }
} else
launchAndroidForWork(context, intent.getComponent(), bundle, userId);
} else
context.startActivity(intent, bundle);
} catch (ActivityNotFoundException e) {
launchAndroidForWork(context, intent.getComponent(), bundle, userId);
- } catch (IllegalArgumentException e) { /* Gracefully fail */ }
+ } catch (IllegalArgumentException | SecurityException e) { /* Gracefully fail */ }
} else
launchAndroidForWork(context, intent.getComponent(), bundle, userId);
} else
context.startActivity(intent, bundle);
} catch (ActivityNotFoundException e) {
launchAndroidForWork(context, intent.getComponent(), bundle, userId);
- } catch (IllegalArgumentException e) { /* Gracefully fail */ }
+ } catch (IllegalArgumentException | SecurityException e) { /* Gracefully fail */ }
} else
launchAndroidForWork(context, intent.getComponent(), bundle, userId);
} else
context.startActivity(intent, bundle);
} catch (ActivityNotFoundException e) {
launchAndroidForWork(context, intent.getComponent(), bundle, userId);
- } catch (IllegalArgumentException e) { /* Gracefully fail */ }
+ } catch (IllegalArgumentException | SecurityException e) { /* Gracefully fail */ }
} else
launchAndroidForWork(context, intent.getComponent(), bundle, userId);
} else
metrics.widthPixels + 1,
metrics.heightPixels + 1
)).toBundle());
- } catch (IllegalArgumentException e) { /* Gracefully fail */ }
+ } catch (IllegalArgumentException | SecurityException e) { /* Gracefully fail */ }
}
public static void checkForUpdates(Context context) {
stackId = FREEFORM_WORKSPACE_STACK_ID;
break;
case CONTEXT_MENU:
- if(isOPreview()) stackId = FULLSCREEN_WORKSPACE_STACK_ID;
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
+ stackId = FULLSCREEN_WORKSPACE_STACK_ID;
}
if(stackId != null) {
}
}
- @TargetApi(Build.VERSION_CODES.M)
- public static boolean isOPreview() {
- return (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) || (Build.VERSION.RELEASE.equals("O") && Build.VERSION.PREVIEW_SDK_INT > 0);
- }
-
public static boolean isChromeOs(Context context) {
return context.getPackageManager().hasSystemFeature("org.chromium.arc");
}
return metrics;
}
+
+ public static int getOverlayType() {
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
+ ? WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
+ : WindowManager.LayoutParams.TYPE_PHONE;
+ }
}