expandSettingsPanel() changed API with android 9

Now it gets a parameter. However, it can be null
https://code.yawk.at/android/android-9.0.0_r35/android/app/StatusBarManager.java#android.app.StatusBarManager%23expandSettingsPanel(java.lang.String)
For now, I don't have android 10's but it's probably a version without the noargument method
This commit is contained in:
brunoais 2021-04-17 18:22:58 +01:00
commit cd533a9ab2

View file

@ -12,6 +12,7 @@ public class StatusBarManager {
private final IInterface manager; private final IInterface manager;
private Method expandNotificationsPanelMethod; private Method expandNotificationsPanelMethod;
private Method expandSettingsPanelMethod; private Method expandSettingsPanelMethod;
private Object[] expandSettingsPanelArgs;
private Method collapsePanelsMethod; private Method collapsePanelsMethod;
public StatusBarManager(IInterface manager) { public StatusBarManager(IInterface manager) {
@ -27,7 +28,19 @@ public class StatusBarManager {
private Method getExpandSettingsPanel() throws NoSuchMethodException { private Method getExpandSettingsPanel() throws NoSuchMethodException {
if (expandSettingsPanelMethod == null) { if (expandSettingsPanelMethod == null) {
expandSettingsPanelMethod = manager.getClass().getMethod("expandSettingsPanel"); try{
expandSettingsPanelMethod = manager.getClass().getMethod("expandSettingsPanel");
expandSettingsPanelArgs = new Object[] {};
} catch (NoSuchMethodException e){
try{
expandSettingsPanelMethod = manager.getClass().getMethod("expandSettingsPanel", String.class);
expandSettingsPanelArgs = new Object[] {null};
} catch (NoSuchMethodException f){
f.initCause(e);
throw f;
}
}
} }
return expandSettingsPanelMethod; return expandSettingsPanelMethod;
} }
@ -50,7 +63,7 @@ public class StatusBarManager {
public void expandSettingsPanel() { public void expandSettingsPanel() {
try { try {
Method method = getExpandSettingsPanel(); Method method = getExpandSettingsPanel();
method.invoke(manager); method.invoke(manager, expandSettingsPanelArgs);
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) { } catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
Ln.e("Could not invoke method", e); Ln.e("Could not invoke method", e);
} }