當前位置: 首頁>>代碼示例>>Java>>正文


Java ArrayUtils類代碼示例

本文整理匯總了Java中com.lody.virtual.helper.utils.ArrayUtils的典型用法代碼示例。如果您正苦於以下問題:Java ArrayUtils類的具體用法?Java ArrayUtils怎麽用?Java ArrayUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ArrayUtils類屬於com.lody.virtual.helper.utils包,在下文中一共展示了ArrayUtils類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: call

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    String pkg = (String) args[0];
    if (getHostPkg().equals(pkg)) {
        return method.invoke(who, args);
    }
    int notificationIndex = ArrayUtils.indexOfFirst(args, Notification.class);
    int idIndex = ArrayUtils.indexOfFirst(args, Integer.class);
    int id = (int) args[idIndex];
    id = VNotificationManager.get().dealNotificationId(id, pkg, null, getAppUserId());
    args[idIndex] = id;
    Notification notification = (Notification) args[notificationIndex];
    if (!VNotificationManager.get().dealNotification(id, notification, pkg)) {
        return 0;
    }
    VNotificationManager.get().addNotification(id, null, pkg, getAppUserId());
    args[0] = getHostPkg();
    return method.invoke(who, args);
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:20,代碼來源:MethodProxies.java

示例2: read

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
/**
 * java.io thinks that a read at EOF is an error and should return -1, contrary to traditional
 * Unix practice where you'd read until you got 0 bytes (and any future read would return -1).
 */
