Java Code Examples for com.xunlei.downloadlib.android.XLLog#i()

The following examples show how to use com.xunlei.downloadlib.android.XLLog#i() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XLAppKeyChecker.java    From MiniThunder with Apache License 2.0 6 votes vote down vote up
public boolean verify() {
    try {
        AppKeyEntity keyEntity = getKeyEntity();
        this.mPackageName = "com.xunlei.downloadprovider";
        if (!verifyAppKeyMD5(keyEntity, this.mPackageName)) {
            XLLog.i(TAG, "appkey MD5 invalid.");
            return false;
        } else if (!verifyAppKeyExpired(keyEntity)) {
            return true;
        } else {
            XLLog.i(TAG, "appkey expired.");
            return false;
        }
    } catch (KeyFormateException e) {
        return false;
    }
}
 
Example 2
Source File: XLDownloadManager.java    From MiniThunder with Apache License 2.0 6 votes vote down vote up
public synchronized int uninit() {
    int i = 9900;
    synchronized (this) {
        if (mRunningRefCount != 0) {
            XLLog.i(TAG, "some function of XLDownloadManager is running, uninit failed!");
        } else if (!(mDownloadManagerState == XLManagerStatus.MANAGER_UNINIT || this.mLoader == null)) {
            if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING) {
                undoMonitorNetworkChange();
            }
            stopGetGuidTimer();
            i = this.mLoader.unInit();
            mDownloadManagerState = XLManagerStatus.MANAGER_UNINIT;
            this.mContext = null;
        }
    }
    return i;
}
 
Example 3
Source File: XLAppKeyChecker.java    From BtPlayer with Apache License 2.0 6 votes vote down vote up
public boolean verify() {
    try {
        AppKeyEntity keyEntity = getKeyEntity();
        this.mPackageName = "com.xunlei.downloadprovider";
        if (!verifyAppKeyMD5(keyEntity, this.mPackageName)) {
            XLLog.i(TAG, "appkey MD5 invalid.");
            return false;
        } else if (!verifyAppKeyExpired(keyEntity)) {
            return true;
        } else {
            XLLog.i(TAG, "appkey expired.");
            return false;
        }
    } catch (KeyFormateException e) {
        return false;
    }
}
 
Example 4
Source File: XLAppKeyChecker.java    From MiniThunder with Apache License 2.0 6 votes vote down vote up
private AppKeyEntity getKeyEntity() throws KeyFormateException {
    String[] split = this.mAppKey.split("==");
    if (split.length != 2) {
        XLLog.i(TAG, "keyPair length invalid");
        throw new KeyFormateException("error");
    }
    AppKeyEntity appKeyEntity = new AppKeyEntity();
    appKeyEntity.setMD5(split[1]);
    try {
        String replace = split[0].replace('^', '=');
        String str = new String(Base64.decode(replace.substring(2, replace.length() - 2), 0), "UTF-8");
        appKeyEntity.setmRawItems(str);
        XLLog.i(TAG, "items:" + str);
        appKeyEntity.setmItemsEntity(getRawItemsEntity(str));
        return appKeyEntity;
    } catch (UnsupportedEncodingException e) {
        throw new KeyFormateException("error");
    }
}
 
Example 5
Source File: XLDownloadManager.java    From AndroidDownload with Apache License 2.0 6 votes vote down vote up
public synchronized int uninit() {
    int i = 9900;
    synchronized (this) {
        if (mRunningRefCount != 0) {
            XLLog.i(TAG, "some function of XLDownloadManager is running, uninit failed!");
        } else if (!(mDownloadManagerState == XLManagerStatus.MANAGER_UNINIT || this.mLoader == null)) {
            if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING) {
                undoMonitorNetworkChange();
            }
            stopGetGuidTimer();
            i = this.mLoader.unInit();
            mDownloadManagerState = XLManagerStatus.MANAGER_UNINIT;
            this.mContext = null;
        }
    }
    return i;
}
 
Example 6
Source File: XLAppKeyChecker.java    From TVRemoteIME with GNU General Public License v2.0 6 votes vote down vote up
public boolean verify() {
    try {
        AppKeyEntity keyEntity = getKeyEntity();
        this.mPackageName = "com.xunlei.downloadprovider";
        if (!verifyAppKeyMD5(keyEntity, this.mPackageName)) {
            XLLog.i(TAG, "appkey MD5 invalid.");
            return false;
        } else if (!verifyAppKeyExpired(keyEntity)) {
            return true;
        } else {
            XLLog.i(TAG, "appkey expired.");
            return false;
        }
    } catch (KeyFormateException e) {
        return false;
    }
}
 
