com.android.utils.NullLogger Java Examples
The following examples show how to use
com.android.utils.NullLogger.
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: ExtraPackage.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
/** * Computes a potential installation folder if an archive of this package were * to be installed right away in the given SDK root. * <p/> * A "tool" package should always be located in SDK/tools. * * @param osSdkRoot The OS path of the SDK root folder. Must NOT be null. * @param sdkManager An existing SDK manager to list current platforms and addons. * Not used in this implementation. * @return A new {@link File} corresponding to the directory to use to install this package. */ @Override public File getInstallFolder(String osSdkRoot, SdkManager sdkManager) { // First find if this extra is already installed. If so, reuse the same directory. LocalSdkParser localParser = new LocalSdkParser(); Package[] pkgs = localParser.parseSdk( osSdkRoot, sdkManager, LocalSdkParser.PARSE_EXTRAS, new NullTaskMonitor(NullLogger.getLogger())); for (Package pkg : pkgs) { if (sameItemAs(pkg) && pkg instanceof ExtraPackage) { File localPath = ((ExtraPackage) pkg).getLocalArchivePath(); if (localPath != null) { return localPath; } } } return getInstallSubFolder(osSdkRoot); }
Example #2
Source File: ExtraPackage.java From javaide with GNU General Public License v3.0 | 6 votes |
/** * Computes a potential installation folder if an archive of this package were * to be installed right away in the given SDK root. * <p/> * A "tool" package should always be located in SDK/tools. * * @param osSdkRoot The OS path of the SDK root folder. Must NOT be null. * @param sdkManager An existing SDK manager to list current platforms and addons. * Not used in this implementation. * @return A new {@link File} corresponding to the directory to use to install this package. */ @Override public File getInstallFolder(String osSdkRoot, SdkManager sdkManager) { // First find if this extra is already installed. If so, reuse the same directory. LocalSdkParser localParser = new LocalSdkParser(); Package[] pkgs = localParser.parseSdk( osSdkRoot, sdkManager, LocalSdkParser.PARSE_EXTRAS, new NullTaskMonitor(NullLogger.getLogger())); for (Package pkg : pkgs) { if (sameItemAs(pkg) && pkg instanceof ExtraPackage) { File localPath = ((ExtraPackage) pkg).getLocalArchivePath(); if (localPath != null) { return localPath; } } } return getInstallSubFolder(osSdkRoot); }
Example #3
Source File: CreateAvdVisualPanel3.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
public List<AvdInfo> getAvds(boolean forceRefresh) { if (forceRefresh) { try { avdManager.reloadAvds(new NullLogger()); } catch (AndroidLocation.AndroidLocationException e) { Exceptions.printStackTrace(e); } } ArrayList<AvdInfo> avdInfos = Lists.newArrayList(avdManager.getAllAvds()); boolean needsRefresh = false; for (AvdInfo info : avdInfos) { if (info.getStatus() == AvdInfo.AvdStatus.ERROR_DEVICE_CHANGED) { updateDeviceChanged(info); needsRefresh = true; } } if (needsRefresh) { return getAvds(true); } else { return avdInfos; } }
Example #4
Source File: CreateAvdVisualPanel3.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
public boolean updateDeviceChanged(@NotNull AvdInfo avdInfo) { try { return avdManager.updateDeviceChanged(avdInfo, new NullLogger()) != null; } catch (IOException e) { Exceptions.printStackTrace(e); } return false; }
Example #5
Source File: AvdManager.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
private void refreshAvds() { try { avdManager.reloadAvds(new NullLogger()); } catch (AndroidLocation.AndroidLocationException ex) { Exceptions.printStackTrace(ex); } AvdInfo[] validAvds = avdManager.getValidAvds(); model = new ExistingDevicesTableModel(validAvds); table.setModel(model); }
Example #6
Source File: AvdManager.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
@Override public Object getValueAt(int rowIndex, int columnIndex) { AvdInfo avdInfo = avdInfos[rowIndex]; Map<String, String> properties = avdInfo.getProperties(); switch (columnIndex) { case 0: return new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/android/avd/manager/" + getDeviceClassIcon(avdInfo))); case 1: return avdInfo.getDeviceName(); case 2: if (avdInfo.hasPlayStore()) { return new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/android/avd/manager/device-play-store.png")); } return null; case 3: return getResolution(avdInfo); case 4: return avdInfo.getAndroidVersion().getApiString(); case 5: return SdkVersionInfo.getVersionWithCodename(avdInfo.getAndroidVersion()); case 6: return avdInfo.getAbiType(); case 7: return storageSizeDisplayString(getSize(avdInfo)); case 8: boolean avdRunning = avdManager.isAvdRunning(avdInfo, new NullLogger()); if (avdRunning) { return "Running"; } return "Turned off"; default: return "Err"; } }
Example #7
Source File: AvdManager.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
/** * Returns the {@link SdkManager} associated with the {@link AvdManager}. * Note: This is temporary and will be removed as SdkManager is phased out. * TODO: Remove this when SdkManager is removed */ @NonNull @Deprecated public SdkManager getSdkManager() { return SdkManager.createManager(myLocalSdk.getPath(), NullLogger.getLogger()); }
Example #8
Source File: EmulatorLauncher.java From NBANDROID-V2 with Apache License 2.0 | 4 votes |
public Future<IDevice> launchEmulator(AvdInfo avdInfo, LaunchConfiguration launchCfg) { final String cookie = Long.toString(System.currentTimeMillis()); ExecutionDescriptor descriptor = new ExecutionDescriptor() .frontWindow(true).postExecution(new Runnable() { @Override public void run() { cancel = true; semaphore.release(); } }); ProcessBuilder processBuilder = ProcessBuilder.getLocal(); processBuilder.setExecutable(getEmulatorBinaryPath()); List<String> arguments = new ArrayList<>(); arguments.add(FLAG_AVD); arguments.add(avdInfo.getName()); arguments.add(FLAG_PROP); arguments.add(LAUNCH_COOKIE + "=" + cookie); if(SelectDeviceAction.wipeData.isSelected()){ arguments.add(FLAG_WIPE_DATA); } for (String arg : Splitter.on(' ').omitEmptyStrings().split(launchCfg.getEmulatorOptions())) { arguments.add(arg); } processBuilder.setArguments(arguments); AndroidSdk defaultSdk = AndroidSdkProvider.getDefaultSdk(); if (defaultSdk != null) { try { AvdManager avdManager = AvdManager.getInstance(defaultSdk.getAndroidSdkHandler(), new NullLogger()); if (avdManager != null) { File baseAvdFolder = avdManager.getBaseAvdFolder(); processBuilder.getEnvironment().setVariable("ANDROID_AVD_HOME", baseAvdFolder.getAbsolutePath()); } } catch (AndroidLocation.AndroidLocationException ex) { Exceptions.printStackTrace(ex); } } ExecutionService service = ExecutionService.newService( processBuilder, descriptor, "Android emulator"); final Future<Integer> taskStatus = service.run(); return EXECUTOR.submit(new Callable<IDevice>() { @Override public IDevice call() throws Exception { ProgressHandle handle = ProgressHandle.createHandle("Emulator starting", new Cancellable() { @Override public boolean cancel() { cancel = true; semaphore.release(); return true; } }); handle.start(); while (true) { Map<String, IDevice> runningEmulators = AdbUtils.getRunningEmulators(); IDevice device = runningEmulators.get(avdInfo.getName()); if (device != null && device.isOnline()) { handle.finish(); LOG.log(Level.INFO, "Started emulator device connected."); return device; } else if (cancel) { handle.finish(); LOG.log(Level.INFO, "Emulator start canceled"); return null; } semaphore.tryAcquire(2, TimeUnit.SECONDS); } } }); }