Skip to content

Commit

Permalink
expandSettingsPanel() changed API with android 9
Browse files Browse the repository at this point in the history
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
  • Loading branch information
brunoais committed Apr 18, 2021
1 parent ba0a6f0 commit aa60476
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -27,7 +28,19 @@ private Method getExpandNotificationsPanelMethod() throws NoSuchMethodException

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;
}
Expand All @@ -50,7 +63,7 @@ public void expandNotificationsPanel() {
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);
}
Expand Down

0 comments on commit aa60476

Please sign in to comment.