package com.genymobile.scrcpy.wrappers;

import android.os.IInterface;

import com.genymobile.scrcpy.Ln;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class StatusBarManager {

    private final IInterface manager;
    private Method expandNotificationsPanelMethod;
    private Method collapsePanelsMethod;

    public StatusBarManager(IInterface manager) {
        this.manager = manager;
    }

    public void expandNotificationsPanel() {
        if (expandNotificationsPanelMethod == null) {
            try {
                expandNotificationsPanelMethod = manager.getClass().getMethod("expandNotificationsPanel");
            } catch (NoSuchMethodException e) {
                Ln.e("ServiceBarManager.expandNotificationsPanel() is not available on this device");
                return;
            }
        }
        try {
            expandNotificationsPanelMethod.invoke(manager);
        } catch (InvocationTargetException | IllegalAccessException e) {
            Ln.e("Cannot invoke ServiceBarManager.expandNotificationsPanel()", e);
        }
    }

    public void collapsePanels() {
        if (collapsePanelsMethod == null) {
            try {
                collapsePanelsMethod = manager.getClass().getMethod("collapsePanels");
            } catch (NoSuchMethodException e) {
                Ln.e("ServiceBarManager.collapsePanels() is not available on this device");
                return;
            }
        }
        try {
            collapsePanelsMethod.invoke(manager);
        } catch (InvocationTargetException | IllegalAccessException e) {
            Ln.e("Cannot invoke ServiceBarManager.collapsePanels()", e);
        }
    }
}

@@ -45,63 +45,63 @@
 ort 
-android.os.IInterface;%0A%0Aimport com.genymobile.scrcpy.Ln
+com.genymobile.scrcpy.Ln;%0A%0Aimport android.os.IInterface
 ;%0A%0Ai

Fix checkstyle warning