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

Commit fa4ae989 authored by Xiao-Long Chen's avatar Xiao-Long Chen Committed by Dan Pasanen
Browse files

Re-add dialer lookup.

BUGBASH-612: do not send phone numbers to non-ssl sites for reverse/forward/people lookups

Change-Id: I677460ad5767b8698ee24d6d43ff159aee55387a
parent 56aa9e55
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ RES_DIRS := \
	$(BASE_DIR)/dialer/dialpadview/res \
	$(BASE_DIR)/dialer/enrichedcall/simulator/res \
	$(BASE_DIR)/dialer/interactions/res \
	$(BASE_DIR)/dialer/lookup/res \
	$(BASE_DIR)/dialer/main/impl/res \
	$(BASE_DIR)/dialer/notification/res \
	$(BASE_DIR)/dialer/oem/res \
@@ -145,6 +146,7 @@ DIALER_MANIFEST_FILES += \
	$(BASE_DIR)/dialer/dialpadview/AndroidManifest.xml \
	$(BASE_DIR)/dialer/enrichedcall/simulator/AndroidManifest.xml \
	$(BASE_DIR)/dialer/interactions/AndroidManifest.xml \
	$(BASE_DIR)/dialer/lookup/AndroidManifest.xml \
	$(BASE_DIR)/dialer/main/impl/AndroidManifest.xml \
	$(BASE_DIR)/dialer/notification/AndroidManifest.xml \
	$(BASE_DIR)/dialer/oem/AndroidManifest.xml \
@@ -300,6 +302,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
	libphonenumber \
	okhttp \
	volley \
	org.lineageos.platform.sdk

LOCAL_STATIC_ANDROID_LIBRARIES := \
	android-support-design \
+2 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.provider.CallLog.Calls;
import android.support.annotation.NonNull;
import com.android.dialer.app.R;
import com.android.dialer.common.Assert;
import com.android.dialer.lookup.LookupCache;
import com.android.dialer.phonenumbercache.CachedNumberLookupService;
import com.android.dialer.phonenumbercache.PhoneNumberCache;

@@ -70,6 +71,7 @@ public class ClearCallLogDialog extends DialogFragment {
                    if (cachedNumberLookupService != null) {
                      cachedNumberLookupService.clearAllCacheEntries(context);
                    }
                    LookupCache.deleteCachedContacts(context);
                    return null;
                  }

+3 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.contacts.common.list.PinnedHeaderListView;
import com.android.dialer.app.R;
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.common.LogUtil;
import com.android.dialer.lookup.LookupCache;
import com.android.dialer.phonenumbercache.CachedNumberLookupService;
import com.android.dialer.phonenumbercache.PhoneNumberCache;
import com.android.dialer.util.PermissionsUtil;
@@ -71,11 +72,12 @@ public class RegularSearchFragment extends SearchFragment
  protected void cacheContactInfo(int position) {
    CachedNumberLookupService cachedNumberLookupService =
        PhoneNumberCache.get(getContext()).getCachedNumberLookupService();
    if (cachedNumberLookupService != null) {
    final RegularSearchListAdapter adapter = (RegularSearchListAdapter) getAdapter();
    if (cachedNumberLookupService != null) {
      cachedNumberLookupService.addContact(
          getContext(), adapter.getContactInfo(cachedNumberLookupService, position));
    }
    LookupCache.cacheContact(getContext(), adapter.getLookupContactInfo(position));
  }

  @Override
+14 −0
Original line number Diff line number Diff line
@@ -39,6 +39,20 @@ public class RegularSearchListAdapter extends DialerPhoneNumberListAdapter {
    setShortcutEnabled(SHORTCUT_ADD_TO_EXISTING_CONTACT, false);
  }

  public ContactInfo getLookupContactInfo(int position) {
    ContactInfo info = new ContactInfo();
    final Cursor item = (Cursor) getItem(position);
    if (item != null) {
      info.name = item.getString(PhoneQuery.DISPLAY_NAME);
      info.type = item.getInt(PhoneQuery.PHONE_TYPE);
      info.label = item.getString(PhoneQuery.PHONE_LABEL);
      info.number = item.getString(PhoneQuery.PHONE_NUMBER);
      final String photoUriStr = item.getString(PhoneQuery.PHOTO_URI);
      info.photoUri = photoUriStr == null ? null : Uri.parse(photoUriStr);
    }
    return info;
  }

  public CachedContactInfo getContactInfo(CachedNumberLookupService lookupService, int position) {
    ContactInfo info = new ContactInfo();
    CachedContactInfo cacheInfo = lookupService.buildCachedContactInfo(info);
+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.dialer.about.AboutPhoneFragment;
import com.android.dialer.app.R;
import com.android.dialer.blocking.FilteredNumberCompat;
import com.android.dialer.common.LogUtil;
import com.android.dialer.lookup.LookupSettingsFragment;
import com.android.dialer.proguard.UsedByReflection;
import com.android.voicemail.VoicemailClient;
import com.android.voicemail.VoicemailComponent;
@@ -89,6 +90,11 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity {
    quickResponseSettingsHeader.intent = quickResponseSettingsIntent;
    target.add(quickResponseSettingsHeader);

    final Header lookupSettingsHeader = new Header();
    lookupSettingsHeader.titleRes = R.string.lookup_settings_label;
    lookupSettingsHeader.fragment = LookupSettingsFragment.class.getName();
    target.add(lookupSettingsHeader);

    TelephonyManager telephonyManager =
        (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

Loading