fix: Crash when trying to access Window/Display context in Backup & Restore
Signed-off-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
@@ -41,6 +41,7 @@ Compatibility list:
|
||||
* [Launcher] Crash due to incorrect thread looper for accessing cache
|
||||
* [Launcher] Make icon shapes change instantaneous
|
||||
* [Build] Update dependency to fully support 16-kb page size in Android (x86_64 architecture)
|
||||
* [Lawnchair] Crash due to unable to access Window/Display context on Android 8.0 and above
|
||||
|
||||
### 🥞 Development 4 Release 1 (Snapshot 10)
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextClock;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -397,7 +398,8 @@ public class LauncherPreviewRenderer extends BaseContext
|
||||
* Returns the insets of the screen closest to the display given by the context
|
||||
*/
|
||||
private static Rect getInsets(Context context) {
|
||||
Display display = context.getDisplay();
|
||||
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
Display display = windowManager.getDefaultDisplay();
|
||||
return DisplayController.INSTANCE.get(context).getInfo().supportedBounds.stream()
|
||||
.filter(w -> w.rotationHint == display.getRotation())
|
||||
.min(comparingDouble(w ->
|
||||
|
||||
Reference in New Issue
Block a user