Example 7
Source File: XLDownloadManager.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
private String getGuid() {
    if (!mAllowExecution) {
        return "00000000000000_000000000000";
    }
    GuidInfo guidInfo = new GuidInfo();
    guidInfo = XLUtil.generateGuid(this.mContext);
    if (guidInfo.mType != GUID_TYPE.ALL) {
        XLLog.i(TAG, "Start the GetGuidTimer");
        startGetGuidTimer();
    }
    return guidInfo.mGuid;
}
 
Example 8
Source File: XLDownloadManager.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
public int addServerResource(long j, ServerResourceParam serverResourceParam) {
    int i = 9900;
    if (serverResourceParam != null && serverResourceParam.checkMemberVar()) {
        increRefCount();
        if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
            XLLog.i(TAG, "respara.mUrl=" + serverResourceParam.mUrl);
            i = this.mLoader.addServerResource(j, serverResourceParam.mUrl, serverResourceParam.mRefUrl, serverResourceParam.mCookie, serverResourceParam.mResType, serverResourceParam.mStrategy);
        }
        decreRefCount();
    }
    return i;
}
 
Example 9
Source File: XLDownloadManager.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
public synchronized int init(Context context, InitParam initParam, boolean z) {
    int i = XLConstant.XLErrorCode.DOWNLOAD_MANAGER_ERROR;
    int i2 = 0;
    synchronized (this) {
        if (!mIsLoadErrcodeMsg) {
            loadErrcodeString(context);
            mIsLoadErrcodeMsg = true;
        }
        if (!(context == null || initParam == null || !initParam.checkMemberVar())) {
            this.mContext = context;
            mAllowExecution = z;
            if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING) {
                XLLog.i(TAG, "XLDownloadManager is already init");
            } else if (this.mLoader != null) {
                String peerid = getPeerid();
                String guid = getGuid();
                XLLog.i(TAG, "Peerid:" + new String(Base64.encode(peerid.getBytes(), 0)));
                XLLog.i(TAG, "Guid:" + new String(Base64.encode(guid.getBytes(), 0)));
                if (mAllowExecution) {
                    i2 = XLUtil.getNetworkTypeComplete(context);
                }
                i = this.mLoader.init(context, initParam.mAppVersion, "", peerid, guid, initParam.mStatSavePath, initParam.mStatCfgSavePath, i2, initParam.mPermissionLevel);
                if (i != 9000) {
                    mDownloadManagerState = XLManagerStatus.MANAGER_INIT_FAIL;
                    XLLog.e(TAG, "XLDownloadManager init failed ret=" + i);
                } else {
                    mDownloadManagerState = XLManagerStatus.MANAGER_RUNNING;
                    doMonitorNetworkChange();
                    setLocalProperty("PhoneModel", Build.MODEL);
                }
            }
        }
    }
    return i;
}
 
Example 10
Source File: XLDownloadManager.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
private void doMonitorNetworkChange() {
    XLLog.i(TAG, "doMonitorNetworkChange()");
    if (this.mContext != null && this.mReceiver == null) {
        this.mReceiver = new NetworkChangeReceiver(this);
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
        XLLog.i(TAG, "register Receiver");
        this.mContext.registerReceiver(this.mReceiver, intentFilter);
    }
}
 
Example 11
Source File: XLDownloadManager.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
private String getGuid() {
    if (!mAllowExecution) {
        return "00000000000000_000000000000";
    }
    GuidInfo guidInfo = new GuidInfo();
    guidInfo = XLUtil.generateGuid(this.mContext);
    if (guidInfo.mType != GUID_TYPE.ALL) {
        XLLog.i(TAG, "Start the GetGuidTimer");
        startGetGuidTimer();
    }
    return guidInfo.mGuid;
}
 
Example 12
Source File: XLDownloadManager.java    From MiniThunder with Apache License 2.0 5 votes vote down vote up
private void doMonitorNetworkChange() {
    XLLog.i(TAG, "doMonitorNetworkChange()");
    if (this.mContext != null && this.mReceiver == null) {
        this.mReceiver = new NetworkChangeReceiver(this);
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
        XLLog.i(TAG, "register Receiver");
        this.mContext.registerReceiver(this.mReceiver, intentFilter);
    }
}
 
Example 13
Source File: XLDownloadManager.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public int stopTask(long j) {
    int i = 9900;
    increRefCount();
    if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
        i = this.mLoader.stopTask(j);
    }
    XLLog.i(TAG, "XLStopTask()----- ret=" + i);
    decreRefCount();
    return i;
}
 
