Exemple #1
0
        protected void OnSuccess()
        {
            var             intent      = Intent;
            var             forResponse = intent.GetBooleanExtra(CommonUtil.EXTRA_FOR_RESPONSE, true);
            AssistStructure structure   = (AssistStructure)intent.GetParcelableExtra(AutofillManager.ExtraAssistStructure);
            StructureParser parser      = new StructureParser(structure);

            parser.ParseForFill();
            AutofillFieldMetadataCollection autofillFields = parser.AutofillFields;
            var saveTypes = autofillFields.SaveType;

            ReplyIntent = new Intent();
            var clientFormDataMap = SharedPrefsAutofillRepository.GetInstance(this).GetFilledAutofillFieldCollection
                                        (autofillFields.FocusedAutofillHints, autofillFields.AllAutofillHints);

            if (forResponse)
            {
                SetResponseIntent(AutofillHelper.NewResponse(this, false, autofillFields, clientFormDataMap));
            }
            else
            {
                String datasetName = intent.GetStringExtra(CommonUtil.EXTRA_DATASET_NAME);
                SetDatasetIntent(AutofillHelper.NewDataset(this, autofillFields, clientFormDataMap[datasetName], false));
            }
        }
Exemple #2
0
 public StructureParser(Context context, AssistStructure structure)
 {
     mContext                = context;
     Structure               = structure;
     AutofillFields          = new AutofillFieldMetadataCollection();
     domainSuffixParserCache = new PublicSuffixRuleCache(context);
 }
Exemple #3
0
 public StructureParser(Context context, AssistStructure structure)
 {
     kp2aDigitalAssetLinksDataSource = new Kp2aDigitalAssetLinksDataSource(context);
     mContext                = context;
     Structure               = structure;
     AutofillFields          = new AutofillFieldMetadataCollection();
     domainSuffixParserCache = new PublicSuffixRuleCache(context);
 }
Exemple #4
0
        public static void DumpStructure(AssistStructure structure)
        {
            int nodeCount = structure.WindowNodeCount;

            Log.Verbose(TAG, "dumpStructure(): component=" + structure.ActivityComponent
                        + " numberNodes=" + nodeCount);
            for (int i = 0; i < nodeCount; i++)
            {
                Log.Verbose(TAG, "node #" + i);
                AssistStructure.WindowNode node = structure.GetWindowNodeAt(i);
                DumpNode("  ", node.RootViewNode);
            }
        }
        protected void OnSuccess(FilledAutofillFieldCollection clientFormDataMap, bool isManual)
        {
            var             intent    = Intent;
            AssistStructure structure = (AssistStructure)intent.GetParcelableExtra(AutofillManager.ExtraAssistStructure);
            StructureParser parser    = new StructureParser(this, structure);

            parser.ParseForFill(isManual);
            AutofillFieldMetadataCollection autofillFields = parser.AutofillFields;
            int partitionIndex = AutofillHintsHelper.GetPartitionIndex(autofillFields.FocusedAutofillCanonicalHints.FirstOrDefault());
            FilledAutofillFieldCollection partitionData = AutofillHintsHelper.FilterForPartition(clientFormDataMap, partitionIndex);

            ReplyIntent = new Intent();
            SetDatasetIntent(AutofillHelper.NewDataset(this, autofillFields, partitionData, IntentBuilder));
        }
 public static void DumpStructure(AssistStructure structure)
 {
     if (LogVerboseEnabled())
     {
         int nodeCount = structure.WindowNodeCount;
         Logv("dumpStructure(): component=%s numberNodes=%d",
              structure.ActivityComponent, nodeCount);
         for (int i = 0; i < nodeCount; i++)
         {
             Logv("node #%d", i);
             var node = structure.GetWindowNodeAt(i);
             DumpNode(new StringBuilder(), "  ", node.RootViewNode, 0);
         }
     }
 }
        protected void OnSuccess(FilledAutofillFieldCollection clientFormDataMap, bool isManual)
        {
            var             intent    = Intent;
            AssistStructure structure = (AssistStructure)intent.GetParcelableExtra(AutofillManager.ExtraAssistStructure);
            StructureParser parser    = new StructureParser(this, structure);

            parser.ParseForFill(isManual);
            AutofillFieldMetadataCollection autofillFields = parser.AutofillFields;
            var partitionData = AutofillHintsHelper.FilterForPartition(clientFormDataMap, parser.AutofillFields.FocusedAutofillCanonicalHints);



            ReplyIntent = new Intent();
            SetDatasetIntent(AutofillHelper.NewDataset(this, autofillFields, partitionData, IntentBuilder, null /*TODO can we get the inlinePresentationSpec here?*/));
            SetResult(Result.Ok, ReplyIntent);
        }
        /**
         * Gets a node if it matches the filter criteria for the given id.
         */
        public static AssistStructure.ViewNode FindNodeByFilter([NonNull] AssistStructure structure, [NonNull] object id, [NonNull] NodeFilter filter)
        {
            Logv("Parsing request for activity %s", structure.ActivityComponent);
            int nodes = structure.WindowNodeCount;

            for (int i = 0; i < nodes; i++)
            {
                AssistStructure.WindowNode windowNode = structure.GetWindowNodeAt(i);
                AssistStructure.ViewNode   rootNode   = windowNode.RootViewNode;
                AssistStructure.ViewNode   node       = FindNodeByFilter(rootNode, id, filter);
                if (node != null)
                {
                    return(node);
                }
            }
            return(null);
        }
