| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package com.android.internal.view; |
| 18 |
|
| 19 |
import android.compat.annotation.UnsupportedAppUsage; |
| 20 |
import android.hardware.input.InputManager; |
| 21 |
import android.os.Bundle; |
| 22 |
import android.os.ParcelFileDescriptor; |
| 23 |
import android.os.RemoteException; |
| 24 |
import android.util.MergedConfiguration; |
| 25 |
import android.view.DragEvent; |
| 26 |
import android.view.IScrollCaptureResponseListener; |
| 27 |
import android.view.IWindow; |
| 28 |
import android.view.IWindowSession; |
| 29 |
import android.view.InsetsSourceControl; |
| 30 |
import android.view.InsetsState; |
| 31 |
import android.view.PointerIcon; |
| 32 |
import android.view.ScrollCaptureResponse; |
| 33 |
import android.view.WindowInsets.Type.InsetsType; |
| 34 |
import android.window.ClientWindowFrames; |
| 35 |
|
| 36 |
import com.android.internal.os.IResultReceiver; |
| 37 |
|
| 38 |
import java.io.IOException; |
| 39 |
|
| 40 |
public class BaseIWindow extends IWindow.Stub { |
| 41 |
|
| 42 |
@UnsupportedAppUsage(maxTargetSdk = android.os.Build.VERSION_CODES.P) |
| 43 |
public BaseIWindow() {} |
| 44 |
|
| 45 |
private IWindowSession mSession; |
| 46 |
|
| 47 |
public void setSession(IWindowSession session) { |
| 48 |
mSession = session; |
| 49 |
} |
| 50 |
|
| 51 |
@Override |
| 52 |
public void resized(ClientWindowFrames frames, boolean reportDraw, |
| 53 |
MergedConfiguration mergedConfiguration, InsetsState insetsState, boolean forceLayout, |
| 54 |
boolean alwaysConsumeSystemBars, int displayId, int seqId, int resizeMode) { |
| 55 |
if (reportDraw) { |
| 56 |
try { |
| 57 |
mSession.finishDrawing(this, null , seqId); |
| 58 |
} catch (RemoteException e) { |
| 59 |
} |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
@Override |
| 64 |
public void insetsControlChanged(InsetsState insetsState, |
| 65 |
InsetsSourceControl[] activeControls) { |
| 66 |
} |
| 67 |
|
| 68 |
@Override |
| 69 |
public void showInsets(@InsetsType int types, boolean fromIme) { |
| 70 |
} |
| 71 |
|
| 72 |
@Override |
| 73 |
public void hideInsets(@InsetsType int types, boolean fromIme) { |
| 74 |
} |
| 75 |
|
| 76 |
@Override |
| 77 |
public void moved(int newX, int newY) { |
| 78 |
} |
| 79 |
|
| 80 |
@Override |
| 81 |
public void dispatchAppVisibility(boolean visible) { |
| 82 |
} |
| 83 |
|
| 84 |
@Override |
| 85 |
public void dispatchGetNewSurface() { |
| 86 |
} |
| 87 |
|
| 88 |
@Override |
| 89 |
public void executeCommand(String command, String parameters, ParcelFileDescriptor out) { |
| 90 |
if (out != null) { |
| 91 |
try { |
| 92 |
out.closeWithError("Unsupported command " + command); |
| 93 |
} catch (IOException e) { |
| 94 |
|
| 95 |
} |
| 96 |
} |
| 97 |
} |
| 98 |
|
| 99 |
@Override |
| 100 |
public void closeSystemDialogs(String reason) { |
| 101 |
} |
| 102 |
|
| 103 |
@Override |
| 104 |
public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, float zoom, |
| 105 |
boolean sync) { |
| 106 |
if (sync) { |
| 107 |
try { |
| 108 |
mSession.wallpaperOffsetsComplete(asBinder()); |
| 109 |
} catch (RemoteException e) { |
| 110 |
} |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
@Override |
| 115 |
public void dispatchDragEvent(DragEvent event) { |
| 116 |
if (event.getAction() == DragEvent.ACTION_DROP) { |
| 117 |
try { |
| 118 |
mSession.reportDropResult(this, false); |
| 119 |
} catch (RemoteException e) { |
| 120 |
} |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
@Override |
| 125 |
public void updatePointerIcon(float x, float y) { |
| 126 |
InputManager.getInstance().setPointerIconType(PointerIcon.TYPE_NOT_SPECIFIED); |
| 127 |
} |
| 128 |
|
| 129 |
@Override |
| 130 |
public void dispatchWallpaperCommand(String action, int x, int y, |
| 131 |
int z, Bundle extras, boolean sync) { |
| 132 |
if (sync) { |
| 133 |
try { |
| 134 |
mSession.wallpaperCommandComplete(asBinder(), null); |
| 135 |
} catch (RemoteException e) { |
| 136 |
} |
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
@Override |
| 141 |
public void dispatchWindowShown() { |
| 142 |
} |
| 143 |
|
| 144 |
@Override |
| 145 |
public void requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId) { |
| 146 |
} |
| 147 |
|
| 148 |
@Override |
| 149 |
public void requestScrollCapture(IScrollCaptureResponseListener listener) { |
| 150 |
try { |
| 151 |
listener.onScrollCaptureResponse( |
| 152 |
new ScrollCaptureResponse.Builder().setDescription("Not Implemented").build()); |
| 153 |
|
| 154 |
} catch (RemoteException ex) { |
| 155 |
|
| 156 |
} |
| 157 |
} |
| 158 |
} |