private void checkCaller() {
            if (mVerifiedUid == -1) {
                String[] packages = getPackageManager().getPackagesForUid(getCallingUid());
                // We need to read Preferences. This should only be called on the Binder thread
                // which is designed to handle long running, blocking tasks, so disk I/O should be
                // OK.
                StrictMode.ThreadPolicy policy = StrictMode.allowThreadDiskReads();
                try {
                    String verifiedPackage = getPreferences(TrustedWebActivityService.this)
                            .getString(PREFS_VERIFIED_PROVIDER, null);

                    if (Arrays.asList(packages).contains(verifiedPackage)) {
                        mVerifiedUid = getCallingUid();

                        return;
                    }
                } finally {
                    StrictMode.setThreadPolicy(policy);
                }
            }

            if (mVerifiedUid == getCallingUid()) return;

            throw new SecurityException("Caller is not verified as Trusted Web Activity provider.");
        }
Used as a return value of {@link #getSmallIconId} when the icon is not provided.
customtabs/src/android/support/customtabs/trusted/TrustedWebActivityService.java