I am currently using a slightly modified version of this code to open a free-form window of the currently open foreground app
private fun goToSplitMode() {
val manager = packageManager
val i = manager.getLaunchIntentForPackage("com.google.android.apps.maps") ? : return
i.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT |
Intent.FLAG_CLEAR_TOP |
Intent.FLAG_SINGLE_TOP |
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT |
Intent.FLAG_ACTIVITY_NEW_TASK)
val mBounds = new Rect(getScreenWidth(applicationContext) / 4, 0, getScreenWidth(applicationContext) / 2, getScreenHeight(applicationContext));
var mOptions = getActivityOptions();
mOptions = mOptions.setLaunchBounds(mBounds);
startActivity(i, mOptions.toBundle());
}
This works fine as is and opens google maps somewhere in a free-form window on the screen. The location or size doesn't matter to me right now.
Does anyone know a way of now switching this window back to a full screen/normal window? I am doing all this from a foreground service by the way
Any help would be greatly appreciated!
Things I have considered
- Closing and reopening the application
- I can't seem to find a way to reliably do this for an activity outside of MY app
- Running a modified version of the code above to either set the bounds to be different or to use some combination of flags to try and change it back
- Neither of these have worked and the free-form window doesn't change at all