本文整理汇总了Java中android.os.WorkSource类的典型用法代码示例。如果您正苦于以下问题:Java WorkSource类的具体用法?Java WorkSource怎么用?Java WorkSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WorkSource类属于android.os包,在下文中一共展示了WorkSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startHook
import android.os.WorkSource; //导入依赖的package包/类
@Override
public void startHook() {
Method setImplmethod = RefInvoke.findMethodExact(
"android.app.AlarmManager", ClassLoader.getSystemClassLoader(),
"setImpl",int.class,long.class,long.class,long.class,PendingIntent.class,WorkSource.class);
hookhelper.hookMethod(setImplmethod, new AbstractBahaviorHookCallBack() {
@Override
public void descParam(HookParam param) {
Logger.log_behavior("The Alarm Information:");
PendingIntent intent = (PendingIntent) param.args[4];
descPendingIntent(intent);
Logger.log_behavior("TriggerAtMillis = "+param.args[1]);
Logger.log_behavior("windowMillis = "+param.args[2]);
Logger.log_behavior("intervalMillis = "+param.args[3]);
}
});
}
示例2: startHook
import android.os.WorkSource; //导入依赖的package包/类
@Override
public void startHook() {
Method setImplmethod = RefInvoke.findMethodExact(
"android.app.AlarmManager", ClassLoader.getSystemClassLoader(),
"setImpl",int.class,long.class,long.class,long.class,PendingIntent.class,WorkSource.class);
hookhelper.hookMethod(setImplmethod, new AbstractBahaviorHookCallBack() {
@Override
public void descParam(HookParam param) {
Logger.log_behavior("The Alarm Information:");
PendingIntent intent = (PendingIntent) param.args[4];
if(intent != null)
descPendingIntent(intent);
Logger.log_behavior("TriggerAtMillis = "+param.args[1]);
Logger.log_behavior("windowMillis = "+param.args[2]);
Logger.log_behavior("intervalMillis = "+param.args[3]);
}
});
}
示例3: onSetRequest
import android.os.WorkSource; //导入依赖的package包/类
@Override
public void onSetRequest(ProviderRequestUnbundled requests, WorkSource source) {
Log.v(TAG, "onSetRequest: " + requests + " by " + source);
long autoTime = Math.max(requests.getInterval(), FASTEST_REFRESH_INTERVAL);
boolean autoUpdate = requests.getReportLocation();
Log.v(TAG, "using autoUpdate=" + autoUpdate + " autoTime=" + autoTime);
if (autoUpdate) {
helper.setTime(autoTime);
helper.enable();
} else {
helper.disable();
}
}
示例4: createFromParcel
import android.os.WorkSource; //导入依赖的package包/类
@Override
public LocationRequest createFromParcel(Parcel in) {
LocationRequest request = new LocationRequest();
request.setQuality(in.readInt());
request.setFastestInterval(in.readLong());
request.setInterval(in.readLong());
request.setExpireAt(in.readLong());
request.setNumUpdates(in.readInt());
request.setSmallestDisplacement(in.readFloat());
request.setHideFromAppOps(in.readInt() != 0);
String provider = in.readString();
if (provider != null)
request.setProvider(provider);
WorkSource workSource = in.readParcelable(null);
if (workSource != null)
request.setWorkSource(workSource);
return request;
}
示例5: beforeCall
import android.os.WorkSource; //导入依赖的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;
}
示例6: call
import android.os.WorkSource; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
int index = ArrayUtils.indexOfFirst(args, WorkSource.class);
if (index >= 0) {
args[index] = null;
}
return super.call(who, method, args);
}
示例7: startScan
import android.os.WorkSource; //导入依赖的package包/类
/**
* Request a scan for access points. Returns immediately. The availability
* of the results is made known later by means of an asynchronous event sent
* on completion of the scan.
* @return {@code true} if the operation succeeded, i.e., the scan was initiated
*/
public boolean startScan() {
try {
final WorkSource workSource = null;
mService.startScan(workSource);
return true;
} catch (RemoteException e) {
return false;
}
}
示例8: onSetMinTime
import android.os.WorkSource; //导入依赖的package包/类
@Override
public void onSetMinTime(long minTime, WorkSource ws) {
Log.v(TAG, "onSetMinTime: " + minTime + " by " + ws);
autoTime = Math.max(minTime, FASTEST_REFRESH_INTERVAL);
helper.setTime(autoTime);
if (autoUpdate) helper.enable();
}
示例9: onSetRequest
import android.os.WorkSource; //导入依赖的package包/类
@Override
public void onSetRequest(final ProviderRequestUnbundled requests, final WorkSource ws) {
try {
if (DEBUG) Log.d(TAG, "onSetRequest: requests=" + requests + ", ws=" + ws);
wirelessEnvListener.disable();
long autoTime = Long.MAX_VALUE;
boolean autoUpdate = false;
for (final LocationRequestUnbundled request : requests.getLocationRequests()) {
if (DEBUG) Log.d(TAG, "onSetRequest: request=" + request);
if (autoTime > request.getInterval()) {
autoTime = request.getInterval();
}
autoUpdate = true;
}
if (autoUpdate) {
if (autoTime < 1500) {
autoTime = 1500;
}
wirelessEnvListener.setTime(autoTime);
wirelessEnvListener.enable();
}
else {
wirelessEnvListener.disable();
}
}
catch (Exception e) {
Log.e(TAG, "onSetRequest: e=" + e, e);
}
}
示例10: getWorkSource
import android.os.WorkSource; //导入依赖的package包/类
/**
* @hide
*/
public WorkSource getWorkSource() {
return null;
}
示例11: onAddListener
import android.os.WorkSource; //导入依赖的package包/类
@Override
public void onAddListener(final int uid, final WorkSource ws) {
if (DEBUG) Log.d(TAG, uid + " is listening as " + ws != null ? (ws + " (contents:" + ws.describeContents() + ")") : "[unknown WorkSource]");
}
示例12: onRemoveListener
import android.os.WorkSource; //导入依赖的package包/类
@Override
public void onRemoveListener(final int uid, final WorkSource ws) {
}
示例13: onSetMinTime
import android.os.WorkSource; //导入依赖的package包/类
@Override
public void onSetMinTime(final long minTime, final WorkSource ws) {
autoTime = minTime;
}
示例14: setMinTime
import android.os.WorkSource; //导入依赖的package包/类
public void setMinTime(long minTime, WorkSource ws) {
LocationProvider.this.onSetMinTime(minTime, ws);
}
示例15: addListener
import android.os.WorkSource; //导入依赖的package包/类
public void addListener(int uid) {
LocationProvider.this.onAddListener(uid, new WorkSource(uid));
}