Exemple #9
0
 public Parser(AssistStructure structure)
 {
     _structure = structure;
 }
 public StructureParser(Context context, AssistStructure structure)
 {
     mContext       = context;
     Structure      = structure;
     AutofillFields = new AutofillFieldMetadataCollection();
 }
Exemple #11
0
 public Parser(AssistStructure structure, Context applicationContext)
 {
     _structure         = structure;
     ApplicationContext = applicationContext;
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            string requestedUrl = Intent.GetStringExtra(ChooseForAutofillActivityBase.ExtraQueryString);

            if (requestedUrl == null)
            {
                Toast.MakeText(this, "Cannot execute query for null.", ToastLength.Long).Show();
                RestartApp();
                return;
            }

            var prefs = PreferenceManager.GetDefaultSharedPreferences(this);

            bool isDisable = Intent.GetBooleanExtra(ExtraIsDisable, true);

            var disabledValues = prefs.GetStringSet("AutoFillDisabledQueries", new HashSet <string>()
            {
            }).ToHashSet();

            if (isDisable)
            {
                disabledValues.Add(requestedUrl);
            }
            else
            {
                disabledValues.Remove(requestedUrl);
            }


            prefs.Edit().PutStringSet("AutoFillDisabledQueries", disabledValues).Commit();

            bool isManual = Intent.GetBooleanExtra(ChooseForAutofillActivityBase.ExtraIsManualRequest, false);

            Intent reply = new Intent();

            FillResponse.Builder builder   = new FillResponse.Builder();
            AssistStructure      structure = (AssistStructure)Intent.GetParcelableExtra(AutofillManager.ExtraAssistStructure);
            StructureParser      parser    = new StructureParser(this, structure);

            try
            {
                parser.ParseForFill(isManual);
            }
            catch (Java.Lang.SecurityException e)
            {
                Log.Warn(CommonUtil.Tag, "Security exception handling request");
                SetResult(Result.Canceled);
                return;
            }

            try
            {
                reply.PutExtra(AutofillManager.ExtraAuthenticationResult, (FillResponse)null);
            }
            catch (Exception e)
            {
                Kp2aLog.LogUnexpectedError(e);
                throw;
            }

            SetResult(Result.Ok, reply);


            Finish();
        }
 public ClientParser(AssistStructure structure) : this(new List <AssistStructure>() { structure }.ToImmutableList())
 {
 }
Exemple #14
0
 public StructureParser(AssistStructure structure)
 {
     Structure      = structure;
     AutofillFields = new AutofillFieldMetadataCollection();
 }
 public StructureParser(Context context, AssistStructure structure)
 {
     mContext   = context;
     mStructure = structure;
 }
Exemple #16
0
 public override void OnHandleAssist(Bundle data, AssistStructure structure, AssistContent content)
 {
     //Toast.MakeText(Context, "OnHandleAssist", ToastLength.Short).Show();
 }