Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60415866 authored by Mohammadinamul Sheik's avatar Mohammadinamul Sheik
Browse files

[LatinIME] Support MNC permissions.


This build has been compiled against API 23

This build is approved to go out with the M OTA, but may NOT be released
to the public until the Play Store has enabled API level 23 apps

Version: 4.1.2300x.build_id

1. Replaces the personalization is on information with the suggest
   contacts.
2. Enables "Use Contacts" only if the app has permission to read
   contacts.
3. Disables the contacts dictionary in the Facilitator.
4. Do not register/read the contacts in the contact observer.

Bug: 22236416
Change-Id: I9674e13d0d0f4a2014c5024fde0178de684c07e7
parent 7d5fb3a9
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
        coreApp="true"
        package="com.android.inputmethod.latin">

    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
@@ -77,6 +77,13 @@
            </intent-filter>
        </activity>

        <activity
            android:name=".permissions.PermissionsActivity"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:exported="false"
            android:taskAffinity="" >
        </activity>

        <activity android:name=".setup.SetupWizardActivity"
                android:theme="@style/platformActivityTheme"
                android:label="@string/english_ime_name"
+0 −30
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2014, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->

<resources>
    <!-- The array of the text of the important notices displayed on the suggestion strip. -->
    <string-array name="important_notice_title_array" translatable="false">
        <!-- empty -->
    </string-array>
    <!-- The array of the contents of the important notices. -->
    <string-array name="important_notice_contents_array" translatable="false">
        <!-- empty -->
    </string-array>
</resources>
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2015 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->

<resources>
    <!-- The text shown on the suggestion bar to request the contacts permission info. -->
    <string name="important_notice_suggest_contact_names">Suggest contact names? Touch for info.</string>
</resources>
 No newline at end of file
+0 −25
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2014, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->

<resources>
    <integer name="config_important_notice_version">0</integer>
    <!-- Description for option enabling the use by the keyboards of sent/received messages, e-mail and typing history to improve suggestion accuracy [CHAR LIMIT=68] -->
    <string name="use_personalized_dicts_summary">Learn from your communications and typed data to improve suggestions</string>
</resources>
+7 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.inputmethod.latin;

import android.Manifest;
import android.content.Context;
import android.net.Uri;
import android.provider.ContactsContract;
@@ -25,6 +26,7 @@ import android.util.Log;
import com.android.inputmethod.annotations.ExternallyReferenced;
import com.android.inputmethod.latin.ContactsManager.ContactsChangedListener;
import com.android.inputmethod.latin.common.StringUtils;
import com.android.inputmethod.latin.permissions.PermissionsUtil;
import com.android.inputmethod.latin.personalization.AccountUtils;

import java.io.File;
@@ -108,6 +110,11 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary
     * Loads data within content providers to the dictionary.
     */
    private void loadDictionaryForUriLocked(final Uri uri) {
        if (!PermissionsUtil.checkAllPermissionsGranted(
                mContext, Manifest.permission.READ_CONTACTS)) {
            Log.i(TAG, "No permission to read contacts. Not loading the Dictionary.");
        }

        final ArrayList<String> validNames = mContactsManager.getValidNames(uri);
        for (final String name : validNames) {
            addNameLocked(name);
Loading