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
parent 499f595088
commit cd533a9ab2

View file

@ -12,6 +12,7 @@ public class StatusBarManager {
private final IInterface manager;
private Method expandNotificationsPanelMethod;
private Method expandSettingsPanelMethod;
private Object[] expandSettingsPanelArgs;
private Method collapsePanelsMethod;
public StatusBarManager(IInterface manager) {
@ -27,7 +28,19 @@ public class StatusBarManager {
private Method getExpandSettingsPanel() throws NoSuchMethodException {
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;
}
@ -50,7 +63,7 @@ public class StatusBarManager {
public void expandSettingsPanel() {
try {
Method method = getExpandSettingsPanel();
method.invoke(manager);
method.invoke(manager, expandSettingsPanelArgs);
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
Ln.e("Could not invoke method", e);
}