| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.view.inputmethod; |
| 18 |
|
| 19 |
import android.annotation.BinderThread; |
| 20 |
import android.annotation.CallbackExecutor; |
| 21 |
import android.annotation.MainThread; |
| 22 |
import android.annotation.NonNull; |
| 23 |
import android.annotation.Nullable; |
| 24 |
import android.annotation.TestApi; |
| 25 |
import android.content.Context; |
| 26 |
import android.os.Handler; |
| 27 |
import android.os.Looper; |
| 28 |
import android.os.Parcel; |
| 29 |
import android.os.Parcelable; |
| 30 |
import android.os.RemoteException; |
| 31 |
import android.util.Size; |
| 32 |
import android.util.Slog; |
| 33 |
import android.view.SurfaceControlViewHost; |
| 34 |
import android.view.View; |
| 35 |
import android.view.ViewGroup; |
| 36 |
import android.widget.inline.InlineContentView; |
| 37 |
|
| 38 |
import com.android.internal.util.DataClass; |
| 39 |
import com.android.internal.util.Parcelling; |
| 40 |
import com.android.internal.view.inline.IInlineContentCallback; |
| 41 |
import com.android.internal.view.inline.IInlineContentProvider; |
| 42 |
import com.android.internal.view.inline.InlineTooltipUi; |
| 43 |
|
| 44 |
import java.lang.ref.WeakReference; |
| 45 |
import java.util.concurrent.Executor; |
| 46 |
import java.util.function.Consumer; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
@DataClass(genEqualsHashCode = true, genToString = true, genHiddenConstDefs = true, |
| 56 |
genHiddenConstructor = true) |
| 57 |
public final class InlineSuggestion implements Parcelable { |
| 58 |
|
| 59 |
private static final String TAG = "InlineSuggestion"; |
| 60 |
|
| 61 |
@NonNull |
| 62 |
private final InlineSuggestionInfo mInfo; |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
@Nullable |
| 68 |
private final IInlineContentProvider mContentProvider; |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
@DataClass.ParcelWith(InlineContentCallbackImplParceling.class) |
| 76 |
@Nullable |
| 77 |
private InlineContentCallbackImpl mInlineContentCallback; |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
@Nullable |
| 85 |
@DataClass.ParcelWith(InlineTooltipUiParceling.class) |
| 86 |
private InlineTooltipUi mInlineTooltipUi; |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
@TestApi |
| 94 |
@NonNull |
| 95 |
public static InlineSuggestion newInlineSuggestion(@NonNull InlineSuggestionInfo info) { |
| 96 |
return new InlineSuggestion(info, null, null, |
| 97 |
null); |
| 98 |
} |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
public InlineSuggestion(@NonNull InlineSuggestionInfo info, |
| 106 |
@Nullable IInlineContentProvider contentProvider) { |
| 107 |
this(info, contentProvider, null, null); |
| 108 |
} |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
public void inflate(@NonNull Context context, @NonNull Size size, |
| 141 |
@NonNull @CallbackExecutor Executor callbackExecutor, |
| 142 |
@NonNull Consumer<InlineContentView> callback) { |
| 143 |
final Size minSize = mInfo.getInlinePresentationSpec().getMinSize(); |
| 144 |
final Size maxSize = mInfo.getInlinePresentationSpec().getMaxSize(); |
| 145 |
if (!isValid(size.getWidth(), minSize.getWidth(), maxSize.getWidth()) |
| 146 |
|| !isValid(size.getHeight(), minSize.getHeight(), maxSize.getHeight())) { |
| 147 |
throw new IllegalArgumentException( |
| 148 |
"size is neither between min:" + minSize + " and max:" + maxSize |
| 149 |
+ ", nor wrap_content"); |
| 150 |
} |
| 151 |
|
| 152 |
InlineSuggestion toolTip = mInfo.getTooltip(); |
| 153 |
if (toolTip != null) { |
| 154 |
if (mInlineTooltipUi == null) { |
| 155 |
mInlineTooltipUi = new InlineTooltipUi(context); |
| 156 |
} |
| 157 |
} else { |
| 158 |
mInlineTooltipUi = null; |
| 159 |
} |
| 160 |
|
| 161 |
mInlineContentCallback = getInlineContentCallback(context, callbackExecutor, callback, |
| 162 |
mInlineTooltipUi); |
| 163 |
if (mContentProvider == null) { |
| 164 |
callbackExecutor.execute(() -> callback.accept( null)); |
| 165 |
mInlineTooltipUi = null; |
| 166 |
return; |
| 167 |
} |
| 168 |
try { |
| 169 |
mContentProvider.provideContent(size.getWidth(), size.getHeight(), |
| 170 |
new InlineContentCallbackWrapper(mInlineContentCallback)); |
| 171 |
} catch (RemoteException e) { |
| 172 |
Slog.w(TAG, "Error creating suggestion content surface: " + e); |
| 173 |
callbackExecutor.execute(() -> callback.accept( null)); |
| 174 |
} |
| 175 |
if (toolTip == null) return; |
| 176 |
|
| 177 |
final Size tooltipSize = new Size(ViewGroup.LayoutParams.WRAP_CONTENT, |
| 178 |
ViewGroup.LayoutParams.WRAP_CONTENT); |
| 179 |
mInfo.getTooltip().inflate(context, tooltipSize, callbackExecutor, view -> { |
| 180 |
Handler.getMain().post(() -> mInlineTooltipUi.setTooltipView(view)); |
| 181 |
}); |
| 182 |
} |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
private static boolean isValid(int actual, int min, int max) { |
| 189 |
if (actual == ViewGroup.LayoutParams.WRAP_CONTENT) { |
| 190 |
return true; |
| 191 |
} |
| 192 |
return actual >= min && actual <= max; |
| 193 |
} |
| 194 |
|
| 195 |
private synchronized InlineContentCallbackImpl getInlineContentCallback(Context context, |
| 196 |
Executor callbackExecutor, Consumer<InlineContentView> callback, |
| 197 |
InlineTooltipUi inlineTooltipUi) { |
| 198 |
if (mInlineContentCallback != null) { |
| 199 |
throw new IllegalStateException("Already called #inflate()"); |
| 200 |
} |
| 201 |
return new InlineContentCallbackImpl(context, mContentProvider, callbackExecutor, |
| 202 |
callback, inlineTooltipUi); |
| 203 |
} |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
private static final class InlineContentCallbackWrapper extends IInlineContentCallback.Stub { |
| 210 |
|
| 211 |
private final WeakReference<InlineContentCallbackImpl> mCallbackImpl; |
| 212 |
|
| 213 |
InlineContentCallbackWrapper(InlineContentCallbackImpl callbackImpl) { |
| 214 |
mCallbackImpl = new WeakReference<>(callbackImpl); |
| 215 |
} |
| 216 |
|
| 217 |
@Override |
| 218 |
@BinderThread |
| 219 |
public void onContent(SurfaceControlViewHost.SurfacePackage content, int width, |
| 220 |
int height) { |
| 221 |
final InlineContentCallbackImpl callbackImpl = mCallbackImpl.get(); |
| 222 |
if (callbackImpl != null) { |
| 223 |
callbackImpl.onContent(content, width, height); |
| 224 |
} |
| 225 |
} |
| 226 |
|
| 227 |
@Override |
| 228 |
@BinderThread |
| 229 |
public void onClick() { |
| 230 |
final InlineContentCallbackImpl callbackImpl = mCallbackImpl.get(); |
| 231 |
if (callbackImpl != null) { |
| 232 |
callbackImpl.onClick(); |
| 233 |
} |
| 234 |
} |
| 235 |
|
| 236 |
@Override |
| 237 |
@BinderThread |
| 238 |
public void onLongClick() { |
| 239 |
final InlineContentCallbackImpl callbackImpl = mCallbackImpl.get(); |
| 240 |
if (callbackImpl != null) { |
| 241 |
callbackImpl.onLongClick(); |
| 242 |
} |
| 243 |
} |
| 244 |
} |
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
private static final class InlineContentCallbackImpl { |
| 254 |
|
| 255 |
@NonNull |
| 256 |
private final Handler mMainHandler = new Handler(Looper.getMainLooper()); |
| 257 |
|
| 258 |
@NonNull |
| 259 |
private final Context mContext; |
| 260 |
@Nullable |
| 261 |
private final IInlineContentProvider mInlineContentProvider; |
| 262 |
@NonNull |
| 263 |
private final Executor mCallbackExecutor; |
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
@NonNull |
| 272 |
private final Consumer<InlineContentView> mCallback; |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
private boolean mFirstContentReceived = false; |
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
@Nullable |
| 285 |
private InlineContentView mView; |
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
@Nullable |
| 292 |
private SurfaceControlViewHost.SurfacePackage mSurfacePackage; |
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
@Nullable |
| 300 |
private Consumer<SurfaceControlViewHost.SurfacePackage> mSurfacePackageConsumer; |
| 301 |
|
| 302 |
@Nullable |
| 303 |
private InlineTooltipUi mInlineTooltipUi; |
| 304 |
|
| 305 |
InlineContentCallbackImpl(@NonNull Context context, |
| 306 |
@Nullable IInlineContentProvider inlineContentProvider, |
| 307 |
@NonNull @CallbackExecutor Executor callbackExecutor, |
| 308 |
@NonNull Consumer<InlineContentView> callback, |
| 309 |
@Nullable InlineTooltipUi inlineTooltipUi) { |
| 310 |
mContext = context; |
| 311 |
mInlineContentProvider = inlineContentProvider; |
| 312 |
mCallbackExecutor = callbackExecutor; |
| 313 |
mCallback = callback; |
| 314 |
mInlineTooltipUi = inlineTooltipUi; |
| 315 |
} |
| 316 |
|
| 317 |
@BinderThread |
| 318 |
public void onContent(SurfaceControlViewHost.SurfacePackage content, int width, |
| 319 |
int height) { |
| 320 |
mMainHandler.post(() -> handleOnContent(content, width, height)); |
| 321 |
} |
| 322 |
|
| 323 |
@MainThread |
| 324 |
private void handleOnContent(SurfaceControlViewHost.SurfacePackage content, int width, |
| 325 |
int height) { |
| 326 |
if (!mFirstContentReceived) { |
| 327 |
handleOnFirstContentReceived(content, width, height); |
| 328 |
mFirstContentReceived = true; |
| 329 |
} else { |
| 330 |
handleOnSurfacePackage(content); |
| 331 |
} |
| 332 |
} |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
@MainThread |
| 338 |
private void handleOnFirstContentReceived(SurfaceControlViewHost.SurfacePackage content, |
| 339 |
int width, int height) { |
| 340 |
mSurfacePackage = content; |
| 341 |
if (mSurfacePackage == null) { |
| 342 |
mCallbackExecutor.execute(() -> mCallback.accept(null)); |
| 343 |
} else { |
| 344 |
mView = new InlineContentView(mContext); |
| 345 |
if (mInlineTooltipUi != null) { |
| 346 |
mView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { |
| 347 |
@Override |
| 348 |
public void onLayoutChange(View v, int left, int top, int right, |
| 349 |
int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { |
| 350 |
if (mInlineTooltipUi != null) { |
| 351 |
mInlineTooltipUi.update(mView); |
| 352 |
} |
| 353 |
} |
| 354 |
}); |
| 355 |
} |
| 356 |
mView.setLayoutParams(new ViewGroup.LayoutParams(width, height)); |
| 357 |
mView.setChildSurfacePackageUpdater(getSurfacePackageUpdater()); |
| 358 |
mCallbackExecutor.execute(() -> mCallback.accept(mView)); |
| 359 |
} |
| 360 |
} |
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
@MainThread |
| 367 |
private void handleOnSurfacePackage(SurfaceControlViewHost.SurfacePackage surfacePackage) { |
| 368 |
if (surfacePackage == null) { |
| 369 |
return; |
| 370 |
} |
| 371 |
if (mSurfacePackage != null || mSurfacePackageConsumer == null) { |
| 372 |
|
| 373 |
surfacePackage.release(); |
| 374 |
try { |
| 375 |
mInlineContentProvider.onSurfacePackageReleased(); |
| 376 |
} catch (RemoteException e) { |
| 377 |
Slog.w(TAG, "Error calling onSurfacePackageReleased(): " + e); |
| 378 |
} |
| 379 |
return; |
| 380 |
} |
| 381 |
mSurfacePackage = surfacePackage; |
| 382 |
if (mSurfacePackage == null) { |
| 383 |
return; |
| 384 |
} |
| 385 |
if (mSurfacePackageConsumer != null) { |
| 386 |
mSurfacePackageConsumer.accept(mSurfacePackage); |
| 387 |
mSurfacePackageConsumer = null; |
| 388 |
} |
| 389 |
} |
| 390 |
|
| 391 |
@MainThread |
| 392 |
private void handleOnSurfacePackageReleased() { |
| 393 |
if (mSurfacePackage != null) { |
| 394 |
try { |
| 395 |
mInlineContentProvider.onSurfacePackageReleased(); |
| 396 |
} catch (RemoteException e) { |
| 397 |
Slog.w(TAG, "Error calling onSurfacePackageReleased(): " + e); |
| 398 |
} |
| 399 |
mSurfacePackage = null; |
| 400 |
} |
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
mSurfacePackageConsumer = null; |
| 405 |
} |
| 406 |
|
| 407 |
@MainThread |
| 408 |
private void handleGetSurfacePackage( |
| 409 |
Consumer<SurfaceControlViewHost.SurfacePackage> consumer) { |
| 410 |
if (mSurfacePackage != null) { |
| 411 |
consumer.accept(mSurfacePackage); |
| 412 |
} else { |
| 413 |
mSurfacePackageConsumer = consumer; |
| 414 |
try { |
| 415 |
mInlineContentProvider.requestSurfacePackage(); |
| 416 |
} catch (RemoteException e) { |
| 417 |
Slog.w(TAG, "Error calling getSurfacePackage(): " + e); |
| 418 |
consumer.accept(null); |
| 419 |
mSurfacePackageConsumer = null; |
| 420 |
} |
| 421 |
} |
| 422 |
} |
| 423 |
|
| 424 |
private InlineContentView.SurfacePackageUpdater getSurfacePackageUpdater() { |
| 425 |
return new InlineContentView.SurfacePackageUpdater() { |
| 426 |
@Override |
| 427 |
public void onSurfacePackageReleased() { |
| 428 |
mMainHandler.post( |
| 429 |
() -> InlineContentCallbackImpl.this.handleOnSurfacePackageReleased()); |
| 430 |
} |
| 431 |
|
| 432 |
@Override |
| 433 |
public void getSurfacePackage( |
| 434 |
Consumer<SurfaceControlViewHost.SurfacePackage> consumer) { |
| 435 |
mMainHandler.post( |
| 436 |
() -> InlineContentCallbackImpl.this.handleGetSurfacePackage(consumer)); |
| 437 |
} |
| 438 |
}; |
| 439 |
} |
| 440 |
|
| 441 |
@BinderThread |
| 442 |
public void onClick() { |
| 443 |
mMainHandler.post(() -> { |
| 444 |
if (mView != null && mView.hasOnClickListeners()) { |
| 445 |
mView.callOnClick(); |
| 446 |
} |
| 447 |
}); |
| 448 |
} |
| 449 |
|
| 450 |
@BinderThread |
| 451 |
public void onLongClick() { |
| 452 |
mMainHandler.post(() -> { |
| 453 |
if (mView != null && mView.hasOnLongClickListeners()) { |
| 454 |
mView.performLongClick(); |
| 455 |
} |
| 456 |
}); |
| 457 |
} |
| 458 |
} |
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
private static class InlineContentCallbackImplParceling implements |
| 465 |
Parcelling<InlineContentCallbackImpl> { |
| 466 |
@Override |
| 467 |
public void parcel(InlineContentCallbackImpl item, Parcel dest, int parcelFlags) { |
| 468 |
} |
| 469 |
|
| 470 |
@Override |
| 471 |
public InlineContentCallbackImpl unparcel(Parcel source) { |
| 472 |
return null; |
| 473 |
} |
| 474 |
} |
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
private static class InlineTooltipUiParceling implements |
| 481 |
Parcelling<InlineTooltipUi> { |
| 482 |
@Override |
| 483 |
public void parcel(InlineTooltipUi item, Parcel dest, int parcelFlags) { |
| 484 |
} |
| 485 |
|
| 486 |
@Override |
| 487 |
public InlineTooltipUi unparcel(Parcel source) { |
| 488 |
return null; |
| 489 |
} |
| 490 |
} |
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
@DataClass.Generated.Member |
| 517 |
public InlineSuggestion( |
| 518 |
@NonNull InlineSuggestionInfo info, |
| 519 |
@Nullable IInlineContentProvider contentProvider, |
| 520 |
@Nullable InlineContentCallbackImpl inlineContentCallback, |
| 521 |
@Nullable InlineTooltipUi inlineTooltipUi) { |
| 522 |
this.mInfo = info; |
| 523 |
com.android.internal.util.AnnotationValidations.validate( |
| 524 |
NonNull.class, null, mInfo); |
| 525 |
this.mContentProvider = contentProvider; |
| 526 |
this.mInlineContentCallback = inlineContentCallback; |
| 527 |
this.mInlineTooltipUi = inlineTooltipUi; |
| 528 |
|
| 529 |
|
| 530 |
} |
| 531 |
|
| 532 |
@DataClass.Generated.Member |
| 533 |
public @NonNull InlineSuggestionInfo getInfo() { |
| 534 |
return mInfo; |
| 535 |
} |
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
@DataClass.Generated.Member |
| 541 |
public @Nullable IInlineContentProvider getContentProvider() { |
| 542 |
return mContentProvider; |
| 543 |
} |
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
@DataClass.Generated.Member |
| 551 |
public @Nullable InlineContentCallbackImpl getInlineContentCallback() { |
| 552 |
return mInlineContentCallback; |
| 553 |
} |
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
@DataClass.Generated.Member |
| 561 |
public @Nullable InlineTooltipUi getInlineTooltipUi() { |
| 562 |
return mInlineTooltipUi; |
| 563 |
} |
| 564 |
|
| 565 |
@Override |
| 566 |
@DataClass.Generated.Member |
| 567 |
public String toString() { |
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
return "InlineSuggestion { " + |
| 572 |
"info = " + mInfo + ", " + |
| 573 |
"contentProvider = " + mContentProvider + ", " + |
| 574 |
"inlineContentCallback = " + mInlineContentCallback + ", " + |
| 575 |
"inlineTooltipUi = " + mInlineTooltipUi + |
| 576 |
" }"; |
| 577 |
} |
| 578 |
|
| 579 |
@Override |
| 580 |
@DataClass.Generated.Member |
| 581 |
public boolean equals(@Nullable Object o) { |
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
if (this == o) return true; |
| 587 |
if (o == null || getClass() != o.getClass()) return false; |
| 588 |
@SuppressWarnings("unchecked") |
| 589 |
InlineSuggestion that = (InlineSuggestion) o; |
| 590 |
|
| 591 |
return true |
| 592 |
&& java.util.Objects.equals(mInfo, that.mInfo) |
| 593 |
&& java.util.Objects.equals(mContentProvider, that.mContentProvider) |
| 594 |
&& java.util.Objects.equals(mInlineContentCallback, that.mInlineContentCallback) |
| 595 |
&& java.util.Objects.equals(mInlineTooltipUi, that.mInlineTooltipUi); |
| 596 |
} |
| 597 |
|
| 598 |
@Override |
| 599 |
@DataClass.Generated.Member |
| 600 |
public int hashCode() { |
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
int _hash = 1; |
| 605 |
_hash = 31 * _hash + java.util.Objects.hashCode(mInfo); |
| 606 |
_hash = 31 * _hash + java.util.Objects.hashCode(mContentProvider); |
| 607 |
_hash = 31 * _hash + java.util.Objects.hashCode(mInlineContentCallback); |
| 608 |
_hash = 31 * _hash + java.util.Objects.hashCode(mInlineTooltipUi); |
| 609 |
return _hash; |
| 610 |
} |
| 611 |
|
| 612 |
@DataClass.Generated.Member |
| 613 |
static Parcelling<InlineContentCallbackImpl> sParcellingForInlineContentCallback = |
| 614 |
Parcelling.Cache.get( |
| 615 |
InlineContentCallbackImplParceling.class); |
| 616 |
static { |
| 617 |
if (sParcellingForInlineContentCallback == null) { |
| 618 |
sParcellingForInlineContentCallback = Parcelling.Cache.put( |
| 619 |
new InlineContentCallbackImplParceling()); |
| 620 |
} |
| 621 |
} |
| 622 |
|
| 623 |
@DataClass.Generated.Member |
| 624 |
static Parcelling<InlineTooltipUi> sParcellingForInlineTooltipUi = |
| 625 |
Parcelling.Cache.get( |
| 626 |
InlineTooltipUiParceling.class); |
| 627 |
static { |
| 628 |
if (sParcellingForInlineTooltipUi == null) { |
| 629 |
sParcellingForInlineTooltipUi = Parcelling.Cache.put( |
| 630 |
new InlineTooltipUiParceling()); |
| 631 |
} |
| 632 |
} |
| 633 |
|
| 634 |
@Override |
| 635 |
@DataClass.Generated.Member |
| 636 |
public void writeToParcel(@NonNull Parcel dest, int flags) { |
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
byte flg = 0; |
| 641 |
if (mContentProvider != null) flg |= 0x2; |
| 642 |
if (mInlineContentCallback != null) flg |= 0x4; |
| 643 |
if (mInlineTooltipUi != null) flg |= 0x8; |
| 644 |
dest.writeByte(flg); |
| 645 |
dest.writeTypedObject(mInfo, flags); |
| 646 |
if (mContentProvider != null) dest.writeStrongInterface(mContentProvider); |
| 647 |
sParcellingForInlineContentCallback.parcel(mInlineContentCallback, dest, flags); |
| 648 |
sParcellingForInlineTooltipUi.parcel(mInlineTooltipUi, dest, flags); |
| 649 |
} |
| 650 |
|
| 651 |
@Override |
| 652 |
@DataClass.Generated.Member |
| 653 |
public int describeContents() { return 0; } |
| 654 |
|
| 655 |
|
| 656 |
@SuppressWarnings({"unchecked", "RedundantCast"}) |
| 657 |
@DataClass.Generated.Member |
| 658 |
InlineSuggestion(@NonNull Parcel in) { |
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
byte flg = in.readByte(); |
| 663 |
InlineSuggestionInfo info = (InlineSuggestionInfo) in.readTypedObject(InlineSuggestionInfo.CREATOR); |
| 664 |
IInlineContentProvider contentProvider = (flg & 0x2) == 0 ? null : IInlineContentProvider.Stub.asInterface(in.readStrongBinder()); |
| 665 |
InlineContentCallbackImpl inlineContentCallback = sParcellingForInlineContentCallback.unparcel(in); |
| 666 |
InlineTooltipUi inlineTooltipUi = sParcellingForInlineTooltipUi.unparcel(in); |
| 667 |
|
| 668 |
this.mInfo = info; |
| 669 |
com.android.internal.util.AnnotationValidations.validate( |
| 670 |
NonNull.class, null, mInfo); |
| 671 |
this.mContentProvider = contentProvider; |
| 672 |
this.mInlineContentCallback = inlineContentCallback; |
| 673 |
this.mInlineTooltipUi = inlineTooltipUi; |
| 674 |
|
| 675 |
|
| 676 |
} |
| 677 |
|
| 678 |
@DataClass.Generated.Member |
| 679 |
public static final @NonNull Parcelable.Creator<InlineSuggestion> CREATOR |
| 680 |
= new Parcelable.Creator<InlineSuggestion>() { |
| 681 |
@Override |
| 682 |
public InlineSuggestion[] newArray(int size) { |
| 683 |
return new InlineSuggestion[size]; |
| 684 |
} |
| 685 |
|
| 686 |
@Override |
| 687 |
public InlineSuggestion createFromParcel(@NonNull Parcel in) { |
| 688 |
return new InlineSuggestion(in); |
| 689 |
} |
| 690 |
}; |
| 691 |
|
| 692 |
@DataClass.Generated( |
| 693 |
time = 1615562097666L, |
| 694 |
codegenVersion = "1.0.22", |
| 695 |
sourceFile = "frameworks/base/core/java/android/view/inputmethod/InlineSuggestion.java", |
| 696 |
inputSignatures = "private static final java.lang.String TAG\nprivate final @android.annotation.NonNull android.view.inputmethod.InlineSuggestionInfo mInfo\nprivate final @android.annotation.Nullable com.android.internal.view.inline.IInlineContentProvider mContentProvider\nprivate @com.android.internal.util.DataClass.ParcelWith(android.view.inputmethod.InlineSuggestion.InlineContentCallbackImplParceling.class) @android.annotation.Nullable android.view.inputmethod.InlineSuggestion.InlineContentCallbackImpl mInlineContentCallback\nprivate @android.annotation.Nullable @com.android.internal.util.DataClass.ParcelWith(android.view.inputmethod.InlineSuggestion.InlineTooltipUiParceling.class) com.android.internal.view.inline.InlineTooltipUi mInlineTooltipUi\npublic static @android.annotation.TestApi @android.annotation.NonNull android.view.inputmethod.InlineSuggestion newInlineSuggestion(android.view.inputmethod.InlineSuggestionInfo)\npublic void inflate(android.content.Context,android.util.Size,java.util.concurrent.Executor,java.util.function.Consumer<android.widget.inline.InlineContentView>)\nprivate static boolean isValid(int,int,int)\nprivate synchronized android.view.inputmethod.InlineSuggestion.InlineContentCallbackImpl getInlineContentCallback(android.content.Context,java.util.concurrent.Executor,java.util.function.Consumer<android.widget.inline.InlineContentView>,com.android.internal.view.inline.InlineTooltipUi)\nclass InlineSuggestion extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genHiddenConstDefs=true, genHiddenConstructor=true)") |
| 697 |
@Deprecated |
| 698 |
private void __metadata() {} |
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
} |