Re: [android-developers] Re: How to retrieve Intents used by installed apps on the phone
Hi micheal, Here i attache the code for accessing for inbuilt camer and gallery. Take a look .. package com.cool.coolapp; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.content.res.Configuration; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.Toast; public class CoolApp extends Activity{ private static final int SELECT_PICTURE = 0; private Bitmap bitmap; private File file; Bitmap thumbnail; private Intent i; private FileOutputStream fOut; final static int TAKE_PICTURE = 1; private Bitmap croppedImage; Bitmap resizedBitmap; private ImageView capturedimage; private Button selectframe; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cool); capturedimage = (ImageView)findViewById(R.id.captureimage); ImageButton camera = (ImageButton)findViewById(R.id.imageButton1); camera.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub // Intent nextactivity = new Intent(getApplicationContext(),Frame_ItActivity.class); // startActivity(nextactivity); // overridePendingTransition(R.anim.anim_in,R.anim.anim_out); // overridePendingTransition(R.anim.anim_out, R.anim.rotate_out); i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(i, TAKE_PICTURE); overridePendingTransition(R.anim.incoming, R.anim.zoom_exit); } }); ImageButton gallery = (ImageButton)findViewById(R.id.imageButton3); gallery.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Intent gallery = new Intent(); gallery.setType(image/*); gallery.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(gallery,Select Picture), SELECT_PICTURE); overridePendingTransition(R.anim.fadein, R.anim.slide_down); } }); ImageButton about = (ImageButton)findViewById(R.id.about); about.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Dialog dialog = new Dialog(CoolApp.this); dialog.setContentView(R.layout.about); dialog.setTitle(About Cool Frame); dialog.show(); } }); selectframe = (Button)findViewById(R.id.selectframe); selectframe.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Intent intd = new Intent(CoolApp.this,AndroidGridLayoutActivity.class); Bundle bundle = new Bundle(); bundle.putParcelable(BITMAP_A, thumbnail); intd.putExtras(bundle); startActivity(intd); //overridePendingTransition(R.anim.anim_in, R.anim.anim_out); //overridePendingTransition(R.anim.outgoing, R.anim.incoming); overridePendingTransition(R.anim.incoming, R.anim.outgoing); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub switch (requestCode) { case TAKE_PICTURE: if (resultCode == RESULT_OK) { Bundle extras = data.getExtras(); thumbnail = (Bitmap) extras.get(data); capturedimage.setImageBitmap(thumbnail); selectframe.setVisibility(View.VISIBLE); } break; case SELECT_PICTURE: if (resultCode == RESULT_OK) { Uri selectedImageUri = data.getData(); // selectedImagePath = getPath(selectedImageUri); String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(selectedImageUri, projection, null, null, null); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); String tmppath = cursor.getString(column_index); croppedImage = BitmapFactory.decodeFile(tmppath); int width = croppedImage.getWidth(); int height = croppedImage.getHeight(); int newWidth = 200; int newHeight = 200; // calculate the scale - in this case = 0.4f float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; // createa matrix for the manipulation Matrix matrix = new Matrix(); // resize the bit map matrix.postScale(scaleWidth, scaleHeight); // rotate the Bitmap //matrix.postRotate(45);
[android-developers] Re: How to retrieve Intents used by installed apps on the phone
Hi,all, thanks for the discussions and great feedback. I think, I am a bit confused about this discussion. What I want: 1) get the Intent without running the app ; 2) get the Intent without decompiling the Android app. 3) I just want the major Intents to invokes the deputy apps , e.g., Email, Browser, Camera, SMS What is the best location should I look for them in Andorid? Thanks. On Jun 6, 7:42 pm, Kristopher Micinski krismicin...@gmaiil.com wrote: Right, you're necessarily making an approximation, and , very unsound one. But, who knows, maybe for what the OP wants, knowing the list of possible intents is enough, he hasn't said anything about that. I still think that what the more sensible thing (and also off topic for this list) to do is to dynamically monitor intents as they are sent by apps. I could see this having potential for security enhancing applications, or something related.. If this is the case, you'll want to look into the package manager.. kris On Wed, Jun 6, 2012 at 9:35 PM, Dianne Hackborn hack...@android.com wrote: Any web browser can generate an infinite number of intents, especially since web pages can use the intent: scheme to provide a detailed intent specification for a link. On Tue, Jun 5, 2012 at 10:44 PM, Kristopher Micinski krismicin...@gmail.com wrote: Of potential interest along this same line is Stowaway, http://android-permissions.org/ It's analysis, while necessarily static, seems to work quite well, for the perhaps uninteresting cases.. And of course, as Chris points out, you can imagine situations where the user constructs intents using strings input by the user, but in practice, you're almost never going to see a string for an intent object that can't be reconstructed by using some global constant propagation. The exception to this case is when you have some strange RPC sharing pattern, but I've never seen that. In these cases any analysis will simply fail, and usually error on the side of caution, telling you you do in fact need the permission.. kris On Wed, Jun 6, 2012 at 1:40 AM, Kristopher Micinski krismicin...@gmail.com wrote: On Wed, Jun 6, 2012 at 1:17 AM, Chris Stratton cs07...@gmail.com wrote: On Jun 5, 7:29 pm, Kristopher Micinski krismicin...@gmail.com wrote: Is there any way to retrieve the Intents used by intalled apps on the phone? For example, how do I know that one app could send an Intent to invoke Camera app or Email app or Text Message app? But you could track this in the system, of course, which is what I assume the OP wanted to do.. Well, you can't really detect the potential (how do I know that one app could) due to the potential crossovers between inputs, data, and code represented by things like intent objects and reflection. I spend a fair amount of time in research on static analysis of permissions in Android apps doing exactly this, ;-)... A number of other systems try to do the same.. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.148.2511 You can however detect the actual attempt as it occurs, to a degree by watching the logs, and more substantially by modifying the platform to in effect breakpoint Intent sending. Right, I think that's what I said, isn't it? I don't think I mentioned potential, just dynamically, which is, as I said, what I interpreted the OP to mean... kris -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to retrieve Intents used by installed apps on the phone
On Thu, Jun 7, 2012 at 2:06 PM, michael xuetao@gmail.com wrote: I think, I am a bit confused about this discussion. We are a bit confused by your questions. What I want: 1) get the Intent without running the app Please use a minimum of 50 words to explain what you mean by this. ; 2) get the Intent without decompiling the Android app. Please use another minimum of 50 words to explain what you mean by this. 3) I just want the major Intents to invokes the deputy apps , e.g., Email, Browser, Camera, SMS What is a deputy app? What is a major Intent? -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to retrieve Intents used by installed apps on the phone
3) I just want the major Intents to invokes the deputy apps , e.g., Email, Browser, Camera, SMS What is a deputy app? What is a major Intent? Let me try to project what he wants: a list of the intent filters, as they would come from the manifest. Question: why do you want this? The only reason to have this is because you're sending generated strings to apps to coerce them to do bad things. What you want to know is if some intent is available, for that you can use the package manager, which is a much more sensible thing to do. http://developer.android.com/reference/android/content/pm/PackageManager.html#queryIntentActivities(android.content.Intent, int) I.e., there is no use in knowing a complete list of available intents, other than trying to attack the things on the device. However, if you have a specific intent in mind, and want to find someone who will respond to it, you can find out through the package manager. And I would guess by major intents, he means preinstalled apps, or something like that... kris -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to retrieve Intents used by installed apps on the phone
Any web browser can generate an infinite number of intents, especially since web pages can use the intent: scheme to provide a detailed intent specification for a link. On Tue, Jun 5, 2012 at 10:44 PM, Kristopher Micinski krismicin...@gmail.com wrote: Of potential interest along this same line is Stowaway, http://android-permissions.org/ It's analysis, while necessarily static, seems to work quite well, for the perhaps uninteresting cases.. And of course, as Chris points out, you can imagine situations where the user constructs intents using strings input by the user, but in practice, you're almost never going to see a string for an intent object that can't be reconstructed by using some global constant propagation. The exception to this case is when you have some strange RPC sharing pattern, but I've never seen that. In these cases any analysis will simply fail, and usually error on the side of caution, telling you you do in fact need the permission.. kris On Wed, Jun 6, 2012 at 1:40 AM, Kristopher Micinski krismicin...@gmail.com wrote: On Wed, Jun 6, 2012 at 1:17 AM, Chris Stratton cs07...@gmail.com wrote: On Jun 5, 7:29 pm, Kristopher Micinski krismicin...@gmail.com wrote: Is there any way to retrieve the Intents used by intalled apps on the phone? For example, how do I know that one app could send an Intent to invoke Camera app or Email app or Text Message app? But you could track this in the system, of course, which is what I assume the OP wanted to do.. Well, you can't really detect the potential (how do I know that one app could) due to the potential crossovers between inputs, data, and code represented by things like intent objects and reflection. I spend a fair amount of time in research on static analysis of permissions in Android apps doing exactly this, ;-)... A number of other systems try to do the same.. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.148.2511 You can however detect the actual attempt as it occurs, to a degree by watching the logs, and more substantially by modifying the platform to in effect breakpoint Intent sending. Right, I think that's what I said, isn't it? I don't think I mentioned potential, just dynamically, which is, as I said, what I interpreted the OP to mean... kris -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to retrieve Intents used by installed apps on the phone
Right, you're necessarily making an approximation, and a potentially very unsound one. But, who knows, maybe for what the OP wants, knowing the list of possible intents is enough, he hasn't said anything about that. I still think that what the more sensible thing (and also off topic for this list) to do is to dynamically monitor intents as they are sent by apps. I could see this having potential for security enhancing applications, or something related.. If this is the case, you'll want to look into the package manager.. kris On Wed, Jun 6, 2012 at 9:35 PM, Dianne Hackborn hack...@android.com wrote: Any web browser can generate an infinite number of intents, especially since web pages can use the intent: scheme to provide a detailed intent specification for a link. On Tue, Jun 5, 2012 at 10:44 PM, Kristopher Micinski krismicin...@gmail.com wrote: Of potential interest along this same line is Stowaway, http://android-permissions.org/ It's analysis, while necessarily static, seems to work quite well, for the perhaps uninteresting cases.. And of course, as Chris points out, you can imagine situations where the user constructs intents using strings input by the user, but in practice, you're almost never going to see a string for an intent object that can't be reconstructed by using some global constant propagation. The exception to this case is when you have some strange RPC sharing pattern, but I've never seen that. In these cases any analysis will simply fail, and usually error on the side of caution, telling you you do in fact need the permission.. kris On Wed, Jun 6, 2012 at 1:40 AM, Kristopher Micinski krismicin...@gmail.com wrote: On Wed, Jun 6, 2012 at 1:17 AM, Chris Stratton cs07...@gmail.com wrote: On Jun 5, 7:29 pm, Kristopher Micinski krismicin...@gmail.com wrote: Is there any way to retrieve the Intents used by intalled apps on the phone? For example, how do I know that one app could send an Intent to invoke Camera app or Email app or Text Message app? But you could track this in the system, of course, which is what I assume the OP wanted to do.. Well, you can't really detect the potential (how do I know that one app could) due to the potential crossovers between inputs, data, and code represented by things like intent objects and reflection. I spend a fair amount of time in research on static analysis of permissions in Android apps doing exactly this, ;-)... A number of other systems try to do the same.. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.148.2511 You can however detect the actual attempt as it occurs, to a degree by watching the logs, and more substantially by modifying the platform to in effect breakpoint Intent sending. Right, I think that's what I said, isn't it? I don't think I mentioned potential, just dynamically, which is, as I said, what I interpreted the OP to mean... kris -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to retrieve Intents used by installed apps on the phone
On Jun 5, 5:23 pm, michael xuetao@gmail.com wrote: Is there any way to retrieve the Intents used by intalled apps on the phone? For example, how do I know that one app could send an Intent to invoke Camera app or Email app or Text Message app? No. Not only is there no way to query the information, the information may not even deterministically exist. For example, it would be trivial to write an application which presented the user with a few EditText widgets into which they could manually type the various required pieces to create an Intent object, and a button to dispatch the result. This app would then be capable of dispatching truly arbitrary intents. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to retrieve Intents used by installed apps on the phone
But you could track this in the system, of course, which is what I assume the OP wanted to do.. kris On Tue, Jun 5, 2012 at 7:24 PM, Chris Stratton cs07...@gmail.com wrote: On Jun 5, 5:23 pm, michael xuetao@gmail.com wrote: Is there any way to retrieve the Intents used by intalled apps on the phone? For example, how do I know that one app could send an Intent to invoke Camera app or Email app or Text Message app? No. Not only is there no way to query the information, the information may not even deterministically exist. For example, it would be trivial to write an application which presented the user with a few EditText widgets into which they could manually type the various required pieces to create an Intent object, and a button to dispatch the result. This app would then be capable of dispatching truly arbitrary intents. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to retrieve Intents used by installed apps on the phone
On Jun 5, 7:29 pm, Kristopher Micinski krismicin...@gmail.com wrote: Is there any way to retrieve the Intents used by intalled apps on the phone? For example, how do I know that one app could send an Intent to invoke Camera app or Email app or Text Message app? But you could track this in the system, of course, which is what I assume the OP wanted to do.. Well, you can't really detect the potential (how do I know that one app could) due to the potential crossovers between inputs, data, and code represented by things like intent objects and reflection. You can however detect the actual attempt as it occurs, to a degree by watching the logs, and more substantially by modifying the platform to in effect breakpoint Intent sending. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to retrieve Intents used by installed apps on the phone
On Wed, Jun 6, 2012 at 1:17 AM, Chris Stratton cs07...@gmail.com wrote: On Jun 5, 7:29 pm, Kristopher Micinski krismicin...@gmail.com wrote: Is there any way to retrieve the Intents used by intalled apps on the phone? For example, how do I know that one app could send an Intent to invoke Camera app or Email app or Text Message app? But you could track this in the system, of course, which is what I assume the OP wanted to do.. Well, you can't really detect the potential (how do I know that one app could) due to the potential crossovers between inputs, data, and code represented by things like intent objects and reflection. I spend a fair amount of time in research on static analysis of permissions in Android apps doing exactly this, ;-)... A number of other systems try to do the same.. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.148.2511 You can however detect the actual attempt as it occurs, to a degree by watching the logs, and more substantially by modifying the platform to in effect breakpoint Intent sending. Right, I think that's what I said, isn't it? I don't think I mentioned potential, just dynamically, which is, as I said, what I interpreted the OP to mean... kris -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to retrieve Intents used by installed apps on the phone
Of potential interest along this same line is Stowaway, http://android-permissions.org/ It's analysis, while necessarily static, seems to work quite well, for the perhaps uninteresting cases.. And of course, as Chris points out, you can imagine situations where the user constructs intents using strings input by the user, but in practice, you're almost never going to see a string for an intent object that can't be reconstructed by using some global constant propagation. The exception to this case is when you have some strange RPC sharing pattern, but I've never seen that. In these cases any analysis will simply fail, and usually error on the side of caution, telling you you do in fact need the permission.. kris On Wed, Jun 6, 2012 at 1:40 AM, Kristopher Micinski krismicin...@gmail.com wrote: On Wed, Jun 6, 2012 at 1:17 AM, Chris Stratton cs07...@gmail.com wrote: On Jun 5, 7:29 pm, Kristopher Micinski krismicin...@gmail.com wrote: Is there any way to retrieve the Intents used by intalled apps on the phone? For example, how do I know that one app could send an Intent to invoke Camera app or Email app or Text Message app? But you could track this in the system, of course, which is what I assume the OP wanted to do.. Well, you can't really detect the potential (how do I know that one app could) due to the potential crossovers between inputs, data, and code represented by things like intent objects and reflection. I spend a fair amount of time in research on static analysis of permissions in Android apps doing exactly this, ;-)... A number of other systems try to do the same.. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.148.2511 You can however detect the actual attempt as it occurs, to a degree by watching the logs, and more substantially by modifying the platform to in effect breakpoint Intent sending. Right, I think that's what I said, isn't it? I don't think I mentioned potential, just dynamically, which is, as I said, what I interpreted the OP to mean... kris -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en