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

Commit f8591833 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix print sensitive log IMSI" am: 00d61d52

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1343377

Change-Id: Idf73bb08c94db6b793de0bce8f3eba8eaaed396e
parents 0278312a 00d61d52
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.ParcelUuid;
import android.os.RegistrantList;
@@ -1959,13 +1960,26 @@ public class SubscriptionController extends ISub.Stub {
        return result;
    }

    /**
     * Scrub given IMSI on production builds.
     */
    private String scrubImsi(String imsi) {
        if (Build.IS_ENG) {
            return imsi;
        } else if (imsi != null) {
            return imsi.substring(0, Math.min(6, imsi.length())) + "...";
        } else {
            return "null";
        }
    }

    /**
     * Set IMSI by subscription ID
     * @param imsi IMSI (International Mobile Subscriber Identity)
     * @return the number of records updated
     */
    public int setImsi(String imsi, int subId) {
        if (DBG) logd("[setImsi]+ imsi:" + imsi + " subId:" + subId);
        if (DBG) logd("[setImsi]+ imsi:" + scrubImsi(imsi) + " subId:" + subId);
        ContentValues value = new ContentValues(1);
        value.put(SubscriptionManager.IMSI, imsi);