Loading cmds/idmap2/idmap2/Scan.cpp +4 −3 Original line number Original line Diff line number Diff line Loading @@ -68,9 +68,10 @@ struct InputOverlay { }; }; bool VendorIsQOrLater() { bool VendorIsQOrLater() { // STOPSHIP(b/119390857): Check api version once Q sdk version is finalized constexpr int kQSdkVersion = 29; std::string version = android::base::GetProperty("ro.vndk.version", "Q"); int version = std::atoi(android::base::GetProperty("ro.vndk.version", "29").data()); return version == "Q" || version == "q"; // If the string cannot be parsed, it is a development sdk codename. return version >= kQSdkVersion || version == 0; } } Result<std::unique_ptr<std::vector<std::string>>> FindApkFiles(const std::vector<std::string>& dirs, Result<std::unique_ptr<std::vector<std::string>>> FindApkFiles(const std::vector<std::string>& dirs, Loading core/java/android/app/ActivityThread.java +10 −9 Original line number Original line Diff line number Diff line Loading @@ -5564,15 +5564,9 @@ public final class ActivityThread extends ClientTransactionHandler { private void handleConfigurationChanged(Configuration config, CompatibilityInfo compat) { private void handleConfigurationChanged(Configuration config, CompatibilityInfo compat) { int configDiff = 0; int configDiff; boolean equivalent; // This flag tracks whether the new configuration is fundamentally equivalent to the // existing configuration. This is necessary to determine whether non-activity // callbacks should receive notice when the only changes are related to non-public fields. // We do not gate calling {@link #performActivityConfigurationChanged} based on this flag // as that method uses the same check on the activity config override as well. final boolean equivalent = config != null && mConfiguration != null && (0 == mConfiguration.diffPublicOnly(config)); final Theme systemTheme = getSystemContext().getTheme(); final Theme systemTheme = getSystemContext().getTheme(); final Theme systemUiTheme = getSystemUiContext().getTheme(); final Theme systemUiTheme = getSystemUiContext().getTheme(); Loading @@ -5590,6 +5584,13 @@ public final class ActivityThread extends ClientTransactionHandler { return; return; } } // This flag tracks whether the new configuration is fundamentally equivalent to the // existing configuration. This is necessary to determine whether non-activity callbacks // should receive notice when the only changes are related to non-public fields. // We do not gate calling {@link #performActivityConfigurationChanged} based on this // flag as that method uses the same check on the activity config override as well. equivalent = mConfiguration != null && (0 == mConfiguration.diffPublicOnly(config)); if (DEBUG_CONFIGURATION) Slog.v(TAG, "Handle configuration changed: " if (DEBUG_CONFIGURATION) Slog.v(TAG, "Handle configuration changed: " + config); + config); Loading core/java/android/view/ViewRootImpl.java +17 −5 Original line number Original line Diff line number Diff line Loading @@ -1522,6 +1522,7 @@ public final class ViewRootImpl implements ViewParent, } } void setWindowStopped(boolean stopped) { void setWindowStopped(boolean stopped) { checkThread(); if (mStopped != stopped) { if (mStopped != stopped) { mStopped = stopped; mStopped = stopped; final ThreadedRenderer renderer = mAttachInfo.mThreadedRenderer; final ThreadedRenderer renderer = mAttachInfo.mThreadedRenderer; Loading @@ -1543,7 +1544,7 @@ public final class ViewRootImpl implements ViewParent, } } if (mStopped) { if (mStopped) { if (mSurfaceHolder != null) { if (mSurfaceHolder != null && mSurface.isValid()) { notifySurfaceDestroyed(); notifySurfaceDestroyed(); } } destroySurface(); destroySurface(); Loading Loading @@ -2001,9 +2002,18 @@ public final class ViewRootImpl implements ViewParent, mDisplay.getRealSize(size); mDisplay.getRealSize(size); desiredWindowWidth = size.x; desiredWindowWidth = size.x; desiredWindowHeight = size.y; desiredWindowHeight = size.y; } else if (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT || lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) { // For wrap content, we have to remeasure later on anyways. Use size consistent with // below so we get best use of the measure cache. desiredWindowWidth = dipToPx(config.screenWidthDp); desiredWindowHeight = dipToPx(config.screenHeightDp); } else { } else { desiredWindowWidth = mWinFrame.width(); // After addToDisplay, the frame contains the frameHint from window manager, which desiredWindowHeight = mWinFrame.height(); // for most windows is going to be the same size as the result of relayoutWindow. // Using this here allows us to avoid remeasuring after relayoutWindow desiredWindowWidth = frame.width(); desiredWindowHeight = frame.height(); } } // We used to use the following condition to choose 32 bits drawing caches: // We used to use the following condition to choose 32 bits drawing caches: Loading Loading @@ -2209,6 +2219,8 @@ public final class ViewRootImpl implements ViewParent, final boolean isViewVisible = viewVisibility == View.VISIBLE; final boolean isViewVisible = viewVisibility == View.VISIBLE; final boolean windowRelayoutWasForced = mForceNextWindowRelayout; final boolean windowRelayoutWasForced = mForceNextWindowRelayout; boolean surfaceSizeChanged = false; if (mFirst || windowShouldResize || insetsChanged || if (mFirst || windowShouldResize || insetsChanged || viewVisibilityChanged || params != null || mForceNextWindowRelayout) { viewVisibilityChanged || params != null || mForceNextWindowRelayout) { mForceNextWindowRelayout = false; mForceNextWindowRelayout = false; Loading Loading @@ -2287,7 +2299,7 @@ public final class ViewRootImpl implements ViewParent, final boolean cutoutChanged = !mPendingDisplayCutout.equals( final boolean cutoutChanged = !mPendingDisplayCutout.equals( mAttachInfo.mDisplayCutout); mAttachInfo.mDisplayCutout); final boolean outsetsChanged = !mPendingOutsets.equals(mAttachInfo.mOutsets); final boolean outsetsChanged = !mPendingOutsets.equals(mAttachInfo.mOutsets); final boolean surfaceSizeChanged = (relayoutResult surfaceSizeChanged = (relayoutResult & WindowManagerGlobal.RELAYOUT_RES_SURFACE_RESIZED) != 0; & WindowManagerGlobal.RELAYOUT_RES_SURFACE_RESIZED) != 0; surfaceChanged |= surfaceSizeChanged; surfaceChanged |= surfaceSizeChanged; final boolean alwaysConsumeSystemBarsChanged = final boolean alwaysConsumeSystemBarsChanged = Loading Loading @@ -2570,7 +2582,7 @@ public final class ViewRootImpl implements ViewParent, maybeHandleWindowMove(frame); maybeHandleWindowMove(frame); } } if (surfaceChanged) { if (surfaceSizeChanged) { updateBoundsSurface(); updateBoundsSurface(); } } Loading core/java/android/view/WindowManagerGlobal.java +19 −1 Original line number Original line Diff line number Diff line Loading @@ -636,13 +636,21 @@ public final class WindowManagerGlobal { } } public void setStoppedState(IBinder token, boolean stopped) { public void setStoppedState(IBinder token, boolean stopped) { ArrayList<ViewRootImpl> nonCurrentThreadRoots = null; synchronized (mLock) { synchronized (mLock) { int count = mViews.size(); int count = mViews.size(); for (int i = count - 1; i >= 0; i--) { for (int i = count - 1; i >= 0; i--) { if (token == null || mParams.get(i).token == token) { if (token == null || mParams.get(i).token == token) { ViewRootImpl root = mRoots.get(i); ViewRootImpl root = mRoots.get(i); // Client might remove the view by "stopped" event. // Client might remove the view by "stopped" event. if (root.mThread == Thread.currentThread()) { root.setWindowStopped(stopped); root.setWindowStopped(stopped); } else { if (nonCurrentThreadRoots == null) { nonCurrentThreadRoots = new ArrayList<>(); } nonCurrentThreadRoots.add(root); } // Recursively forward stopped state to View's attached // Recursively forward stopped state to View's attached // to this Window rather than the root application token, // to this Window rather than the root application token, // e.g. PopupWindow's. // e.g. PopupWindow's. Loading @@ -650,6 +658,16 @@ public final class WindowManagerGlobal { } } } } } } // Update the stopped state synchronously to ensure the surface won't be used after server // side has destroyed it. This operation should be outside the lock to avoid any potential // paths from setWindowStopped to WindowManagerGlobal which may cause deadlocks. if (nonCurrentThreadRoots != null) { for (int i = nonCurrentThreadRoots.size() - 1; i >= 0; i--) { ViewRootImpl root = nonCurrentThreadRoots.get(i); root.mHandler.runWithScissors(() -> root.setWindowStopped(stopped), 0); } } } } public void reportNewConfiguration(Configuration config) { public void reportNewConfiguration(Configuration config) { Loading core/java/com/android/internal/app/ChooserActivity.java +39 −19 Original line number Original line Diff line number Diff line Loading @@ -716,18 +716,31 @@ public class ChooserActivity extends ResolverActivity { public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig); adjustPreviewWidth(newConfig.orientation, null); } private boolean shouldDisplayLandscape(int orientation) { // Sharesheet fixes the # of items per row and therefore can not correctly lay out // when in the restricted size of multi-window mode. In the future, would be nice // to use minimum dp size requirements instead return orientation == Configuration.ORIENTATION_LANDSCAPE && !isInMultiWindowMode(); } private void adjustPreviewWidth(int orientation, View parent) { int width = -1; int width = -1; if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { if (shouldDisplayLandscape(orientation)) { width = getResources().getDimensionPixelSize(R.dimen.chooser_preview_width); width = getResources().getDimensionPixelSize(R.dimen.chooser_preview_width); } } updateLayoutWidth(R.id.content_preview_text_layout, width); parent = parent == null ? getWindow().getDecorView() : parent; updateLayoutWidth(R.id.content_preview_title_layout, width); updateLayoutWidth(R.id.content_preview_file_layout, width); updateLayoutWidth(R.id.content_preview_text_layout, width, parent); updateLayoutWidth(R.id.content_preview_title_layout, width, parent); updateLayoutWidth(R.id.content_preview_file_layout, width, parent); } } private void updateLayoutWidth(int layoutResourceId, int width) { private void updateLayoutWidth(int layoutResourceId, int width, View parent) { View view = findViewById(layoutResourceId); View view = parent.findViewById(layoutResourceId); if (view != null && view.getLayoutParams() != null) { if (view != null && view.getLayoutParams() != null) { LayoutParams params = view.getLayoutParams(); LayoutParams params = view.getLayoutParams(); params.width = width; params.width = width; Loading @@ -740,18 +753,27 @@ public class ChooserActivity extends ResolverActivity { ViewGroup parent) { ViewGroup parent) { if (convertView != null) return convertView; if (convertView != null) return convertView; ViewGroup layout = null; switch (previewType) { switch (previewType) { case CONTENT_PREVIEW_TEXT: case CONTENT_PREVIEW_TEXT: return displayTextContentPreview(targetIntent, layoutInflater, parent); layout = displayTextContentPreview(targetIntent, layoutInflater, parent); break; case CONTENT_PREVIEW_IMAGE: case CONTENT_PREVIEW_IMAGE: return displayImageContentPreview(targetIntent, layoutInflater, parent); layout = displayImageContentPreview(targetIntent, layoutInflater, parent); break; case CONTENT_PREVIEW_FILE: case CONTENT_PREVIEW_FILE: return displayFileContentPreview(targetIntent, layoutInflater, parent); layout = displayFileContentPreview(targetIntent, layoutInflater, parent); break; default: default: Log.e(TAG, "Unexpected content preview type: " + previewType); Log.e(TAG, "Unexpected content preview type: " + previewType); } } return null; if (layout != null) { adjustPreviewWidth(getResources().getConfiguration().orientation, layout); } return layout; } } private ViewGroup displayTextContentPreview(Intent targetIntent, LayoutInflater layoutInflater, private ViewGroup displayTextContentPreview(Intent targetIntent, LayoutInflater layoutInflater, Loading Loading @@ -2180,9 +2202,7 @@ public class ChooserActivity extends ResolverActivity { if (mChooserRowAdapter.consumeLayoutRequest() if (mChooserRowAdapter.consumeLayoutRequest() || mChooserRowAdapter.calculateChooserTargetWidth(availableWidth) || mChooserRowAdapter.calculateChooserTargetWidth(availableWidth) || mAdapterView.getAdapter() == null) { || mAdapterView.getAdapter() == null) { if (mAdapterView.getAdapter() == null) { mAdapterView.setAdapter(mChooserRowAdapter); mAdapterView.setAdapter(mChooserRowAdapter); } getMainThreadHandler().post(() -> { getMainThreadHandler().post(() -> { if (mResolverDrawerLayout == null || mChooserRowAdapter == null) { if (mResolverDrawerLayout == null || mChooserRowAdapter == null) { Loading Loading @@ -2225,9 +2245,9 @@ public class ChooserActivity extends ResolverActivity { } } } } boolean isPortrait = getResources().getConfiguration().orientation boolean isExpandable = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; == Configuration.ORIENTATION_PORTRAIT && !isInMultiWindowMode(); if (directShareHeight != 0 && isSendAction(getTargetIntent()) && isPortrait) { if (directShareHeight != 0 && isSendAction(getTargetIntent()) && isExpandable) { // make sure to leave room for direct share 4->8 expansion // make sure to leave room for direct share 4->8 expansion int requiredExpansionHeight = int requiredExpansionHeight = (int) (directShareHeight / DIRECT_SHARE_EXPANSION_RATE); (int) (directShareHeight / DIRECT_SHARE_EXPANSION_RATE); Loading Loading @@ -2791,8 +2811,7 @@ public class ChooserActivity extends ResolverActivity { private int getMaxTargetsPerRow() { private int getMaxTargetsPerRow() { int maxTargets = MAX_TARGETS_PER_ROW_PORTRAIT; int maxTargets = MAX_TARGETS_PER_ROW_PORTRAIT; if (getResources().getConfiguration().orientation if (shouldDisplayLandscape(getResources().getConfiguration().orientation)) { == Configuration.ORIENTATION_LANDSCAPE) { maxTargets = MAX_TARGETS_PER_ROW_LANDSCAPE; maxTargets = MAX_TARGETS_PER_ROW_LANDSCAPE; } } Loading Loading @@ -3178,7 +3197,8 @@ public class ChooserActivity extends ResolverActivity { int orientation = getResources().getConfiguration().orientation; int orientation = getResources().getConfiguration().orientation; boolean canExpandDirectShare = boolean canExpandDirectShare = mChooserListAdapter.getNumShortcutResults() > getMaxTargetsPerRow() mChooserListAdapter.getNumShortcutResults() > getMaxTargetsPerRow() && orientation == Configuration.ORIENTATION_PORTRAIT; && orientation == Configuration.ORIENTATION_PORTRAIT && !isInMultiWindowMode(); if (mDirectShareViewHolder != null && canExpandDirectShare) { if (mDirectShareViewHolder != null && canExpandDirectShare) { mDirectShareViewHolder.handleScroll(mAdapterView, y, oldy, getMaxTargetsPerRow()); mDirectShareViewHolder.handleScroll(mAdapterView, y, oldy, getMaxTargetsPerRow()); Loading Loading
cmds/idmap2/idmap2/Scan.cpp +4 −3 Original line number Original line Diff line number Diff line Loading @@ -68,9 +68,10 @@ struct InputOverlay { }; }; bool VendorIsQOrLater() { bool VendorIsQOrLater() { // STOPSHIP(b/119390857): Check api version once Q sdk version is finalized constexpr int kQSdkVersion = 29; std::string version = android::base::GetProperty("ro.vndk.version", "Q"); int version = std::atoi(android::base::GetProperty("ro.vndk.version", "29").data()); return version == "Q" || version == "q"; // If the string cannot be parsed, it is a development sdk codename. return version >= kQSdkVersion || version == 0; } } Result<std::unique_ptr<std::vector<std::string>>> FindApkFiles(const std::vector<std::string>& dirs, Result<std::unique_ptr<std::vector<std::string>>> FindApkFiles(const std::vector<std::string>& dirs, Loading
core/java/android/app/ActivityThread.java +10 −9 Original line number Original line Diff line number Diff line Loading @@ -5564,15 +5564,9 @@ public final class ActivityThread extends ClientTransactionHandler { private void handleConfigurationChanged(Configuration config, CompatibilityInfo compat) { private void handleConfigurationChanged(Configuration config, CompatibilityInfo compat) { int configDiff = 0; int configDiff; boolean equivalent; // This flag tracks whether the new configuration is fundamentally equivalent to the // existing configuration. This is necessary to determine whether non-activity // callbacks should receive notice when the only changes are related to non-public fields. // We do not gate calling {@link #performActivityConfigurationChanged} based on this flag // as that method uses the same check on the activity config override as well. final boolean equivalent = config != null && mConfiguration != null && (0 == mConfiguration.diffPublicOnly(config)); final Theme systemTheme = getSystemContext().getTheme(); final Theme systemTheme = getSystemContext().getTheme(); final Theme systemUiTheme = getSystemUiContext().getTheme(); final Theme systemUiTheme = getSystemUiContext().getTheme(); Loading @@ -5590,6 +5584,13 @@ public final class ActivityThread extends ClientTransactionHandler { return; return; } } // This flag tracks whether the new configuration is fundamentally equivalent to the // existing configuration. This is necessary to determine whether non-activity callbacks // should receive notice when the only changes are related to non-public fields. // We do not gate calling {@link #performActivityConfigurationChanged} based on this // flag as that method uses the same check on the activity config override as well. equivalent = mConfiguration != null && (0 == mConfiguration.diffPublicOnly(config)); if (DEBUG_CONFIGURATION) Slog.v(TAG, "Handle configuration changed: " if (DEBUG_CONFIGURATION) Slog.v(TAG, "Handle configuration changed: " + config); + config); Loading
core/java/android/view/ViewRootImpl.java +17 −5 Original line number Original line Diff line number Diff line Loading @@ -1522,6 +1522,7 @@ public final class ViewRootImpl implements ViewParent, } } void setWindowStopped(boolean stopped) { void setWindowStopped(boolean stopped) { checkThread(); if (mStopped != stopped) { if (mStopped != stopped) { mStopped = stopped; mStopped = stopped; final ThreadedRenderer renderer = mAttachInfo.mThreadedRenderer; final ThreadedRenderer renderer = mAttachInfo.mThreadedRenderer; Loading @@ -1543,7 +1544,7 @@ public final class ViewRootImpl implements ViewParent, } } if (mStopped) { if (mStopped) { if (mSurfaceHolder != null) { if (mSurfaceHolder != null && mSurface.isValid()) { notifySurfaceDestroyed(); notifySurfaceDestroyed(); } } destroySurface(); destroySurface(); Loading Loading @@ -2001,9 +2002,18 @@ public final class ViewRootImpl implements ViewParent, mDisplay.getRealSize(size); mDisplay.getRealSize(size); desiredWindowWidth = size.x; desiredWindowWidth = size.x; desiredWindowHeight = size.y; desiredWindowHeight = size.y; } else if (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT || lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) { // For wrap content, we have to remeasure later on anyways. Use size consistent with // below so we get best use of the measure cache. desiredWindowWidth = dipToPx(config.screenWidthDp); desiredWindowHeight = dipToPx(config.screenHeightDp); } else { } else { desiredWindowWidth = mWinFrame.width(); // After addToDisplay, the frame contains the frameHint from window manager, which desiredWindowHeight = mWinFrame.height(); // for most windows is going to be the same size as the result of relayoutWindow. // Using this here allows us to avoid remeasuring after relayoutWindow desiredWindowWidth = frame.width(); desiredWindowHeight = frame.height(); } } // We used to use the following condition to choose 32 bits drawing caches: // We used to use the following condition to choose 32 bits drawing caches: Loading Loading @@ -2209,6 +2219,8 @@ public final class ViewRootImpl implements ViewParent, final boolean isViewVisible = viewVisibility == View.VISIBLE; final boolean isViewVisible = viewVisibility == View.VISIBLE; final boolean windowRelayoutWasForced = mForceNextWindowRelayout; final boolean windowRelayoutWasForced = mForceNextWindowRelayout; boolean surfaceSizeChanged = false; if (mFirst || windowShouldResize || insetsChanged || if (mFirst || windowShouldResize || insetsChanged || viewVisibilityChanged || params != null || mForceNextWindowRelayout) { viewVisibilityChanged || params != null || mForceNextWindowRelayout) { mForceNextWindowRelayout = false; mForceNextWindowRelayout = false; Loading Loading @@ -2287,7 +2299,7 @@ public final class ViewRootImpl implements ViewParent, final boolean cutoutChanged = !mPendingDisplayCutout.equals( final boolean cutoutChanged = !mPendingDisplayCutout.equals( mAttachInfo.mDisplayCutout); mAttachInfo.mDisplayCutout); final boolean outsetsChanged = !mPendingOutsets.equals(mAttachInfo.mOutsets); final boolean outsetsChanged = !mPendingOutsets.equals(mAttachInfo.mOutsets); final boolean surfaceSizeChanged = (relayoutResult surfaceSizeChanged = (relayoutResult & WindowManagerGlobal.RELAYOUT_RES_SURFACE_RESIZED) != 0; & WindowManagerGlobal.RELAYOUT_RES_SURFACE_RESIZED) != 0; surfaceChanged |= surfaceSizeChanged; surfaceChanged |= surfaceSizeChanged; final boolean alwaysConsumeSystemBarsChanged = final boolean alwaysConsumeSystemBarsChanged = Loading Loading @@ -2570,7 +2582,7 @@ public final class ViewRootImpl implements ViewParent, maybeHandleWindowMove(frame); maybeHandleWindowMove(frame); } } if (surfaceChanged) { if (surfaceSizeChanged) { updateBoundsSurface(); updateBoundsSurface(); } } Loading
core/java/android/view/WindowManagerGlobal.java +19 −1 Original line number Original line Diff line number Diff line Loading @@ -636,13 +636,21 @@ public final class WindowManagerGlobal { } } public void setStoppedState(IBinder token, boolean stopped) { public void setStoppedState(IBinder token, boolean stopped) { ArrayList<ViewRootImpl> nonCurrentThreadRoots = null; synchronized (mLock) { synchronized (mLock) { int count = mViews.size(); int count = mViews.size(); for (int i = count - 1; i >= 0; i--) { for (int i = count - 1; i >= 0; i--) { if (token == null || mParams.get(i).token == token) { if (token == null || mParams.get(i).token == token) { ViewRootImpl root = mRoots.get(i); ViewRootImpl root = mRoots.get(i); // Client might remove the view by "stopped" event. // Client might remove the view by "stopped" event. if (root.mThread == Thread.currentThread()) { root.setWindowStopped(stopped); root.setWindowStopped(stopped); } else { if (nonCurrentThreadRoots == null) { nonCurrentThreadRoots = new ArrayList<>(); } nonCurrentThreadRoots.add(root); } // Recursively forward stopped state to View's attached // Recursively forward stopped state to View's attached // to this Window rather than the root application token, // to this Window rather than the root application token, // e.g. PopupWindow's. // e.g. PopupWindow's. Loading @@ -650,6 +658,16 @@ public final class WindowManagerGlobal { } } } } } } // Update the stopped state synchronously to ensure the surface won't be used after server // side has destroyed it. This operation should be outside the lock to avoid any potential // paths from setWindowStopped to WindowManagerGlobal which may cause deadlocks. if (nonCurrentThreadRoots != null) { for (int i = nonCurrentThreadRoots.size() - 1; i >= 0; i--) { ViewRootImpl root = nonCurrentThreadRoots.get(i); root.mHandler.runWithScissors(() -> root.setWindowStopped(stopped), 0); } } } } public void reportNewConfiguration(Configuration config) { public void reportNewConfiguration(Configuration config) { Loading
core/java/com/android/internal/app/ChooserActivity.java +39 −19 Original line number Original line Diff line number Diff line Loading @@ -716,18 +716,31 @@ public class ChooserActivity extends ResolverActivity { public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig); adjustPreviewWidth(newConfig.orientation, null); } private boolean shouldDisplayLandscape(int orientation) { // Sharesheet fixes the # of items per row and therefore can not correctly lay out // when in the restricted size of multi-window mode. In the future, would be nice // to use minimum dp size requirements instead return orientation == Configuration.ORIENTATION_LANDSCAPE && !isInMultiWindowMode(); } private void adjustPreviewWidth(int orientation, View parent) { int width = -1; int width = -1; if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { if (shouldDisplayLandscape(orientation)) { width = getResources().getDimensionPixelSize(R.dimen.chooser_preview_width); width = getResources().getDimensionPixelSize(R.dimen.chooser_preview_width); } } updateLayoutWidth(R.id.content_preview_text_layout, width); parent = parent == null ? getWindow().getDecorView() : parent; updateLayoutWidth(R.id.content_preview_title_layout, width); updateLayoutWidth(R.id.content_preview_file_layout, width); updateLayoutWidth(R.id.content_preview_text_layout, width, parent); updateLayoutWidth(R.id.content_preview_title_layout, width, parent); updateLayoutWidth(R.id.content_preview_file_layout, width, parent); } } private void updateLayoutWidth(int layoutResourceId, int width) { private void updateLayoutWidth(int layoutResourceId, int width, View parent) { View view = findViewById(layoutResourceId); View view = parent.findViewById(layoutResourceId); if (view != null && view.getLayoutParams() != null) { if (view != null && view.getLayoutParams() != null) { LayoutParams params = view.getLayoutParams(); LayoutParams params = view.getLayoutParams(); params.width = width; params.width = width; Loading @@ -740,18 +753,27 @@ public class ChooserActivity extends ResolverActivity { ViewGroup parent) { ViewGroup parent) { if (convertView != null) return convertView; if (convertView != null) return convertView; ViewGroup layout = null; switch (previewType) { switch (previewType) { case CONTENT_PREVIEW_TEXT: case CONTENT_PREVIEW_TEXT: return displayTextContentPreview(targetIntent, layoutInflater, parent); layout = displayTextContentPreview(targetIntent, layoutInflater, parent); break; case CONTENT_PREVIEW_IMAGE: case CONTENT_PREVIEW_IMAGE: return displayImageContentPreview(targetIntent, layoutInflater, parent); layout = displayImageContentPreview(targetIntent, layoutInflater, parent); break; case CONTENT_PREVIEW_FILE: case CONTENT_PREVIEW_FILE: return displayFileContentPreview(targetIntent, layoutInflater, parent); layout = displayFileContentPreview(targetIntent, layoutInflater, parent); break; default: default: Log.e(TAG, "Unexpected content preview type: " + previewType); Log.e(TAG, "Unexpected content preview type: " + previewType); } } return null; if (layout != null) { adjustPreviewWidth(getResources().getConfiguration().orientation, layout); } return layout; } } private ViewGroup displayTextContentPreview(Intent targetIntent, LayoutInflater layoutInflater, private ViewGroup displayTextContentPreview(Intent targetIntent, LayoutInflater layoutInflater, Loading Loading @@ -2180,9 +2202,7 @@ public class ChooserActivity extends ResolverActivity { if (mChooserRowAdapter.consumeLayoutRequest() if (mChooserRowAdapter.consumeLayoutRequest() || mChooserRowAdapter.calculateChooserTargetWidth(availableWidth) || mChooserRowAdapter.calculateChooserTargetWidth(availableWidth) || mAdapterView.getAdapter() == null) { || mAdapterView.getAdapter() == null) { if (mAdapterView.getAdapter() == null) { mAdapterView.setAdapter(mChooserRowAdapter); mAdapterView.setAdapter(mChooserRowAdapter); } getMainThreadHandler().post(() -> { getMainThreadHandler().post(() -> { if (mResolverDrawerLayout == null || mChooserRowAdapter == null) { if (mResolverDrawerLayout == null || mChooserRowAdapter == null) { Loading Loading @@ -2225,9 +2245,9 @@ public class ChooserActivity extends ResolverActivity { } } } } boolean isPortrait = getResources().getConfiguration().orientation boolean isExpandable = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; == Configuration.ORIENTATION_PORTRAIT && !isInMultiWindowMode(); if (directShareHeight != 0 && isSendAction(getTargetIntent()) && isPortrait) { if (directShareHeight != 0 && isSendAction(getTargetIntent()) && isExpandable) { // make sure to leave room for direct share 4->8 expansion // make sure to leave room for direct share 4->8 expansion int requiredExpansionHeight = int requiredExpansionHeight = (int) (directShareHeight / DIRECT_SHARE_EXPANSION_RATE); (int) (directShareHeight / DIRECT_SHARE_EXPANSION_RATE); Loading Loading @@ -2791,8 +2811,7 @@ public class ChooserActivity extends ResolverActivity { private int getMaxTargetsPerRow() { private int getMaxTargetsPerRow() { int maxTargets = MAX_TARGETS_PER_ROW_PORTRAIT; int maxTargets = MAX_TARGETS_PER_ROW_PORTRAIT; if (getResources().getConfiguration().orientation if (shouldDisplayLandscape(getResources().getConfiguration().orientation)) { == Configuration.ORIENTATION_LANDSCAPE) { maxTargets = MAX_TARGETS_PER_ROW_LANDSCAPE; maxTargets = MAX_TARGETS_PER_ROW_LANDSCAPE; } } Loading Loading @@ -3178,7 +3197,8 @@ public class ChooserActivity extends ResolverActivity { int orientation = getResources().getConfiguration().orientation; int orientation = getResources().getConfiguration().orientation; boolean canExpandDirectShare = boolean canExpandDirectShare = mChooserListAdapter.getNumShortcutResults() > getMaxTargetsPerRow() mChooserListAdapter.getNumShortcutResults() > getMaxTargetsPerRow() && orientation == Configuration.ORIENTATION_PORTRAIT; && orientation == Configuration.ORIENTATION_PORTRAIT && !isInMultiWindowMode(); if (mDirectShareViewHolder != null && canExpandDirectShare) { if (mDirectShareViewHolder != null && canExpandDirectShare) { mDirectShareViewHolder.handleScroll(mAdapterView, y, oldy, getMaxTargetsPerRow()); mDirectShareViewHolder.handleScroll(mAdapterView, y, oldy, getMaxTargetsPerRow()); Loading