public void onReceive(Context context, Intent intent) { if (intent.getAction().equals("android.intent.action.USER_PRESENT")) { AdUtil.a(true); } else if (intent.getAction().equals("android.intent.action.SCREEN_OFF")) { AdUtil.a(false); } }
public boolean shouldOverrideUrlLoading(WebView webView, String url) { com.google.ads.util.b.a("shouldOverrideUrlLoading(\"" + url + "\")"); Uri parse = Uri.parse(url); HashMap b = AdUtil.b(parse); if (b != null) { String str = (String) b.get("ai"); if (str != null) { this.a.l().a(str); } } if (c.a(parse)) { c.a(this.a, this.d, parse, webView); return true; } else if (this.f) { if (AdUtil.a(parse)) { return super.shouldOverrideUrlLoading(webView, url); } b = new HashMap(); b.put(AdActivity.URL_PARAM, url); AdActivity.launchAdActivity(this.a, new e("intent", b)); return true; } else if (this.e) { b = new HashMap(); b.put(AdActivity.URL_PARAM, parse.toString()); AdActivity.launchAdActivity(this.a, new e("intent", b)); return true; } else { com.google.ads.util.b.e("URL is not a GMSG and can't handle URL: " + url); return true; } }
public Map<String, Object> getRequestMap(Context paramContext) { HashMap localHashMap = new HashMap(); if (this.c != null) localHashMap.put("kw", this.c); if (this.a != null) localHashMap.put("cust_gender", Integer.valueOf(this.a.ordinal())); if (this.b != null) localHashMap.put("cust_age", this.b); if (this.f != null) localHashMap.put("uule", AdUtil.a(this.f)); if (this.g) localHashMap.put("testing", Integer.valueOf(1)); if (this.d) { localHashMap.put("pto", Integer.valueOf(1)); if (!isTestDevice(paramContext)) break label208; localHashMap.put("adtest", "on"); } label208: while (this.h) { if (this.e != null) localHashMap.put("extras", this.e); return localHashMap; if (aa.a(paramContext)); for (int j = 1; ; j = 0) { localHashMap.put("cipa", Integer.valueOf(j)); break; } } if (AdUtil.c()); for (String str = "AdRequest.TEST_EMULATOR"; ; str = "\"" + AdUtil.a(paramContext) + "\"") { a.c("To get test ads on this device, call adRequest.addTestDevice(" + str + ");"); this.h = true; break; } }
public boolean isTestDevice(Context paramContext) { if (this.i != null) { String str = AdUtil.a(paramContext); if (str == null) return false; if (this.i.contains(str)) return true; } return false; }
public void a_(d dVar, Map map, Uri uri, WebView webView) { HashMap b = AdUtil.b(uri); if (b == null) { b.e("An error occurred while parsing the message parameters."); } else { String a = a(uri, b); if (a == null) { b.e("An error occurred while parsing the message."); } else { n nVar = (n) map.get(a); if (nVar == null) { b.e("No AdResponse found, <message: " + a + ">"); } else { nVar.a(dVar, b, webView); } } } }
public final void a(w wVar, HashMap hashMap, WebView webView) { String str = (String) hashMap.get("action"); if (str == null) { g.a("No \"action\" parameter in a video gmsg."); } else if (webView instanceof e) { e eVar = (e) webView; Activity i = eVar.i(); if (i == null) { g.a("Could not get adActivity for a video gmsg."); } else { boolean equals = str.equals("new"); boolean equals2 = str.equals("position"); DisplayMetrics a; int a2; if (equals || equals2) { a = AdUtil.a(i); a2 = a(hashMap, "x", 0, a); int a3 = a(hashMap, "y", 0, a); int a4 = a(hashMap, "w", -1, a); int a5 = a(hashMap, "h", -1, a); if (equals && i.a() == null) { i.b(a2, a3, a4, a5); } else { i.a(a2, a3, a4, a5); } } else { c a6 = i.a(); if (a6 == null) { h hVar = a; h.a(eVar, "onVideoEvent", "{'event': 'error', 'what': 'no_video_view'}"); } else if (str.equals("click")) { a = AdUtil.a(i); int a7 = a(hashMap, "x", 0, a); a2 = a(hashMap, "y", 0, a); long uptimeMillis = SystemClock.uptimeMillis(); a6.a(MotionEvent.obtain(uptimeMillis, uptimeMillis, 0, (float) a7, (float) a2, 0)); } else if (str.equals("controls")) { str = (String) hashMap.get("enabled"); if (str == null) { g.a("No \"enabled\" parameter in a controls video gmsg."); } else if (str.equals("true")) { a6.a(true); } else { a6.a(false); } } else if (str.equals("currentTime")) { str = (String) hashMap.get("time"); if (str == null) { g.a("No \"time\" parameter in a currentTime video gmsg."); } else { try { a6.a((int) (Float.parseFloat(str) * 1000.0f)); } catch (NumberFormatException e) { g.a( new StringBuilder("Could not parse \"time\" parameter: ") .append(str) .toString()); } } } else if (str.equals("hide")) { a6.setVisibility(ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_DEFAULT); } else if (str.equals("load")) { a6.a(); } else if (str.equals("pause")) { a6.b(); } else if (str.equals("play")) { a6.c(); } else if (str.equals("show")) { a6.setVisibility(0); } else if (str.equals("src")) { a6.a((String) hashMap.get("src")); } else { g.a(new StringBuilder("Unknown video action: ").append(str).toString()); } } } } else { g.a("Could not get adWebView for a video gmsg."); } }
public class AdRequest { public static final String LOGTAG = "Ads"; public static final String TEST_EMULATOR = AdUtil.a("emulator"); public static final String VERSION = "4.3.1"; private Gender a = null; private String b = null; private Set<String> c = null; private boolean d = false; private Map<String, Object> e = null; private Location f = null; private boolean g = false; private boolean h = false; private Set<String> i = null; public void addExtra(String paramString, Object paramObject) { if (this.e == null) this.e = new HashMap(); this.e.put(paramString, paramObject); } public void addKeyword(String paramString) { if (this.c == null) this.c = new HashSet(); this.c.add(paramString); } public void addTestDevice(String paramString) { if (this.i == null) this.i = new HashSet(); this.i.add(paramString); } public Map<String, Object> getRequestMap(Context paramContext) { HashMap localHashMap = new HashMap(); if (this.c != null) localHashMap.put("kw", this.c); if (this.a != null) localHashMap.put("cust_gender", Integer.valueOf(this.a.ordinal())); if (this.b != null) localHashMap.put("cust_age", this.b); if (this.f != null) localHashMap.put("uule", AdUtil.a(this.f)); if (this.g) localHashMap.put("testing", Integer.valueOf(1)); if (this.d) { localHashMap.put("pto", Integer.valueOf(1)); if (!isTestDevice(paramContext)) break label208; localHashMap.put("adtest", "on"); } label208: while (this.h) { if (this.e != null) localHashMap.put("extras", this.e); return localHashMap; if (aa.a(paramContext)); for (int j = 1; ; j = 0) { localHashMap.put("cipa", Integer.valueOf(j)); break; } } if (AdUtil.c()); for (String str = "AdRequest.TEST_EMULATOR"; ; str = "\"" + AdUtil.a(paramContext) + "\"") { a.c("To get test ads on this device, call adRequest.addTestDevice(" + str + ");"); this.h = true; break; } } public boolean isTestDevice(Context paramContext) { if (this.i != null) { String str = AdUtil.a(paramContext); if (str == null) return false; if (this.i.contains(str)) return true; } return false; } public void setBirthday(String paramString) { this.b = paramString; } public void setExtras(Map<String, Object> paramMap) { this.e = paramMap; } public void setGender(Gender paramGender) { this.a = paramGender; } public void setKeywords(Set<String> paramSet) { this.c = paramSet; } public void setLocation(Location paramLocation) { this.f = paramLocation; } public void setPlusOneOptOut(boolean paramBoolean) { this.d = paramBoolean; } public void setTestDevices(Set<String> paramSet) { this.i = paramSet; } public void setTesting(boolean paramBoolean) { this.g = paramBoolean; } public static enum ErrorCode { private String a; static { NETWORK_ERROR = new ErrorCode("NETWORK_ERROR", 2, "A network error occurred."); INTERNAL_ERROR = new ErrorCode("INTERNAL_ERROR", 3, "There was an internal error."); ErrorCode[] arrayOfErrorCode = new ErrorCode[4]; arrayOfErrorCode[0] = INVALID_REQUEST; arrayOfErrorCode[1] = NO_FILL; arrayOfErrorCode[2] = NETWORK_ERROR; arrayOfErrorCode[3] = INTERNAL_ERROR; } private ErrorCode(String paramString) { this.a = paramString; } public final String toString() { return this.a; } } public static enum Gender { static { MALE = new Gender("MALE", 1); FEMALE = new Gender("FEMALE", 2); Gender[] arrayOfGender = new Gender[3]; arrayOfGender[0] = UNKNOWN; arrayOfGender[1] = MALE; arrayOfGender[2] = FEMALE; } }