#2 多设备测试

Open
opened 5 years ago by lyq · 0 comments
天问 commented 5 years ago
  1. 由于调用系统摄像头,有些设备没有摄像头。。等需要测试兼容性

  2. 测试打开闪光灯的同时,摄像头会不会打开!(oppo find手机调用Camera会 升起摄像头)

  3. 打开闪光灯方式一:

    开:
    cam = Camera.open();
    p = cam.getParameters();
    p.setFlashMode(Parameters.FLASH_MODE_TORCH);
    cam.setParameters(p);
    cam.startPreview();
    
    
    关:
    p.setFlashMode(Parameters.FLASH_MODE_OFF);
    cam.setParameters(p);
    cam.stopPreview();
    cam.setPreviewCallback(null);
    cam.release();
    cam = null;
    

二:

			Class sm = Class.forName("android.os.ServiceManager");
			Object hwBinder = sm.getMethod("getService", String.class).invoke(
					null, "hardware");
			Class hwsstub = Class.forName("android.os.IHardwareService$Stub");
			Method asInterface = hwsstub.getMethod("asInterface",
					android.os.IBinder.class);
			svc = asInterface.invoke(null, (IBinder) hwBinder);
			Class proxy = svc.getClass();

			// save methods
			getFlashlightEnabled = proxy.getMethod("getFlashlightEnabled");
			setFlashlightEnabled = proxy.getMethod("setFlashlightEnabled",
					boolean.class);



getFlashlightEnabled.invoke(svc).equals(true);

开:
setFlashlightEnabled.invoke(svc, tf);


测试两种方法调用闪光灯 ,摄像头会不会同时开启。其实摄像头不需要开启!!

1. 由于调用系统摄像头,有些设备没有摄像头。。等需要测试兼容性 2. 测试打开闪光灯的同时,摄像头会不会打开!(oppo find手机调用Camera会 升起摄像头) 3. 打开闪光灯方式一: ``` 开: cam = Camera.open(); p = cam.getParameters(); p.setFlashMode(Parameters.FLASH_MODE_TORCH); cam.setParameters(p); cam.startPreview(); 关: p.setFlashMode(Parameters.FLASH_MODE_OFF); cam.setParameters(p); cam.stopPreview(); cam.setPreviewCallback(null); cam.release(); cam = null; ``` 二: ``` Class sm = Class.forName("android.os.ServiceManager"); Object hwBinder = sm.getMethod("getService", String.class).invoke( null, "hardware"); Class hwsstub = Class.forName("android.os.IHardwareService$Stub"); Method asInterface = hwsstub.getMethod("asInterface", android.os.IBinder.class); svc = asInterface.invoke(null, (IBinder) hwBinder); Class proxy = svc.getClass(); // save methods getFlashlightEnabled = proxy.getMethod("getFlashlightEnabled"); setFlashlightEnabled = proxy.getMethod("setFlashlightEnabled", boolean.class); getFlashlightEnabled.invoke(svc).equals(true); 开: setFlashlightEnabled.invoke(svc, tf); ``` 测试两种方法调用闪光灯 ,摄像头会不会同时开启。其实摄像头不需要开启!!
Sign in to join this conversation.
No Label
No Milestone
No assignee
1 Participants
Loading...
Cancel
Save
There is no content yet.