Example 14
Source File: XLDownloadManager.java    From BtPlayer with Apache License 2.0 5 votes vote down vote up
public int stopTask(long j) {
    int i = 9900;
    increRefCount();
    if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING && this.mLoader != null) {
        i = this.mLoader.stopTask(j);
    }
    XLLog.i(TAG, "XLStopTask()----- ret=" + i);
    decreRefCount();
    return i;
}
 
Example 15
Source File: XLDownloadManager.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
public synchronized int init(Context context, InitParam initParam, boolean z) {
    int i = 9900;
    int i2 = 0;
    synchronized (this) {
        if (!mIsLoadErrcodeMsg) {
            loadErrcodeString(context);
            mIsLoadErrcodeMsg = true;
        }
        if (!(context == null || initParam == null || !initParam.checkMemberVar())) {
            this.mContext = context;
            mAllowExecution = z;
            if (mDownloadManagerState == XLManagerStatus.MANAGER_RUNNING) {
                XLLog.i(TAG, "XLDownloadManager is already init");
            } else if (this.mLoader != null) {
                String peerid = getPeerid();
                String guid = getGuid();
                XLLog.i(TAG, "Peerid:" + new String(Base64.encode(peerid.getBytes(), 0)));
                XLLog.i(TAG, "Guid:" + new String(Base64.encode(guid.getBytes(), 0)));
                if (mAllowExecution) {
                    i2 = XLUtil.getNetworkTypeComplete(context);
                }
                  i = this.mLoader.init(initParam.mAppKey, "com.xunlei.downloadprovider", initParam.mAppVersion, "", peerid, guid, initParam.mStatSavePath, initParam.mStatCfgSavePath, i2, initParam.mPermissionLevel);
                if (i != 9000) {
                    mDownloadManagerState = XLManagerStatus.MANAGER_INIT_FAIL;
                } else {
                    mDownloadManagerState = XLManagerStatus.MANAGER_RUNNING;
                    doMonitorNetworkChange();
                    setLocalProperty("PhoneModel", Build.MODEL);
                }
            }
        }
    }
    return i;
}
 
Example 16
Source File: XLDownloadManager.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
private void undoMonitorNetworkChange() {
    XLLog.i(TAG, "undoMonitorNetworkChange()");
    if (this.mContext != null && this.mReceiver != null) {
        try {
            this.mContext.unregisterReceiver(this.mReceiver);
            XLLog.i(TAG, "unregister Receiver");
        } catch (IllegalArgumentException e) {
            XLLog.e(TAG, "Receiver not registered");
        }
        this.mReceiver = null;
    }
}
 
Example 17
Source File: XLDownloadManager.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
private void doMonitorNetworkChange() {
    XLLog.i(TAG, "doMonitorNetworkChange()");
    if (this.mContext != null && this.mReceiver == null) {
        this.mReceiver = new NetworkChangeReceiver(this);
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
        XLLog.i(TAG, "register Receiver");
        this.mContext.registerReceiver(this.mReceiver, intentFilter);
    }
}
 
Example 18
Source File: XLDownloadManager.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
private void stopGetGuidTimer() {
    if (this.mGetGuidTimer instanceof Timer) {
        this.mGetGuidTimer.cancel();
        this.mGetGuidTimer.purge();
        this.mGetGuidTimer = null;
        XLLog.i(TAG, "stopGetGuidTimer");
    }
    if (this.mGetGuidTimerTask instanceof TimerTask) {
        this.mGetGuidTimerTask.cancel();
        this.mGetGuidTimerTask = null;
    }
}
 
Example 19
Source File: XLDownloadManager.java    From MiniThunder with Apache License 2.0 5 votes vote down vote up
private void stopGetGuidTimer() {
    if (this.mGetGuidTimer instanceof Timer) {
        this.mGetGuidTimer.cancel();
        this.mGetGuidTimer.purge();
        this.mGetGuidTimer = null;
        XLLog.i(TAG, "stopGetGuidTimer");
    }
    if (this.mGetGuidTimerTask instanceof TimerTask) {
        this.mGetGuidTimerTask.cancel();
        this.mGetGuidTimerTask = null;
    }
}
 
Example 20
Source File: XLAppKeyChecker.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
private boolean verifyAppKeyMD5(AppKeyEntity appKeyEntity, String str) {
    String str2 = appKeyEntity.getmRawItems() + ";" + str;
    XLLog.i(TAG, "totalContent:" + str2);
    str2 = XLUtil.getMd5(str2).toLowerCase().replace('b', '^').replace('9', 'b');
    XLLog.i(TAG, "keyEntity getMD5 MD5:" + appKeyEntity.getMD5());
    if (str2.compareTo(appKeyEntity.getMD5()) == 0) {
        return true;
    }
    return false;
}