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

Commit 00d61d52 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix print sensitive log IMSI"

parents 3bbc72c2 dffd4899
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);