From 9f8f6e4e1c93025892bb5d8005725bcbdab5830b Mon Sep 17 00:00:00 2001 From: Clara Bayarri Date: Tue, 9 Jun 2015 01:26:08 +0100 Subject: [PATCH] Fallback to old Window.Callback#onWindowStartingActionMode Some custom implementations of Window.Callback might not have the new typed method, fallback to typeless if it is implemented and the type was Primary. Change-Id: Ie98f9a57354363f1b9f8e48f889298f3ee4b59e2 --- core/java/com/android/internal/policy/PhoneWindow.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 14065b18f3f20..4c9aa8ff8c775 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -2740,7 +2740,14 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { try { mode = getCallback().onWindowStartingActionMode(wrappedCallback, type); } catch (AbstractMethodError ame) { - // Older apps might not implement this callback method. + // Older apps might not implement the typed version of this method. + if (type == ActionMode.TYPE_PRIMARY) { + try { + mode = getCallback().onWindowStartingActionMode(wrappedCallback); + } catch (AbstractMethodError ame2) { + // Older apps might not implement this callback method at all. + } + } } } if (mode != null) {