import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemService;
-import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
* Runs the specified action on the UI thread.
*/
void runOnUiThread(Runnable action);
+
+ /**
+ * Gets the complete component name of this client.
+ *
+ * <p>Temporary method on O-MR1 only.
+ */
+ ComponentName getComponentNameForAutofill();
}
/**
return mContext.getAutofillClient();
}
- private ComponentName getComponentNameFromContext() {
- if (mContext instanceof Activity) {
- return ((Activity) mContext).getComponentName();
- }
- return null;
+ private ComponentName getComponentNameFromContext(AutofillClient client) {
+ return client == null ? null : client.getComponentNameForAutofill();
}
/** @hide */
return;
}
try {
- final ComponentName componentName = getComponentNameFromContext();
+ final AutofillClient client = getClientLocked();
+ final ComponentName componentName = getComponentNameFromContext(client);
if (componentName == null) {
Log.w(TAG, "startSessionLocked(): context is not activity: " + mContext);
return;
if (mSessionId != NO_SESSION) {
mState = STATE_ACTIVE;
}
- final AutofillClient client = getClientLocked();
if (client != null) {
client.autofillCallbackResetableStateAvailable();
}
try {
if (restartIfNecessary) {
- final ComponentName componentName = getComponentNameFromContext();
+ final AutofillClient client = getClientLocked();
+ final ComponentName componentName = getComponentNameFromContext(client);
if (componentName == null) {
Log.w(TAG, "startSessionLocked(): context is not activity: " + mContext);
return;
if (sDebug) Log.d(TAG, "Session restarted: " + mSessionId + "=>" + newId);
mSessionId = newId;
mState = (mSessionId == NO_SESSION) ? STATE_UNKNOWN : STATE_ACTIVE;
- final AutofillClient client = getClientLocked();
if (client != null) {
client.autofillCallbackResetableStateAvailable();
}