Merge "Avoid activity embedding if the activity is already embedded" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b8beeb1cda
@@ -23,6 +23,7 @@ import android.util.FeatureFlagUtils;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import androidx.window.embedding.ActivityEmbeddingController;
|
||||
import androidx.window.embedding.SplitController;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -81,4 +82,13 @@ public class ActivityEmbeddingUtils {
|
||||
return dm.widthPixels >= (int) TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP, MIN_REGULAR_HOMEPAGE_LAYOUT_WIDTH_DP, dm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if activity is already embedded
|
||||
*/
|
||||
public static boolean isAlreadyEmbedded(Activity activity) {
|
||||
return ActivityEmbeddingController
|
||||
.getInstance(activity)
|
||||
.isActivityEmbedded(activity);
|
||||
}
|
||||
}
|
||||
|
@@ -102,7 +102,8 @@ public class SearchResultTrampoline extends Activity {
|
||||
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
|
||||
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this)) {
|
||||
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this)
|
||||
|| ActivityEmbeddingUtils.isAlreadyEmbedded(this)) {
|
||||
startActivity(intent);
|
||||
} else if (isSettingsIntelligence(callingActivity)) {
|
||||
if (FeatureFlagUtils.isEnabled(this, FeatureFlags.SETTINGS_SEARCH_ALWAYS_EXPAND)) {
|
||||
|
Reference in New Issue
Block a user