Skip to content

Commit

Permalink
Revert "Fix crash when switching back from Samsung DeX to Phone mode."
Browse files Browse the repository at this point in the history
This reverts commit e23729f.

Reason for revert: Probably causing other crashing (see bug)

Original change's description:
> Fix crash when switching back from Samsung DeX to Phone mode.
> 
> Regressed in d875cac
> 
> Bug: 780593
> Change-Id: Ifee7a93ada73f5b757a35ece75b0bef61ea767c2
> Reviewed-on: https://chromium-review.googlesource.com/820531
> Reviewed-by: Theresa <twellington@chromium.org>
> Reviewed-by: Ted Choc (back but slow, ping me) <tedchoc@chromium.org>
> Commit-Queue: agrieve <agrieve@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#527117}

TBR=tedchoc@chromium.org,twellington@chromium.org,agrieve@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 780593, 794551
Change-Id: Ia91f278b1dff52af4f4fc1bbd33743168dfb5e4a
Reviewed-on: https://chromium-review.googlesource.com/874803
Reviewed-by: agrieve <agrieve@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530406}
  • Loading branch information
agrieve authored and Commit Bot committed Jan 19, 2018
1 parent 59c0d46 commit 3f25cfc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ protected void attachBaseContext(Context newBase) {
// On N+, Chrome should always retain the tab strip layout on tablets. Normally in
// multi-window, if Chrome is launched into a smaller screen Android will load the tab
// switcher resources. Overriding the smallestScreenWidthDp in the Configuration ensures
// Android will load the tab strip resources.
// See crbug.com/588838, crbug.com/662338, crbug.com/780593.
// Android will load the tab strip resources. See crbug.com/588838.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Configuration overrideConfiguration = new Configuration();
overrideConfiguration.smallestScreenWidthDp =
DeviceFormFactor.getSmallestDeviceWidthDp();
applyOverrideConfiguration(overrideConfiguration);
if (DeviceFormFactor.isTablet()) {
Configuration overrideConfiguration = new Configuration();
overrideConfiguration.smallestScreenWidthDp =
DeviceFormFactor.getSmallestDeviceWidthDp();
applyOverrideConfiguration(overrideConfiguration);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ public class DeviceFormFactor {
public static final int MINIMUM_TABLET_WIDTH_DP = 600;

/**
* @return Whether the app should currently treat the device as a tablet for layout. This method
* is not affected by Android N multi-window, but can change for external displays.
* E.g. http://developer.samsung.com/samsung-dex/testing
* @return Whether the app should treat the device as a tablet for layout. This method is not
* affected by Android N multi-window.
*/
@CalledByNative
public static boolean isTablet() {
// On some devices, OEM modifications have been made to the resource loader that cause the
// DeviceFormFactor calculation of whether a device is using tablet resources to be
// incorrect. Check which resources were actually loaded rather than look at screen size.
// See crbug.com/662338.
return ContextUtils.getApplicationContext().getResources().getBoolean(R.bool.is_tablet);
}

Expand Down

0 comments on commit 3f25cfc

Please sign in to comment.