| Chunk |
|---|
| Conflicting content |
|---|
package com.android.settings.deviceinfo; <<<<<<< HEAD import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; import com.android.settings.deviceinfo.Constants.MediaDirectory; import com.android.settings.deviceinfo.MemoryMeasurement.MeasurementReceiver; import android.app.ActivityManager; ======= >>>>>>> b593a6280fc7d56cce37e42e5271019a00fe12e0 import android.app.AlertDialog; import android.app.Dialog; import android.content.BroadcastReceiver; |
| Solution content |
|---|
package com.android.settings.deviceinfo; import android.app.AlertDialog; import android.app.Dialog; import android.content.BroadcastReceiver; |
| File |
|---|
| Memory.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
import android.content.DialogInterface.OnCancelListener; import android.content.Intent; import android.content.IntentFilter; <<<<<<< HEAD import android.content.pm.ApplicationInfo; ======= >>>>>>> b593a6280fc7d56cce37e42e5271019a00fe12e0 import android.content.res.Resources; import android.os.Bundle; import android.os.Environment; |
| Solution content |
|---|
import android.content.DialogInterface.OnCancelListener; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.os.Bundle; import android.os.Environment; |
| File |
|---|
| Memory.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
}
storagePreferenceCategory.init();
getPreferenceScreen().addPreference(storagePreferenceCategory);
mResources = getResources();
<<<<<<< HEAD
if (Environment.isExternalStorageEmulated()) {
getPreferenceScreen().removePreference(mSdMountPreferenceGroup);
}
mInternalSize = findPreference(MEMORY_INTERNAL_SIZE);
mInternalAppsColor = mRes.getColor(R.color.memory_apps_usage);
mInternalUsedColor = android.graphics.Color.GRAY;
mInternalAvailColor = mRes.getColor(R.color.memory_avail);
final int buttonWidth = (int) mRes.getDimension(R.dimen.device_memory_usage_button_width);
final int buttonHeight = (int) mRes.getDimension(R.dimen.device_memory_usage_button_height);
// total available space
mInternalAvail = findPreference(MEMORY_INTERNAL_AVAIL);
mInternalAvail.setIcon(createRectShape(buttonHeight, buttonWidth, mInternalAvailColor));
// used by apps
mInternalAppsUsage = findPreference(MEMORY_INTERNAL_APPS);
mInternalAppsUsage.setIcon(createRectShape(buttonHeight, buttonWidth, mInternalAppsColor));
// space used by individual major directories on /sdcard
for (int i = 0; i < Constants.NUM_MEDIA_DIRS_TRACKED; i++) {
// nothing to be displayed for certain entries in Constants.mMediaDirs
final MediaDirectory mediaDirectory = Constants.mMediaDirs.get(i);
final String preferenceName = mediaDirectory.mPreferenceName;
if (preferenceName == null) {
continue;
}
mMediaPreferences[i] = findPreference(preferenceName);
final int color = mRes.getColor(mediaDirectory.mColor);
mMediaPreferences[i].setIcon(createRectShape(buttonHeight, buttonWidth, color));
=======
try {
IMountService mountService = IMountService.Stub.asInterface(ServiceManager
.getService("mount"));
Parcelable[] volumes = mountService.getVolumeList();
int length = volumes.length;
mStorageVolumePreferenceCategories = new StorageVolumePreferenceCategory[length];
for (int i = 0; i < length; i++) {
StorageVolume storageVolume = (StorageVolume) volumes[i];
StorageVolumePreferenceCategory storagePreferenceCategory =
new StorageVolumePreferenceCategory(getActivity(), mResources, storageVolume,
i == 0); // The first volume is the primary volume
mStorageVolumePreferenceCategories[i] = storagePreferenceCategory;
} catch (Exception e) {
Log.e(TAG, "couldn't talk to MountService", e);
>>>>>>> b593a6280fc7d56cce37e42e5271019a00fe12e0
}
}
|
| Solution content |
|---|
mResources = getResources();
try {
IMountService mountService = IMountService.Stub.asInterface(ServiceManager
.getService("mount"));
Parcelable[] volumes = mountService.getVolumeList();
int length = volumes.length;
mStorageVolumePreferenceCategories = new StorageVolumePreferenceCategory[length];
for (int i = 0; i < length; i++) {
StorageVolume storageVolume = (StorageVolume) volumes[i];
StorageVolumePreferenceCategory storagePreferenceCategory =
new StorageVolumePreferenceCategory(getActivity(), mResources, storageVolume,
i == 0); // The first volume is the primary volume
mStorageVolumePreferenceCategories[i] = storagePreferenceCategory;
getPreferenceScreen().addPreference(storagePreferenceCategory);
storagePreferenceCategory.init();
}
} catch (Exception e) {
Log.e(TAG, "couldn't talk to MountService", e);
}
}
|
| File |
|---|
| Memory.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Array access |
| Attribute |
| Cast expression |
| Catch clause |
| Comment |
| For statement |
| If statement |
| Method invocation |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
} catch (RemoteException ex) {
// Not much can be done
}
<<<<<<< HEAD
}
private void updateUiExact(long totalSize, long availSize, long appsSize, long[] mediaSizes) {
// There are other things that can take up storage, but we didn't measure it.
// add that unaccounted-for-usage to Apps Usage
long appsPlusRemaining = totalSize - availSize;
for (int i = 0; i < Constants.NUM_MEDIA_DIRS_TRACKED; i++) {
if (Constants.mMediaDirs.get(i).mPreferenceName == null) {
continue;
}
appsPlusRemaining -= mediaSizes[i];
}
mInternalSize.setSummary(formatSize(totalSize));
mInternalAvail.setSummary(formatSize(availSize));
mInternalAppsUsage.setSummary(formatSize(appsPlusRemaining));
mInternalUsageChart.clear();
mInternalUsageChart.addEntry(appsPlusRemaining / (float) totalSize, mInternalAppsColor);
for (int i = 0; i < Constants.NUM_MEDIA_DIRS_TRACKED; i++) {
if (Constants.mMediaDirs.get(i).mPreferenceName == null) {
continue;
}
this.mMediaPreferences[i].setSummary(formatSize(mediaSizes[i]));
// don't add entry to color chart for media usage and for zero-sized dirs
if (mediaSizes[i] > 0) {
final int color = mRes.getColor(Constants.mMediaDirs.get(i).mColor);
mInternalUsageChart.addEntry(mediaSizes[i] / (float) totalSize, color);
}
}
mInternalUsageChart.addEntry(availSize / (float) totalSize, mInternalAvailColor);
mInternalUsageChart.commit();
}
private void updateUiApproximate(long totalSize, long availSize) {
mInternalSize.setSummary(formatSize(totalSize));
mInternalAvail.setSummary(formatSize(availSize));
final long usedSize = totalSize - availSize;
mInternalUsageChart.clear();
mInternalUsageChart.addEntry(usedSize / (float) totalSize, mInternalUsedColor);
mInternalUsageChart.commit();
}
private void updateExternalStorage(long totalSize, long availSize) {
String status = Environment.getExternalStorageState();
String readOnly = "";
if (status.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
status = Environment.MEDIA_MOUNTED;
readOnly = mRes.getString(R.string.read_only);
}
if (status.equals(Environment.MEDIA_MOUNTED)) {
if (!Environment.isExternalStorageRemovable()) {
// This device has built-in storage that is not removable.
// There is no reason for the user to unmount it.
if (mSdMountToggleAdded) {
mSdMountPreferenceGroup.removePreference(mSdMountToggle);
mSdMountToggleAdded = false;
}
}
try {
mSdSize.setSummary(formatSize(totalSize));
mSdAvail.setSummary(formatSize(availSize) + readOnly);
mSdMountToggle.setEnabled(true);
mSdMountToggle.setTitle(mRes.getString(R.string.sd_eject));
mSdMountToggle.setSummary(mRes.getString(R.string.sd_eject_summary));
} catch (IllegalArgumentException e) {
// this can occur if the SD card is removed, but we haven't
// received the ACTION_MEDIA_REMOVED Intent yet.
status = Environment.MEDIA_REMOVED;
}
} else {
mSdSize.setSummary(mRes.getString(R.string.sd_unavailable));
mSdAvail.setSummary(mRes.getString(R.string.sd_unavailable));
if (!Environment.isExternalStorageRemovable()) {
if (status.equals(Environment.MEDIA_UNMOUNTED)) {
if (!mSdMountToggleAdded) {
mSdMountPreferenceGroup.addPreference(mSdMountToggle);
mSdMountToggleAdded = true;
}
}
}
if (status.equals(Environment.MEDIA_UNMOUNTED) || status.equals(Environment.MEDIA_NOFS)
|| status.equals(Environment.MEDIA_UNMOUNTABLE)) {
mSdMountToggle.setEnabled(true);
mSdMountToggle.setTitle(mRes.getString(R.string.sd_mount));
mSdMountToggle.setSummary(mRes.getString(R.string.sd_mount_summary));
} else {
mSdMountToggle.setEnabled(false);
mSdMountToggle.setTitle(mRes.getString(R.string.sd_mount));
mSdMountToggle.setSummary(mRes.getString(R.string.sd_insert_summary));
}
}
}
private String formatSize(long size) {
return Formatter.formatFileSize(getActivity(), size);
=======
mClickedMountToggle = null;
>>>>>>> b593a6280fc7d56cce37e42e5271019a00fe12e0
}
public void onCancel(DialogInterface dialog) { |
| Solution content |
|---|
} catch (RemoteException ex) {
// Not much can be done
}
mClickedMountToggle = null;
}
public void onCancel(DialogInterface dialog) { |
| File |
|---|
| Memory.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Method declaration |
| Method invocation |
| Method signature |
| Return statement |