智慧考勤 v1.0.28版本的 MD5 值为:12729d810518c958a6eb8d5a86a946dd

以下内容为反编译后的 TrayContract.java 源代码,内容仅作参考


package net.grandcentrix.tray.provider;

import android.content.Context;
import android.content.pm.ProviderInfo;
import android.net.Uri;
import android.os.Process;
import android.provider.BaseColumns;
import android.util.Log;
import java.util.List;
import net.grandcentrix.tray.R;
import net.grandcentrix.tray.core.TrayLog;
import net.grandcentrix.tray.core.TrayRuntimeException;
class TrayContract {
    static String sAuthority;

    public interface InternalPreferences extends Preferences {
        public static final String BASE_PATH = "internal_preferences";
    }

    public interface Preferences {
        public static final String BASE_PATH = "preferences";

        public interface Columns extends BaseColumns {
            public static final String CREATED = "CREATED";
            public static final String ID = "_id";
            public static final String KEY = "KEY";
            public static final String MIGRATED_KEY = "MIGRATED_KEY";
            public static final String MODULE = "MODULE";
            public static final String UPDATED = "UPDATED";
            public static final String VALUE = "VALUE";
        }
    }

    TrayContract() {
    }

    public static Uri generateContentUri(Context context) {
        return generateContentUri(context, Preferences.BASE_PATH);
    }

    public static Uri generateInternalContentUri(Context context) {
        return generateContentUri(context, InternalPreferences.BASE_PATH);
    }

    private static void checkOldWayToSetAuthority(Context context) {
        if ("legacyTrayAuthority".equals(context.getString(R.string.tray__authority))) {
            return;
        }
        Log.e("Tray", "Deprecated way of defining the Tray authority detected\n#########################################\n#########################################\n#########################################\nDon't set the authority with `tray__authority` in your build.gradle.\nTo change the default authority override it inside the AndroidManifest\nSee https://github.com/grandcentrix/tray/wiki/Custom-Authority for instructions\n#########################################\n#########################################\n#########################################\n");
    }

    private static Uri generateContentUri(Context context, String str) {
        String authority = getAuthority(context);
        return Uri.withAppendedPath(Uri.parse("content://" + authority), str);
    }

    private static synchronized String getAuthority(Context context) {
        synchronized (TrayContract.class) {
            String str = sAuthority;
            if (str != null) {
                return str;
            }
            checkOldWayToSetAuthority(context);
            List<ProviderInfo> queryContentProviders = context.getPackageManager().queryContentProviders(context.getPackageName(), Process.myUid(), 0);
            if (queryContentProviders != null) {
                for (ProviderInfo providerInfo : queryContentProviders) {
                    if (providerInfo.name.equals(TrayContentProvider.class.getName())) {
                        sAuthority = providerInfo.authority;
                        TrayLog.v("found authority: " + sAuthority);
                        return sAuthority;
                    }
                }
            }
            throw new TrayRuntimeException("Internal tray error. Could not find the provider authority. Please fill an issue at https://github.com/grandcentrix/tray/issues");
        }
    }
}