summaryrefslogtreecommitdiff
path: root/core/java/android/app/Activity.java
diff options
context:
space:
mode:
authorPhilip P. Moltmann <moltmann@google.com>2017-04-11 10:13:33 -0700
committerPhilip P. Moltmann <moltmann@google.com>2017-04-16 21:36:25 -0700
commit494c3f5da2c467ad07f50b4e1ad01065a8e3aa4f (patch)
treea19730d180908b5749aad27938bba1dea3d9f779 /core/java/android/app/Activity.java
parentd8837b6fca23847fcd4dd295ccbb33ef9d4edcec (diff)
Allow to finish session when all views are gone
An service can option to finish the session once all views that it declared as important. Views that are important are all autofillable views of any partition and the saveable fields of the last partition. Test: CtsAutoFillServiceTestCases Fixes: 35708237 Change-Id: I0ccade8ebb427e5d8928697ef0007c75d3f83df0
Diffstat (limited to 'core/java/android/app/Activity.java')
-rw-r--r--core/java/android/app/Activity.java60
1 files changed, 55 insertions, 5 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index b36a1600bae5..169dcb01c90a 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -16,21 +16,16 @@
package android.app;
-import android.metrics.LogMaker;
import android.graphics.Rect;
import android.os.SystemClock;
import android.view.ViewRootImpl.ActivityConfigCallback;
-import android.view.autofill.AutofillId;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillPopupWindow;
-import android.view.autofill.AutofillValue;
import android.view.autofill.IAutofillWindowPresenter;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.app.IVoiceInteractor;
import com.android.internal.app.ToolbarActionBar;
import com.android.internal.app.WindowDecorActionBar;
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto;
import com.android.internal.policy.PhoneWindow;
import android.annotation.CallSuper;
@@ -1234,6 +1229,13 @@ public class Activity extends ContextThemeWrapper
mFragments.doLoaderStart();
getApplication().dispatchActivityStarted(this);
+
+ if (mAutoFillResetNeeded) {
+ AutofillManager afm = getAutofillManager();
+ if (afm != null) {
+ afm.onVisibleForAutofill();
+ }
+ }
}
/**
@@ -7407,6 +7409,54 @@ public class Activity extends ContextThemeWrapper
return true;
}
+ /** @hide */
+ @Override
+ public boolean getViewVisibility(int viewId) {
+ Window window = getWindow();
+ if (window == null) {
+ Log.i(TAG, "no window");
+ return false;
+ }
+
+ View decorView = window.peekDecorView();
+ if (decorView == null) {
+ Log.i(TAG, "no decorView");
+ return false;
+ }
+
+ View view = decorView.findViewByAccessibilityIdTraversal(viewId);
+ if (view == null) {
+ Log.i(TAG, "cannot find view");
+ return false;
+ }
+
+ // Check if the view is visible by checking all parents
+ while (view != null) {
+ if (view == decorView) {
+ break;
+ }
+
+ if (view.getVisibility() != View.VISIBLE) {
+ Log.i(TAG, view + " is not visible");
+ return false;
+ }
+
+ if (view.getParent() instanceof View) {
+ view = (View) view.getParent();
+ } else {
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ /** @hide */
+ @Override
+ public boolean isVisibleForAutofill() {
+ return !mStopped;
+ }
+
/**
* If set to true, this indicates to the system that it should never take a
* screenshot of the activity to be used as a representation while it is not in a started state.