public static int read(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws IOException {
    ArrayUtils.checkOffsetAndCount(bytes.length, byteOffset, byteCount);
    if (byteCount == 0) {
        return 0;
    }
    try {
        int readCount = Os.read(fd, bytes, byteOffset, byteCount);
        if (readCount == 0) {
            return -1;
        }
        return readCount;
    } catch (ErrnoException errnoException) {
        if (errnoException.errno == OsConstants.EAGAIN) {
            // We return 0 rather than throw if we try to read from an empty non-blocking pipe.
            return 0;
        }
        throw new IOException(errnoException);
    }
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:24,代碼來源:FileBridge.java

示例3: write

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
/**
 * java.io always writes every byte it's asked to, or fails with an error. (That is, unlike
 * Unix it never just writes as many bytes as happens to be convenient.)
 */
public static void write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws IOException {
    ArrayUtils.checkOffsetAndCount(bytes.length, byteOffset, byteCount);
    if (byteCount == 0) {
        return;
    }
    try {
        while (byteCount > 0) {
            int bytesWritten = Os.write(fd, bytes, byteOffset, byteCount);
            byteCount -= bytesWritten;
            byteOffset += bytesWritten;
        }
    } catch (ErrnoException errnoException) {
        throw new IOException(errnoException);
    }
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:20,代碼來源:FileBridge.java

示例4: uninstallPackageAsUser

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
@Override
public synchronized boolean uninstallPackageAsUser(String packageName, int userId) {
    if (!VUserManagerService.get().exists(userId)) {
        return false;
    }
    PackageSetting ps = PackageCacheManager.getSetting(packageName);
    if (ps != null) {
        int[] userIds = getPackageInstalledUsers(packageName);
        if (!ArrayUtils.contains(userIds, userId)) {
            return false;
        }
        if (userIds.length == 1) {
            uninstallPackageFully(ps);
        } else {
            // Just hidden it
            VActivityManagerService.get().killAppByPkg(packageName, userId);
            ps.setInstalled(userId, false);
            notifyAppUninstalled(ps, userId);
            mPersistenceLayer.save();
            FileUtils.deleteDir(VEnvironment.getDataUserPackageDirectory(userId, packageName));
        }
        return true;
    }
    return false;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:26,代碼來源:VAppManagerService.java

示例5: realStartActivitiesLocked

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
private void realStartActivitiesLocked(IBinder resultTo, Intent[] intents, String[] resolvedTypes, Bundle options) {
    Class<?>[] types = IActivityManager.startActivities.paramList();
    Object[] args = new Object[types.length];
    if (types[0] == IApplicationThread.TYPE) {
        args[0] = ActivityThread.getApplicationThread.call(VirtualCore.mainThread());
    }
    int pkgIndex = ArrayUtils.protoIndexOf(types, String.class);
    int intentsIndex = ArrayUtils.protoIndexOf(types, Intent[].class);
    int resultToIndex = ArrayUtils.protoIndexOf(types, IBinder.class, 2);
    int optionsIndex = ArrayUtils.protoIndexOf(types, Bundle.class);
    int resolvedTypesIndex = intentsIndex + 1;
    if (pkgIndex != -1) {
        args[pkgIndex] = VirtualCore.get().getHostPkg();
    }
    args[intentsIndex] = intents;
    args[resultToIndex] = resultTo;
    args[resolvedTypesIndex] = resolvedTypes;
    args[optionsIndex] = options;
    ClassUtils.fixArgs(types, args);
    IActivityManager.startActivities.call(ActivityManagerNative.getDefault.call(),
            (Object[]) args);
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:23,代碼來源:ActivityStack.java

示例6: call

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    if (isFakeLocationEnable()) {
        Object transport = ArrayUtils.getFirst(args, mirror.android.location.LocationManager.GpsStatusListenerTransport.TYPE);
        Object locationManager = mirror.android.location.LocationManager.GpsStatusListenerTransport.this$0.get(transport);
        mirror.android.location.LocationManager.GpsStatusListenerTransport.onGpsStarted.call(transport);
        mirror.android.location.LocationManager.GpsStatusListenerTransport.onFirstFix.call(transport, 0);
        if (mirror.android.location.LocationManager.GpsStatusListenerTransport.mListener.get(transport) != null) {
            MockLocationHelper.invokeSvStatusChanged(transport);
        } else {
            MockLocationHelper.invokeNmeaReceived(transport);
        }
        GPSListenerThread.get().addListenerTransport(locationManager);
        return true;
    }
    return super.call(who, method, args);
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:18,代碼來源:MethodProxies.java

示例7: call

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    //enqueueNotification(pkg, id, notification, idOut);
    String pkg = (String) args[0];
    int notificationIndex = ArrayUtils.indexOfFirst(args, Notification.class);
    int idIndex = ArrayUtils.indexOfFirst(args, Integer.class);
    int id = (int) args[idIndex];
    id = VNotificationManager.get().dealNotificationId(id, pkg, null, getVUserId());
    args[idIndex] = id;
    Notification notification = (Notification) args[notificationIndex];
    if (!VNotificationManager.get().dealNotification(id, notification, pkg)) {
        return 0;
    }
    VNotificationManager.get().addNotification(id, null, pkg, getVUserId());
    args[0] = getHostPkg();
    return method.invoke(who, args);
}
 
開發者ID:codehz,項目名稱:container,代碼行數:18,代碼來源:EnqueueNotification.java

示例8: realStartActivityLocked

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
private void realStartActivityLocked(IBinder resultTo, Intent intent, String resultWho, int requestCode,
                                     Bundle options) {
    Class<?>[] types = mirror.android.app.IActivityManager.startActivity.paramList();
    Object[] args = new Object[types.length];
    if (types[0] == IApplicationThread.TYPE) {
        args[0] = ActivityThread.getApplicationThread.call(VirtualCore.mainThread());
    }
    int intentIndex = ArrayUtils.protoIndexOf(types, Intent.class);
    int resultToIndex = ArrayUtils.protoIndexOf(types, IBinder.class, 2);
    int optionsIndex = ArrayUtils.protoIndexOf(types, Bundle.class);
    int resolvedTypeIndex = intentIndex + 1;
    int resultWhoIndex = resultToIndex + 1;
    int requestCodeIndex = resultToIndex + 2;

    args[intentIndex] = intent;
    args[resultToIndex] = resultTo;
    args[resultWhoIndex] = resultWho;
    args[requestCodeIndex] = requestCode;
    if (optionsIndex != -1) {
        args[optionsIndex] = options;
    }
    args[resolvedTypeIndex] = intent.getType();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        args[intentIndex - 1] = VirtualCore.get().getHostPkg();
    }
    ClassUtils.fixArgs(types, args);

    mirror.android.app.IActivityManager.startActivity.call(ActivityManagerNative.getDefault.call(),
            (Object[]) args);
}
 
開發者ID:codehz,項目名稱:container,代碼行數:31,代碼來源:ActivityStack.java

示例9: beforeCall

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
@Override
public boolean beforeCall(Object who, Method method, Object... args) {
    int index = ArrayUtils.indexOfLast(args, Integer.class);
    if (index != -1) {
        int uid = (int) args[index];
        if (uid == Process.myUid()) {
            args[index] = getRealUid();
        }
    }
    return super.beforeCall(who, method, args);
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:12,代碼來源:ReplaceLastUidMethodProxy.java

示例10: beforeCall

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
@Override
     public boolean beforeCall(Object who, Method method, Object... args) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && args[0] instanceof String) {
	args[0] = getHostPkg();
}
         int index = ArrayUtils.indexOfFirst(args, WorkSource.class);
         if (index >= 0) {
             args[index] = null;
         }
         return true;
     }
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:12,代碼來源:AlarmManagerStub.java

示例11: call

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    int index = ArrayUtils.indexOfFirst(args, WindowManager.LayoutParams.class);
    if (index != -1) {
        WindowManager.LayoutParams attrs = (WindowManager.LayoutParams) args[index];
        if (attrs != null) {
            attrs.packageName = getHostPkg();
        }
    }
    return method.invoke(who, args);
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:12,代碼來源:BaseMethodProxy.java

示例12: call

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {

    if (args.length == 2 && args[0] instanceof String && args[1] instanceof String) {

        PackageManager pm = VirtualCore.getPM();

        String pkgNameOne = (String) args[0], pkgNameTwo = (String) args[1];
        try {
            PackageInfo pkgOne = pm.getPackageInfo(pkgNameOne, PackageManager.GET_SIGNATURES);
            PackageInfo pkgTwo = pm.getPackageInfo(pkgNameTwo, PackageManager.GET_SIGNATURES);

            Signature[] one = pkgOne.signatures;
            Signature[] two = pkgTwo.signatures;

            if (ArrayUtils.isEmpty(one)) {
                if (!ArrayUtils.isEmpty(two)) {
                    return PackageManager.SIGNATURE_FIRST_NOT_SIGNED;
                } else {
                    return PackageManager.SIGNATURE_NEITHER_SIGNED;
                }
            } else {
                if (ArrayUtils.isEmpty(two)) {
                    return PackageManager.SIGNATURE_SECOND_NOT_SIGNED;
                } else {
                    // 走到了這裏說明兩個包的簽名都在
                    if (Arrays.equals(one, two)) {
                        return PackageManager.SIGNATURE_MATCH;
                    } else {
                        return PackageManager.SIGNATURE_NO_MATCH;
                    }
                }
            }
        } catch (Throwable e) {
            // Ignore
        }
    }

    return method.invoke(who, args);
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:41,代碼來源:MethodProxies.java

示例13: call

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    if (noEditorInfo == null) {
        editorInfoIndex = ArrayUtils.indexOfFirst(args, EditorInfo.class);
        noEditorInfo = editorInfoIndex == -1;
    }
    if (!noEditorInfo) {
        EditorInfo attribute = (EditorInfo) args[editorInfoIndex];
        if (attribute != null) {
            attribute.packageName = getHostPkg();
        }
    }
    return method.invoke(who, args);
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:15,代碼來源:MethodProxies.java

示例14: replaceFirstAppPkg

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
public static String replaceFirstAppPkg(Object[] args) {
	if (args == null) {
		return null;
	}
	int index = ArrayUtils.indexOfFirst(args, String.class);
	if (index != -1) {
		String pkg = (String) args[index];
		args[index] = VirtualCore.get().getHostPkg();
		return pkg;
	}
	return null;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:13,代碼來源:MethodParameterUtils.java

示例15: replaceLastAppPkg

import com.lody.virtual.helper.utils.ArrayUtils; //導入依賴的package包/類
public static String replaceLastAppPkg(Object[] args) {
	int index = ArrayUtils.indexOfLast(args, String.class);
	if (index != -1) {
		String pkg = (String) args[index];
		args[index] = VirtualCore.get().getHostPkg();
		return pkg;
	}
	return null;
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:10,代碼來源:MethodParameterUtils.java


注:本文中的com.lody.virtual.helper.utils.ArrayUtils類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。